From: W. Trevor King Date: Sat, 1 Mar 2014 05:44:28 +0000 (-0800) Subject: ngircd: Add support for GLOBAL_PASSWORD X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7bd572fe0c2b8c9bc2097e9cd4701c784cae0f9c;p=dockerfile.git ngircd: Add support for GLOBAL_PASSWORD We need to disable PAM support at compile time to get this working, because with PAM compiled in global password are broken until 485d0ae (Use server password when PAM is compiled in but disabled, 2014-02-27, [1]). 485d0ae landed after ngIRCd v21, so it will probably be in the next release after that. Once that lands in Gentoo's Portage tree, we can re-enable PAM. [1]: http://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git;a=commit;h=485d0aec813db9966922f17aae044df2d82b0b67 --- diff --git a/ngircd/Dockerfile.template b/ngircd/Dockerfile.template index ff97fa3..1a23faf 100644 --- a/ngircd/Dockerfile.template +++ b/ngircd/Dockerfile.template @@ -26,6 +26,7 @@ FROM ${NAMESPACE}/gentoo-syslog:${TAG} MAINTAINER ${MAINTAINER} #VOLUME ["${PORTAGE}:/usr/portage:ro", "${PORTAGE}/distfiles:/usr/portage/distfiles:rw"] RUN echo 'net-irc/ngircd ~amd64' >> /etc/portage/package.accept_keywords +RUN echo 'net-irc/ngircd -pam' >> /etc/portage/package.use RUN emerge -v net-irc/ngircd RUN eselect news read new RUN rc-update add ngircd default diff --git a/ngircd/README.md b/ngircd/README.md index 7497288..01cc1b2 100644 --- a/ngircd/README.md +++ b/ngircd/README.md @@ -28,6 +28,9 @@ and the [unencrypted port][6667]: > … > -p 6667:6667 -p 6697:6697 wking/ngircd +You can optionally set a `GLOBAL_PASSWORD` environment variable to +require a global password for all client connections. + [ngIRCd]: http://ngircd.barton.de/ [TLS]: http://en.wikipedia.org/wiki/Transport_Layer_Security [volume-mount]: http://docs.docker.io/en/latest/use/working_with_volumes/ diff --git a/ngircd/setup-ngircd-config-from-environment.sh b/ngircd/setup-ngircd-config-from-environment.sh index c957f40..f354471 100755 --- a/ngircd/setup-ngircd-config-from-environment.sh +++ b/ngircd/setup-ngircd-config-from-environment.sh @@ -28,15 +28,24 @@ # EMAIL="admin@example.net" INFO="testing, testing" \ # setup-ngircd-config-from-environment +ENVSUBST=' + ${HOSTNAME} + ${DESCRIPTION} + ${LOCATION} + ${EMAIL} + ${INFO} + ' + +if [ -n "${GLOBAL_PASSWORD}" ] +then + ENVSUBST="${ENVSUBST} \${GLOBAL_PASSWORD}" + # In lines matching '# Global password' or the two succeeding lines, + # replace ';Password = .*' with 'Password = ${GLOBAL_PASSWORD}' + sed -i '/# Global password/,+2 s/;Password = .*/Password = ${GLOBAL_PASSWORD}/' /etc/ngircd/ngircd.conf +fi + HOSTNAME=$(hostname -f) \ - envsubst ' - ${HOSTNAME} - ${DESCRIPTION} - ${LOCATION} - ${EMAIL} - ${INFO} - ' \ - < /etc/ngircd/ngircd.conf > /tmp/ngircd.conf && + envsubst "${ENVSUBST}" < /etc/ngircd/ngircd.conf > /tmp/ngircd.conf && mv /tmp/ngircd.conf /etc/ngircd/ngircd.conf if [ "${SSL}" = 'yes' ]