Skip to content
Snippets Groups Projects
Verified Commit 38a3a3ee authored by David Beniamine's avatar David Beniamine
Browse files

WIP sympa => postfix ok but postfix does not send mails to relay

parent 36732862
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,10 @@ services: ...@@ -23,6 +23,10 @@ services:
SYMPA_DB_NAME: SYMPA_DB_NAME:
SYMPA_DB_USER: SYMPA_DB_USER:
SYMPA_DB_PASSWD: SYMPA_DB_PASSWD:
REMOTES:
networks:
- postfix
- default
ports: ports:
- '8081:80' - '8081:80'
...@@ -32,6 +36,8 @@ services: ...@@ -32,6 +36,8 @@ services:
- "./sympa/shared:/etc/sympa/shared" - "./sympa/shared:/etc/sympa/shared"
- "./postfix/log:/var/log/postfix" - "./postfix/log:/var/log/postfix"
- "spool_postfix:/var/spool/postfix" - "spool_postfix:/var/spool/postfix"
networks:
- postfix
environment: environment:
POSTFIX_VIRTUAL_DOMAINS: POSTFIX_VIRTUAL_DOMAINS:
MAILNAME: MAILNAME:
...@@ -56,3 +62,9 @@ volumes: ...@@ -56,3 +62,9 @@ volumes:
spool_postfix: spool_postfix:
spool_nullmailer: spool_nullmailer:
lib_sympa: lib_sympa:
networks:
postfix:
ipam:
config:
- subnet: 10.42.0.0/16
sed "s/POSTFIX_VIRTUAL_DOMAINS/$POSTFIX_VIRTUAL_DOMAINS/g" /etc/postfix/main.cf.append > /etc/postfix/main.cf cp /etc/postfix/main.cf.orig /etc/postfix/main.cf
cat /etc/postfix/master.cf.orig /etc/postfix/master.cf.append > /etc/postfix/master.cf cp /etc/postfix/master.cf.orig /etc/postfix/master.cf
sed "s/POSTFIX_VIRTUAL_DOMAINS/$POSTFIX_VIRTUAL_DOMAINS/g" /etc/postfix/main.cf.append >> /etc/postfix/main.cf
cat /etc/postfix/master.cf.orig /etc/postfix/master.cf.append >> /etc/postfix/master.cf
...@@ -10,8 +10,10 @@ RUN apt-get -y install \ ...@@ -10,8 +10,10 @@ RUN apt-get -y install \
libapache2-mod-fcgid \ libapache2-mod-fcgid \
libdbd-pg-perl \ libdbd-pg-perl \
libfcgi-perl \ libfcgi-perl \
nullmailer \
openssh-server \ openssh-server \
sudo sudo \
supervisor
RUN apt-get -y install --no-install-recommends sympa RUN apt-get -y install --no-install-recommends sympa
...@@ -25,6 +27,8 @@ RUN echo "local1.* -/var/log/sympa.log" >> /etc/syslog.conf ...@@ -25,6 +27,8 @@ RUN echo "local1.* -/var/log/sympa.log" >> /etc/syslog.conf
RUN cp -r /etc/sympa /etc/sympa.sample RUN cp -r /etc/sympa /etc/sympa.sample
COPY supervisord.conf /etc/supervisor/conf.d
COPY run.sh /opt/sympa_run.sh COPY run.sh /opt/sympa_run.sh
COPY entrypoint.sh /entrypoint COPY entrypoint.sh /entrypoint
......
#!/bin/bash #!/bin/bash
## Init sympa
# Populate volume # Populate volume
if [ -z "$(ls /etc/sympa/)" ]; then if [ -z "$(ls /etc/sympa/)" ]; then
cp -pr /etc/sympa.sample/* /etc/sympa/ cp -pr /etc/sympa.sample/* /etc/sympa/
...@@ -20,14 +21,17 @@ done ...@@ -20,14 +21,17 @@ done
cp /opt/sympa_run.sh /etc/sympa/run.sh cp /opt/sympa_run.sh /etc/sympa/run.sh
chmod +x /etc/sympa/run.sh chmod +x /etc/sympa/run.sh
# Fix permissions # Fix permissions
chown -R sympa:sympa /etc/sympa/ chown -Rh :sympa /etc/sympa/*
chown -Rh sympa:sympa /var/lib/sympa /var/spool/sympa
chmod 771 /var/spool/sympa
chmod 750 /etc/sympa/includes
chmod 640 /etc/sympa/includes/*
chown -Rh :sympa /etc/sympa/includes/*
/bin/mkdir -p /run/sympa /bin/mkdir -p /run/sympa
/bin/chown sympa:sympa /run/sympa /bin/chown sympa:sympa /run/sympa
# Launch services
syslogd
# So that Postfix can connect into us to deliver e-mail to mailing lists. /etc/sympa/shared is a # So that Postfix can connect into us to deliver e-mail to mailing lists. /etc/sympa/shared is a
# volume shared with the Postfix container which contains the SSH key that container should use # volume shared with the Postfix container which contains the SSH key that container should use
# when connecting to this container. # when connecting to this container.
...@@ -41,7 +45,7 @@ rm -f /etc/sympa/shared/known_hosts ...@@ -41,7 +45,7 @@ rm -f /etc/sympa/shared/known_hosts
echo -n 'sympa ' > /etc/sympa/shared/known_hosts echo -n 'sympa ' > /etc/sympa/shared/known_hosts
cat /etc/ssh/ssh_host_rsa_key.pub >> /etc/sympa/shared/known_hosts cat /etc/ssh/ssh_host_rsa_key.pub >> /etc/sympa/shared/known_hosts
# Allow sympa user to ssh # Allow sympa user to ssh
usermod -s /bin/sh sympa usermod -s /etc/sympa/run.sh sympa
mkdir -p /var/lib/sympa/.ssh mkdir -p /var/lib/sympa/.ssh
echo -n 'no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command="/etc/sympa/run.sh" ' > /var/lib/sympa/.ssh/authorized_keys echo -n 'no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command="/etc/sympa/run.sh" ' > /var/lib/sympa/.ssh/authorized_keys
...@@ -50,9 +54,37 @@ cat /etc/sympa/shared/id_rsa.pub >> /var/lib/sympa/.ssh/authorized_keys ...@@ -50,9 +54,37 @@ cat /etc/sympa/shared/id_rsa.pub >> /var/lib/sympa/.ssh/authorized_keys
# Remove any stale config binaries. # Remove any stale config binaries.
rm -f /etc/sympa/*/*.bin rm -f /etc/sympa/*/*.bin
sudo -u sympa /usr/lib/sympa/bin/sympa_automatic.pl --foreground 2>&1 & ## Init apache2
sudo -u sympa /usr/lib/sympa/bin/sympa_msg.pl mkdir -p /var/log/apache2
/usr/bin/sympa --health_check chown -R www-data:www-data /var/log/apache2
mkdir -p /var/run/sshd
/usr/sbin/sshd -D -e & ## Init ssh
exec apache2ctl -DFOREGROUND mkdir /run/sshd
### Init nullmailer
chown mail /var/spool/nullmailer
# If directory is empty, we restore it from our copy of initial files
[[ $(ls -A /var/spool/nullmailer | grep -v placeholder) ]] || cp -a /var/spool/nullmailer.orig/* /var/spool/nullmailer/
if [ ! -p /var/spool/nullmailer/trigger ]; then
rm -f /var/spool/nullmailer/trigger
mkfifo /var/spool/nullmailer/trigger
fi
chown mail:root /var/spool/nullmailer/trigger
chmod 0622 /var/spool/nullmailer/trigger
if [ -n "$ADMINADDR" ]; then
echo "$ADMINADDR" > /etc/nullmailer/adminaddr
fi
if [ -n "$REMOTES" ]; then
echo "$REMOTES" > /etc/nullmailer/remotes
fi
if [ -n "$HOSTNAME" ]; then
echo "$HOSTNAME" > /etc/mailname
fi
# Launch all services
exec /usr/bin/supervisord
...@@ -4,6 +4,7 @@ services: ...@@ -4,6 +4,7 @@ services:
sympa: sympa:
networks: networks:
- default - default
- postfix
- dolibarr_shared - dolibarr_shared
networks: networks:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment