gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
16.95k stars 1.7k forks source link

Teleport binaries not in root PATH after yum install #25997

Open fspmarshall opened 1 year ago

fspmarshall commented 1 year ago

Installing the teleport yum packages on centos7 and amzn2 (possibly other distros as well) results in teleport and tctl not being in PATH when running commands as root. This is because these distros don't have /usr/local/bin as part of PATH when running commands as root.

This ends up being annoying if you want to write a script/program that depends on teleport without depending on absolute install location. It's especially annoying on auth servers since tctl is explicitly designed to be run as root.

I'm not sure what the solution to this should be. Having package installation modify PATH to include /usr/local/bin feels wrong. Maybe installing a symlink to /usr/bin would work, tho I'm not sure what potential drawbacks/issues might arise from that.

webvictim commented 1 year ago

We solve this in the Teleport AMIs (which use Amazon Linux) by updating secure_path: https://github.com/gravitational/teleport/blob/2baa7e72d9c22fc5263d46a03a4ba1e17de74ffd/assets/aws/files/install.sh#L105-L106

That only really helps with sudo though.

AFAIK this is only an issue on Amazon Linux - a stock Docker container seems to have /usr/local/bin in $PATH:

gus@apollo:~ % docker run --rm --name centos -it centos:7 /bin/bash -c "echo \$PATH"
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin