From 1a64deeb894dc95e2645a75771732c6cc53a79ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 4 Oct 2023 01:35:06 +0200 Subject: Squash changes containing private information There were a lot of changes since the previous commit, but a lot of them contained personnal information about users. All thos changes got stashed into a single commit (history is kept in a different place) and private information was moved in a separate private repository --- modules/private/ftp_sync.sh | 47 --------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100755 modules/private/ftp_sync.sh (limited to 'modules/private/ftp_sync.sh') diff --git a/modules/private/ftp_sync.sh b/modules/private/ftp_sync.sh deleted file mode 100755 index 8b0d9c5..0000000 --- a/modules/private/ftp_sync.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -LDAPSEARCH=ldapsearch - -LDAP_BIND="cn=ssh,ou=services,dc=immae,dc=eu" -LDAP_PASS=$(cat /etc/ssh/ldap_password) -LDAP_HOST="ldap.immae.eu" -LDAP_BASE="dc=immae,dc=eu" -LDAP_FILTER="(memberOf=cn=users,cn=ftp,ou=services,dc=immae,dc=eu)" - -handle_keys() { - uids="$1" - keys="$2" - if [ -n "$uids" ]; then - for uid in $uids; do - echo "$keys" | while read key; do - if [ -n "$key" ]; then - ssh-keygen -e -f <(echo "$key") - fi - done > /var/lib/proftpd/authorized_keys/$uid - done - fi -} - -mkdir -p /var/lib/proftpd/authorized_keys - -while read i; do - if [[ "$i" =~ ^dn: ]]; then - handle_keys "$uids" "$keys" - uids="" - keys="" - fi; - if [[ "$i" =~ ^uid: ]]; then - uids="$uids ${i#uid: }" - fi - if [[ "$i" =~ ^immaeSshKey: ]]; then - key="${i#immaeSshKey: }" - if [[ "$key" =~ ^ssh- ]]; then - keys="$keys -$key" - elif echo "$key" | cut -d" " -f1 | grep -q "\bftp\b"; then - keys="$keys -$(echo "$key" | cut -d" " -f2-)" - fi - fi -done < <(ldapsearch -h "$LDAP_HOST" -ZZ -LLL -D "$LDAP_BIND" -w "$LDAP_PASS" -b "$LDAP_BASE" -x -o ldif-wrap=no "$LDAP_FILTER" uid immaeSshKey) -handle_keys "$uids" "$keys" -- cgit v1.2.3