From 9083b43a67467e9cc7d07ae0d88f55d483055007 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 26 Dec 2017 21:11:22 +0000 Subject: [PATCH 1/2] Ensure that default fbone user gets removed on first boot of the non-mesh system --- src/freedombone-utils-final | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/freedombone-utils-final b/src/freedombone-utils-final index 0dedf637..c38b4a82 100755 --- a/src/freedombone-utils-final +++ b/src/freedombone-utils-final @@ -91,10 +91,46 @@ function update_installed_apps_list { cat $COMPLETION_FILE | grep "install_" > /usr/share/${PROJECT_NAME}/installed.txt } +function create_default_user_removal_daemon { + # This daemon runs on first boot and removes the default fbone user + + first_start_daemon_filename=/etc/systemd/system/firststart.service + first_start_script=/usr/local/bin/firststart + echo '#!/bin/bash' > $first_start_script + echo 'if [ -d /home/fbone]; then' >> $first_start_script + echo ' userdel -r fbone' >> $first_start_script + echo ' if [ -d /home/fbone]; then' >> $first_start_script + echo ' rm -rf /home/fbone' >> $first_start_script + echo ' fi' >> $first_start_script + echo 'fi' >> $first_start_script + echo 'systemctl disable firststart' >> $first_start_script + echo "rm $first_start_daemon_filename" >> $first_start_script + chmod +x $first_start_script + + echo '[Unit]' > $first_start_daemon_filename + echo 'Description=Daemon run on first boot' >> $first_start_daemon_filename + echo 'After=syslog.target' >> $first_start_daemon_filename + echo 'After=network.target' >> $first_start_daemon_filename + echo '' >> $first_start_daemon_filename + echo '[Service]' >> $first_start_daemon_filename + echo 'User=root' >> $first_start_daemon_filename + echo 'Group=root' >> $first_start_daemon_filename + echo "ExecStart=$first_start_script" >> $first_start_daemon_filename + echo 'StandardOutput=syslog' >> $first_start_daemon_filename + echo 'StandardError=syslog' >> $first_start_daemon_filename + echo '' >> $first_start_daemon_filename + echo '[Install]' >> $first_start_daemon_filename + echo 'WantedBy=multi-user.target' >> $first_start_daemon_filename + systemctl enable firststart +} + function setup_final { function_check update_installed_apps_list update_installed_apps_list + function_check create_default_user_removal_daemon + create_default_user_removal_daemon + function_check install_tripwire install_tripwire From 78e9bdb93e095dc22344e3b6a31f3f9dddf27681 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 26 Dec 2017 21:52:00 +0000 Subject: [PATCH 2/2] More of an explanation about username at the end of installation --- src/freedombone | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/freedombone b/src/freedombone index 5d7d3958..3fd8463b 100755 --- a/src/freedombone +++ b/src/freedombone @@ -358,6 +358,10 @@ setup_apps $command_options setup_final echo '' -echo "${PROJECT_NAME} installation is complete" +echo $"${PROJECT_NAME} installation is complete." +echo '' +echo $'The default fbone user will be deleted when the system restarts.' +echo $'Next time you login use the username you gave during the install.' +echo '' exit 0