]>
git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/ssh/ldap_authorized_keys.sh
5 LDAP_BIND
="cn=ssh,ou=services,dc=immae,dc=eu"
6 LDAP_PASS
=$(cat /etc/ssh/ldap_password)
7 LDAP_HOST
="ldap.immae.eu"
8 LDAP_BASE
="dc=immae,dc=eu"
14 if [[ $key != *$
'\n'* ]] && [[ $key == ssh-* ]]; then
17 key_type
=$(cut -d " " -f 1 <<< "$key")
19 if grep -q "\b-$type_for\b" <<< "$key_type"; then
21 elif grep -q "\b$type_for\b" <<< "$key_type"; then
22 echo $(sed -e "s/^[^ ]* //g" <<< "$key")
33 if [[ "$line" == $KEY::* ]]; then
34 # base64 keys should't happen, unless wrong copy-pasting
37 key
=$(sed -e "s/^$KEY: *//" -e "s/ *$//" <<< "$line")
40 suitable_for
"$type_for" "$key"
44 $LDAPSEARCH -h $LDAP_HOST -ZZ -b $LDAP_BASE -D $LDAP_BIND -w "$LDAP_PASS" -x -o ldif
-wrap=no
-LLL "$@"