-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[teleport-update] Support for CentOS 7 #52951
Conversation
Co-authored-by: Zac Bergquist <zac.bergquist@goteleport.com>
Confusingly, after more extensive testing, it appears that a number of these commands are implemented in the last release of centos7, even though the systemd version reports 219 via They seem to be backported incompletely, as CC: @hugoShaka |
// The --now flag is not supported in systemd versions older than 220, | ||
// so perform enable + start commands instead. | ||
code := s.systemctl(ctx, slog.LevelInfo, "enable", s.ServiceName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like both RHEL7 and CentOS7 have systemctl enable --now
:
$ docker run -it --rm centos:7 bash -c "systemctl enable --help | grep now"
--now Start or stop unit in addition to enabling or disabling it
$ [root@hugo-autoupdate-test-rhel7 ec2-user]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
$ [root@hugo-autoupdate-test-rhel7 ec2-user]# systemctl enable --help | grep "now"
--now Start or stop unit in addition to enabling or disabling it
Note: they do both run systemd 219, so I suppose we either misunderstood when --now was introduced, or they did fun backports (likely as we're talking about RedHat).
Do we still want to do this change>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--now
was added in 220: https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#--now
Since we're aiming to support a wide range of distros, and older versions of rhel7/centos7 will not have the backport, it seems safer to stick to the spec and check the version for any APIs that have version requirements.
The
teleport-update
binary uses systemctl commands that are not supported on CentOS 7. Although CentOS 7 is EOL and no longer receiving security patches as of June 2024, Teleport v17 is currently documented to support it.These commands include
list-unit-files
,is-enabled
, and the--now
flag.This PR avoids executing those commands when systemd is too old to support them. Edit: due to backports of the most of the functionality above, the last published version of CentOS 7 is fully-functional aside from a few missing warnings. I still plan to merge this PR to protect against unexpected behavior on Linux distros with older versions of systemd.
Additionally, this PR simplifies the uninstallation workflow by allowing a stopped but enabled teleport systemd service to be removed. This behavior is more logical, and avoids
is-enabled
.changelog: Improve support for teleport-update on CentOS 7 and distros with older SystemD versions.
The
teleport-update
binary will be used to enable, disable, and trigger automatic Teleport agent updates. The new auto-updates system manages a local installation of the cluster-specified version of Teleport stored in/opt/teleport
.RFD: #47126
Goal (internal): https://github.com/gravitational/cloud/issues/11856