]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env bash | |
2 | ||
3 | LDAPSEARCH=ldapsearch | |
4 | LDAP_BIND="cn=ssh,ou=services,dc=immae,dc=eu" | |
5 | LDAP_PASS=$(cat /etc/ssh/ldap_password) | |
6 | LDAP_HOST="ldap://ldap.immae.eu" | |
7 | LDAP_BASE="dc=immae,dc=eu" | |
8 | USER_LDAP_BASE="ou=users,dc=immae,dc=eu" | |
9 | ||
10 | PSQL_BASE="immae" | |
11 | PSQL_HOST="localhost" | |
12 | PSQL_USER="immae_auth_read" | |
13 | PSQL_PASS=$(cat /etc/ssh/psql_password) | |
14 | ||
15 | ldap_search() { | |
16 | $LDAPSEARCH -H $LDAP_HOST -ZZ -b $LDAP_BASE -D $LDAP_BIND -w "$LDAP_PASS" -x -o ldif-wrap=no -LLL "$@" | |
17 | } | |
18 | ||
19 | psql_search() { | |
20 | PGPASSWORD="$PSQL_PASS" psql -U "$PSQL_USER" -h "$PSQL_HOST" -X -A -t -d "$PSQL_BASE" -c "$@" | |
21 | } | |
22 | ||
23 | ldap_keys() { | |
24 | user=$1; | |
25 | @snippets@ | |
26 | } | |
27 | ||
28 | ldap_keys $@ |