forked from GNUsocial/gnu-social
[TOOLS][DOCKER] Add mail setup to configure
This commit is contained in:
parent
a5eca9f110
commit
66670ff220
68
bin/configure
vendored
68
bin/configure
vendored
@ -85,7 +85,7 @@ fi
|
||||
mkdir -p $ROOT/docker/bootstrap
|
||||
|
||||
|
||||
cat > ./docker/bootstrap/bootstrap.env <<EOF
|
||||
cat > $ROOT/docker/bootstrap/bootstrap.env <<EOF
|
||||
#!/bin/sh
|
||||
email=${email}
|
||||
domain=${domain}
|
||||
@ -241,7 +241,7 @@ if [ "${dbms}" = 'mariadb' ]; then
|
||||
exec 3>&-
|
||||
check_input $db_root_password
|
||||
|
||||
cat > ./docker/db/db.env <<EOF
|
||||
cat > $ROOT/docker/db/db.env <<EOF
|
||||
DBMS=${dbms}
|
||||
MYSQL_ROOT_PASSWORD=${db_root_password}
|
||||
EOF
|
||||
@ -249,7 +249,7 @@ EOF
|
||||
database_url="DATABASE_URL=mysql://${user}:${password}@db:3306/${db}"
|
||||
|
||||
else
|
||||
cat > ./docker/db/db.env <<EOF
|
||||
cat > $ROOT/docker/db/db.env <<EOF
|
||||
DBMS=${dbms}
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=${password}
|
||||
@ -264,7 +264,7 @@ echo "${database_url}" >> .env.local
|
||||
|
||||
mkdir -p $ROOT/docker/social
|
||||
|
||||
cat > ./docker/social/social.env <<EOF
|
||||
cat > $ROOT/docker/social/social.env <<EOF
|
||||
SOCIAL_DBMS="${dbms}"
|
||||
SOCIAL_DB="${db}"
|
||||
SOCIAL_USER="${user}"
|
||||
@ -321,10 +321,68 @@ esac
|
||||
|
||||
case $docker_compose in *"mail"*)
|
||||
$ROOT/docker/social/mail
|
||||
exec 3>&1
|
||||
mail_domain_root=$(dialog \
|
||||
--title "Configure Mail" \
|
||||
--clear \
|
||||
--ok-label "Ok" \
|
||||
--cancel-label "Exit" \
|
||||
--inputbox "E-mail domain root:" $HEIGHT $WIDTH \
|
||||
2>&1 1>&3)
|
||||
check_retval $?
|
||||
exec 3>&-
|
||||
check_input $mail_domain_root
|
||||
|
||||
exec 3>&1
|
||||
mail_subdomain=$(dialog \
|
||||
--title "Configure Mail" \
|
||||
--clear \
|
||||
--ok-label "Ok" \
|
||||
--cancel-label "Exit" \
|
||||
--inputbox "E-mail subdomain (can be empty):" $HEIGHT $WIDTH \
|
||||
2>&1 1>&3)
|
||||
check_retval $?
|
||||
exec 3>&-
|
||||
|
||||
exec 3>&1
|
||||
mail_user=$(dialog \
|
||||
--title "Configure Mail" \
|
||||
--clear \
|
||||
--ok-label "Ok" \
|
||||
--cancel-label "Exit" \
|
||||
--inputbox "E-mail user (name without @domain): " $HEIGHT $WIDTH \
|
||||
2>&1 1>&3)
|
||||
check_retval $?
|
||||
exec 3>&-
|
||||
check_input $mail_user
|
||||
|
||||
exec 3>&1
|
||||
mail_pass=$(dialog \
|
||||
--title "Configure Mail" \
|
||||
--clear \
|
||||
--ok-label "Ok" \
|
||||
--cancel-label "Exit" \
|
||||
--inputbox "E-mail user password: " $HEIGHT $WIDTH \
|
||||
2>&1 1>&3)
|
||||
check_retval $?
|
||||
exec 3>&-
|
||||
check_input $mail_pass
|
||||
|
||||
mkdir -p $ROOT/docker/mail
|
||||
|
||||
cat > $ROOT/docker/mail/mail.env <<EOF
|
||||
MAIL_DOMAIN_ROOT="${mail_domain_root}"
|
||||
MAIL_SUBDOMAIN="${mail_subdomain}"
|
||||
MAIL_USER="${mail_user}"
|
||||
MAIL_PASSWORD="${mail_pass}"
|
||||
EOF
|
||||
|
||||
$ROOT/docker/mail/setup.sh
|
||||
|
||||
esac
|
||||
|
||||
echo "volumes:\n database:" >> docker-compose.yaml
|
||||
clear
|
||||
|
||||
|
||||
|
||||
|
||||
|
0
docker/mail/config/aliases
Normal file
0
docker/mail/config/aliases
Normal file
0
docker/mail/config/domains
Normal file
0
docker/mail/config/domains
Normal file
0
docker/mail/config/mailboxes
Normal file
0
docker/mail/config/mailboxes
Normal file
0
docker/mail/config/passwd
Normal file
0
docker/mail/config/passwd
Normal file
41
docker/mail/setup.sh
Normal file → Executable file
41
docker/mail/setup.sh
Normal file → Executable file
@ -1,39 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
ROOT="$(git rev-parse --show-toplevel)"
|
||||
. $ROOT/docker/mail/mail.env
|
||||
|
||||
cd "${0%/*}"
|
||||
|
||||
printf "Domain root: "
|
||||
read -r domain_root
|
||||
printf "Subdomain (can be empty): "
|
||||
read -r sub_domain
|
||||
|
||||
printf "E-mail user (name without @domain): "
|
||||
read -r user
|
||||
printf "E-mail pass: "
|
||||
read -r pass
|
||||
|
||||
if [ -z "${sub_domain}" ]
|
||||
if [ -z "${MAIL_SUBDOMAIN}" ]
|
||||
then
|
||||
domain="${domain_root}"
|
||||
domain="${MAIL_DOMAIN_ROOT}"
|
||||
else
|
||||
domain="${sub_domain}.${domain_root}"
|
||||
domain="${MAIL_SUBDOMAIN}.${MAIL_DOMAIN_ROOT}"
|
||||
fi
|
||||
|
||||
PASSHASH=$(mkpasswd -m sha-512 -S "" -R 5000 ${MAIL_PASSWORD})
|
||||
|
||||
cat > mail.env <<EOF
|
||||
#!/bin/sh
|
||||
DOMAINNAME=${domain_root}
|
||||
DOMAINNAME=${MAIL_DOMAIN_ROOT}
|
||||
MAILNAME=${domain}
|
||||
SSL_CERT=/etc/letsencrypt/live/${domain_root}/fullchain.pem
|
||||
SSL_KEY=/etc/letsencrypt/live/${domain_root}/privkey.pem
|
||||
USER="${user}@${domain_root}"
|
||||
SSL_CERT=/etc/letsencrypt/live/${MAIL_DOMAIN_ROOT}/fullchain.pem
|
||||
SSL_KEY=/etc/letsencrypt/live/${MAIL_DOMAIN_ROOT}/privkey.pem
|
||||
MAIL_USER="${MAIL_USER}"
|
||||
USER="${MAIL_USER}@${MAIL_DOMAIN_ROOT}"
|
||||
EOF
|
||||
|
||||
DOMAINNAME="${domain_root}"
|
||||
MAILNAME="${domain}"
|
||||
SSL_CERT="/etc/letsencrypt/live/${domain_root}/fullchain.pem"
|
||||
SSL_KEY="/etc/letsencrypt/live/${domain_root}/privkey.pem"
|
||||
|
||||
USER="${user}@${DOMAINNAME}"
|
||||
PASSHASH=$(mkpasswd -m sha-512 -S "" -R 5000 ${pass})
|
||||
. $ROOT/docker/mail/mail.env
|
||||
|
||||
# Config postfix
|
||||
sed -i -e "s#^\s*myhostname\s*=.*#myhostname = ${MAILNAME}#" config/postfix/main.cf
|
||||
@ -53,5 +44,5 @@ sed -i -e "s/^.*#HOSTNAME/${MAILNAME}#HOSTNAME/" config/opendkim/TrustedHosts
|
||||
touch config/aliases config/domains config/mailboxes config/passwd
|
||||
echo "${DOMAINNAME} #OK" > config/domains
|
||||
echo "${USER} ${USER}" > config/aliases
|
||||
echo "${USER} ${DOMAINNAME}/${user}/" > config/mailboxes
|
||||
echo "${USER} ${DOMAINNAME}/${MAIL_USER}/" > config/mailboxes
|
||||
echo "${USER}:${PASSHASH}" > config/passwd
|
||||
|
@ -6,6 +6,7 @@ echo " mail:
|
||||
- ./docker/mail/mail.env
|
||||
ports:
|
||||
- 25:25
|
||||
- 110:110
|
||||
- 143:143
|
||||
- 587:587
|
||||
- 993:993
|
||||
|
Loading…
Reference in New Issue
Block a user