3 changed files with 64 additions and 20 deletions
-
5sympa/doc/migration.md
-
29sympa/miaou/miaou-install-from-import-sympa
-
50sympa/recipe/sympa_ldap_auth_remote.recipe
@ -1,18 +1,36 @@ |
|||
#!/usr/bin/env miaou-recipe |
|||
|
|||
# changes in /etc/sympa/auth.conf |
|||
if grep -q '.*host 192.168.1.254:389.*' /etc/sympa/auth.conf; then |
|||
/opt/miaou-bash/tools/append_or_replace '.*host 192.168.1.254:389.*' "\thost 127.0.0.1:3890" /etc/sympa/auth.conf |
|||
echo 'sympa auth from LDAP local 127.0.0.1:3890 is now active' |
|||
else |
|||
echo 'sympa auth from LDAP local 127.0.0.1:3890 already enabled' |
|||
fi |
|||
|
|||
# start SSH port translation if needed |
|||
if ! ss -tln | grep -q 127.0.0.1:3890; then |
|||
ssh -fN listes.artcode.re -L 3890:192.168.1.254:389 |
|||
echo 'SSH port translation 3890 is now active!' |
|||
systemctl restart wwsympa.socket |
|||
else |
|||
echo 'SSH already enabled!' |
|||
fi |
|||
# CONSTANTS |
|||
|
|||
LDAP_SERVER=192.168.1.254 |
|||
LOCAL_PORT=3890 |
|||
|
|||
# FUNCTIONS |
|||
|
|||
function tweak_sympa_auth { |
|||
if grep -q ".*host $LDAP_SERVER.*" /etc/sympa/auth.conf; then |
|||
/opt/miaou-bash/tools/append_or_replace ".*host $LDAP_SERVER:389.*" "\thost 127.0.0.1:$LOCAL_PORT" /etc/sympa/auth.conf |
|||
echo "sympa auth from LDAP local 127.0.0.1:$LOCAL_PORT is now active" |
|||
else |
|||
echo "sympa auth from LDAP local 127.0.0.1:$LOCAL_PORT already enabled" |
|||
fi |
|||
} |
|||
|
|||
function ssh_port_translation { |
|||
if ! ss -tln | grep -q 127.0.0.1:$LOCAL_PORT; then |
|||
|
|||
local sympa_domain=$(grep ^domain /etc/sympa/sympa/sympa.conf | cut -f2) |
|||
|
|||
ssh -fN $sympa_domain -L $LOCAL_PORT:$LDAP_SERVER:389 |
|||
echo "SSH port translation $LOCAL_PORT is now listening!" |
|||
systemctl restart wwsympa.socket |
|||
else |
|||
echo 'SSH listener already enabled!' |
|||
fi |
|||
} |
|||
|
|||
# MAIN |
|||
|
|||
set -Eue |
|||
tweak_sympa_auth |
|||
ssh_port_translation |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue