Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Commit b603bb9

Browse files
committed
add shadow management in config if user changes password
1 parent c234b66 commit b603bb9

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ RUN \
112112
-L "http://security.ubuntu.com/ubuntu/pool/universe/libp/libpam4j/libpam4j-java_1.4-2+deb8u1build0.16.04.1_all.deb" && \
113113
dpkg -i /tmp/libpam.deb && \
114114
echo "**** cleanup ****" && \
115+
mv /usr/bin/passwd /usr/bin/passwdbin && \
115116
apt-get autoclean && \
116117
rm -rf \
117118
/var/lib/apt/lists/* \

Dockerfile.aarch64

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ RUN \
112112
-L "http://security.ubuntu.com/ubuntu/pool/universe/libp/libpam4j/libpam4j-java_1.4-2+deb8u1build0.16.04.1_all.deb" && \
113113
dpkg -i /tmp/libpam.deb && \
114114
echo "**** cleanup ****" && \
115+
mv /usr/bin/passwd /usr/bin/passwdbin && \
115116
apt-get autoclean && \
116117
rm -rf \
117118
/var/lib/apt/lists/* \

Dockerfile.armhf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ RUN \
112112
-L "http://security.ubuntu.com/ubuntu/pool/universe/libp/libpam4j/libpam4j-java_1.4-2+deb8u1build0.16.04.1_all.deb" && \
113113
dpkg -i /tmp/libpam.deb && \
114114
echo "**** cleanup ****" && \
115+
mv /usr/bin/passwd /usr/bin/passwdbin && \
115116
apt-get autoclean && \
116117
rm -rf \
117118
/var/lib/apt/lists/* \

root/etc/cont-init.d/61-shadow-config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/with-contenv bash
2+
3+
if [ -f /config/shadow ] && [ "$(md5sum /config/shadow| cut -c -32)" != "$(md5sum /etc/shadow| cut -c -32)" ]; then
4+
cp /config/shadow /etc/shadow
5+
chown root:shadow /etc/shadow
6+
chmod 640 /etc/shadow
7+
fi

root/usr/bin/passwd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/bash
2+
/usr/bin/passwdbin "$@"
3+
sudo cp /etc/shadow /config/shadow
4+
sudo chown ${USER}:${USER} /config/shadow
5+
echo "A wrapper has been executed to save shadow so your password survives upgrades"
6+
echo "If you would like to disable this feature please run:"
7+
echo "sudo mv /usr/bin/passwdbin /usr/bin/passwd"

0 commit comments

Comments
 (0)