Skip to content

Commit

Permalink
added rsyslog and redirect to container log
Browse files Browse the repository at this point in the history
  • Loading branch information
kohlerdominik committed Apr 3, 2020
1 parent 908b6ee commit 26a2916
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ftp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RUN apt-get update && \
apt-get -y install wget build-essential && \
apt-get -y install libssl-dev && \
apt-get -y install libmariadb-dev && \
apt-get -y install rsyslog && \
# download, configure and compile pure-ftpd
mkdir /usr/src/pure-ftpd && cd /usr/src/pure-ftpd && \
wget https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.49.tar.gz && \
Expand All @@ -20,7 +21,15 @@ RUN apt-get update && \
# create a dummy certificate, as the ftp server fails without it.
mkdir -p /etc/ssl/private && \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth" > /etc/ssl/openssl.cnf && \
openssl req -x509 -keyout /etc/ssl/private/privkey.pem -out /etc/ssl/private/fullchain.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -extensions EXT -config /etc/ssl/openssl.cnf
openssl req -x509 -keyout /etc/ssl/private/privkey.pem -out /etc/ssl/private/fullchain.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -extensions EXT -config /etc/ssl/openssl.cnf && \
# configure rsyslog
# disable kernel log as it doesn't work in containers - and it should not
sed -i '/imklog/s/^/#/' /etc/rsyslog.conf && \
# disable the template preset and set a custom one (first empty line after GLOBAL DIRECTIVES)
sed -i '/ActionFileDefaultTemplate/s/^/#/' /etc/rsyslog.conf &&
sed -i '/GLOBAL DIRECTIVES/!b;:a;n;/./ba;i$template customFormat,"%msg%\\n" \n$ActionFileDefaultTemplate customFormat' /etc/rsyslog.conf &&
# redirect the output to the process 1
ln -sf /proc/1/fd/1 /var/log/syslog

# setup run/init file
COPY run.sh /run.sh
Expand Down
3 changes: 3 additions & 0 deletions ftp/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ echo "Concatiante CertFile..."
cat /etc/ssl/private/privkey.pem > /etc/ssl/private/pureftpd.pem
cat /etc/ssl/private/fullchain.pem >> /etc/ssl/private/pureftpd.pem

echo "Start rsylog deamon in background..."
rsyslogd &

echo "Start pure-ftpd..."
/usr/local/sbin/pure-ftpd /etc/pureftpd/pureftpd.conf

0 comments on commit 26a2916

Please sign in to comment.