]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - flakes/private/ssh/ldap_authorized_keys.sh
Hardcode ssh keys for normal login
[perso/Immae/Config/Nix.git] / flakes / private / ssh / ldap_authorized_keys.sh
index f4395be294caed399cc4e9982937ecd7ab08a5b3..38fa750fff19fd55223b60ea94f9175cb16e6f56 100755 (executable)
@@ -1,7 +1,6 @@
 #!/usr/bin/env bash
 
 LDAPSEARCH=ldapsearch
-KEY="immaeSshKey"
 LDAP_BIND="cn=ssh,ou=services,dc=immae,dc=eu"
 LDAP_PASS=$(cat /etc/ssh/ldap_password)
 LDAP_HOST="ldap://ldap.immae.eu"
@@ -13,39 +12,6 @@ PSQL_HOST="localhost"
 PSQL_USER="immae_auth_read"
 PSQL_PASS=$(cat /etc/ssh/psql_password)
 
-suitable_for() {
-  type_for="$1"
-  key="$2"
-
-  if [[ $key != *$'\n'* ]] && [[ $key == ssh-* ]]; then
-    echo "$key"
-  else
-    key_type=$(cut -d " " -f 1 <<< "$key")
-
-    if grep -q "\b-$type_for\b" <<< "$key_type"; then
-      echo ""
-    elif grep -q "\b$type_for\b" <<< "$key_type"; then
-      echo $(sed -e "s/^[^ ]* //g" <<< "$key")
-    else
-      echo ""
-    fi
-  fi
-}
-
-clean_key_line() {
-  type_for="$1"
-  line="$2"
-
-  if [[ "$line" == $KEY::* ]]; then
-    # base64 keys should't happen, unless wrong copy-pasting
-    key=""
-  else
-    key=$(sed -e "s/^$KEY: *//" -e "s/ *$//" <<< "$line")
-  fi
-
-  suitable_for "$type_for" "$key"
-}
-
 ldap_search() {
   $LDAPSEARCH -H $LDAP_HOST -ZZ -b $LDAP_BASE -D $LDAP_BIND -w "$LDAP_PASS" -x -o ldif-wrap=no -LLL "$@"
 }