Skip to content
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 doesn't respect /etc/environment and /etc/security/pam_env.conf #3021

Closed
jkendzorra opened this issue Sep 25, 2019 · 1 comment · Fixed by #3317
Closed

Teleport doesn't respect /etc/environment and /etc/security/pam_env.conf #3021

jkendzorra opened this issue Sep 25, 2019 · 1 comment · Fixed by #3317
Assignees
Labels
bug PAM Label related to Pluggable Authentication Module (PAM) Submethod.

Comments

@jkendzorra
Copy link
Contributor

What happened:
Added environment variables into /etc/environment and /etc/security/pam_env.conf, these do not appear in the user session when using Teleport (but do with OpenSSH).

What you expected to happen:
With PAM enabled and using the default configuration (sshd), the environment should be very similar when logging in via OpenSSH vs. Teleport (with Teleport's additional environment variables in place). On a side note, when running sudo su as the login user, the environment is correct (since config for su contains pam_env.so as well).
Also, other environment variables aren't exactly as expected, like PATH is different from what an SSH session via OpenSSH shows.

How to reproduce it (as minimally and precisely as possible):

  • configure Teleport with PAM enabled:
    (...)
    pam:
      enabled: yes
      service_name: "sshd"

In Ubuntu 16.04, /etc/pam.d/sshd references pam_env.so:

(...)
# Read environment variables from /etc/environment and
# /etc/security/pam_env.conf.
session    required     pam_env.so # [1]
# In Debian 4.0 (etch), locale-related environment variables were moved to
session    required     pam_env.so user_readenv=1 envfile=/etc/default/locale

Environment:

  • Teleport version (use teleport version): Teleport Enterprise v4.0.0git:v4.0.0-0-gc7f55ac3 go1.12.1
  • OS (e.g. from /etc/os-release): Ubuntu 16.04
@klizhentas klizhentas added this to the 4.2 "Alameda" milestone Oct 8, 2019
@benarent benarent added the bug label Nov 1, 2019
@russjones
Copy link
Contributor

I suspect Teleport has actually been reading /etc/environment and /etc/security/pam_env.conf but not doing anything with the environment variables it reads in. We'll need to update Teleport to get the list of environment variables the PAM modules found and then add then into the environment of the child process like OpenSSH does: https://github.com/openssh/openssh-portable/blob/V_8_1/session.c#L1142-L1145

@benarent benarent added the PAM Label related to Pluggable Authentication Module (PAM) Submethod. label Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug PAM Label related to Pluggable Authentication Module (PAM) Submethod.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants