Bug 260476 - sysutils/amazon-ssm-agent Set PATH for SSM interactive sessions
Summary: sysutils/amazon-ssm-agent Set PATH for SSM interactive sessions
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Colin Percival
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-16 16:32 UTC by amendlik
Modified: 2021-12-18 05:19 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (cperciva)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amendlik 2021-12-16 16:32:26 UTC
When using a shell session provided by SSM, the PATH variable only includes base system directories: /sbin:/bin:/usr/sbin:/usr/bin

The path should also include: /usr/local/sbin:/usr/local/bin:/home/ssm-user/bin

I have fixed this in my own environment by adding the following line to /usr/local/etc/rc.d/amazon-ssm-agent:

export PATH=${PATH}:/usr/local/sbin:/usr/local/bin:/home/ssm-user/bin
Comment 1 Colin Percival freebsd_committer freebsd_triage 2021-12-17 07:50:35 UTC
Can you confirm if adding this line instead works?  I think this is the more "rc.d" way of setting PATH in the environment from an rc.d script:

: ${amazon_ssm_agent_env="PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/ssm-user/bin"}
Comment 2 amendlik 2021-12-17 14:53:27 UTC
Yes - your version works great. I was not aware of that technique. Thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-12-18 05:19:15 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=639c5484460ad18b8acfe8d259f2ef08158438ba

commit 639c5484460ad18b8acfe8d259f2ef08158438ba
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2021-12-18 05:11:53 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2021-12-18 05:14:39 +0000

    sysutils/amazon-ssm-agent: Add missing $PATH

    The SSM Agent can be used to effect a login shell; set $PATH
    appropriately for interactive logins.

    PR:             260476
    Reported by:    amendlik at gmail
    Sponsored by:   https://www.patreon.com/cperciva

 sysutils/amazon-ssm-agent/Makefile                  | 2 +-
 sysutils/amazon-ssm-agent/files/amazon-ssm-agent.in | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Comment 4 Colin Percival freebsd_committer freebsd_triage 2021-12-18 05:19:51 UTC
Thanks, committed.