Skip to content

fix(config): restrict config:install to the admin role (backport #2861) - #2862

Merged
jbonofre merged 1 commit into
apache:karaf-4.4.xfrom
jbonofre:backport-2861-karaf-4.4.x
Sep 11, 2026
Merged

fix(config): restrict config:install to the admin role (backport #2861)#2862
jbonofre merged 1 commit into
apache:karaf-4.4.xfrom
jbonofre:backport-2861-karaf-4.4.x

Conversation

@jbonofre

@jbonofre jbonofre commented Sep 8, 2026

Copy link
Copy Markdown
Member

Backport of #2861 to karaf-4.4.x.

Problem

config:install <url> <finalname> downloads a file from an arbitrary URL and writes it into ${karaf.etc} (the -o/--override option lets it overwrite an existing file). That folder also holds users.properties, keys.properties, host.key and every org.apache.karaf.*.acl.* file.

The command has no entry in org.apache.karaf.command.acl.config. SecuredSessionFactoryImpl.checkSecurity() treats an unmatched command as allowed (Specificity.NO_MATCHpassCheck = true), and karaf.secured.command.compulsory.roles ships commented out, so any authenticated shell/SSH user — including a viewer — can run config:install and overwrite, for example, the command ACL files or users.properties.

By contrast bundle:install, feature:install and kar:install are all admin-only in their own ACLs, and config:delete is admin in this same ACL.

Fix

Add install = admin to the config command ACL, in both shipped locations:

  • assemblies/features/standard/src/main/feature/feature.xml (<config> block)
  • instance/.../etc/org.apache.karaf.command.acl.config.cfg (instance template)

and to the itest etc fixture (itests/test/src/test/filtered-resources/etc/feature.xml).

Test

ConfigSshCommandSecurityTest#testConfigInstallCommandSecurityViaSsh — a viewer and a manager get Command not found; an admin can run it.

Note

The underlying fail-open behaviour (unmatched command → allowed, with karaf.secured.command.compulsory.roles disabled by default) is a broader hardening question tracked separately; this PR only closes the config:install gap.

config:install writes a file fetched from an arbitrary URL into
${karaf.etc}, which also holds users.properties, keys.properties and the
*.acl.* files. The command had no entry in the org.apache.karaf.command.acl.config
ACL, and the command guard treats an unmatched command as allowed, so any
authenticated shell user could run it.

Add "install = admin" to the config command ACL, consistent with
config:delete and with bundle:install / feature:install / kar:install.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test Results

  656 files  ±0    656 suites  ±0   1h 6m 34s ⏱️ + 5m 32s
1 007 tests +1    964 ✅ +1   43 💤 ±0  0 ❌ ±0 
2 752 runs  +2  2 632 ✅ +2  120 💤 ±0  0 ❌ ±0 

Results for commit ac2a825. ± Comparison against base commit 2880f87.

@jbonofre
jbonofre merged commit 044278e into apache:karaf-4.4.x Sep 11, 2026
7 checks passed
@jbonofre
jbonofre deleted the backport-2861-karaf-4.4.x branch September 11, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant