pam-nss-signedjit reads a signed (via CMS) file from an HTTPS endpoint and applies the file to local NSS and PAM files for the purposes of enabling Just-in-Time (JIT) administration.
It intended to be used with:
- ssh keys via AuthorizedKeysCommand
- PAM listfile for authorization / JIT
- NSS extrausers for user and group (admin / sudoers group) info
- pam_mkhomedir for homedir creation
First make a bootstrap.json and also a signed json file uploaded to the url in bootstrap.json. This can be done either via:
- openssl
gzip bootstrap.example.json
openssl cms -sign -in cat bootstrap.example.json.gz -text -outform pem -out jit.signed -signer acert.pem
- via
certsign.ps1
It can be validated with either powershell/.NET CMS or via openssl:
openssl cms -verify -in jit.signed -inform pem -out bootstrap.example.json.gz -certfile acert.pem -noverify -nointern
gunzip bootstrap.example.json.gz
Next on client machines:
cp pam-nss-signedjit /usr/local/bin/pam-nss-signedjit
mkdir /var/lib/pam-nss-signedjit && mkdir /etc/pam-nss-signedjit
/usr/local/bin/pam-nss-signedjit bootstrap --filepath bootstrap.json
apt install libnss-extrausers
ln -s /var/lib/pam-nss-signedjit/passwd /var/lib/extrausers/passwd && ln -s /var/lib/pam-nss-signedjit/group /var/lib/extrausers/group
- edit /etc/nsswitch.conf adding
passwd: compat extrausers
group: compat extrausers
- Add the following to /etc/ssh/sshd_config:
AuthorizedKeysCommand /usr/local/bin/pam-nss-signedjit sshkey --username %u
AuthorizedKeysCommandUser nobody
- Add a crontab entry
* * * * * /usr/local/bin/pam-nss-signedjit update 2>/dev/null >/dev/null
- Add a sudoers entry
%jitadmins ALL=(ALL) NOPASSWD: ALL
- Add a common-auth entry
auth requisite pam_listfile.so item=user sense=allow file=/var/lib/pam-nss-signedjit/jitedusers onerr=fail
- If you want separate break-glass allow list you can use
[success=1 default=ignore]
instead ofrequisite
and a second pam_listfile.so line withrequisite
- If you want separate break-glass allow list you can use
- Add a common-session entry
session required pam_mkhomedir.so skel=/etc/skel/ umask=0022