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:
@@ -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"]
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user