Compare commits
39 Commits
gestionSec
...
974f826757
Author | SHA1 | Date | |
---|---|---|---|
974f826757 | |||
b1b9f3afed | |||
e3041f2df6 | |||
060c6e4443 | |||
13826a7c4c | |||
|
ab2d4e1610 | ||
fd48ef488f | |||
731c5dc8a0 | |||
ea817aba47 | |||
bca0693a14 | |||
|
0d00b418a0 | ||
98cc875611 | |||
618f22db6b | |||
290c6fe360 | |||
6619246346 | |||
3b5d01d5df | |||
4d127a57e2 | |||
3a3c4f4d0c | |||
898d6a652d | |||
3bf952b57f | |||
70442f6464 | |||
33f793fcbe | |||
6e58f328e4 | |||
813e0e761f | |||
2e62e9782e | |||
9f0b8f2e1e | |||
fc4adc0fae | |||
74812fa79a | |||
490c527d9a | |||
3220d862a6 | |||
51cd89c16d | |||
1936326535 | |||
a630e47bfe | |||
b4eee312df | |||
27ca4dfce3 | |||
33fc237cb8 | |||
ed5ef23ed2 | |||
6f33808736 | |||
|
477a9155fe |
@@ -180,59 +180,59 @@ saveComposes () {
|
||||
;;
|
||||
sympa)
|
||||
echo "save sympa"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh sympaDB
|
||||
saveDB ${sympaDBName} "${sympaDB_MYSQL_USER}" "${sympaDB_MYSQL_PASSWORD}" "${sympaDB_MYSQL_DATABASE}" sympa mysql
|
||||
. $KAZ_KEY_DIR/env-sympaDB
|
||||
saveDB ${sympaDBName} "${DB_MYSQL_USER}" "${DB_MYSQL_PASSWORD}" "${DB_MYSQL_DATABASE}" sympa mysql
|
||||
;;
|
||||
web)
|
||||
# rien à faire (fichiers)
|
||||
;;
|
||||
etherpad)
|
||||
echo "save pad"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh etherpadDB
|
||||
saveDB ${etherpadDBName} "${etherpadDB_MYSQL_USER}" "${etherpadDB_MYSQL_PASSWORD}" "${etherpadDB_MYSQL_DATABASE}" etherpad mysql
|
||||
. $KAZ_KEY_DIR/env-etherpadDB
|
||||
saveDB ${etherpadDBName} "${DB_MYSQL_USER}" "${DB_MYSQL_PASSWORD}" "${DB_MYSQL_DATABASE}" etherpad mysql
|
||||
;;
|
||||
framadate)
|
||||
echo "save date"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh framadateDB
|
||||
saveDB ${framadateDBName} "${framadateDB_MYSQL_USER}" "${framadateDB_MYSQL_PASSWORD}" "${framadateDB_MYSQL_DATABASE}" framadate mysql
|
||||
. $KAZ_KEY_DIR/env-framadateDB
|
||||
saveDB ${framadateDBName} "${DB_MYSQL_USER}" "${DB_MYSQL_PASSWORD}" "${DB_MYSQL_DATABASE}" framadate mysql
|
||||
;;
|
||||
cloud)
|
||||
echo "save cloud"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh nextcloudDB
|
||||
saveDB ${nextcloudDBName} "${nextcloudDB_MYSQL_USER}" "${nextcloudDB_MYSQL_PASSWORD}" "${nextcloudDB_MYSQL_DATABASE}" nextcloud mysql
|
||||
. $KAZ_KEY_DIR/env-nextcloudDB
|
||||
saveDB ${nextcloudDBName} "${DB_MYSQL_USER}" "${DB_MYSQL_PASSWORD}" "${DB_MYSQL_DATABASE}" nextcloud mysql
|
||||
;;
|
||||
paheko)
|
||||
# rien à faire (fichiers)
|
||||
;;
|
||||
mattermost)
|
||||
echo "save mattermost"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh mattermostDB
|
||||
saveDB matterPG "${mattermostDB_POSTGRES_USER}" "${mattermostDB_POSTGRES_PASSWORD}" "${mattermostDB_POSTGRES_DB}" mattermost postgres
|
||||
. $KAZ_KEY_DIR/env-mattermostDB
|
||||
saveDB matterPG "${DB_POSTGRES_USER}" "${DB_POSTGRES_PASSWORD}" "${DB_POSTGRES_DB}" mattermost postgres
|
||||
;;
|
||||
mobilizon)
|
||||
echo "save mobilizon"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh mobilizonDB
|
||||
saveDB ${mobilizonDBName} "${mobilizonDB_POSTGRES_USER}" "${mobilizonDB_POSTGRES_PASSWORD}" "${mobilizonDB_POSTGRES_DB}" mobilizon postgres
|
||||
. $KAZ_KEY_DIR/env-mobilizonDB
|
||||
saveDB ${mobilizonDBName} "${DB_POSTGRES_USER}" "${DB_POSTGRES_PASSWORD}" "${DB_POSTGRES_DB}" mobilizon postgres
|
||||
;;
|
||||
peertube)
|
||||
echo "save peertube"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh peertubeDB
|
||||
saveDB ${peertubeDBName} "${peertubeDB_POSTGRES_USER}" "${peertubeDB_POSTGRES_PASSWORD}" "${peertubeDB_PEERTUBE_DB_HOSTNAME}" peertube postgres
|
||||
. $KAZ_KEY_DIR/env-peertubeDB
|
||||
saveDB ${peertubeDBName} "${DB_POSTGRES_USER}" "${DB_POSTGRES_PASSWORD}" "${DB_PEERTUBE_DB_HOSTNAME}" peertube postgres
|
||||
;;
|
||||
mastodon)
|
||||
echo "save mastodon"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh mastodonDB
|
||||
saveDB ${mastodonDBName} "${mastodonDB_POSTGRES_USER}" "${mastodonDB_POSTGRES_PASSWORD}" "${mastodonDB_POSTGRES_DB}" mastodon postgres
|
||||
. $KAZ_KEY_DIR/env-mastodonDB
|
||||
saveDB ${mastodonDBName} "${DB_POSTGRES_USER}" "${DB_POSTGRES_PASSWORD}" "${DB_POSTGRES_DB}" mastodon postgres
|
||||
;;
|
||||
roundcube)
|
||||
echo "save roundcube"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh roundcubeDB
|
||||
saveDB ${roundcubeDBName} "${roundcubeDB_MYSQL_USER}" "${roundcubeDB_MYSQL_PASSWORD}" "${roundcubeDB_MYSQL_DATABASE}" roundcube mysql
|
||||
. $KAZ_KEY_DIR/env-roundcubeDB
|
||||
saveDB ${roundcubeDBName} "${DB_MYSQL_USER}" "${DB_MYSQL_PASSWORD}" "${DB_MYSQL_DATABASE}" roundcube mysql
|
||||
;;
|
||||
vaultwarden)
|
||||
echo "save vaultwarden"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh vaultwardenDB
|
||||
saveDB ${vaultwardenDBName} "${vaultwardenDB_MYSQL_USER}" "${vaultwardenDB_MYSQL_PASSWORD}" "${vaultwardenDB_MYSQL_DATABASE}" vaultwarden mysql
|
||||
. $KAZ_KEY_DIR/env-vaultwardenDB
|
||||
saveDB ${vaultwardenDBName} "${DB_MYSQL_USER}" "${DB_MYSQL_PASSWORD}" "${DB_MYSQL_DATABASE}" vaultwarden mysql
|
||||
;;
|
||||
dokuwiki)
|
||||
# rien à faire (fichiers)
|
||||
|
@@ -36,13 +36,14 @@ framadateUpdate(){
|
||||
if [ ! -f "${DOCK_LIB}/volumes/framadate_dateConfig/_data/config.php" ]; then
|
||||
return 0
|
||||
fi
|
||||
.$KAZ_BIN_DIR/getPasswords.sh framadateDB framadateServ
|
||||
. $KAZ_KEY_DIR/env-framadateDB
|
||||
. $KAZ_KEY_DIR/env-framadateServ
|
||||
|
||||
checkDockerRunning "${framadateServName}" "Framadate" &&
|
||||
${SIMU} docker exec -ti "${framadateServName}" bash -c -i "htpasswd -bc /var/framadate/admin/.htpasswd ${framadateServ_HTTPD_USER} ${framadateServ_HTTPD_PASSWORD}"
|
||||
${SIMU} docker exec -ti "${framadateServName}" bash -c -i "htpasswd -bc /var/framadate/admin/.htpasswd ${HTTPD_USER} ${HTTPD_PASSWORD}"
|
||||
${SIMU} sed -i \
|
||||
-e "s/^#*const DB_USER[ ]*=.*$/const DB_USER= '${framadateDB_MYSQL_USER}';/g" \
|
||||
-e "s/^#*const DB_PASSWORD[ ]*=.*$/const DB_PASSWORD= '${framadateDB_MYSQL_PASSWORD}';/g" \
|
||||
-e "s/^#*const DB_USER[ ]*=.*$/const DB_USER= '${DB_MYSQL_USER}';/g" \
|
||||
-e "s/^#*const DB_PASSWORD[ ]*=.*$/const DB_PASSWORD= '${DB_MYSQL_PASSWORD}';/g" \
|
||||
"${DOCK_LIB}/volumes/framadate_dateConfig/_data/config.php"
|
||||
}
|
||||
|
||||
@@ -51,8 +52,8 @@ jirafeauUpdate(){
|
||||
if [ ! -f "${DOCK_LIB}/volumes/jirafeau_fileConfig/_data/config.local.php" ]; then
|
||||
return 0
|
||||
fi
|
||||
. $KAZ_BIN_DIR/getPasswords.sh jirafeauServ
|
||||
SHA=$(echo -n "${jirafeauServ_HTTPD_PASSWORD}" | sha256sum | cut -d \ -f 1)
|
||||
. $KAZ_KEY_DIR/env-jirafeauServ
|
||||
SHA=$(echo -n "${_HTTPD_PASSWORD}" | sha256sum | cut -d \ -f 1)
|
||||
${SIMU} sed -i \
|
||||
-e "s/'admin_password'[ ]*=>[ ]*'[^']*'/'admin_password' => '${SHA}'/g" \
|
||||
"${DOCK_LIB}/volumes/jirafeau_fileConfig/_data/config.local.php"
|
||||
|
5
bin/createUser.py
Executable file
5
bin/createUser.py
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
from lib.user import create_users_from_file
|
||||
|
||||
create_users_from_file()
|
@@ -39,7 +39,9 @@ cd "${KAZ_ROOT}"
|
||||
. "${DOCKERS_ENV}"
|
||||
|
||||
|
||||
. $KAZ_BIN_DIR/getPasswords.sh ldapServ sympaServ paheko
|
||||
. $KAZ_KEY_DIR/env-ldapServ
|
||||
. $KAZ_KEY_DIR/env-sympaServ
|
||||
. $KAZ_KEY_DIR/env-paheko
|
||||
|
||||
# DOCK_DIR="${KAZ_COMP_DIR}" # ???
|
||||
|
||||
@@ -73,7 +75,7 @@ URL_LISTE="${sympaHost}.${domain}"
|
||||
URL_AGORA="${matterHost}.${domain}"
|
||||
URL_MDP="${ldapUIHost}.${domain}"
|
||||
# URL_PAHEKO="kaz-${pahekoHost}.${domain}"
|
||||
URL_PAHEKO="${httpProto}://${paheko_API_USER}:${paheko_API_PASSWORD}@kaz-paheko.${domain}"
|
||||
URL_PAHEKO="${httpProto}://${API_USER}:${API_PASSWORD}@kaz-paheko.${domain}"
|
||||
|
||||
availableProxyComposes=($(getList "${KAZ_CONF_DIR}/container-proxy.list"))
|
||||
|
||||
@@ -208,7 +210,7 @@ for i in "${CMD_LOGIN}" "${CMD_SYMPA}" "${CMD_ORGA}" "${CMD_PROXY}" "${CMD_FIRST
|
||||
done
|
||||
|
||||
echo "numero,nom,quota_disque,action_auto" > "${TEMP_PAHEKO}"
|
||||
echo "curl \"https://${paheko_API_USER}:${paheko_API_PASSWORD}@kaz-paheko.kaz.bzh/api/user/import\" -T \"${TEMP_PAHEKO}\"" >> "${CMD_PAHEKO}"
|
||||
echo "curl \"https://${API_USER}:${API_PASSWORD}@kaz-paheko.kaz.bzh/api/user/import\" -T \"${TEMP_PAHEKO}\"" >> "${CMD_PAHEKO}"
|
||||
|
||||
echo "on récupère tous les emails (secours/alias/kaz) sur le ldap"
|
||||
FILE_LDIF=/home/sauve/ldap.ldif
|
||||
@@ -396,9 +398,9 @@ nextcloudEnabled: TRUE\n\
|
||||
nextcloudQuota: ${QUOTA} GB\n\
|
||||
mobilizonEnabled: TRUE\n\
|
||||
agoraEnabled: TRUE\n\
|
||||
userPassword: {CRYPT}${pass}\n\n' | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}\" -x -w ${ldapServ_LDAP_ADMIN_PASSWORD}" | tee -a "${CMD_LOGIN}"
|
||||
userPassword: {CRYPT}${pass}\n\n' | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=${LDAP_ADMIN_USERNAME},${ldap_root}\" -x -w ${LDAP_ADMIN_PASSWORD}" | tee -a "${CMD_LOGIN}"
|
||||
fi
|
||||
#userPassword: {CRYPT}\$6\$${pass}\n\n\" | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=${ldapServ_LDAP_CONFIG_ADMIN_USERNAME},${ldap_root}\" -x -w ${ldapServ_LDAP_CONFIG_ADMIN_PASSWORD}" | tee -a "${CMD_LOGIN}"
|
||||
#userPassword: {CRYPT}\$6\$${pass}\n\n\" | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=${LDAP_CONFIG_ADMIN_USERNAME},${ldap_root}\" -x -w ${LDAP_CONFIG_ADMIN_PASSWORD}" | tee -a "${CMD_LOGIN}"
|
||||
|
||||
CREATE_ORGA_SERVICES=""
|
||||
|
||||
@@ -490,8 +492,8 @@ userPassword: {CRYPT}${pass}\n\n' | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=$
|
||||
|
||||
# TODO : vérif existance user
|
||||
# # le user existe t-il déjà sur le wp ?
|
||||
# . $KAZ_BIN_DIR/getPasswords.sh wpServ
|
||||
# curl -o "${TEMP_USER_WP}" -X GET "${httpProto}://${wpServ_WORDPRESS_ADMIN_USER}:${wpServ_WORDPRESS_ADMIN_PASSWORD}@${URL_WP_ORGA}/ocs/v1.php/cloud/users?search=${IDENT_KAZ}"
|
||||
# . $KAZ_KEY_DIR/env-wpServ
|
||||
# curl -o "${TEMP_USER_WP}" -X GET "${httpProto}://${WORDPRESS_ADMIN_USER}:${WORDPRESS_ADMIN_PASSWORD}@${URL_WP_ORGA}/ocs/v1.php/cloud/users?search=${IDENT_KAZ}"
|
||||
# nb_user_wp_orga=$(grep "<element>${IDENT_KAZ}</element>" "${TEMP_USER_WP}" | wc -l)
|
||||
# if [ "${nb_user_wp_orga}" != "0" ];then
|
||||
# (
|
||||
@@ -627,13 +629,13 @@ userPassword: {CRYPT}${pass}\n\n' | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=$
|
||||
# docker exec -i sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=https://listes.kaz.sns/sympasoap --trusted_application=SOAP_USER --trusted_application_password=SOAP_PASSWORD --proxy_vars="USER_EMAIL=contact1@kaz.sns" --service=which
|
||||
if [[ "${mode}" = "dev" ]]; then
|
||||
echo "# DEV, on teste l'inscription à sympa"| tee -a "${CMD_SYMPA}"
|
||||
LISTMASTER=$(echo ${sympaServ_LISTMASTERS} | cut -d',' -f1)
|
||||
echo "docker exec -i sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${sympaServ_SOAP_USER} --trusted_application_password=${sympaServ_SOAP_PASSWORD} --proxy_vars=\"USER_EMAIL=${LISTMASTER}\" --service=add --service_parameters=\"${NL_LIST},${EMAIL_SOUHAITE}\"" | tee -a "${CMD_SYMPA}"
|
||||
LISTMASTER=$(echo ${LISTMASTERS} | cut -d',' -f1)
|
||||
echo "docker exec -i sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${SOAP_USER} --trusted_application_password=${SOAP_PASSWORD} --proxy_vars=\"USER_EMAIL=${LISTMASTER}\" --service=add --service_parameters=\"${NL_LIST},${EMAIL_SOUHAITE}\"" | tee -a "${CMD_SYMPA}"
|
||||
else
|
||||
echo "# PROD, on inscrit à sympa"| tee -a "${CMD_SYMPA}"
|
||||
LISTMASTER=$(echo ${sympaServ_LISTMASTERS} | cut -d',' -f1)
|
||||
echo "docker exec -i sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${sympaServ_SOAP_USER} --trusted_application_password=${sympaServ_SOAP_PASSWORD} --proxy_vars=\"USER_EMAIL=${LISTMASTER}\" --service=add --service_parameters=\"${NL_LIST},${EMAIL_SOUHAITE}\"" | tee -a "${CMD_SYMPA}"
|
||||
echo "docker exec -i sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${sympaServ_SOAP_USER} --trusted_application_password=${sympaServ_SOAP_PASSWORD} --proxy_vars=\"USER_EMAIL=${LISTMASTER}\" --service=add --service_parameters=\"${NL_LIST},${EMAIL_SECOURS}\"" | tee -a "${CMD_SYMPA}"
|
||||
LISTMASTER=$(echo ${LISTMASTERS} | cut -d',' -f1)
|
||||
echo "docker exec -i sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${SOAP_USER} --trusted_application_password=${SOAP_PASSWORD} --proxy_vars=\"USER_EMAIL=${LISTMASTER}\" --service=add --service_parameters=\"${NL_LIST},${EMAIL_SOUHAITE}\"" | tee -a "${CMD_SYMPA}"
|
||||
echo "docker exec -i sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${SOAP_USER} --trusted_application_password=${SOAP_PASSWORD} --proxy_vars=\"USER_EMAIL=${LISTMASTER}\" --service=add --service_parameters=\"${NL_LIST},${EMAIL_SECOURS}\"" | tee -a "${CMD_SYMPA}"
|
||||
fi
|
||||
|
||||
if [ "${service[ADMIN_ORGA]}" == "O" ]; then
|
||||
@@ -645,7 +647,7 @@ userPassword: {CRYPT}${pass}\n\n' | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=$
|
||||
###################
|
||||
|
||||
# TODO : problème si 2 comptes partagent le même email souhaité (cela ne devrait pas arriver)
|
||||
curl -s "https://${paheko_API_USER}:${paheko_API_PASSWORD}@kaz-paheko.kaz.bzh/api/sql" -d "SELECT numero,nom,quota_disque from users WHERE email='${EMAIL_SOUHAITE}'" | jq '.results[] | .numero,.nom,.quota_disque ' | tr \\n ',' | sed 's/,$/,Aucune\n/' >> "${TEMP_PAHEKO}"
|
||||
curl -s "https://${API_USER}:${API_PASSWORD}@kaz-paheko.kaz.bzh/api/sql" -d "SELECT numero,nom,quota_disque from users WHERE email='${EMAIL_SOUHAITE}'" | jq '.results[] | .numero,.nom,.quota_disque ' | tr \\n ',' | sed 's/,$/,Aucune\n/' >> "${TEMP_PAHEKO}"
|
||||
|
||||
####################
|
||||
# Inscription MAIL #
|
||||
|
@@ -8,7 +8,10 @@ KAZ_ROOT=$(cd "$(dirname $0)"/..; pwd)
|
||||
setKazVars
|
||||
|
||||
. $DOCKERS_ENV
|
||||
. $KAZ_BIN_DIR/getPasswords.sh ldapServ nextcloudServ sympaServ paheko
|
||||
. $KAZ_KEY_DIR/env-ldapServ
|
||||
. $KAZ_KEY_DIR/env-nextcloudServ
|
||||
. $KAZ_KEY_DIR/env-sympaServ
|
||||
. $KAZ_KEY_DIR/env-paheko
|
||||
|
||||
VERSION="18-05-2025"
|
||||
PRG=$(basename $0)
|
||||
@@ -20,11 +23,11 @@ LOG=$RACINE".log"
|
||||
URL_NC=$(echo $cloudHost).$(echo $domain)
|
||||
URL_AGORA=$(echo $matterHost).$(echo $domain)
|
||||
URL_LISTE=$(echo $sympaHost).$(echo $domain)
|
||||
URL_PAHEKO="$httpProto://${paheko_API_USER}:${paheko_API_PASSWORD}@kaz-paheko.$(echo $domain)"
|
||||
URL_PAHEKO="$httpProto://${API_USER}:${API_PASSWORD}@kaz-paheko.$(echo $domain)"
|
||||
NL_LIST=infos@listes.kaz.bzh
|
||||
URL_AGORA_API=${URL_AGORA}/api/v4
|
||||
EQUIPE=kaz
|
||||
LISTMASTER=$(echo ${sympaServ_LISTMASTERS} | cut -d',' -f1)
|
||||
LISTMASTER=$(echo ${LISTMASTERS} | cut -d',' -f1)
|
||||
|
||||
|
||||
#### Test du serveur sur lequel s' execute le script ####
|
||||
@@ -94,8 +97,8 @@ searchEmail() {
|
||||
fi
|
||||
done
|
||||
ldapsearch -H ldap://${LDAP_IP} \
|
||||
-x -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${ldapServ_LDAP_ADMIN_PASSWORD}" \
|
||||
-x -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${LDAP_ADMIN_PASSWORD}" \
|
||||
-b "${ldap_root}" "(&(objectclass=${SEARCH_OBJECT_CLASS})(cn=*${RMAIL}*))" cn | grep ^cn | sed -e 's/^cn: //' >$TFILE_EMAILS
|
||||
COMPTEUR_LIGNE=0
|
||||
while read LIGNE
|
||||
@@ -186,12 +189,12 @@ infoEmail() {
|
||||
printKazMsg " DETAILS DU COMPTE DANS NEXTCLOUD PRINCIPAL"
|
||||
echo -e ""
|
||||
#TEMP_USER_NC=$(mktemp /tmp/$RACINE.XXXXXXXXX.TEMP_USER_NC)
|
||||
#curl -s -o $TEMP_USER_NC -X GET -H 'OCS-APIRequest:true' $httpProto://admin:$nextcloudServ_NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users?search=$CHOIX_MAIL
|
||||
#curl -s -o $TEMP_USER_NC -X GET -H 'OCS-APIRequest:true' $httpProto://admin:$NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users?search=$CHOIX_MAIL
|
||||
#cat $TEMP_USER_NC | grep -i "element" | sed -e s/[\<\>\/]//g | sed -e s/element//g
|
||||
echo -ne "${NC}"
|
||||
echo -ne " - Nextcloud enable : "
|
||||
echo -ne "${GREEN}"
|
||||
ldapsearch -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${ldapServ_LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i nextcloudEnabled | cut -c 18-30
|
||||
ldapsearch -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i nextcloudEnabled | cut -c 18-30
|
||||
echo -ne "${NC}"
|
||||
echo -e "${NC} ------------------------------------------------"
|
||||
printKazMsg " DETAILS DU COMPTE DANS LDAP ET PAHEKO"
|
||||
@@ -207,11 +210,11 @@ infoEmail() {
|
||||
echo -ne "${NC}"
|
||||
echo -n " - Quota Mail (Ldap) : "
|
||||
echo -ne "${GREEN}"
|
||||
ldapsearch -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${ldapServ_LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i mailquota | cut -c 11-60
|
||||
ldapsearch -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i mailquota | cut -c 11-60
|
||||
echo -ne "${NC}"
|
||||
echo -n " - Quota Nextcloud (Ldap) : "
|
||||
echo -ne "${GREEN}"
|
||||
ldapsearch -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${ldapServ_LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i nextcloudquota | cut -c 17-60
|
||||
ldapsearch -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i nextcloudquota | cut -c 17-60
|
||||
echo -ne "${NC}"
|
||||
echo -n " - Mail de secours (Paheko ): "
|
||||
echo -ne "${GREEN}"
|
||||
@@ -219,11 +222,11 @@ infoEmail() {
|
||||
echo -ne "${NC}"
|
||||
echo -n " - Mail de secours (Ldap): "
|
||||
echo -ne "${GREEN}"
|
||||
ldapsearch -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${ldapServ_LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i maildeSecours | sed -e 's/mailDeSecours://'
|
||||
ldapsearch -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i maildeSecours | sed -e 's/mailDeSecours://'
|
||||
echo -ne "${NC}"
|
||||
echo -n " - Alias (Ldap) : "
|
||||
echo -ne "${GREEN}"
|
||||
LDAP_ALIAS=$(ldapsearch -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${ldapServ_LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i alias | cut -c 11-60)
|
||||
LDAP_ALIAS=$(ldapsearch -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${LDAP_ADMIN_PASSWORD}" -b "cn=${CHOIX_MAIL},ou=users,${ldap_root}" | grep -i alias | cut -c 11-60)
|
||||
echo -ne "${NC}"
|
||||
echo -ne "${GREEN}"
|
||||
for ldap_alias in ${LDAP_ALIAS}
|
||||
@@ -243,8 +246,8 @@ infoEmail() {
|
||||
echo "------------------------------------------------"
|
||||
echo " Alias : ${CHOIX_MAIL} "
|
||||
echo ""
|
||||
for INFOALIAS in $(ldapsearch -H ldap://${LDAP_IP} -x -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${ldapServ_LDAP_ADMIN_PASSWORD}" -b "${ldap_root}" "(&(objectclass=PostfixBookMailForward)(cn=*${CHOIX_MAIL}*))" mail \
|
||||
for INFOALIAS in $(ldapsearch -H ldap://${LDAP_IP} -x -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${LDAP_ADMIN_PASSWORD}" -b "${ldap_root}" "(&(objectclass=PostfixBookMailForward)(cn=*${CHOIX_MAIL}*))" mail \
|
||||
| grep ^mail: | sed -e 's/^mail://')
|
||||
do
|
||||
echo -ne "=====> ${GREEN} "
|
||||
@@ -311,12 +314,12 @@ searchDestroy() {
|
||||
fi
|
||||
echo -e "${NC}"
|
||||
echo -e "Recherche de ${GREEN} ${REP_SEARCH_DESTROY} ${NC} dans nextcloud"
|
||||
USER_NEXTCLOUD_SUPPR=$(curl -s -X GET -H 'OCS-APIRequest:true' $httpProto://admin:$nextcloudServ_NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users?search=${REP_SEARCH_DESTROY} | grep element | sed -s 's/[ \<\>\/]//g' | sed 's/element//g')
|
||||
USER_NEXTCLOUD_SUPPR=$(curl -s -X GET -H 'OCS-APIRequest:true' $httpProto://admin:$NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users?search=${REP_SEARCH_DESTROY} | grep element | sed -s 's/[ \<\>\/]//g' | sed 's/element//g')
|
||||
if [ ! -z ${USER_NEXTCLOUD_SUPPR} ]
|
||||
then
|
||||
printKazMsg "le user trouvé est : ${USER_NEXTCLOUD_SUPPR}"
|
||||
echo -e "${RED} Suppresion de ${USER_NEXTCLOUD_SUPPR}"
|
||||
curl -H 'OCS-APIREQUEST: true' -X DELETE $httpProto://admin:$nextcloudServ_NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users/${USER_NEXTCLOUD_SUPPR} >/dev/null 2>&1
|
||||
curl -H 'OCS-APIREQUEST: true' -X DELETE $httpProto://admin:$NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users/${USER_NEXTCLOUD_SUPPR} >/dev/null 2>&1
|
||||
if [ "$?" -eq "0" ]
|
||||
then
|
||||
printKazMsg "Suppresion ok"
|
||||
@@ -331,7 +334,7 @@ searchDestroy() {
|
||||
echo -e "${RED} suppression de ${REP_SEARCH_DESTROY} dans la liste info de sympa"
|
||||
echo -e "${NC}"
|
||||
echo ""
|
||||
docker exec -ti sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${sympaServ_SOAP_USER} --trusted_application_password=${sympaServ_SOAP_PASSWORD} --proxy_vars=USER_EMAIL=${LISTMASTER} --service=del --service_parameters="${NL_LIST},${REP_SEARCH_DESTROY}"
|
||||
docker exec -ti sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${SOAP_USER} --trusted_application_password=${SOAP_PASSWORD} --proxy_vars=USER_EMAIL=${LISTMASTER} --service=del --service_parameters="${NL_LIST},${REP_SEARCH_DESTROY}"
|
||||
echo -e "${NC}"
|
||||
echo ""
|
||||
echo -e "${RED} suppression de ${REP_SEARCH_DESTROY} dans le serveur de mail"
|
||||
@@ -348,7 +351,7 @@ searchDestroy() {
|
||||
echo -e "${RED} suppression de ${REP_SEARCH_DESTROY} dans le ldap"
|
||||
echo -e "${NC}"
|
||||
echo ""
|
||||
ldapdelete -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${ldapServ_LDAP_ADMIN_PASSWORD}" "cn=${REP_SEARCH_DESTROY},ou=users,${ldap_root}"
|
||||
ldapdelete -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${LDAP_ADMIN_PASSWORD}" "cn=${REP_SEARCH_DESTROY},ou=users,${ldap_root}"
|
||||
if [ "$?" -eq "0" ]
|
||||
then
|
||||
printKazMsg "Suppresion ok"
|
||||
@@ -381,8 +384,8 @@ gestPassword() {
|
||||
# MAIL_SECOURS=$(jq .results[].email_secours $FICMAILSECOURS | sed -e 's/\"//g')
|
||||
|
||||
MAIL_SECOURS=$(ldapsearch -H ldap://${LDAP_IP} \
|
||||
-x -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${ldapServ_LDAP_ADMIN_PASSWORD}" \
|
||||
-x -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${LDAP_ADMIN_PASSWORD}" \
|
||||
-b "${ldap_root}" "(&(objectclass=inetOrgPerson)(cn=*${CHOIX_MAIL}*))" | grep ^mailDeSecours | sed -e 's/^mailDeSecours: //')
|
||||
if [ "$MAIL_SECOURS" = "" ]
|
||||
then
|
||||
@@ -409,19 +412,19 @@ gestPassword() {
|
||||
fi
|
||||
if [ "$SEARCH_RESET_INPUT" = "o" ] || [ "$SEARCH_RESET_INPUT" = "O" ]
|
||||
then
|
||||
USER_NEXTCLOUD_MODIF=$(curl -s -X GET -H 'OCS-APIRequest:true' $httpProto://admin:$nextcloudServ_NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users?search=${COMPTE_A_MODIFIER} | grep element | sed -e 's/[ \<\>\/]//g' -e 's/element//g')
|
||||
USER_NEXTCLOUD_MODIF=$(curl -s -X GET -H 'OCS-APIRequest:true' $httpProto://admin:$NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users?search=${COMPTE_A_MODIFIER} | grep element | sed -e 's/[ \<\>\/]//g' -e 's/element//g')
|
||||
echo -e "$GREEN Compte à modifier = $RED ${COMPTE_A_MODIFIER} ${NC}"
|
||||
echo -e "$GREEN Mail de secours = $RED ${MAIL_SECOURS} ${NC}"
|
||||
echo -e "$GREEN Compte $RED $(searchMattermost $COMPTE_A_MODIFIER) ${NC}"
|
||||
echo -e "$GREEN Compte Nextcloud $RED ${USER_NEXTCLOUD_MODIF} ${NC}"
|
||||
echo -e "$GREEN Le mot de passe sera = $RED ${PASSWORD} ${NC}"
|
||||
docker exec -ti mattermostServ bin/mmctl user change-password $(searchMattermost $COMPTE_A_MODIFIER) -p $PASSWORD >/dev/null 2>&1
|
||||
curl -H 'OCS-APIREQUEST: true' -X PUT $httpProto://admin:$nextcloudServ_NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users/${USER_NEXTCLOUD_MODIF} -d key=password -d value=${PASSWORD} >/dev/null 2>&1
|
||||
curl -H 'OCS-APIREQUEST: true' -X PUT $httpProto://admin:$NEXTCLOUD_ADMIN_PASSWORD@$URL_NC/ocs/v1.php/cloud/users/${USER_NEXTCLOUD_MODIF} -d key=password -d value=${PASSWORD} >/dev/null 2>&1
|
||||
pass=$(mkpasswd -m sha512crypt ${PASSWORD})
|
||||
echo -e "\n\ndn: cn=${COMPTE_A_MODIFIER},ou=users,${ldap_root}\n\
|
||||
changeType: modify\n\
|
||||
replace: userPassword\n\
|
||||
userPassword: {CRYPT}${pass}\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${ldapServ_LDAP_ADMIN_PASSWORD}"
|
||||
userPassword: {CRYPT}${pass}\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${LDAP_ADMIN_PASSWORD}"
|
||||
echo -e "Envoi d'un message dans mattermost pour la modification du mot de passe"
|
||||
docker exec -ti mattermostServ bin/mmctl post create kaz:Creation-Comptes --message "Le mot de passe du compte ${COMPTE_A_MODIFIER} a été modifié" >/dev/null 2>&1
|
||||
if [ $ADRESSE_SEC == "OUI" ]
|
||||
@@ -469,8 +472,8 @@ createMail() {
|
||||
if [[ ${EMAIL_SOUHAITE} =~ ${regexMail} ]]
|
||||
then
|
||||
ldapsearch -H ldap://${LDAP_IP} \
|
||||
-x -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${ldapServ_LDAP_ADMIN_PASSWORD}" \
|
||||
-x -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${LDAP_ADMIN_PASSWORD}" \
|
||||
-b "${ldap_root}" "(&(objectclass=inetOrgPerson)(cn=${EMAIL_SOUHAITE}))" cn | grep ^cn | sed -e 's/^cn: //' >$TFILE_EMAILS
|
||||
if grep -q "^${EMAIL_SOUHAITE}$" "${TFILE_EMAILS}"
|
||||
then
|
||||
@@ -568,7 +571,7 @@ nextcloudEnabled: ${TRUE_KAZ}\n\
|
||||
nextcloudQuota: ${QUOTA} GB\n\
|
||||
mobilizonEnabled: ${TRUE_KAZ}\n\
|
||||
agoraEnabled: ${TRUE_KAZ}\n\
|
||||
userPassword: {CRYPT}${LDAPPASS}\n\n' | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}\" -x -w ${ldapServ_LDAP_ADMIN_PASSWORD}" >${TFILE_CREATE_MAIL}
|
||||
userPassword: {CRYPT}${LDAPPASS}\n\n' | ldapmodify -c -H ldap://${LDAP_IP} -D \"cn=${LDAP_ADMIN_USERNAME},${ldap_root}\" -x -w ${LDAP_ADMIN_PASSWORD}" >${TFILE_CREATE_MAIL}
|
||||
# on execute le fichier avec les données ldap pour créer l' entrée dans l' annuaire
|
||||
bash ${TFILE_CREATE_MAIL} >/dev/null
|
||||
# on colle le compte et le mot de passe dans le fichier
|
||||
@@ -614,12 +617,12 @@ createAlias() {
|
||||
if [[ ${AMAIL} =~ ${regexMail} ]]
|
||||
then
|
||||
RESU_ALIAS=$(ldapsearch -H ldap://${LDAP_IP} \
|
||||
-x -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${ldapServ_LDAP_ADMIN_PASSWORD}" \
|
||||
-x -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${LDAP_ADMIN_PASSWORD}" \
|
||||
-b "${ldap_root}" "(&(objectclass=PostfixBookMailForward)(cn=*${AMAIL}*))" | grep ^cn | sed -e 's/^cn: //')
|
||||
RESU_ALIAS_IS_MAIL=$(ldapsearch -H ldap://${LDAP_IP} \
|
||||
-x -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${ldapServ_LDAP_ADMIN_PASSWORD}" \
|
||||
-x -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${LDAP_ADMIN_PASSWORD}" \
|
||||
-b "${ldap_root}" "(&(objectclass=inetOrgPerson)(cn=*${AMAIL}*))" cn | grep ^cn | sed -e 's/^cn: //')
|
||||
|
||||
if echo ${RESU_ALIAS} | grep -q "^${AMAIL}$" || echo ${RESU_ALIAS_IS_MAIL} | grep -q "^${AMAIL}$"
|
||||
@@ -694,7 +697,7 @@ changeType: add\n\
|
||||
objectClass: organizationalRole\n\
|
||||
objectClass: PostfixBookMailForward\n\
|
||||
mailAlias: ${AMAIL}\n\
|
||||
${LDAPALAISMAIL}\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${ldapServ_LDAP_ADMIN_PASSWORD}
|
||||
${LDAPALAISMAIL}\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${LDAP_ADMIN_PASSWORD}
|
||||
fait=1
|
||||
printKazMsg "Création de ${AMAIL}"
|
||||
sleep 3
|
||||
@@ -726,8 +729,8 @@ delAlias() {
|
||||
if [[ ${RALIAS} =~ ${regexMail} ]]
|
||||
then
|
||||
RESU_ALIAS=$(ldapsearch -H ldap://${LDAP_IP} \
|
||||
-x -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${ldapServ_LDAP_ADMIN_PASSWORD}" \
|
||||
-x -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${LDAP_ADMIN_PASSWORD}" \
|
||||
-b "${ldap_root}" "(&(objectclass=PostfixBookMailForward)(cn=${RALIAS}))" cn | grep ^cn | sed -e 's/^cn: //')
|
||||
if [ ! -z ${RESU_ALIAS} ]
|
||||
then
|
||||
@@ -737,7 +740,7 @@ delAlias() {
|
||||
read -p "suppression de ${RESU_ALIAS} ? (o/n): " REPDELALIAS
|
||||
case "${REPDELALIAS}" in
|
||||
o | O )
|
||||
ldapdelete -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${ldapServ_LDAP_ADMIN_PASSWORD}" "cn=${RESU_ALIAS},ou=mailForwardings,${ldap_root}"
|
||||
ldapdelete -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w "${LDAP_ADMIN_PASSWORD}" "cn=${RESU_ALIAS},ou=mailForwardings,${ldap_root}"
|
||||
printKazMsg "suppression ${RESU_ALIAS} effectuée"
|
||||
sleep 2
|
||||
faitdel=1
|
||||
@@ -773,8 +776,8 @@ modifyAlias()
|
||||
ACHANGE=0
|
||||
searchEmail alias
|
||||
LISTE_MAIL_ALIAS=$(ldapsearch -H ldap://${LDAP_IP} \
|
||||
-x -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${ldapServ_LDAP_ADMIN_PASSWORD}" \
|
||||
-x -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${LDAP_ADMIN_PASSWORD}" \
|
||||
-b "${ldap_root}" "(&(objectclass=PostfixBookMailForward)(cn=*${CHOIX_MAIL}*))" \
|
||||
| grep -i ^mail: | sed -e 's/^mail: /_/' | tr -d [:space:] | sed -s 's/_/ /g')
|
||||
echo "-------------------------------------------------------------------"
|
||||
@@ -849,8 +852,8 @@ modifyAlias()
|
||||
echo "mail: ${key}" >>${FIC_MODIF_LDIF}
|
||||
done
|
||||
echo "-" >>${FIC_MODIF_LDIF}
|
||||
ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-x -w ${ldapServ_LDAP_ADMIN_PASSWORD} \
|
||||
ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-x -w ${LDAP_ADMIN_PASSWORD} \
|
||||
-f ${FIC_MODIF_LDIF} >/dev/null
|
||||
else
|
||||
printKazMsg "Pas de changement"
|
||||
@@ -876,8 +879,8 @@ updateUser() {
|
||||
for attribut in mailDeSecours mailAlias mailQuota nextcloudQuota
|
||||
do
|
||||
ATTRIB+=([${attribut}]=$(ldapsearch -H ldap://${LDAP_IP} \
|
||||
-x -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${ldapServ_LDAP_ADMIN_PASSWORD}" \
|
||||
-x -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-w "${LDAP_ADMIN_PASSWORD}" \
|
||||
-b "${ldap_root}" "(&(objectclass=inetOrgPerson)(cn=*${CHOIX_MAIL}*))" \
|
||||
| grep ^"${attribut}": | sed -e 's/^'${attribut}': //' | tr -s '[:space:]' ' ' ))
|
||||
# si l' attribut est mailDesecours on l' attrape et on on le stocke pour pouvoir l' enlever de sympa
|
||||
@@ -1060,15 +1063,15 @@ updateUser() {
|
||||
done
|
||||
cat ${FIC_MODIF_LDIF}
|
||||
sleep 3
|
||||
ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-x -w ${ldapServ_LDAP_ADMIN_PASSWORD} \
|
||||
ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" \
|
||||
-x -w ${LDAP_ADMIN_PASSWORD} \
|
||||
-f ${FIC_MODIF_LDIF}
|
||||
if [ ! -z ${MAILDESECOURS} ]
|
||||
then
|
||||
# suppression du mail de secours de la liste infos
|
||||
docker exec -ti sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${sympaServ_SOAP_USER} --trusted_application_password=${sympaServ_SOAP_PASSWORD} --proxy_vars=USER_EMAIL=${LISTMASTER} --service=del --service_parameters="${NL_LIST},${MAILDESECOURSACTUEL}"
|
||||
docker exec -ti sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${SOAP_USER} --trusted_application_password=${SOAP_PASSWORD} --proxy_vars=USER_EMAIL=${LISTMASTER} --service=del --service_parameters="${NL_LIST},${MAILDESECOURSACTUEL}"
|
||||
# ajout de l' adresse de la nouvelle adresse de secours
|
||||
docker exec -ti sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${sympaServ_SOAP_USER} --trusted_application_password=${sympaServ_SOAP_PASSWORD} --proxy_vars=USER_EMAIL=${LISTMASTER} --service=add --service_parameters="${NL_LIST},${MAILDESECOURS}"
|
||||
docker exec -ti sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${SOAP_USER} --trusted_application_password=${SOAP_PASSWORD} --proxy_vars=USER_EMAIL=${LISTMASTER} --service=add --service_parameters="${NL_LIST},${MAILDESECOURS}"
|
||||
fi
|
||||
updateUser
|
||||
fi
|
||||
|
@@ -1,94 +0,0 @@
|
||||
#!/bin/bash
|
||||
#Ki: Gael
|
||||
#Kan: 2025
|
||||
#Koi: gestion mots de passe
|
||||
|
||||
KAZ_ROOT=/kaz
|
||||
|
||||
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
|
||||
QUIET=1
|
||||
|
||||
usage() {
|
||||
echo "getPasswords.sh [OPTIONS] [envname ...]
|
||||
Récupère les variables d'environnement présentes dans /kaz/secret/env-envname et crée des variables à partir de ces noms là.
|
||||
Les variables sont du type envname_NOMVARIABLE=valeur
|
||||
On peut passer plusieurs fichiers env, à partir du moment ou ils sont tous dans le même répertoire !
|
||||
OPTIONS
|
||||
-h|--help Cette aide :-)
|
||||
-n|--simu SIMULATION
|
||||
-d foldername prend les envfiles dans un sous dossier /kaz/secret/foldername/ (pour les orgas !)
|
||||
Les variables seront du type foldername-envname_NOMVARIABLE=valeur
|
||||
-e varname Affiche le contenu d'une variable en particulier
|
||||
"
|
||||
}
|
||||
|
||||
if [ ! -d "${KAZ_KEY_DIR}/tmp" ]; then
|
||||
mkdir "${KAZ_KEY_DIR}/tmp"
|
||||
fi
|
||||
|
||||
for ARG in "$@"; do
|
||||
if [ -n "${DIRECTORYARG}" ]; then # après un -d
|
||||
SUBDIRECTORY="${ARG}"
|
||||
unset DIRECTORYARG
|
||||
elif [ -n "${ECHOVARARG}" ]; then # après un -e
|
||||
VARTOECHO="${ARG}"
|
||||
unset ECHOVARARG
|
||||
QUIET="/dev/null" # pour ne pas avoir d'autres bruits ...
|
||||
else
|
||||
|
||||
case "${ARG}" in
|
||||
'-d' | '--directory' | '-f' | '--folder' | '--foldername')
|
||||
DIRECTORYARG="ON ATTEND UN REPERTOIRE APRES CA" ;;
|
||||
'-h' | '--help' )
|
||||
usage && exit ;;
|
||||
'-n' | '--simu')
|
||||
SIMU="echo" ;;
|
||||
'-e' | '--echo')
|
||||
ECHOVARARG="ON ATTEND UNE UN NOM DE VARIABLE APRES CA" ;;
|
||||
'-q' )
|
||||
QUIET="/dev/null" ;;
|
||||
*)
|
||||
ENVFILES="${ENVFILES} ${ARG%}";;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
getVars () {
|
||||
# $1 : filename
|
||||
grep "^[^#]*=" $1 | sed 's/\([^=]*\).*/\1/' | sort -u
|
||||
}
|
||||
|
||||
NB_FILES=$(echo "${ENVFILES}" | wc -w )
|
||||
|
||||
if [[ $NB_FILES = 0 ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for ENVFILE in $ENVFILES; do
|
||||
FILENAME="$KAZ_KEY_DIR/env-$ENVFILE"
|
||||
VARSUFFIX="$ENVFILE"_
|
||||
if [ -n "${SUBDIRECTORY}" ]; then
|
||||
FILENAME="$KAZ_KEY_DIR/orgas/$SUBDIRECTORY/env-$ENVFILE"
|
||||
VARSUFFIX="${SUBDIRECTORY}-${ENVFILE}_"
|
||||
fi
|
||||
|
||||
if ! [ -f "$FILENAME" ]; then
|
||||
echo "$FILENAME does not exist." >& $QUIET
|
||||
continue
|
||||
fi
|
||||
|
||||
. $FILENAME # on récupère les variables
|
||||
vars=$(getVars $FILENAME)
|
||||
for var in $vars; do
|
||||
$SIMU declare $VARSUFFIX$var=${!var}
|
||||
unset $var
|
||||
done
|
||||
unset FILENAME VARSUFFIX vars
|
||||
done
|
||||
|
||||
if [ -n "$VARTOECHO" ]; then
|
||||
echo ${!VARTOECHO}
|
||||
fi
|
||||
|
||||
unset ENVFILES KAZ_ROOT SUBDIRECTORY SIMU QUIET NB_FILES VARTOECHO
|
@@ -123,6 +123,8 @@ export DebugLog="${KAZ_ROOT}/log/log-install-$(date +%y-%m-%d-%T)-"
|
||||
if [[ " ${DOCKERS_LIST[*]} " =~ " traefik " ]]; then
|
||||
# on initialise traefik :-(
|
||||
${KAZ_COMP_DIR}/traefik/first.sh
|
||||
# on démarre traefik (plus lancé dans container.sh)
|
||||
docker-compose -f ${KAZ_COMP_DIR}/traefik/docker-compose.yml up -d
|
||||
fi
|
||||
|
||||
if [[ " ${DOCKERS_LIST[*]} " =~ " etherpad " ]]; then
|
||||
|
@@ -7,9 +7,9 @@ setKazVars
|
||||
|
||||
. $DOCKERS_ENV
|
||||
|
||||
. $KAZ_BIN_DIR/getPasswords.sh paheko
|
||||
. $KAZ_KEY_DIR/env-paheko
|
||||
|
||||
URL_PAHEKO="$httpProto://${paheko_API_USER}:${paheko_API_PASSWORD}@kaz-paheko.$(echo $domain)"
|
||||
URL_PAHEKO="$httpProto://${API_USER}:${API_PASSWORD}@kaz-paheko.$(echo $domain)"
|
||||
|
||||
PRG=$(basename $0)
|
||||
RACINE=$(echo $PRG | awk '{print $1}')
|
||||
|
@@ -5,7 +5,7 @@ KAZ_ROOT=/kaz
|
||||
setKazVars
|
||||
|
||||
. $DOCKERS_ENV
|
||||
. $KAZ_BIN_DIR/getPasswords.sh ldapServ
|
||||
. $KAZ_KEY_DIR/env-ldapServ
|
||||
|
||||
LDAP_IP=$(docker inspect -f '{{.NetworkSettings.Networks.ldapNet.IPAddress}}' ldapServ)
|
||||
|
||||
@@ -20,4 +20,4 @@ EDITOR=${EDITOR:-vi}
|
||||
EDITOR=${EDITOR:-vi}
|
||||
export EDITOR=${EDITOR}
|
||||
|
||||
ldapvi -h $LDAP_IP -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -w ${ldapServ_LDAP_ADMIN_PASSWORD} --discover
|
||||
ldapvi -h $LDAP_IP -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -w ${LDAP_ADMIN_PASSWORD} --discover
|
||||
|
@@ -8,12 +8,13 @@ KAZ_ROOT=/kaz
|
||||
setKazVars
|
||||
|
||||
. $DOCKERS_ENV
|
||||
. $KAZ_BIN_DIR/getPasswords.sh ldapServ paheko
|
||||
. $KAZ_KEY_DIR/env-ldapServ
|
||||
. $KAZ_KEY_DIR/env-paheko
|
||||
|
||||
ACCOUNTS=/kaz/dockers/postfix/config/postfix-accounts.cf
|
||||
|
||||
LDAP_IP=$(docker inspect -f '{{.NetworkSettings.Networks.ldapNet.IPAddress}}' ldapServ)
|
||||
URL_GARRADIN="$httpProto://${paheko_API_USER}:${paheko_API_PASSWORD}@kaz-paheko.$(echo $domain)"
|
||||
URL_GARRADIN="$httpProto://${API_USER}:${API_PASSWORD}@kaz-paheko.$(echo $domain)"
|
||||
# docker exec -i nextcloudDB mysql --user=${nextcloud_MYSQL_USER} --password=${nextcloud_MYSQL_PASSWORD} ${nextcloud_MYSQL_DATABASE} <<< "select * from oc_accounts;" > /tmp/oc_accounts
|
||||
|
||||
ERRORS="/tmp/ldap-errors.log"
|
||||
@@ -126,7 +127,7 @@ replace: agoraEnabled\n\
|
||||
agoraEnabled: TRUE\n\
|
||||
-\n\
|
||||
replace: mobilizonEnabled\n\
|
||||
mobilizonEnabled: TRUE\n\n" | tee /tmp/ldap/${mail}.ldif | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${ldapServ_LDAP_ADMIN_PASSWORD}
|
||||
mobilizonEnabled: TRUE\n\n" | tee /tmp/ldap/${mail}.ldif | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${LDAP_ADMIN_PASSWORD}
|
||||
done
|
||||
|
||||
#replace: nextcloudEnabled\n\
|
||||
@@ -164,7 +165,7 @@ do
|
||||
echo -e "dn: cn=${mail},ou=users,${ldap_root}\n\
|
||||
changeType: modify
|
||||
replace: mailAlias\n\
|
||||
$LIST\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${ldapServ_LDAP_ADMIN_PASSWORD}
|
||||
$LIST\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${LDAP_ADMIN_PASSWORD}
|
||||
else
|
||||
echo "Alias vers un mail externe, go fichier"
|
||||
echo $line >> ${ALIASES_WITHLDAP}
|
||||
@@ -185,7 +186,7 @@ replace: mailAlias\n\
|
||||
mailAlias: ${src}\n\
|
||||
-\n\
|
||||
replace: mail\n\
|
||||
mail: ${dst}\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${ldapServ_LDAP_ADMIN_PASSWORD}
|
||||
mail: ${dst}\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${LDAP_ADMIN_PASSWORD}
|
||||
fi
|
||||
else
|
||||
echo "Forward vers plusieurs adresses, on met dans le fichier"
|
||||
@@ -215,7 +216,7 @@ replace: mailAlias\n\
|
||||
mailAlias: ${src}\n\
|
||||
-\n\
|
||||
replace: mail\n\
|
||||
${LIST}\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${ldapServ_LDAP_ADMIN_PASSWORD}
|
||||
${LIST}\n\n" | ldapmodify -c -H ldap://${LDAP_IP} -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -x -w ${LDAP_ADMIN_PASSWORD}
|
||||
|
||||
fi
|
||||
done
|
||||
|
@@ -5,16 +5,17 @@ KAZ_ROOT=/kaz
|
||||
setKazVars
|
||||
|
||||
. $DOCKERS_ENV
|
||||
. $KAZ_BIN_DIR/getPasswords.sh ldapServ nextcloudDB
|
||||
. $KAZ_KEY_DIR/env-ldapServ
|
||||
. $KAZ_KEY_DIR/env-nextcloudDB
|
||||
|
||||
LDAP_IP=$(docker inspect -f '{{.NetworkSettings.Networks.ldapNet.IPAddress}}' ldapServ)
|
||||
|
||||
docker exec -i nextcloudDB mysql --user=${nextcloudDB_MYSQL_USER} --password=${nextcloudDB_MYSQL_PASSWORD} ${nextcloudDB_MYSQL_DATABASE} <<< "select uid from oc_users;" > /tmp/nc_users.txt
|
||||
docker exec -i nextcloudDB mysql --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} ${MYSQL_DATABASE} <<< "select uid from oc_users;" > /tmp/nc_users.txt
|
||||
|
||||
OLDIFS=${IFS}
|
||||
IFS=$'\n'
|
||||
for line in `cat /tmp/nc_users.txt`; do
|
||||
result=$(ldapsearch -h $LDAP_IP -D "cn=${ldapServ_LDAP_ADMIN_USERNAME},${ldap_root}" -w ${ldapServ_LDAP_ADMIN_PASSWORD} -b $ldap_root -x "(identifiantKaz=${line})" | grep numEntries)
|
||||
result=$(ldapsearch -h $LDAP_IP -D "cn=${LDAP_ADMIN_USERNAME},${ldap_root}" -w ${LDAP_ADMIN_PASSWORD} -b $ldap_root -x "(identifiantKaz=${line})" | grep numEntries)
|
||||
echo "${line} ${result}" | grep -v "numEntries: 1" | grep -v "^uid"
|
||||
done
|
||||
IFS=${OLDIFS}
|
||||
|
15
bin/lib/config.py
Normal file
15
bin/lib/config.py
Normal file
@@ -0,0 +1,15 @@
|
||||
DOCKERS_ENV = "/kaz/config/dockers.env"
|
||||
SECRETS = "/kaz/secret/env-{serv}"
|
||||
|
||||
def getDockersConfig(key):
|
||||
with open(DOCKERS_ENV) as config:
|
||||
for line in config:
|
||||
if line.startswith(f"{key}="):
|
||||
return line.split("=", 1)[1].split("#")[0].strip()
|
||||
|
||||
def getSecretConfig(serv, key):
|
||||
with open(SECRETS.format(serv=serv)) as config:
|
||||
for line in config:
|
||||
if line.startswith(f"{key}="):
|
||||
return line.split("=", 2)[1].split("#")[0].strip()
|
||||
|
101
bin/lib/ldap.py
Normal file
101
bin/lib/ldap.py
Normal file
@@ -0,0 +1,101 @@
|
||||
import ldap
|
||||
from passlib.hash import sha512_crypt
|
||||
from email_validator import validate_email, EmailNotValidError
|
||||
import subprocess
|
||||
|
||||
from .config import getDockersConfig, getSecretConfig
|
||||
|
||||
class Ldap:
|
||||
|
||||
def __init__(self):
|
||||
self.ldap_connection = None
|
||||
self.ldap_root = getDockersConfig("ldap_root")
|
||||
self.ldap_admin_username = getSecretConfig("ldapServ", "LDAP_ADMIN_USERNAME")
|
||||
self.ldap_admin_password = getSecretConfig("ldapServ", "LDAP_ADMIN_PASSWORD")
|
||||
cmd="docker inspect -f '{{.NetworkSettings.Networks.ldapNet.IPAddress}}' ldapServ"
|
||||
self.ldap_host = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT).strip().decode()
|
||||
|
||||
def __enter__(self):
|
||||
self.ldap_connection = ldap.initialize(f"ldap://{self.ldap_host}")
|
||||
self.ldap_connection.simple_bind_s("cn={},{}".format(self.ldap_admin_username, self.ldap_root), self.ldap_admin_password)
|
||||
return self
|
||||
|
||||
def __exit__(self, tp, e, traceback):
|
||||
self.ldap_connection.unbind_s()
|
||||
|
||||
|
||||
def get_email(self, email):
|
||||
"""
|
||||
Vérifier si un utilisateur avec cet email existe dans le LDAP soit comme mail principal soit comme alias
|
||||
"""
|
||||
# Créer une chaîne de filtre pour rechercher dans les champs "cn" et "mailAlias"
|
||||
filter_str = "(|(cn={})(mailAlias={}))".format(email, email)
|
||||
result = self.ldap_connection.search_s("ou=users,{}".format(self.ldap_root), ldap.SCOPE_SUBTREE, filter_str)
|
||||
return result
|
||||
|
||||
|
||||
def delete_user(self, email):
|
||||
"""
|
||||
Supprimer un utilisateur du LDAP par son adresse e-mail
|
||||
"""
|
||||
try:
|
||||
# Recherche de l'utilisateur
|
||||
result = self.ldap_connection.search_s("ou=users,{}".format(self.ldap_root), ldap.SCOPE_SUBTREE, "(cn={})".format(email))
|
||||
|
||||
if not result:
|
||||
return False # Utilisateur non trouvé
|
||||
|
||||
# Récupération du DN de l'utilisateur
|
||||
dn = result[0][0]
|
||||
|
||||
# Suppression de l'utilisateur
|
||||
self.ldap_connection.delete_s(dn)
|
||||
return True # Utilisateur supprimé avec succès
|
||||
|
||||
except ldap.NO_SUCH_OBJECT:
|
||||
return False # Utilisateur non trouvé
|
||||
except ldap.LDAPError as e:
|
||||
return False # Erreur lors de la suppression
|
||||
|
||||
|
||||
|
||||
def create_user(self, email, prenom, nom, password, email_secours, quota):
|
||||
"""
|
||||
Créer une nouvelle entrée dans le LDAP pour un nouvel utilisateur. QUESTION: A QUOI SERVENT PRENOM/NOM/IDENT_KAZ DANS LE LDAP ? POURQUOI 3 QUOTA ?
|
||||
"""
|
||||
password_chiffre = sha512_crypt.hash(password)
|
||||
|
||||
if not validate_email(email) or not validate_email(email_secours):
|
||||
return False
|
||||
|
||||
if self.get_email(email):
|
||||
return False
|
||||
|
||||
# Construire le DN
|
||||
dn = f"cn={email},ou=users,{self.ldap_root}"
|
||||
|
||||
mod_attrs = [
|
||||
('objectClass', [b'inetOrgPerson', b'PostfixBookMailAccount', b'nextcloudAccount', b'kaznaute']),
|
||||
('sn', f'{prenom} {nom}'.encode('utf-8')),
|
||||
('mail', email.encode('utf-8')),
|
||||
('mailEnabled', b'TRUE'),
|
||||
('mailGidNumber', b'5000'),
|
||||
('mailHomeDirectory', f"/var/mail/{email.split('@')[1]}/{email.split('@')[0]}/".encode('utf-8')),
|
||||
('mailQuota', f'{quota}G'.encode('utf-8')),
|
||||
('mailStorageDirectory', f"maildir:/var/mail/{email.split('@')[1]}/{email.split('@')[0]}/".encode('utf-8')),
|
||||
('mailUidNumber', b'5000'),
|
||||
('mailDeSecours', email_secours.encode('utf-8')),
|
||||
('identifiantKaz', f'{prenom.lower()}.{nom.lower()}'.encode('utf-8')),
|
||||
('quota', str(quota).encode('utf-8')),
|
||||
('nextcloudEnabled', b'TRUE'),
|
||||
('nextcloudQuota', f'{quota} GB'.encode('utf-8')),
|
||||
('mobilizonEnabled', b'TRUE'),
|
||||
('agoraEnabled', b'TRUE'),
|
||||
('userPassword', f'{{CRYPT}}{password_chiffre}'.encode('utf-8')),
|
||||
('cn', email.encode('utf-8'))
|
||||
]
|
||||
|
||||
self.ldap_connection.add_s(dn, mod_attrs)
|
||||
return True
|
||||
|
||||
|
134
bin/lib/mattermost.py
Normal file
134
bin/lib/mattermost.py
Normal file
@@ -0,0 +1,134 @@
|
||||
import subprocess
|
||||
|
||||
from .config import getDockersConfig, getSecretConfig
|
||||
|
||||
mattermost_user = getSecretConfig("mattermostServ", "MM_ADMIN_USER")
|
||||
mattermost_pass = getSecretConfig("mattermostServ", "MM_ADMIN_PASSWORD")
|
||||
mattermost_url = f"https://{getDockersConfig('matterHost')}.{getDockersConfig('domain')}"
|
||||
mmctl = "docker exec -i mattermostServ bin/mmctl"
|
||||
|
||||
class Mattermost:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def __enter__(self):
|
||||
self.authenticate()
|
||||
return self
|
||||
|
||||
def __exit__(self, tp, e, traceback):
|
||||
self.logout()
|
||||
|
||||
|
||||
def authenticate(self):
|
||||
# Authentification sur MM
|
||||
cmd = f"{mmctl} auth login {mattermost_url} --name local-server --username {mattermost_user} --password {mattermost_pass}"
|
||||
subprocess.run(cmd, shell=True, stderr=subprocess.STDOUT, check=True)
|
||||
|
||||
|
||||
def logout(self):
|
||||
# Authentification sur MM
|
||||
cmd = f"{mmctl} auth clean"
|
||||
subprocess.run(cmd, shell=True, stderr=subprocess.STDOUT, check=True)
|
||||
|
||||
def post_message(self, message, equipe="kaz", canal="creation-comptes"):
|
||||
"""
|
||||
Envoyer un message dans une Equipe/Canal de MM
|
||||
"""
|
||||
cmd = f"{mmctl} post create {equipe}:{canal} --message \"{message}\""
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
return output.decode()
|
||||
|
||||
|
||||
def get_user(self, user):
|
||||
"""
|
||||
Le user existe t-il sur MM ?
|
||||
"""
|
||||
try:
|
||||
cmd = f"{mmctl} user search {user} --json"
|
||||
user_list_output = subprocess.check_output(cmd, shell=True)
|
||||
return True # Le nom d'utilisateur existe
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
|
||||
|
||||
def create_user(self, user, email, password):
|
||||
"""
|
||||
Créer un utilisateur sur MM
|
||||
"""
|
||||
cmd = f"{mmctl} user create --email {email} --username {user} --password {password}"
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
return output.decode()
|
||||
|
||||
|
||||
def delete_user(self, email):
|
||||
"""
|
||||
Supprimer un utilisateur sur MM
|
||||
"""
|
||||
cmd = f"{mmctl} user delete {email} --confirm"
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
return output.decode()
|
||||
|
||||
|
||||
def update_password(self, email, new_password):
|
||||
"""
|
||||
Changer un password pour un utilisateur de MM
|
||||
"""
|
||||
cmd = f"{mmctl} user change-password {email} --password {new_password}"
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
return output.decode()
|
||||
|
||||
|
||||
def add_user_to_team(self, email, equipe):
|
||||
"""
|
||||
Affecte un utilisateur à une équipe MM
|
||||
"""
|
||||
cmd = f"{mmctl} team users add {equipe} {email}"
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
return output.decode()
|
||||
|
||||
|
||||
def add_user_to_channel(self, email, equipe, canal):
|
||||
"""
|
||||
Affecte un utilisateur à un canal MM
|
||||
"""
|
||||
cmd = f'{mmctl} channel users add {equipe}:{canal} {email}'
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
return output.decode()
|
||||
|
||||
|
||||
def get_teams(self):
|
||||
"""
|
||||
Lister les équipes sur MM
|
||||
"""
|
||||
cmd = f"{mmctl} team list --disable-pager"
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
data_list = output.decode("utf-8").strip().split('\n')
|
||||
data_list.pop()
|
||||
return data_list
|
||||
|
||||
|
||||
def create_team(self, equipe, email):
|
||||
"""
|
||||
Créer une équipe sur MM et affecter un admin si email est renseigné (set admin marche pô)
|
||||
"""
|
||||
|
||||
#DANGER: l'option --email ne rend pas le user admin de l'équipe comme c'est indiqué dans la doc :(
|
||||
cmd = f"{mmctl} team create --name {equipe} --display-name {equipe} --private --email {email}"
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
|
||||
#Workaround: on récup l'id du user et de l'équipe pour affecter le rôle "scheme_admin": true, "scheme_user": true avec l'api MM classique.
|
||||
#TODO:
|
||||
|
||||
return output.decode()
|
||||
|
||||
|
||||
def delete_team(self, equipe):
|
||||
"""
|
||||
Supprimer une équipe sur MM
|
||||
"""
|
||||
|
||||
cmd = f"{mmctl} team delete {equipe} --confirm"
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
return output.decode()
|
||||
|
134
bin/lib/paheko.py
Normal file
134
bin/lib/paheko.py
Normal file
@@ -0,0 +1,134 @@
|
||||
import re
|
||||
import requests
|
||||
|
||||
from .config import getDockersConfig, getSecretConfig
|
||||
|
||||
paheko_ident = getDockersConfig("paheko_API_USER")
|
||||
paheko_pass = getDockersConfig("paheko_API_PASSWORD")
|
||||
paheko_auth = (paheko_ident, paheko_pass)
|
||||
paheko_url = f"https://kaz-paheko.{getDockersConfig('domain')}"
|
||||
|
||||
class Paheko:
|
||||
def get_categories(self):
|
||||
"""
|
||||
Récupérer les catégories Paheko avec le compteur associé
|
||||
"""
|
||||
api_url = paheko_url + '/api/user/categories'
|
||||
|
||||
response = requests.get(api_url, auth=paheko_auth)
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
return data
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def get_users_in_categorie(self,categorie):
|
||||
"""
|
||||
Afficher les membres d'une catégorie Paheko
|
||||
"""
|
||||
if not categorie.isdigit():
|
||||
return 'Id de category non valide', 400
|
||||
|
||||
api_url = paheko_url + '/api/user/category/'+categorie+'.json'
|
||||
|
||||
response = requests.get(api_url, auth=paheko_auth)
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
return data
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def get_user(self,ident):
|
||||
"""
|
||||
Afficher un membre de Paheko par son email kaz ou son numéro ou le non court de l'orga
|
||||
"""
|
||||
|
||||
emailmatchregexp = re.compile(r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$")
|
||||
|
||||
if emailmatchregexp.match(ident):
|
||||
data = { "sql": f"select * from users where email='{ident}' or alias = '{ident}'" }
|
||||
api_url = paheko_url + '/api/sql/'
|
||||
response = requests.post(api_url, auth=paheko_auth, data=data)
|
||||
#TODO: if faut Rechercher count et vérifier que = 1 et supprimer le count=1 dans la réponse
|
||||
elif ident.isdigit():
|
||||
api_url = paheko_url + '/api/user/'+ident
|
||||
response = requests.get(api_url, auth=paheko_auth)
|
||||
else:
|
||||
nomorga = re.sub(r'\W+', '', ident) # on vire les caractères non alphanumérique
|
||||
data = { "sql": f"select * from users where admin_orga=1 and nom_orga='{nomorga}'" }
|
||||
api_url = paheko_url + '/api/sql/'
|
||||
response = requests.post(api_url, auth=paheko_auth, data=data)
|
||||
#TODO:if faut Rechercher count et vérifier que = 1 et supprimer le count=1 dans la réponse
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
if data["count"] == 1:
|
||||
return data["results"][0]
|
||||
elif data["count"] == 0:
|
||||
return None
|
||||
else:
|
||||
return data["results"]
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def set_user(self,ident,field,new_value):
|
||||
"""
|
||||
Modifie la valeur d'un champ d'un membre paheko (ident= numéro paheko ou email kaz)
|
||||
"""
|
||||
|
||||
#récupérer le numero paheko si on fournit un email kaz
|
||||
emailmatchregexp = re.compile(r"^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$")
|
||||
if emailmatchregexp.match(ident):
|
||||
data = { "sql": f"select id from users where email='{ident}'" }
|
||||
api_url = paheko_url + '/api/sql/'
|
||||
response = requests.post(api_url, auth=paheko_auth, data=data)
|
||||
if response.status_code == 200:
|
||||
#on extrait l'id de la réponse
|
||||
data = response.json()
|
||||
if data['count'] == 0:
|
||||
print("email non trouvé")
|
||||
return None
|
||||
elif data['count'] > 1:
|
||||
print("trop de résultat")
|
||||
return None
|
||||
else:
|
||||
#OK
|
||||
ident = data['results'][0]['id']
|
||||
else:
|
||||
print("pas de résultat")
|
||||
return None
|
||||
elif not ident.isdigit():
|
||||
print("Identifiant utilisateur invalide")
|
||||
return None
|
||||
|
||||
regexp = re.compile("[^a-zA-Z0-9 \\r\\n\\t" + re.escape(string.punctuation) + "]")
|
||||
valeur = regexp.sub('',new_value) # mouais, il faudrait être beaucoup plus précis ici en fonction des champs qu'on accepte...
|
||||
|
||||
champ = re.sub(r'\W+','',field) # pas de caractères non alphanumériques ici, dans l'idéal, c'est à choisir dans une liste plutot
|
||||
|
||||
api_url = paheko_url + '/api/user/'+str(ident)
|
||||
payload = {champ: valeur}
|
||||
response = requests.post(api_url, auth=paheko_auth, data=payload)
|
||||
return response.json()
|
||||
|
||||
|
||||
def get_users_with_action(self, action):
|
||||
"""
|
||||
retourne tous les membres de paheko avec une action à mener (création du compte kaz / modification...)
|
||||
"""
|
||||
|
||||
api_url = paheko_url + '/api/sql/'
|
||||
payload = { "sql": f"select * from users where action_auto='{action}'" }
|
||||
response = requests.post(api_url, auth=paheko_auth, data=payload)
|
||||
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
else:
|
||||
return None
|
||||
|
||||
|
40
bin/lib/sympa.py
Normal file
40
bin/lib/sympa.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import subprocess
|
||||
from email_validator import validate_email, EmailNotValidError
|
||||
|
||||
from .config import getDockersConfig, getSecretConfig
|
||||
|
||||
sympa_user = getSecretConfig("sympaServ", "SOAP_USER")
|
||||
sympa_pass = getSecretConfig("sympaServ", "SOAP_PASSWORD")
|
||||
sympa_listmaster = getSecretConfig("sympaServ", "ADMINEMAIL")
|
||||
sympa_url = f"https://{getDockersConfig('sympaHost')}.{getDockersConfig('domain')}"
|
||||
sympa_soap = "docker exec -i sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl"
|
||||
sympa_domain = getDockersConfig('domain_sympa')
|
||||
sympa_liste_info = "infos"
|
||||
|
||||
|
||||
# docker exec -i sympaServ /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=${httpProto}://${URL_LISTE}/sympasoap --trusted_application=${sympa_SOAP_USER} --trusted_application_password=${sympa_SOAP_PASSWORD} --proxy_vars=\"USER_EMAIL=${LISTMASTER}\" --service=add --service_parameters=\"${NL_LIST},${EMAIL_SOUHAITE}\"" | tee -a "${CMD_SYMPA}"
|
||||
|
||||
class Sympa:
|
||||
|
||||
def _execute_sympa_command(self, email, liste, service):
|
||||
if validate_email(email) and validate_email(liste):
|
||||
cmd = f'{sympa_soap} --soap_url={sympa_url}/sympasoap --trusted_application={sympa_user} --trusted_application_password={sympa_pass} --proxy_vars=USER_EMAIL={sympa_listmaster} --service={service} --service_parameters="{liste},{email}" && echo $?'
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
return output.decode()
|
||||
|
||||
def add_email_to_list(self, email, liste=sympa_liste_info):
|
||||
"""
|
||||
Ajouter un email dans une liste sympa
|
||||
"""
|
||||
output = self._execute_sympa_command(email, f"{liste}@{sympa_domain}", 'add')
|
||||
return output
|
||||
|
||||
def delete_email_from_list(self, email, liste=sympa_liste_info):
|
||||
"""
|
||||
Supprimer un email dans une liste sympa
|
||||
"""
|
||||
output = self._execute_sympa_command(email, f"{liste}@{sympa_domain}", 'del')
|
||||
return output
|
||||
|
||||
|
||||
|
8
bin/lib/template.py
Normal file
8
bin/lib/template.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import jinja2
|
||||
|
||||
templateLoader = jinja2.FileSystemLoader(searchpath="../templates")
|
||||
templateEnv = jinja2.Environment(loader=templateLoader)
|
||||
|
||||
def render_template(filename, args):
|
||||
template = templateEnv.get_template(filename)
|
||||
return template.render(args)
|
213
bin/lib/user.py
Normal file
213
bin/lib/user.py
Normal file
@@ -0,0 +1,213 @@
|
||||
from email_validator import validate_email, EmailNotValidError
|
||||
from glob import glob
|
||||
import tempfile
|
||||
import subprocess
|
||||
import re
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
import smtplib
|
||||
|
||||
from .paheko import Paheko
|
||||
from .ldap import Ldap
|
||||
from .mattermost import Mattermost
|
||||
from .sympa import Sympa
|
||||
from .template import render_template
|
||||
from .config import getDockersConfig, getSecretConfig
|
||||
|
||||
DEFAULT_FILE = "/kaz/tmp/createUser.txt"
|
||||
|
||||
webmail_url = f"https://webmail.{getDockersConfig('domain')}"
|
||||
mattermost_url = f"https://agora.{getDockersConfig('domain')}"
|
||||
mdp_url = f"https://mdp.{getDockersConfig('domain')}"
|
||||
sympa_url = f"https://listes.{getDockersConfig('domain')}"
|
||||
site_url = f"https://{getDockersConfig('domain')}"
|
||||
cloud_url = f"https://cloud.{getDockersConfig('domain')}"
|
||||
|
||||
|
||||
def _generate_password(self):
|
||||
cmd="apg -n 1 -m 10 -M NCL -d"
|
||||
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
new_password="_"+output.decode("utf-8")+"_"
|
||||
return new_password
|
||||
|
||||
|
||||
def create_user(email, email_secours, admin_orga, nom_orga, quota_disque, nom, prenom, nc_orga, garradin_orga, wp_orga, agora_orga, wiki_orga, nc_base, groupe_nc_base, equipe_agora, password=None):
|
||||
email = email.lower()
|
||||
|
||||
with Ldap() as ldap:
|
||||
# est-il déjà dans le ldap ? (mail ou alias)
|
||||
if ldap.get_email(email):
|
||||
print(f"ERREUR 1: {email} déjà existant dans ldap. on arrête tout")
|
||||
return None
|
||||
|
||||
#test nom orga
|
||||
if admin_orga == 1:
|
||||
if nom_orga is None:
|
||||
print(f"ERREUR 0 sur paheko: {email} : nom_orga vide, on arrête tout")
|
||||
return
|
||||
if not bool(re.match(r'^[a-z0-9-]+$', nom_orga)):
|
||||
print(f"ERREUR 0 sur paheko: {email} : nom_orga ({tab['nom_orga']}) incohérent (minuscule/chiffre/-), on arrête tout")
|
||||
return
|
||||
|
||||
#test email_secours
|
||||
email_secours = email_secours.lower()
|
||||
if not validate_email(email_secours):
|
||||
print("Mauvais email de secours")
|
||||
return
|
||||
|
||||
#test quota
|
||||
quota = quota_disque
|
||||
if not quota.isdigit():
|
||||
print(f"ERREUR 2: quota non numérique : {quota}, on arrête tout")
|
||||
return
|
||||
|
||||
#on génère un password
|
||||
password = password or _generate_password()
|
||||
|
||||
#on créé dans le ldap
|
||||
#à quoi servent prenom/nom dans le ldap ?
|
||||
data = {
|
||||
"prenom": prenom,
|
||||
"nom": nom,
|
||||
"password": password,
|
||||
"email_secours": email_secours,
|
||||
"quota": quota
|
||||
}
|
||||
if not ldap.create_user(email, **data):
|
||||
print("Erreur LDAP")
|
||||
return
|
||||
|
||||
with Mattermost() as mm:
|
||||
#on créé dans MM
|
||||
user = email.split('@')[0]
|
||||
mm.create_user(user, email, password)
|
||||
mm.add_user_to_team(email, "kaz")
|
||||
|
||||
#et aux 2 canaux de base
|
||||
mm.add_user_to_channel(email, "kaz", "une-question--un-soucis")
|
||||
mm.add_user_to_channel(email, "kaz", "cafe-du-commerce--ouvert-2424h")
|
||||
|
||||
#on créé une nouvelle équipe ds MM si besoin
|
||||
if admin_orga == 1:
|
||||
mm.create_team(nom_orga, email)
|
||||
#BUG: créer la nouvelle équipe n'a pas rendu l'email admin, on le rajoute comme membre simple
|
||||
mm.add_user_to_team(email, nom_orga)
|
||||
|
||||
|
||||
#on inscrit email et email_secours à la nl sympa_liste_info
|
||||
sympa = Sympa()
|
||||
sympa.add_email_to_list(email)
|
||||
sympa.add_email_to_list(email_secours)
|
||||
|
||||
#on construit/envoie le mail
|
||||
context = {
|
||||
'ADMIN_ORGA': admin_orga,
|
||||
'NOM': f"{prenom} {nom}",
|
||||
'EMAIL_SOUHAITE': email,
|
||||
'PASSWORD': password,
|
||||
'QUOTA': quota_disque,
|
||||
'URL_WEBMAIL': webmail_url,
|
||||
'URL_AGORA': mattermost_url,
|
||||
'URL_MDP': mdp_url,
|
||||
'URL_LISTE': sympa_url,
|
||||
'URL_SITE': site_url,
|
||||
'URL_CLOUD': cloud_url,
|
||||
}
|
||||
|
||||
html = render_template("email_inscription.html", context)
|
||||
raw = render_template("email_inscription.txt", context)
|
||||
|
||||
message = MIMEMultipart()
|
||||
message["Subject"] = "KAZ: confirmation d'inscription !"
|
||||
message["From"] = f"contact@{getDockersConfig('domain')}"
|
||||
message["To"] = f"{email}, {email_secours}"
|
||||
message.attach(MIMEText(raw, "plain"))
|
||||
message.attach(MIMEText(html, "html"))
|
||||
|
||||
with smtplib.SMTP(f"mail.{getDockersConfig('domain')}", 25) as server:
|
||||
server.sendmail(f"contact@{getDockersConfig('domain')}", [email,email_secours], message.as_string())
|
||||
|
||||
#on met le flag paheko action à Aucune
|
||||
paheko = Paheko()
|
||||
try:
|
||||
paheko.set_user(email, "action_auto", "Aucune")
|
||||
except:
|
||||
print(f"Erreur paheko pour remettre action_auto = Aucune pour {email}")
|
||||
|
||||
#on post sur MM pour dire ok
|
||||
with Mattermost() as mm:
|
||||
msg=f"**POST AUTO** Inscription réussie pour {email} avec le secours {email_secours} Bisou!"
|
||||
mm.post_message(message=msg)
|
||||
|
||||
|
||||
def create_waiting_users():
|
||||
"""
|
||||
Créé les kaznautes en attente: inscription sur MM / Cloud / email + msg sur MM + email à partir de action="a créer" sur paheko
|
||||
"""
|
||||
#verrou pour empêcher de lancer en même temps la même api
|
||||
prefixe="create_user_lock_"
|
||||
if glob(f"{tempfile.gettempdir()}/{prefixe}*"):
|
||||
print("Lock présent")
|
||||
return None
|
||||
lock_file = tempfile.NamedTemporaryFile(prefix=prefixe,delete=True)
|
||||
|
||||
#qui sont les kaznautes à créer ?
|
||||
paheko = Paheko()
|
||||
liste_kaznautes = paheko.get_users_with_action("A créer")
|
||||
|
||||
if liste_kaznautes:
|
||||
count=liste_kaznautes['count']
|
||||
if count==0:
|
||||
print("aucun nouveau kaznaute à créer")
|
||||
return
|
||||
|
||||
#au moins un kaznaute à créer
|
||||
for tab in liste_kaznautes['results']:
|
||||
create_user(**tab)
|
||||
|
||||
print("fin des inscriptions")
|
||||
|
||||
|
||||
def create_users_from_file(file=DEFAULT_FILE):
|
||||
"""
|
||||
Créé les kaznautes en attente: inscription sur MM / Cloud / email + msg sur MM + email à partir du ficher
|
||||
"""
|
||||
#verrou pour empêcher de lancer en même temps la même api
|
||||
prefixe="create_user_lock_"
|
||||
if glob(f"{tempfile.gettempdir()}/{prefixe}*"):
|
||||
print("Lock présent")
|
||||
return None
|
||||
lock_file = tempfile.NamedTemporaryFile(prefix=prefixe,delete=True)
|
||||
|
||||
#qui sont les kaznautes à créer ?
|
||||
liste_kaznautes = []
|
||||
with open(file) as lines:
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
if not line.startswith("#") and line != "":
|
||||
user_data = line.split(';')
|
||||
user_dict = {
|
||||
"nom": user_data[0],
|
||||
"prenom": user_data[1],
|
||||
"email": user_data[2],
|
||||
"email_secours": user_data[3],
|
||||
"nom_orga": user_data[4],
|
||||
"admin_orga": user_data[5],
|
||||
"nc_orga": user_data[6],
|
||||
"garradin_orga": user_data[7],
|
||||
"wp_orga": user_data[8],
|
||||
"agora_orga": user_data[9],
|
||||
"wiki_orga": user_data[10],
|
||||
"nc_base": user_data[11],
|
||||
"groupe_nc_base": user_data[12],
|
||||
"equipe_agora": user_data[13],
|
||||
"quota_disque": user_data[14],
|
||||
"password": user_data.get(15),
|
||||
}
|
||||
liste_kaznautes.append(user_dict)
|
||||
|
||||
if liste_kaznautes:
|
||||
for tab in liste_kaznautes:
|
||||
create_user(**tab)
|
||||
|
||||
print("fin des inscriptions")
|
@@ -83,7 +83,7 @@ Init(){
|
||||
|
||||
# creation compte admin
|
||||
_getPasswords
|
||||
${SIMU} curl -i -d "{\"email\":\"${mattermostServ_MM_ADMIN_EMAIL}\",\"username\":\"${mattermost_user}\",\"password\":\"${mattermost_pass}\",\"allow_marketing\":true}" "${MATTER_URL}/api/v4/users"
|
||||
${SIMU} curl -i -d "{\"email\":\"${MM_ADMIN_EMAIL}\",\"username\":\"${mattermost_user}\",\"password\":\"${mattermost_pass}\",\"allow_marketing\":true}" "${MATTER_URL}/api/v4/users"
|
||||
|
||||
MM_TOKEN=$(_getMMToken ${MATTER_URL})
|
||||
|
||||
@@ -118,10 +118,10 @@ _getPasswords(){
|
||||
# récupération des infos du compte admin
|
||||
if [ -n "$AGORACOMMUN" ] ; then
|
||||
. $KAZ_KEY_DIR/env-mattermostAdmin
|
||||
. $KAZ_BIN_DIR/getPasswords.sh mattermostServ
|
||||
. $KAZ_KEY_DIR/env-mattermostServ
|
||||
else
|
||||
. $KAZ_KEY_DIR/orgas/${ORGA}/env-mattermostAdmin
|
||||
. $KAZ_BIN_DIR/getPasswords.sh -d ${ORGA} mattermostServ
|
||||
. $KAZ_KEY_DIR/orgas/$ORGA/env-mattermostServ
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -143,14 +143,14 @@ setOfficeUrl(){
|
||||
}
|
||||
|
||||
initLdap(){
|
||||
. $KAZ_BIN_DIR/getPasswords.sh ldapServ
|
||||
. $KAZ_KEY_DIR/env-ldapServ
|
||||
# $1 Nom du cloud
|
||||
echo "${CYAN} *** Installation LDAP pour $1${NC}" >& $QUIET
|
||||
occCommand "app:enable user_ldap" "${DockerServName}"
|
||||
occCommand "ldap:delete-config s01" "${DockerServName}"
|
||||
occCommand "ldap:create-empty-config" "${DockerServName}"
|
||||
occCommand "ldap:set-config s01 ldapAgentName cn=cloud,ou=applications,${ldap_root}" "${DockerServName}"
|
||||
occCommand "ldap:set-config s01 ldapAgentPassword ${ldapServ_LDAP_CLOUD_PASSWORD}" "${DockerServName}"
|
||||
occCommand "ldap:set-config s01 ldapAgentPassword ${LDAP_CLOUD_PASSWORD}" "${DockerServName}"
|
||||
occCommand "ldap:set-config s01 ldapBase ${ldap_root}" "${DockerServName}"
|
||||
occCommand "ldap:set-config s01 ldapBaseGroups ${ldap_root}" "${DockerServName}"
|
||||
occCommand "ldap:set-config s01 ldapBaseUsers ou=users,${ldap_root}" "${DockerServName}"
|
||||
|
@@ -54,7 +54,11 @@ Init(){
|
||||
PLG_DIR="${VOL_PREFIX}wikiPlugins/_data"
|
||||
CONF_DIR="${VOL_PREFIX}wikiConf/_data"
|
||||
|
||||
. $KAZ_BIN_DIR/getPasswords.sh dokuwiki
|
||||
if [ -n "$WIKICOMMUN" ]; then
|
||||
. $KAZ_KEY_DIR/env-dokuwiki
|
||||
else
|
||||
. $KAZ_KEY_DIR/orgas/$ORGA/env-dokuwiki
|
||||
fi
|
||||
|
||||
${SIMU} checkDockerRunning "${DockerServName}" "${NOM}" || exit
|
||||
|
||||
@@ -68,11 +72,11 @@ Init(){
|
||||
-d "l=fr" \
|
||||
-d "d[title]=${NOM}" \
|
||||
-d "d[acl]=true" \
|
||||
-d "d[superuser]=${dokuwiki_WIKI_ROOT}" \
|
||||
-d "d[superuser]=${WIKI_ROOT}" \
|
||||
-d "d[fullname]=Admin"\
|
||||
-d "d[email]=${dokuwiki_WIKI_EMAIL}" \
|
||||
-d "d[password]=${dokuwiki_WIKI_PASSWORD}" \
|
||||
-d "d[confirm]=${dokuwiki_WIKI_PASSWORD}" \
|
||||
-d "d[email]=${WIKI_EMAIL}" \
|
||||
-d "d[password]=${WIKI_PASSWORD}" \
|
||||
-d "d[confirm]=${WIKI_PASSWORD}" \
|
||||
-d "d[policy]=1" \
|
||||
-d "d[allowreg]=false" \
|
||||
-d "d[license]=0" \
|
||||
|
@@ -60,11 +60,18 @@ Init(){
|
||||
echo "\n *** Premier lancement de WP" >& $QUIET
|
||||
|
||||
${SIMU} waitUrl "${WP_URL}"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh wpServ
|
||||
|
||||
|
||||
if [ -n "$WIKICOMMUN" ]; then
|
||||
. $KAZ_KEY_DIR/env-wpServ
|
||||
else
|
||||
. $KAZ_KEY_DIR/orgas/$ORGA/env-wpServ
|
||||
fi
|
||||
|
||||
${SIMU} curl -X POST \
|
||||
-d "user_name=${wpServ_WORDPRESS_ADMIN_USER}" \
|
||||
-d "admin_password=${wpServ_WORDPRESS_ADMIN_PASSWORD}" \
|
||||
-d "admin_password2=${wpServ_WORDPRESS_ADMIN_PASSWORD}" \
|
||||
-d "user_name=${WORDPRESS_ADMIN_USER}" \
|
||||
-d "admin_password=${WORDPRESS_ADMIN_PASSWORD}" \
|
||||
-d "admin_password2=${WORDPRESS_ADMIN_PASSWORD}" \
|
||||
-d "pw_weak=true" \
|
||||
-d "admin_email=admin@kaz.bzh" \
|
||||
-d "blog_public=0" \
|
||||
|
@@ -17,9 +17,13 @@ KAZ_ROOT=$(cd "$(dirname $0)"/..; pwd)
|
||||
. $KAZ_ROOT/bin/.commonFunctions.sh
|
||||
setKazVars
|
||||
. $DOCKERS_ENV
|
||||
. $KAZ_BIN_DIR/getPasswords.sh borg
|
||||
|
||||
VERSION="V-10-03-2025"
|
||||
. ${KAZ_KEY_DIR}/env-borg
|
||||
# Si la variable SCRIPTBORG est renseignée avec un fichier on le source
|
||||
if [ ! -z ${SCRIPTBORG} ]
|
||||
then
|
||||
[ -f ${SCRIPTBORG} ] && . ${SCRIPTBORG}
|
||||
fi
|
||||
VERSION="V-07-08-2025"
|
||||
PRG=$(basename $0)
|
||||
RACINE=$(echo $PRG | awk '{print $1}')
|
||||
#IFS=' '
|
||||
|
@@ -114,11 +114,12 @@ crossVarComplete(){
|
||||
else
|
||||
echo "Remplissage $FILENAME" >& $SORTIESTANDARD
|
||||
|
||||
. $$DIR/env-$envname
|
||||
|
||||
varnames=$(grep -Eo '@@crossvar@@[^@]*@@cv@@' $FILENAME | sed -e 's/@@crossvar@@//' -e 's/@@cv@@//')
|
||||
for varname in $varnames; do
|
||||
envname=${varname%%_*}
|
||||
value=$(/$KAZ_BIN_DIR/getPasswords.sh -e $varname $envname -d $ORGA)
|
||||
$SIMU sed -i "s/@@crossvar@@$varname@@cv@@/${value}/" $DIR/*;
|
||||
$SIMU sed -i "s/@@crossvar@@$varname@@cv@@/${!varname}/" $DIR/*;
|
||||
|
||||
done
|
||||
|
||||
|
82
bin/templates/email.css
Normal file
82
bin/templates/email.css
Normal file
@@ -0,0 +1,82 @@
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.email-content {
|
||||
background-color: #f0f0f0; /* Light gray background */
|
||||
margin: 20px auto;
|
||||
padding: 20px;
|
||||
border: 1px solid #dddddd;
|
||||
max-width: 600px;
|
||||
width: 90%; /* This makes the content take 90% width of its container */
|
||||
text-align: left; /* Remove text justification */
|
||||
}
|
||||
|
||||
header {
|
||||
background-color: #E16969;
|
||||
color: white;
|
||||
text-align: center;
|
||||
height: 50px; /* Fixed height for header */
|
||||
line-height: 50px; /* Vertically center the text */
|
||||
width: 100%; /* Make header full width */
|
||||
}
|
||||
|
||||
footer {
|
||||
background-color: #E16969;
|
||||
color: white;
|
||||
text-align: center;
|
||||
height: 50px; /* Fixed height for footer */
|
||||
line-height: 50px; /* Vertically center the text */
|
||||
width: 100%; /* Make footer full width */
|
||||
}
|
||||
|
||||
.header-container {
|
||||
position: relative; /* Pour positionner le logo et le texte dans le header */
|
||||
height: 50px; /* Hauteur maximale du header */
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: absolute; /* Pour positionner le logo */
|
||||
max-height: 100%; /* Taille maximale du logo égale à la hauteur du header */
|
||||
top: 0; /* Aligner le logo en haut */
|
||||
left: 0; /* Aligner le logo à gauche */
|
||||
margin-right: 10px; /* Marge à droite du logo */
|
||||
}
|
||||
|
||||
.header-container h1, .footer-container p {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.footer-container p {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.footer-container a {
|
||||
color: #FFFFFF; /* White color for links in footer */
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.footer-container a:hover {
|
||||
text-decoration: underline; /* Optional: add underline on hover */
|
||||
}
|
||||
|
||||
a {
|
||||
color: #E16969; /* Same color as header/footer background for all other links */
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline; /* Optional: add underline on hover */
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #E16969;
|
||||
}
|
||||
|
||||
p {
|
||||
line-height: 1.6;
|
||||
}
|
9
bin/templates/email_footer.html
Normal file
9
bin/templates/email_footer.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<footer>
|
||||
<div class="footer-container">
|
||||
<p>
|
||||
Ici, on prend soin de vos données et on ne les vend pas !
|
||||
<br>
|
||||
<a href="https://kaz.bzh">https://kaz.bzh</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
6
bin/templates/email_header.html
Normal file
6
bin/templates/email_header.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<header>
|
||||
<div class="header-container">
|
||||
<img class="logo" src="https://kaz-cloud.kaz.bzh/apps/theming/image/logo?v=33" alt="KAZ Logo">
|
||||
<h1>Kaz : Le numérique sobre, libre, éthique et local</h1>
|
||||
</div>
|
||||
</header>
|
94
bin/templates/email_inscription.html
Normal file
94
bin/templates/email_inscription.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Email d'inscription'</title>
|
||||
<style>
|
||||
{% include 'email.css' %}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% include 'email_header.html' %}
|
||||
|
||||
<div class="email-content">
|
||||
|
||||
<p>
|
||||
Bonjour {{NOM}}!<br><br>
|
||||
|
||||
Bienvenue chez KAZ!<br><br>
|
||||
|
||||
Vous disposez de :
|
||||
<ul>
|
||||
<li>une messagerie classique : <a href={{URL_WEBMAIL}}>{{URL_WEBMAIL}}</a></li>
|
||||
<li>une messagerie instantanée pour discuter au sein d'équipes : <a href={{URL_AGORA}}>{{URL_AGORA}}</a></li>
|
||||
</ul>
|
||||
Votre email et identifiant pour ces services : {{EMAIL_SOUHAITE}}<br>
|
||||
Le mot de passe : <b>{{PASSWORD}}</b><br><br>
|
||||
|
||||
Pour changer votre mot de passe de messagerie, c'est ici: <a href={{URL_MDP}}>{{URL_MDP}}</a><br>
|
||||
Si vous avez perdu votre mot de passe, c'est ici: <a href={{URL_MDP}}/?action=sendtoken>{{URL_MDP}}/?action=sendtoken</a><br><br>
|
||||
|
||||
Vous pouvez accéder à votre messagerie classique:
|
||||
<ul>
|
||||
<li>soit depuis votre webmail : <a href={{URL_WEBMAIL}}>{{URL_WEBMAIL}}</a></li>
|
||||
<li>soit depuis votre bureau virtuel : <a href={{URL_CLOUD}}>{{URL_CLOUD}}</a></li>
|
||||
<li>soit depuis un client de messagerie comme thunderbird<br>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
{% if ADMIN_ORGA == '1' %}
|
||||
<p>
|
||||
En tant qu'association/famille/société. Vous avez la possibilité d'ouvrir, quand vous le voulez, des services kaz, il vous suffit de nous le demander.<br><br>
|
||||
|
||||
Pourquoi n'ouvrons-nous pas tous les services tout de suite ? parce que nous aimons la sobriété et que nous préservons notre espace disque ;)<br>
|
||||
A quoi sert d'avoir un site web si on ne l'utilise pas, n'est-ce pas ?<br><br>
|
||||
|
||||
Par retour de mail, dites-nous de quoi vous avez besoin tout de suite entre:
|
||||
<ul>
|
||||
<li>une comptabilité : un service de gestion adhérents/clients</li>
|
||||
<li>un site web de type WordPress</li>
|
||||
<li>un cloud : bureau virtuel pour stocker des fichiers/calendriers/contacts et partager avec vos connaissances</li>
|
||||
</ul>
|
||||
Une fois que vous aurez répondu à ce mail, votre demande sera traitée manuellement.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
Vous avez quelques docs intéressantes sur le wiki de kaz:
|
||||
<ul>
|
||||
<li>Migrer son site internet wordpress vers kaz : <a href="https://wiki.kaz.bzh/wordpress/start#migrer_son_site_wordpress_vers_kaz">https://wiki.kaz.bzh/wordpress/start#migrer_son_site_wordpress_vers_kaz</a></li>
|
||||
<li>Migrer sa messagerie vers kaz : <a href="https://wiki.kaz.bzh/messagerie/gmail/start">https://wiki.kaz.bzh/messagerie/gmail/start</a></li>
|
||||
<li>Démarrer simplement avec son cloud : <a href="https://wiki.kaz.bzh/nextcloud/start">https://wiki.kaz.bzh/messagerie/gmail/start</a></li>
|
||||
</ul>
|
||||
|
||||
Votre quota est de {{QUOTA}}GB. Si vous souhaitez plus de place pour vos fichiers ou la messagerie, faites-nous signe !<br><br>
|
||||
|
||||
Pour accéder à la messagerie instantanée et communiquer avec les membres de votre équipe ou ceux de kaz : <a href={{URL_AGORA}}/login>{{URL_AGORA}}/login</a><br>
|
||||
</p>
|
||||
|
||||
{% if ADMIN_ORGA == '1' %}
|
||||
<p>
|
||||
Comme administrateur de votre organisation, vous pouvez créer des listes de diffusion en vous rendant sur <a href={{URL_LISTE}}>{{URL_LISTE}}</a><br>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
Enfin, vous disposez de tous les autres services KAZ où l'authentification n'est pas nécessaire : <a href={{URL_SITE}}>{{URL_SITE}}</a><br><br>
|
||||
|
||||
En cas de soucis, n'hésitez pas à poser vos questions sur le canal 'Une question ? un soucis' de l'agora dispo ici : <a href={{URL_AGORA}}>{{URL_AGORA}}</a><br><br>
|
||||
|
||||
Si vous avez besoin d'accompagnement pour votre site, votre cloud, votre compta, votre migration de messagerie,...<br>nous proposons des formations mensuelles gratuites. Si vous souhaitez être accompagné par un professionnel, nous pouvons vous donner une liste de pros, référencés par KAZ.<br><br>
|
||||
|
||||
À bientôt 😉<br><br>
|
||||
|
||||
La collégiale de KAZ.<br>
|
||||
|
||||
</p>
|
||||
|
||||
</div> <!-- <div class="email-content"> -->
|
||||
|
||||
{% include 'email_footer.html' %}
|
||||
</body>
|
||||
</html>
|
70
bin/templates/email_inscription.txt
Normal file
70
bin/templates/email_inscription.txt
Normal file
@@ -0,0 +1,70 @@
|
||||
Bonjour {{NOM}}!
|
||||
|
||||
Bienvenue chez KAZ!<br><br>
|
||||
|
||||
Vous disposez de :
|
||||
<ul>
|
||||
<li>une messagerie classique : <a href={{URL_WEBMAIL}}>{{URL_WEBMAIL}}</a></li>
|
||||
<li>une messagerie instantanée pour discuter au sein d'équipes : <a href={{URL_AGORA}}>{{URL_AGORA}}</a></li>
|
||||
</ul>
|
||||
Votre email et identifiant pour ces services : {{EMAIL_SOUHAITE}}<br>
|
||||
Le mot de passe : <b>{{PASSWORD}}</b><br><br>
|
||||
|
||||
Pour changer votre mot de passe de messagerie, c'est ici: <a href={{URL_MDP}}>{{URL_MDP}}</a><br>
|
||||
Si vous avez perdu votre mot de passe, c'est ici: <a href={{URL_MDP}}/?action=sendtoken>{{URL_MDP}}/?action=sendtoken</a><br><br>
|
||||
|
||||
Vous pouvez accéder à votre messagerie classique:
|
||||
<ul>
|
||||
<li>soit depuis votre webmail : <a href={{URL_WEBMAIL}}>{{URL_WEBMAIL}}</a></li>
|
||||
<li>soit depuis votre bureau virtuel : <a href={{URL_CLOUD}}>{{URL_CLOUD}}</a></li>
|
||||
<li>soit depuis un client de messagerie comme thunderbird<br>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
{% if ADMIN_ORGA == '1' %}
|
||||
<p>
|
||||
En tant qu'association/famille/société. Vous avez la possibilité d'ouvrir, quand vous le voulez, des services kaz, il vous suffit de nous le demander.<br><br>
|
||||
|
||||
Pourquoi n'ouvrons-nous pas tous les services tout de suite ? parce que nous aimons la sobriété et que nous préservons notre espace disque ;)<br>
|
||||
A quoi sert d'avoir un site web si on ne l'utilise pas, n'est-ce pas ?<br><br>
|
||||
|
||||
Par retour de mail, dites-nous de quoi vous avez besoin tout de suite entre:
|
||||
<ul>
|
||||
<li>une comptabilité : un service de gestion adhérents/clients</li>
|
||||
<li>un site web de type WordPress</li>
|
||||
<li>un cloud : bureau virtuel pour stocker des fichiers/calendriers/contacts et partager avec vos connaissances</li>
|
||||
</ul>
|
||||
Une fois que vous aurez répondu à ce mail, votre demande sera traitée manuellement.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
Vous avez quelques docs intéressantes sur le wiki de kaz:
|
||||
<ul>
|
||||
<li>Migrer son site internet wordpress vers kaz : <a href="https://wiki.kaz.bzh/wordpress/start#migrer_son_site_wordpress_vers_kaz">https://wiki.kaz.bzh/wordpress/start#migrer_son_site_wordpress_vers_kaz</a></li>
|
||||
<li>Migrer sa messagerie vers kaz : <a href="https://wiki.kaz.bzh/messagerie/gmail/start">https://wiki.kaz.bzh/messagerie/gmail/start</a></li>
|
||||
<li>Démarrer simplement avec son cloud : <a href="https://wiki.kaz.bzh/nextcloud/start">https://wiki.kaz.bzh/messagerie/gmail/start</a></li>
|
||||
</ul>
|
||||
|
||||
Votre quota est de {{QUOTA}}GB. Si vous souhaitez plus de place pour vos fichiers ou la messagerie, faites-nous signe !<br><br>
|
||||
|
||||
Pour accéder à la messagerie instantanée et communiquer avec les membres de votre équipe ou ceux de kaz : <a href={{URL_AGORA}}/login>{{URL_AGORA}}/login</a><br>
|
||||
</p>
|
||||
|
||||
{% if ADMIN_ORGA == '1' %}
|
||||
<p>
|
||||
Comme administrateur de votre organisation, vous pouvez créer des listes de diffusion en vous rendant sur <a href={{URL_LISTE}}>{{URL_LISTE}}</a><br>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<p>
|
||||
Enfin, vous disposez de tous les autres services KAZ où l'authentification n'est pas nécessaire : <a href={{URL_SITE}}>{{URL_SITE}}</a><br><br>
|
||||
|
||||
En cas de soucis, n'hésitez pas à poser vos questions sur le canal 'Une question ? un soucis' de l'agora dispo ici : <a href={{URL_AGORA}}>{{URL_AGORA}}</a><br><br>
|
||||
|
||||
Si vous avez besoin d'accompagnement pour votre site, votre cloud, votre compta, votre migration de messagerie,...<br>nous proposons des formations mensuelles gratuites. Si vous souhaitez être accompagné par un professionnel, nous pouvons vous donner une liste de pros, référencés par KAZ.<br><br>
|
||||
|
||||
À bientôt 😉<br><br>
|
||||
|
||||
La collégiale de KAZ.<br>
|
||||
|
@@ -1,2 +1,2 @@
|
||||
proxy
|
||||
#traefik
|
||||
# proxy
|
||||
traefik
|
||||
|
@@ -4,7 +4,7 @@ dokuwiki
|
||||
paheko
|
||||
gitea
|
||||
jirafeau
|
||||
mattermost
|
||||
#mattermost
|
||||
roundcube
|
||||
mobilizon
|
||||
vaultwarden
|
||||
|
@@ -101,7 +101,7 @@ snappymailHost=snappymail
|
||||
########################################
|
||||
# ports internes
|
||||
|
||||
matterPort=8000
|
||||
matterPort=8065
|
||||
imapsyncPort=8080
|
||||
apikaz=5000
|
||||
|
||||
|
@@ -218,6 +218,7 @@ services:
|
||||
#}}
|
||||
#{{spip
|
||||
spip:
|
||||
container_name: ${orga}-${spipServName}
|
||||
image: ipeos/spip:4.4
|
||||
restart: ${restartPolicy}
|
||||
depends_on:
|
||||
|
@@ -197,6 +197,9 @@ for ARG in "$@"; do
|
||||
'-pod' | '-casto'* )
|
||||
castopod="off"
|
||||
;;
|
||||
'-spip' )
|
||||
spip="off"
|
||||
;;
|
||||
'+paheko' )
|
||||
paheko="on"
|
||||
;;
|
||||
@@ -413,7 +416,7 @@ if [[ -n "${STAGE_DEFAULT}${STAGE_CREATE}" ]]; then
|
||||
ln -sf ../../config/orgaTmpl/orga-rm.sh
|
||||
ln -sf ../../config/orgaTmpl/init-paheko.sh
|
||||
#ln -sf ../../config/orgaTmpl/initdb.d/
|
||||
ln -sf ../../config/orgaTmpl/app/
|
||||
#ln -sf ../../config/orgaTmpl/app/
|
||||
ln -sf ../../config/orgaTmpl/wiki-conf/
|
||||
ln -sf ../../config/orgaTmpl/reload.sh
|
||||
ln -sf ../../config/orgaTmpl/init-db.sh
|
||||
@@ -444,11 +447,6 @@ fi
|
||||
|
||||
if [[ -n "${STAGE_DEFAULT}${STAGE_CREATE}" ]]; then
|
||||
|
||||
|
||||
# ########## create network
|
||||
## GAEL bizarre, je pense que c'est déjà fait qque part, mais chez moi ça veut pas ...
|
||||
docker network create "${ORGA}-orgaNet"
|
||||
|
||||
# ########## create volume
|
||||
./init-volume.sh
|
||||
fi
|
||||
|
@@ -1,9 +1,5 @@
|
||||
|
||||
MM_ADMIN_EMAIL=@@globalvar@@matterHost@@gv@@@@@globalvar@@domain@@gv@@
|
||||
MM_ADMIN_USER=@@user@@mattermost2@@u@@
|
||||
MM_ADMIN_PASSWORD=@@pass@@mattermost2@@p@@
|
||||
|
||||
|
||||
MM_SQLSETTINGS_DRIVERNAME=postgres
|
||||
MM_SQLSETTINGS_DATASOURCE=postgres://@@user@@mattermost@@u@@:@@pass@@mattermost@@p@@@postgres:5432/@@db@@mattermost@@d@@?sslmode=disable&connect_timeout=10
|
||||
|
||||
|
10
config/orgaTmpl/wiki-conf/acl.auth.php
Normal file
10
config/orgaTmpl/wiki-conf/acl.auth.php
Normal file
@@ -0,0 +1,10 @@
|
||||
# acl.auth.php
|
||||
# <?php exit()?>
|
||||
# Don't modify the lines above
|
||||
#
|
||||
# Access Control Lists
|
||||
#
|
||||
# Auto-generated by install script
|
||||
# Date: Sat, 13 Feb 2021 17:42:28 +0000
|
||||
* @ALL 1
|
||||
* @user 8
|
26
config/orgaTmpl/wiki-conf/local.php
Normal file
26
config/orgaTmpl/wiki-conf/local.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*
|
||||
* Dokuwiki's Main Configuration File - Local Settings
|
||||
* Auto-generated by config plugin
|
||||
* Run for user: felix
|
||||
* Date: Sun, 28 Feb 2021 15:56:13 +0000
|
||||
*/
|
||||
|
||||
$conf['title'] = 'Kaz';
|
||||
$conf['template'] = 'docnavwiki';
|
||||
$conf['license'] = 'cc-by-sa';
|
||||
$conf['useacl'] = 1;
|
||||
$conf['superuser'] = '@admin';
|
||||
$conf['manager'] = '@manager';
|
||||
$conf['disableactions'] = 'register';
|
||||
$conf['remoteuser'] = '';
|
||||
$conf['mailfrom'] = 'dokuwiki@kaz.bzh';
|
||||
$conf['updatecheck'] = 0;
|
||||
$conf['userewrite'] = '1';
|
||||
$conf['useslash'] = 1;
|
||||
$conf['plugin']['ckgedit']['scayt_auto'] = 'on';
|
||||
$conf['plugin']['ckgedit']['scayt_lang'] = 'French/fr_FR';
|
||||
$conf['plugin']['ckgedit']['other_lang'] = 'fr';
|
||||
$conf['plugin']['smtp']['smtp_host'] = 'smtp.kaz.bzh';
|
||||
$conf['plugin']['todo']['CheckboxText'] = 0;
|
||||
$conf['plugin']['wrap']['restrictionType'] = '1';
|
13
config/orgaTmpl/wiki-conf/users.auth.php
Normal file
13
config/orgaTmpl/wiki-conf/users.auth.php
Normal file
@@ -0,0 +1,13 @@
|
||||
# users.auth.php
|
||||
# <?php exit()?>
|
||||
# Don't modify the lines above
|
||||
#
|
||||
# Userfile
|
||||
#
|
||||
# Auto-generated by install script
|
||||
# Date: Sat, 13 Feb 2021 17:42:28 +0000
|
||||
#
|
||||
# Format:
|
||||
# login:passwordhash:Real Name:email:groups,comma,separated
|
||||
|
||||
admin:$2y$10$GYvFgViXeEUmDViplHEs7eoYV8tmbfsS8wA1vfHQ.tWgW14o9aTjy:admin:contact@kaz.bzh:admin,user
|
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
|
||||
app:
|
||||
image: mattermost/mattermost-team-edition:10.9.1
|
||||
image: mattermost/mattermost-team-edition:10.11.1
|
||||
container_name: ${mattermostServName}
|
||||
restart: ${restartPolicy}
|
||||
volumes:
|
||||
@@ -39,12 +39,12 @@ services:
|
||||
- "traefik.http.routers.${mattermostServName}.rule=Host(`${matterHost}.${domain}`)"
|
||||
- "traefik.http.services.${mattermostServName}.loadbalancer.server.port=${matterPort}"
|
||||
- "traefik.docker.network=mattermostNet"
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://app:${matterPort}"]
|
||||
interval: 20s
|
||||
retries: 10
|
||||
start_period: 20s
|
||||
timeout: 10s
|
||||
# healthcheck:
|
||||
# test: ["CMD", "curl", "-f", "http://app:${matterPort}"]
|
||||
# interval: 20s
|
||||
# retries: 10
|
||||
# start_period: 20s
|
||||
# timeout: 10s
|
||||
|
||||
postgres:
|
||||
image: postgres:17-alpine
|
||||
|
@@ -10,3 +10,7 @@ cd $(dirname $0)
|
||||
"${KAZ_BIN_DIR}/gestContainers.sh" --install -M -agora
|
||||
|
||||
|
||||
docker exec ${mattermostServName} mmctl auth login https://${matterHost}.${domain} --name local-server --username ${mattermost_MM_ADMIN_USER} --password ${mattermost_MM_ADMIN_PASSWORD}
|
||||
docker exec ${mattermostServName} mmctl channel create --team kaz --name "une-question--un-soucis" --display-name "Une question ? Un souci ?"
|
||||
docker exec ${mattermostServName} mmctl channel create --team kaz --name "cafe-du-commerce--ouvert-2424h" --display-name "Café du commerce"
|
||||
docker exec ${mattermostServName} mmctl channel create --team kaz --name "creation-comptes" --display-name "Création comptes"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
|
||||
app:
|
||||
image: roundcube/roundcubemail:1.6.9-apache
|
||||
image: roundcube/roundcubemail
|
||||
container_name: ${roundcubeServName}
|
||||
restart: ${restartPolicy}
|
||||
depends_on:
|
||||
|
@@ -14,3 +14,6 @@ checkDockerRunning "${DockerServName}" "Sympa" || exit
|
||||
printKazMsg "\n *** Premier lancement de Sympa"
|
||||
|
||||
# docker exec "${DockerServName}" bash -c "DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends sympa || echo ok"
|
||||
|
||||
# Création de liste ne fonctionne pas...
|
||||
# /usr/lib/sympa/bin/sympa_soap_client.pl --soap_url=https://listes.kaz.sns/sympasoap --trusted_application=sympa --trusted_application_password=xxxx --proxy_vars=USER_EMAIL=listmaster@listes.kaz.sns --service=createList --service_parameters='taoto,Test,discussion_list,Test,test'
|
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
reverse-proxy:
|
||||
image: traefik:v3.4.1
|
||||
image: traefik:v3.5.1
|
||||
container_name: ${traefikServName}
|
||||
restart: ${restartPolicy}
|
||||
# Enables the web UI and tells Traefik to listen to docker
|
||||
@@ -23,6 +23,7 @@ services:
|
||||
- TRAEFIK_ENTRYPOINTS_websecure_HTTP_TLS_CERTRESOLVER=letsencrypt
|
||||
- TRAEFIK_ENTRYPOINTS_websecure_HTTP_MIDDLEWARES=hsts@file,test-ipallowlist@file
|
||||
- TRAEFIK_ENTRYPOINTS_websecure_TRANSPORT_RESPONDINGTIMEOUTS_READTIMEOUT=600
|
||||
- TRAEFIK_ENTRYPOINTS_websecure_TRANSPORT_RESPONDINGTIMEOUTS_IDLETIMEOUT=600
|
||||
- TRAEFIK_CERTIFICATESRESOLVERS_letsencrypt_ACME_EMAIL=admin@${domain}
|
||||
- TRAEFIK_CERTIFICATESRESOLVERS_letsencrypt_ACME_CASERVER=${acme_server}
|
||||
- TRAEFIK_CERTIFICATESRESOLVERS_letsencrypt_ACME_STORAGE=/letsencrypt/acme.json
|
||||
|
@@ -4,7 +4,7 @@ KAZ_ROOT=$(cd "$(dirname $0)/../.."; pwd)
|
||||
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
|
||||
setKazVars
|
||||
. "${DOCKERS_ENV}"
|
||||
. $KAZ_BIN_DIR/getPasswords.sh traefik
|
||||
. $KAZ_KEY_DIR/env-traefik
|
||||
|
||||
printKazMsg "\n *** Proxy update config"
|
||||
|
||||
@@ -16,5 +16,5 @@ PASSFILE=conf/passfile
|
||||
cd $(dirname $0)
|
||||
|
||||
[[ -f "${DOCKER_TMPL}" ]] || cp "${DOCKER_DIST}" "${DOCKER_TMPL}"
|
||||
[[ -f "${PASSFILE}" ]] || printf "${traefik_DASHBOARD_USER}:$( echo ${traefik_DASHBOARD_PASSWORD} | openssl passwd -apr1 -stdin)\n" >> ${PASSFILE}
|
||||
[[ -f "${PASSFILE}" ]] || printf "${DASHBOARD_USER}:$( echo ${DASHBOARD_PASSWORD} | openssl passwd -apr1 -stdin)\n" >> ${PASSFILE}
|
||||
"${APPLY_TMPL}" -time "${DOCKER_TMPL}" "${DOCKER_CONF}"
|
||||
|
@@ -1,66 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Attention à cause des scripts pas de ["'/] dans les mot de passe
|
||||
|
||||
|
||||
# A COPIER DANS UN FICHIER DE CONF !! -> mattermostAdmin
|
||||
# pour envoyer des messages sur l'agora avec mmctl
|
||||
mattermost_user="admin-mattermost"
|
||||
mattermost_pass="--clean_val--"
|
||||
mattermost_token="xxx-private"
|
||||
|
||||
|
||||
##################
|
||||
# A DEPLACER DANS DOCKER ENV
|
||||
#qui envoi le mail d'inscription ?
|
||||
EMAIL_CONTACT="toto@kaz.bzh"
|
||||
|
||||
|
||||
# A COPIER DANS UN FICHIER DE CONF !! -> paheko
|
||||
##################
|
||||
# Paheko
|
||||
paheko_API_USER="admin-api"
|
||||
paheko_API_PASSWORD="--clean_val--"
|
||||
|
||||
|
||||
|
||||
# A virer dans koffre
|
||||
##################
|
||||
#Compte sur outlook.com
|
||||
outlook_user="kaz-user@outlook.fr"
|
||||
outlook_pass="--clean_val--"
|
||||
|
||||
|
||||
# A COPIER DANS UN FICHIER DE CONF !! -> mail
|
||||
service_mail=admin-kaz@kaz.bzh
|
||||
service_password="--clean_val--"
|
||||
|
||||
##################
|
||||
#Borg
|
||||
|
||||
# A COPIER DANS UN FICHIER DE CONF !! -> borg
|
||||
BORG_REPO="/mnt/backup-nas1/BorgRepo"
|
||||
BORG_PASSPHRASE="--clean_val--"
|
||||
VOLUME_SAUVEGARDES="/mnt/backup-nas1"
|
||||
MAIL_RAPPORT="a@${domain};b@${domain};c@${domain}"
|
||||
BORGMOUNT="/mnt/disk-nas1/tmp/repo_mount"
|
||||
|
||||
|
||||
#####################
|
||||
#Traefik
|
||||
|
||||
# A COPIER DANS UN FICHIER DE CONF !! -> traefik
|
||||
traefik_DASHBOARD_USER="admin"
|
||||
traefik_DASHBOARD_PASSWORD="--clean_val--"
|
||||
|
||||
|
||||
|
||||
#####################
|
||||
# Castopod
|
||||
# A COPIER DANS UN FICHIER DE CONF !! castopodAdmin
|
||||
|
||||
castopod_ADMIN_USER=adminKaz
|
||||
castopod_ADMIN_MAIL=admin@${domain}
|
||||
castopod_ADMIN_PASSWORD="--clean_val--"
|
||||
|
||||
|
@@ -1,17 +1,17 @@
|
||||
VOLUME_SAUVEGARDES=
|
||||
BORG_REPO=
|
||||
BORG_PASSPHRASE=@@token@@borg@@t@@
|
||||
BORGLOG="/var/log/borg"
|
||||
BORG_FIC_DEL="/tmp/sauvegarde_supp.txt"
|
||||
BORG_EXCLUDE_BACKUP=
|
||||
MAIL_RAPPORT=a@@@globalvar@@domain@@gv@@;b@@@globalvar@@domain@@gv@@;c@@@globalvar@@domain@@gv@@
|
||||
LISTREPSAUV=
|
||||
BORGMOUNT="/mnt/repo_borg"
|
||||
MAILOK=
|
||||
MAILWARNING=
|
||||
MAILDETAIL=
|
||||
BACKUPS_KEEP="4m"
|
||||
NB_BACKUPS_JOUR=90
|
||||
NB_BACKUPS_SEM=30
|
||||
NB_BACKUPS_MOIS=12
|
||||
BORGSCRIPTS=/root/borgscripts
|
||||
borg_VOLUME_SAUVEGARDES=
|
||||
borg_BORG_REPO=
|
||||
borg_BORG_PASSPHRASE=@@token@@borg@@t@@
|
||||
borg_BORGLOG="/var/log/borg"
|
||||
borg_BORG_FIC_DEL="/tmp/sauvegarde_supp.txt"
|
||||
borg_BORG_EXCLUDE_BACKUP=
|
||||
borg_MAIL_RAPPORT=a@@@globalvar@@domain@@gv@@;b@@@globalvar@@domain@@gv@@;c@@@globalvar@@domain@@gv@@
|
||||
borg_LISTREPSAUV=
|
||||
borg_BORGMOUNT="/mnt/repo_borg"
|
||||
borg_MAILOK=
|
||||
borg_MAILWARNING=
|
||||
borg_MAILDETAIL=
|
||||
borg_BACKUPS_KEEP="4m"
|
||||
borg_NB_BACKUPS_JOUR=90
|
||||
borg_NB_BACKUPS_SEM=30
|
||||
borg_NB_BACKUPS_MOIS=12
|
||||
borg_BORGSCRIPTS=/root/borgscripts
|
@@ -2,3 +2,6 @@ MYSQL_ROOT_PASSWORD=@@pass@@castopod@@p@@
|
||||
MYSQL_USER=@@user@@castopod1@@u@@
|
||||
MYSQL_PASSWORD=@@pass@@castopod1@@p@@
|
||||
MYSQL_DATABASE=@@db@@castopod1@@d@@
|
||||
CP_DATABASE_NAME=@@db@@castopod1@@d@@
|
||||
CP_DATABASE_USERNAME=@@user@@castopod1@@u@@
|
||||
CP_DATABASE_PASSWORD=@@pass@@castopod1@@p@@
|
||||
|
@@ -1,9 +1,4 @@
|
||||
|
||||
MYSQL_ROOT_PASSWORD=@@pass@@mattermostroot@@p@@
|
||||
MYSQL_DATABASE=@@db@@mattermost@@d@@
|
||||
MYSQL_USER=@@user@@mattermost@@u@@
|
||||
MYSQL_PASSWORD=@@pass@@mattermost@@p@@
|
||||
|
||||
POSTGRES_USER=@@user@@mattermost@@u@@
|
||||
POSTGRES_PASSWORD=@@pass@@mattermost@@p@@
|
||||
POSTGRES_DB=@@db@@mattermost@@d@@
|
||||
|
||||
|
@@ -1,9 +1,5 @@
|
||||
|
||||
MM_ADMIN_EMAIL=@@globalvar@@matterHost@@gv@@@@@globalvar@@domain@@gv@@
|
||||
MM_ADMIN_USER=@@user@@mattermost2@@u@@
|
||||
MM_ADMIN_PASSWORD=@@pass@@mattermost2@@p@@
|
||||
|
||||
|
||||
MM_SQLSETTINGS_DRIVERNAME=postgres
|
||||
MM_SQLSETTINGS_DATASOURCE=postgres://@@user@@mattermost@@u@@:@@pass@@mattermost@@p@@@postgres:5432/@@db@@mattermost@@d@@?sslmode=disable&connect_timeout=10
|
||||
|
||||
|
Reference in New Issue
Block a user