mirror of
https://github.com/rlister/dockerfiles.git
synced 2025-12-11 00:36:27 +00:00
add htpasswd
This commit is contained in:
15
htpasswd/Dockerfile
Normal file
15
htpasswd/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM progrium/busybox
|
||||
|
||||
MAINTAINER Ric Lister, rlister@gmail.com
|
||||
|
||||
RUN opkg-install openssl-util
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ADD htpasswd.sh /app/
|
||||
RUN chmod 0755 htpasswd.sh
|
||||
|
||||
ENV CRYPT apr1
|
||||
ENV OUTPUT /dev/stdout
|
||||
|
||||
ENTRYPOINT [ "/app/htpasswd.sh" ]
|
||||
14
htpasswd/htpasswd.sh
Normal file
14
htpasswd/htpasswd.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
## make sure output dir exists
|
||||
dir=$(dirname $OUTPUT)
|
||||
if [ ! -d $dir ] ; then
|
||||
mkdir -p $dir
|
||||
fi
|
||||
|
||||
## loop user:pass args
|
||||
for arg in $* ; do
|
||||
user=$(echo ${arg%%:*})
|
||||
pass=$(echo ${arg##*:})
|
||||
printf "${user}:$(openssl passwd -$CRYPT $pass)\n" >> $OUTPUT
|
||||
done
|
||||
Reference in New Issue
Block a user