From fe3b1ce399149103f39580403fea47c8b5808f9c Mon Sep 17 00:00:00 2001 From: Thomas Cole Date: Tue, 13 Jul 2021 08:35:52 -0400 Subject: [PATCH] Add config file for password hashes --- .gitignore | 2 ++ preseed.cfg => input.cfg | 4 ++-- passwd.cfg | 3 +++ preseedserver.sh | 7 +++++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .gitignore rename preseed.cfg => input.cfg (97%) create mode 100644 passwd.cfg diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..232f303 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.passwd.cfg +preseed.cfg \ No newline at end of file diff --git a/preseed.cfg b/input.cfg similarity index 97% rename from preseed.cfg rename to input.cfg index 6e6fe62..d4ba088 100644 --- a/preseed.cfg +++ b/input.cfg @@ -40,13 +40,13 @@ d-i mirror/http/proxy string ### Account setup # Root password -d-i passwd/root-password-crypted password $CRYPT3HASH +d-i passwd/root-password-crypted password @ROOTHASH # To create a normal user account. d-i passwd/user-fullname string CLC User d-i passwd/username string clc # Normal user's password -d-i passwd/user-password-crypted password $CRYPT3HASH +d-i passwd/user-password-crypted password @USERHASH ### Clock and time zone setup # Controls whether or not the hardware clock is set to UTC. diff --git a/passwd.cfg b/passwd.cfg new file mode 100644 index 0000000..053a087 --- /dev/null +++ b/passwd.cfg @@ -0,0 +1,3 @@ +#EXAMPLE PASSWD config file +rootpassword=notarealpassword +userpasswort=12345 \ No newline at end of file diff --git a/preseedserver.sh b/preseedserver.sh index c0e646a..7c0ecb3 100755 --- a/preseedserver.sh +++ b/preseedserver.sh @@ -7,6 +7,13 @@ fi LOCALIP=$(hostname -I) +. .passwd.cfg + +#copy the pre-preseed file and update the passwords from the .passwd.cfg file +cp input.cfg preseed.cfg +sed -i "s/@ROOTHASH/$roothash/g" preseed.cfg +sed -i "s/@USERHASH/$userhash/g" preseed.cfg + echo "Starting server. Press CTRL+C to stop." echo -e "Local IP address: \e[32m$LOCALIP\e[0m"