Browse Source

Merge branch 'master' of gitlab.altinea.fr:altinea/install-scripts

pull/1/head
Julien Escario 3 years ago
parent
commit
924c6d4628
  1. 1
      foreman/altinea_puppet_install.sh
  2. 21
      nextcloud/imports-account-csv.sh
  3. 0
      zimbra/certificat/ca-root.pem
  4. 34
      zimbra/certificat/renew_cert_acmesh_zimbra.sh
  5. 0
      zimbra/certificat/script-certificat.sh
  6. 35
      zimbra/import_export_accounts/imaps_sync_script.sh
  7. 24
      zimbra/import_export_accounts/import_account_with_csv.sh

1
foreman/altinea_puppet_install.sh

@ -21,3 +21,4 @@ echo "[agent]
pluginsync = true pluginsync = true
report = true"> /etc/puppetlabs/puppet/puppet.conf report = true"> /etc/puppetlabs/puppet/puppet.conf
/opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true
. /etc/profile.d/puppet-agent.sh

21
nextcloud/imports-account-csv.sh

@ -0,0 +1,21 @@
#!/bin/bash
input="accountsn.csv"
OLDIFS=$IFS
IFS=','
var_apache_user=www-data
var_path_nextcloud=/usr/share/nginx/nextcloud/
while read -r display_name username group password email
do
var_display_name=$(echo $display_name )
var_username=$(echo $username )
var_group=$(echo $group )
var_password=$(echo $password )
var_email=$(echo $email )
echo "account : ${email}"
export OC_PASS={$var_password}
su -s /bin/sh ${var_apache_user} -c " php ${var_path_nextcloud}occ user:add --display-name='${var_display_name}' --password-from-env --group='${var_group}' '${var_username}' "
done < $input
IFS=$OLDIFS

0
zimbra/ca-root.pem → zimbra/certificat/ca-root.pem

34
zimbra/certificat/renew_cert_acmesh_zimbra.sh

@ -0,0 +1,34 @@
su zimbra /opt/zimbra/bin/zmproxyctl stop
/root/.acme.sh/acme.sh --issue --standalone -d replace_host
cd /etc/myacme/replace_host/
mkdir /opt/zimbra/ssl/letsencrypt
echo '-----BEGIN CERTIFICATE-----
MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
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NTUQ
-----END CERTIFICATE-----' >> fullchain.cer
cp /etc/myacme/replace_host/* /opt/zimbra/ssl/letsencrypt/
chown zimbra:zimbra /opt/zimbra/ssl/letsencrypt/*
chown zimbra:zimbra /opt/zimbra/ssl/letsencrypt/
cp -a /opt/zimbra/ssl/zimbra /opt/zimbra/ssl/zimbra.$(date "+%Y%m%d")
cp /opt/zimbra/ssl/letsencrypt/replace_host.key /opt/zimbra/ssl/zimbra/commercial/commercial.key
su - zimbra -c "
cd /opt/zimbra/ssl/letsencrypt/
/opt/zimbra/bin/zmcertmgr verifycrt comm replace_host.key replace_host.cer fullchain.cer
/opt/zimbra/bin/zmcertmgr deploycrt comm replace_host.cer fullchain.cer
zmcontrol restart"

0
zimbra/script-certificat.sh → zimbra/certificat/script-certificat.sh

35
zimbra/import_export_accounts/imaps_sync_script.sh

@ -0,0 +1,35 @@
#!/bin/bash
echo "Saisir le fichier de comptes :"
read input
echo "Saisir le Host1 :"
read host1
echo "Saisir le Port1 :"
read port1
echo "Saisir le Host2 :"
read host2
echo "Saisir le port2 :"
read Port2
echo "Info host 1 : ${host1} ${port1}"
echo "Info host 2 : ${host2} ${port2}"
option1="--syncinternaldates"
option2="--buffersize 65535000"
option3="--nofoldersizes"
option4="--nofoldersizesatend"
option5="--addheader"
OLDIFS=$IFS
IFS=' '
while read -r account_host1 password_host1 account_host2 password_host2
do
var_acc_host1=$(echo $account_host1)
var_pass_host1=$(echo $password_host1)
var_acc_host2=$(echo $account_host2)
var_pass_host2=$(echo $password_host2)
echo "migration du compte : ${var_acc_host2}"
docker run --rm gilleslamiral/imapsync imapsync --host1 ${host1} --user1 ${var_acc_host1} --password1 ${var_pass_host1} --port1 ${port1} --notls1 --host2 ${host2} --user2 ${var_acc_host2} --password2 ${var_pass_host2} ${option1} ${option2} --port2=993 --ssl2 ${option3} ${option4} ${option5}
done < $input
IFS=$OLDIFS

24
zimbra/import_export_accounts/import_account_with_csv.sh

@ -0,0 +1,24 @@
#!/bin/bash
DATE=$(date)
OLDIFS=$IFS
IFS=','
File_Name="accounts.csv"
Out_log='/tmp/outfile.log'
echo "$DATE - To create account Email" | tee $Out_log
echo "Account, Password, First_Name, Last_Name, DisplayName, zimbraMailHost" | tee -a $Out_log
while read Acount_Email Password First_Name Last_Name Display_Name Mailbox
do
echo "$Acount_Email, $Password, $First_Name, $Last_Name, $Display_Name, $Mailbox" | tee -a $Out_log
echo ""
Uid=$(echo $Acount_Email | cut -d '@' -f1)
Domain=$(echo $Acount_Email | cut -d '@' -f2)
su - zimbra -c "zmprov -l gaa | grep '\b$Uid'@$Domain"
if [ $? -eq 0 ] ; then
echo "$Acount_Email exits"
else
su - zimbra -c "zmprov ca '$Acount_Email' '$Password' givenName '$First_Name' sn '$Last_Name' displayName '$Display_Name' zimbraMailHost '$Mailbox' zimbraPasswordMustChange TRUE " >>$Out_log
fi
done < ${File_Name}
IFS=$OLDIFS
#option "zimbraPasswordMustChange TRUE" pour l'obligation de changement du mot de passe lors de la premiere connexion
Loading…
Cancel
Save