diff --git a/Dockerfile b/Dockerfile index d13c589..4e3ccdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update && apt install -y --no-install-recommends \ libpam-sss \ libpam-modules \ gettext \ + supervisor \ && apt-get autoclean \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* @@ -34,8 +35,8 @@ COPY nsswitch.conf /etc/nsswitch.conf COPY common-session /etc/pam.d/common-session COPY skel /etc/skel -COPY startup.sh /root/startup.sh +COPY supervisord.conf /etc/supervisord.conf +COPY sssd.sv.conf /etc/supervisor/conf.d/sssd.sv.conf +COPY sshd.sv.conf /etc/supervisor/conf.d/sshd.sv.conf -VOLUME /home - -CMD ["/bin/bash", "/root/startup.sh"] +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] diff --git a/sshd.sv.conf b/sshd.sv.conf new file mode 100644 index 0000000..d8400f9 --- /dev/null +++ b/sshd.sv.conf @@ -0,0 +1,5 @@ +[program:sshd] +command=/usr/sbin/sshd -e -D +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +redirect_stderr=true diff --git a/sssd.sv.conf b/sssd.sv.conf new file mode 100644 index 0000000..8037111 --- /dev/null +++ b/sssd.sv.conf @@ -0,0 +1,14 @@ +[program:sssd_init] +command= + /bin/bash -c "envsubst < /etc/sssd/sssd.conf.env > /etc/sssd/sssd.conf; chmod 600 /etc/sssd/sssd.conf; supervisorctl start sssd" +autorestart=false +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[program:sssd] +command=/bin/bash -c "rm -rf /var/run/sssd.pid; /usr/sbin/sssd -i" +autostart=false +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +redirect_stderr=true diff --git a/startup.sh b/startup.sh deleted file mode 100644 index 457d553..0000000 --- a/startup.sh +++ /dev/null @@ -1,6 +0,0 @@ -envsubst < /etc/sssd/sssd.conf.env > /etc/sssd/sssd.conf -chmod 600 /etc/sssd/sssd.conf - -rm -rf /var/run/sssd.pid -/usr/sbin/sssd -f -/usr/sbin/sshd -e -D diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..5d0b98b --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,19 @@ +[supervisord] +nodaemon=true +user=root +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[unix_http_server] +file=/var/run/supervisor.sock +chmod=0700 + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock + +[include] +files = /etc/supervisor/conf.d/*.conf