diff --git a/.drone/auth1-setup.sh b/.drone/auth1-setup.sh index c8486e8..5364618 100755 --- a/.drone/auth1-setup.sh +++ b/.drone/auth1-setup.sh @@ -64,6 +64,7 @@ cat < $POSTGRES_DIR/pg_hba.conf @@ -43,8 +46,10 @@ REVOKE ALL ON SCHEMA public FROM public; GRANT ALL ON SCHEMA public TO postgres; EOF" postgres -# sync with phosphoric-acid apt install -y netcat-openbsd +auth_setup coffee + +# sync with phosphoric-acid nc -l 0.0.0.0 9000 sleep infinity diff --git a/.drone/common.sh b/.drone/common.sh index 740fc93..0f7c287 100644 --- a/.drone/common.sh +++ b/.drone/common.sh @@ -33,3 +33,45 @@ sync_with() { done test $synced = true } + +auth_setup() { + hostname=$1 + + # LDAP + apt install -y --no-install-recommends libnss-ldapd + service nslcd stop || true + cp .drone/ldap.conf /etc/ldap/ldap.conf + grep -Eq '^map group member uniqueMember$' /etc/nslcd.conf || \ + echo 'map group member uniqueMember' >> /etc/nslcd.conf + sed -E -i 's/^uri .*$/uri ldap:\/\/auth1.csclub.internal/' /etc/nslcd.conf + sed -E -i 's/^base .*$/base dc=csclub,dc=internal/' /etc/nslcd.conf + cp .drone/nsswitch.conf /etc/nsswitch.conf + + # KERBEROS + apt install -y krb5-user libpam-krb5 libsasl2-modules-gssapi-mit + cp .drone/krb5.conf /etc/krb5.conf + + if [ $hostname = phosphoric-acid ]; then + sync_port=9000 + elif [ $hostname = coffee ]; then + sync_port=9001 + else + sync_port=9002 + fi + sync_with auth1 $sync_port + + rm -f /etc/krb5.keytab + cat <> /etc/nslcd.conf -sed -E -i 's/^uri .*$/uri ldap:\/\/auth1.csclub.internal/' /etc/nslcd.conf -sed -E -i 's/^base .*$/base dc=csclub,dc=internal/' /etc/nslcd.conf -cp .drone/nsswitch.conf /etc/nsswitch.conf - -# KERBEROS -apt install -y krb5-user libpam-krb5 libsasl2-modules-gssapi-mit -cp .drone/krb5.conf /etc/krb5.conf - apt install -y netcat-openbsd - -sync_with auth1 - -rm -f /etc/krb5.keytab -cat <