This commit is contained in:
xdrm-brackets 2017-01-25 16:33:53 +01:00
parent 0a6b9e73af
commit 2480d669b6
3 changed files with 53 additions and 52 deletions

View File

@ -11,6 +11,9 @@ echo "<<< done";
# [!] Check parameter : device file # [!] Check parameter : device file
#========================================================# #========================================================#
@ -30,6 +33,9 @@ DEV="$1";
# [1] Init device layout (gpt table) # [1] Init device layout (gpt table)
#========================================================# #========================================================#
step1(){ step1(){
@ -55,6 +61,8 @@ step1(){
# [2] Initialize GTP Table # [2] Initialize GTP Table
#========================================================# #========================================================#
step2(){ step2(){
@ -77,6 +85,8 @@ step2(){
# [3] Burn image to device # [3] Burn image to device
#========================================================# #========================================================#
step3(){ step3(){
@ -116,6 +126,9 @@ step4(){
# [5] Updating users # [5] Updating users
#========================================================# #========================================================#
step5(){ step5(){
@ -129,7 +142,6 @@ step5(){
# (2) Adding 'sats' user and new pi entry # # (2) Adding 'sats' user and new pi entry #
echo " (.) Adding 'sats' user and updated 'pi'"; echo " (.) Adding 'sats' user and updated 'pi'";
echo " > /etc/shadow";
cat ./utility/shadow_append | tee -a ./tmp/shadow > /dev/null; cat ./utility/shadow_append | tee -a ./tmp/shadow > /dev/null;
# (3) Setting sats random password # # (3) Setting sats random password #
@ -137,11 +149,14 @@ step5(){
RANDOM_PASS=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 150); RANDOM_PASS=$(tr -dc A-Za-z0-9_ < /dev/urandom | head -c 150);
RANDOM_SHADOW="$(python3 -c "import crypt; print(crypt.crypt(\"${RANDOM_PASS}\", crypt.mksalt(crypt.METHOD_SHA512)))")"; RANDOM_SHADOW="$(python3 -c "import crypt; print(crypt.crypt(\"${RANDOM_PASS}\", crypt.mksalt(crypt.METHOD_SHA512)))")";
RANDOM_SHADOW="$(echo $RANDOM_SHADOW | sed 's/\//\\\//g')" RANDOM_SHADOW="$(echo $RANDOM_SHADOW | sed 's/\//\\\//g')"
cat ./tmp/shadow | sed -e "s/sats-passowrd/$RANDOM_SHADOW/"; cat ./tmp/shadow | sed "s/sats-passowrd/$RANDOM_SHADOW/" | tee ./tmp/shadow > /dev/null;
cat ./tmp/shadow | sudo tee /mnt/etc/shadow | sudo tee /mnt/etc/shadow- > /dev/null; # (4) Update real files #
echo " (.) Update real files";
echo " > /etc/shadow";
cat ./tmp/shadow | sudo tee /mnt/etc/shadow | sudo tee /mnt/etc/shadow- > /dev/null;
rm ./tmp/shadow; rm ./tmp/shadow;
echo " > /etc/passwd"; echo " > /etc/passwd";
@ -157,10 +172,16 @@ step5(){
echo "<<< done"; echo "<<< done";
read -p "next" next;
step6; step6;
} }
# [6] Updating groups # [6] Updating groups
#========================================================# #========================================================#
step6(){ step6(){
@ -177,6 +198,9 @@ step6(){
# [7] Manage SSH keys # # [7] Manage SSH keys #
#========================================================# #========================================================#
step7(){ step7(){
@ -223,7 +247,7 @@ step7(){
# (9) Define config alias with ssh-key # # (9) Define config alias with ssh-key #
echo " (.) Define alias config"; echo " (.) Define alias config";
echo "Host\tsmmp-server\n\tHostname\t${SERVER_HOSTNAME}\n\tUser\t${SERVER_USERNAME}\n\tIdentityFile\t~/.ssh/id_ecdsa\n" | sudo tee /mnt/home/sats/.ssh/config > /dev/null; echo "Host\tsmmp-server\n\tHostname\t$SERVER_HOSTNAME\n\tUser\t$SERVER_USERNAME\n\tIdentityFile\t~/.ssh/id_ecdsa\n" | sudo tee /mnt/home/sats/.ssh/config > /dev/null;
sudo chown 666:666 /mnt/home/sats/.ssh/config; sudo chown 666:666 /mnt/home/sats/.ssh/config;
sudo chmod 444 /mnt/home/sats/.ssh/config; sudo chmod 444 /mnt/home/sats/.ssh/config;
@ -235,6 +259,11 @@ step7(){
} }
# [8] Set up sats automatic login # [8] Set up sats automatic login
#========================================================# #========================================================#
step8(){ step8(){
@ -243,13 +272,13 @@ step8(){
# (1) Create link in order to be handled # # (1) Create link in order to be handled #
echo " (.) Emulate \`systemctl set-default multi-user.target\`"; echo " (.) Emulate \`systemctl set-default multi-user.target\`";
sudo ln -fs /lib/systemd/system/multi-user.target /mnt/etc/systemd/system/default.target; #sudo ln -fs /lib/systemd/system/multi-user.target /mnt/etc/systemd/system/default.target;
# (2) Link autologin to tty service # # (2) Link autologin to tty service #
echo " (.) Link autologin script to tty's default"; echo " (.) Link autologin script to tty's default";
sudo mkdir -pv /mnt/etc/systemd/system/getty@tty1.service.d; #sudo mkdir -pv /mnt/etc/systemd/system/getty@tty1.service.d;
sudo touch /mnt/etc/systemd/system/getty@tty1.service.d/autologin.conf; #sudo touch /mnt/etc/systemd/system/getty@tty1.service.d/autologin.conf;
cat ./utility/autologin_overload.conf | sudo tee /mnt/etc/systemd/system/getty@tty1.service.d/autologin.conf > /dev/null; #cat ./utility/autologin_overload.conf | sudo tee /mnt/etc/systemd/system/getty@tty1.service.d/autologin.conf > /dev/null;
echo "<<< done"; echo "<<< done";
@ -261,6 +290,8 @@ step8(){
# [9] Manage Network config # [9] Manage Network config
#========================================================# #========================================================#
step9(){ step9(){
@ -274,6 +305,10 @@ step9(){
} }
# [10] Set up SATS daemon # [10] Set up SATS daemon
#========================================================# #========================================================#
step10(){ step10(){
@ -299,7 +334,7 @@ step10(){
# (4) Enable startup service unit # # (4) Enable startup service unit #
echo " (.) Emulate \`systemctl enable sats.service\`"; echo " (.) Emulate \`systemctl enable sats.service\`";
sudo mkdir -p /mnt/etc/systemd/system/multi-user.target.wants; sudo mkdir -p /mnt/etc/systemd/system/multi-user.target.wants;
#sudo ln -fs /lib/systemd/system/sats.service /mnt/etc/systemd/system/multi-user.target.wants/sats.service; sudo ln -fs /lib/systemd/system/sats.service /mnt/etc/systemd/system/multi-user.target.wants/sats.service;
# (5) Adjust permissions # # (5) Adjust permissions #
echo " (.) Adjust permissions"; echo " (.) Adjust permissions";
@ -315,6 +350,10 @@ step10(){
# [11] BLablslkfjdlkdsjfks # [11] BLablslkfjdlkdsjfks
#========================================================# #========================================================#
step11(){ step11(){
@ -325,6 +364,10 @@ step11(){
# [0] Step choice # [0] Step choice
#========================================================# #========================================================#
echo "\nSTEPS"; echo "\nSTEPS";

View File

@ -1,42 +0,0 @@
root:$6$ndI3Yluj$IsyVa2pH9C9uaaDwXpuAo4CCoKed3MZ2wh.9riQjkRzRmNZL11tEqRnQWaTucpYz29423JBLm8QG740geSm/9/:17186:0:99999:7:::
daemon:*:16911:0:99999:7:::
bin:*:16911:0:99999:7:::
sys:*:16911:0:99999:7:::
sync:*:16911:0:99999:7:::
games:*:16911:0:99999:7:::
man:*:16911:0:99999:7:::
lp:*:16911:0:99999:7:::
mail:*:16911:0:99999:7:::
news:*:16911:0:99999:7:::
uucp:*:16911:0:99999:7:::
proxy:*:16911:0:99999:7:::
www-data:*:16911:0:99999:7:::
backup:*:16911:0:99999:7:::
list:*:16911:0:99999:7:::
irc:*:16911:0:99999:7:::
gnats:*:16911:0:99999:7:::
nobody:*:16911:0:99999:7:::
systemd-timesync:*:16911:0:99999:7:::
systemd-network:*:16911:0:99999:7:::
systemd-resolve:*:16911:0:99999:7:::
systemd-bus-proxy:*:16911:0:99999:7:::
syslog:*:16911:0:99999:7:::
_apt:*:16911:0:99999:7:::
messagebus:*:16911:0:99999:7:::
uuidd:*:16911:0:99999:7:::
lightdm:*:16911:0:99999:7:::
whoopsie:*:16911:0:99999:7:::
avahi-autoipd:*:16911:0:99999:7:::
avahi:*:16911:0:99999:7:::
dnsmasq:*:16911:0:99999:7:::
colord:*:16911:0:99999:7:::
speech-dispatcher:!:16911:0:99999:7:::
hplip:*:16911:0:99999:7:::
kernoops:*:16911:0:99999:7:::
pulse:*:16911:0:99999:7:::
rtkit:*:16911:0:99999:7:::
saned:*:16911:0:99999:7:::
usbmux:*:16911:0:99999:7:::
xdrm-brackets:$6$aA2bAv6a$jaInJx6rStN5X9pz7fMv4RTJL8XJzLhc6ajywifQbM5mM0TQu4hH0bQq/bzmD27rQAHkMdxJoZBQGMly6wpz//:17185:0:99999:7:::
mysql:!:17185:0:99999:7:::
test:$6$2w5LdwSD$KZP5f6maw3x0vKNhSj97KXhQLnm00iYSkjkYuk.TJK1YC.LssTHBWb03s5/1BZhXMhTzLb6xzox8EJ3kSyK4a1:17188:0:99999:7:::

View File

@ -1,3 +1,3 @@
[Service] [Service]
ExecStart= ExecStart=
ExecStart=-/sbin/agetty --autologin sats --noclear I 38440 linux ExecStart=-/sbin/agetty --autologin sats --noclear %I 38400 linux