Skip to content

ENT-13008: Added symlinks to CFEngine binaries in /usr/sbin for RHEL packages - #1963

Merged
larsewi merged 1 commit into
cfengine:masterfrom
larsewi:symlink-migration
Oct 3, 2025
Merged

ENT-13008: Added symlinks to CFEngine binaries in /usr/sbin for RHEL packages#1963
larsewi merged 1 commit into
cfengine:masterfrom
larsewi:symlink-migration

Conversation

@larsewi

@larsewi larsewi commented Oct 2, 2025

Copy link
Copy Markdown
Contributor
  • Moved creation of CFEngine binary symlinks in /usr/local/bin to RPM spec files
  • Added new to CFEngine binary symlinks in /usr/sbin which is part of secure path

Motivation: RHEL uses a secure path when running sudo commands, which does not include /usr/local/sbin. This means cf-* binaries are not found when invoked via sudo. By adding symlinks to /usr/sbin (which is in the secure path), the binaries become accessible via sudo. We maintain backward compatibility by keeping the /usr/local/sbin symlinks as well.

Build (redhat only):
Build Status

@larsewi

larsewi commented Oct 2, 2025

Copy link
Copy Markdown
Contributor Author

Manual testing on RHEL 7:

$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.9 (Maipo)

Check that cf-agent can be envoked through sudo:

$ sudo cf-agent -V
CFEngine Core 3.27.0a.24228043f
CFEngine Enterprise 3.27.0a.fd2ed860d

Check that symlinks are available in /usr/sbin:

$ ls /usr/sbin/cf-*
/usr/sbin/cf-agent  /usr/sbin/cf-monitord  /usr/sbin/cf-secret
/usr/sbin/cf-check  /usr/sbin/cf-net       /usr/sbin/cf-serverd
/usr/sbin/cf-execd  /usr/sbin/cf-promises  /usr/sbin/cf-support
/usr/sbin/cf-hub    /usr/sbin/cf-reactor
/usr/sbin/cf-key    /usr/sbin/cf-runagent

Check that symlinks are available in /usr/local/sbin:

$ ls /usr/local/sbin/cf-*
/usr/local/sbin/cf-agent     /usr/local/sbin/cf-promises
/usr/local/sbin/cf-check     /usr/local/sbin/cf-reactor
/usr/local/sbin/cf-execd     /usr/local/sbin/cf-runagent
/usr/local/sbin/cf-hub       /usr/local/sbin/cf-secret
/usr/local/sbin/cf-key       /usr/local/sbin/cf-serverd
/usr/local/sbin/cf-monitord  /usr/local/sbin/cf-support
/usr/local/sbin/cf-net

Test that man pages still work:

$ man cf-agent | head -1
CF-AGENT(8)                  System Administration                 CF-AGENT(8)

Test that symlinks are removed:

$ sudo yum remove cfengine-nova-hub
 ---snip---
Complete!
$ ls /usr/sbin/cf-*
ls: cannot access /usr/sbin/cf-*: No such file or directory
$ ls /usr/local/sbin/cf-*
ls: cannot access /usr/local/sbin/cf-*: No such file or directory

@larsewi
larsewi marked this pull request as ready for review October 2, 2025 09:52
@larsewi
larsewi marked this pull request as draft October 2, 2025 11:30
@larsewi
larsewi force-pushed the symlink-migration branch 3 times, most recently from fc13a4a to 333415f Compare October 2, 2025 11:52
@larsewi

larsewi commented Oct 2, 2025

Copy link
Copy Markdown
Contributor Author

@cf-bottom Jenkins with exotics please :)

@vpodzime vpodzime left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me otherwise.

Comment thread packaging/common/cfengine-hub/postinstall.sh Outdated
Comment thread packaging/common/cfengine-hub/postinstall.sh Outdated
@larsewi
larsewi force-pushed the symlink-migration branch from 333415f to d5114f6 Compare October 2, 2025 13:03
- Moved creation of CFEngine binary symlinks in `/usr/local/bin` to RPM
  spec files
- Added new to CFEngine binary symlinks in `/usr/sbin` which is part of
  secure path

RHEL uses a secure path when running sudo commands, which does not
include `/usr/local/sbin`. This means cf-* binaries are not found when
invoked via sudo. By adding symlinks to `/usr/sbin` (which is in the
secure path), the binaries become accessible via sudo.  We maintain
backward compatibility by keeping the `/usr/local/sbin` symlinks as
well.

Ticket: ENT-13008
Changelog: Title
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@larsewi
larsewi force-pushed the symlink-migration branch from d5114f6 to 4f113aa Compare October 2, 2025 13:03
@cfengine cfengine deleted a comment from cf-bottom Oct 2, 2025
@cfengine cfengine deleted a comment from cf-bottom Oct 2, 2025
@cf-bottom

Copy link
Copy Markdown

@vpodzime vpodzime left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@larsewi
larsewi marked this pull request as ready for review October 3, 2025 08:33
@larsewi
larsewi merged commit 12a7735 into cfengine:master Oct 3, 2025
31 of 36 checks passed
@larsewi
larsewi deleted the symlink-migration branch April 27, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants