This commit is contained in:
2020-05-13 14:38:39 -04:00
commit 5077240060
3 changed files with 62 additions and 0 deletions

3
files/ldap-ssh-key.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
ldapsearch -h {{ldap_host}} -D "{{ldap_bind_dn}}" -w "{{ldap_bind_password}}" '(&(|(memberof=cn=host_access,ou=groups,dc=theta42,dc=com)(memberof=cn=host_{{current_host}}_access,ou=groups,dc=theta42,dc=com))(uid='"$1"'))' 'sshPublicKey' | sed -n '/^ /{H;d};/sshPublicKey:/x;$g;s/\n *//g;s/sshPublicKey: //gp'