1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 14:23:11 +00:00

Don't hard code password in image anymore

This commit is contained in:
Darren Shepherd
2015-02-24 01:27:30 -07:00
parent 7a8d9c5ec9
commit beb044b265
5 changed files with 30 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
FROM base
COPY scripts/dockerimages/scripts/console.sh /usr/sbin/
COPY scripts/dockerimages/scripts/update-ssh-keys /usr/bin/
RUN sed -i 's/rancher.*/rancher:rixbL64o6zGmY:16486:0:99999:7:::/g' /etc/shadow && \
RUN sed -i 's/rancher:!/rancher:*/g' /etc/shadow && \
echo '## allow password less for rancher user' >> /etc/sudoers && \
echo 'rancher ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
CMD ["/usr/sbin/console.sh"]

View File

@@ -26,6 +26,18 @@ setup_ssh()
mkdir -p /var/run/sshd
}
for i in $(</proc/cmdline); do
case $i in
rancher.password=*)
PASSWORD=$(echo $i | sed 's/rancher.password=//')
;;
esac
done
if [ -n "$PASSWORD" ]; then
echo "rancher:$PASSWORD" | chpasswd
fi
cloud-init -execute
setup_ssh