-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from herpiko/secure14
Separate installation process for secure installation
- Loading branch information
Showing
18 changed files
with
44,196 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
sbindir = /sbin | ||
sbin_SCRIPTS = b-i-cleanup b-i-copy-fs b-i-install-grub b-i-setup-fs b-i-encrypt-fs b-i-is-efi b-i-wipe-disk b-i-pre b-i-post | ||
sbin_SCRIPTS = b-i-cleanup b-i-copy-fs b-i-install-grub b-i-setup-fs b-i-encrypt-fs b-i-is-efi b-i-wipe-disk b-i-pre b-i-post b-i-secure-post-install | ||
bin_SCRIPTS = blankon-session-try-installer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/bin/bash | ||
|
||
# This secure-post-install script only run on secure installation and will reconfigure the system with real values from post installation step. | ||
|
||
# Needed by apt-get | ||
export PATH=$PATH:/usr/sbin:/usr/bin:/bin:/sbin | ||
|
||
# The /postinstall/config was generated by secure's b-i-ui | ||
read PASSPHRASE ROOTPASSWORD HOSTNAME FULLNAME USERNAME PASSWORD < /postinstall/config | ||
echo -n $PASSPHRASE > /postinstall/config-passphrase | ||
RANDOMPASS=`cat /postinstall/pass` | ||
RANDOMUSERNAME=`cat /postinstall/user-pass | cut -d':' -f1` | ||
|
||
set -e | ||
|
||
###### REMOVE PACKAGES | ||
echo "Remove packages" | ||
/usr/bin/apt-get --yes purge blankon-installer blankon-repository-setup | ||
echo "Removing unused dependencies" | ||
/usr/bin/apt-get --yes autoremove | ||
rm -f /etc/xdg/autostart/blankon-installer.desktop | ||
|
||
###### ENCRYPTION SPECIFIC SETTING UP | ||
echo "Encryption specific setting up" | ||
|
||
# Add new luks key | ||
echo -n $RANDOMPASS | cryptsetup luksAddKey /dev/lvm/root /postinstall/config-passphrase | ||
echo -n $RANDOMPASS | cryptsetup luksRemoveKey /dev/lvm/root | ||
# To bypass encryption on first reboot, the original askpass script has been manipulated. Put it back. | ||
sed -i 's/cp -a \/tmp\/askpass \$DESTDIR\/lib\/cryptsetup\/askpass//' /etc/initramfs-tools/hooks/cryptroot | ||
|
||
###### HOSTNAME | ||
echo "Setting up hostname $HOSTNAME" | ||
echo $HOSTNAME > /etc/hostname | ||
cat << @@EOF > /etc/hosts | ||
127.0.0.1 localhost $HOSTNAME | ||
# The following lines are desirable for IPv6 capable hosts | ||
::1 ip6-localhost ip6-loopback | ||
fe00::0 ip6-localnet | ||
ff00::0 ip6-mcastprefix | ||
ff02::1 ip6-allnodes | ||
ff02::2 ip6-allrouters | ||
@@EOF | ||
|
||
###### USER | ||
echo "Configuring user $USERNAME" | ||
|
||
USER_GROUPS=`groups $RANDOMUSERNAME | cut -d':' -f2 | sed -r "s/$RANDOMUSERNAME//g" | sed -r "s/ /,/g" | sed -r "s/,,//g"` | ||
echo $USER_GROUPS | ||
/usr/sbin/useradd -G $USER_GROUPS -m -s /bin/bash $USERNAME | ||
echo "$USERNAME:$PASSWORD" | /usr/sbin/chpasswd $USERNAME | ||
#/usr/bin/chfn < $ROOTFS/tmp/user-info | ||
echo "root:$ROOTPASSWORD" | /usr/sbin/chpasswd root | ||
|
||
# Disable nopasswd | ||
sed -i -r -e "/%sudo/c\%sudo ALL=(ALL:ALL) ALL" /etc/sudoers | ||
# Delete the random user | ||
/usr/sbin/userdel -rf $RANDOMUSERNAME | ||
|
||
###### CUSTOM GROUP | ||
if [ -n "$BI_CUSTOM_GROUPS" ];then | ||
for i in $BI_CUSTOM_GROUPS;do | ||
do_chroot /usr/sbin/groupadd -r $i | ||
do_chroot /usr/sbin/adduser $USERNAME $i | ||
done | ||
fi | ||
|
||
###### DISABLE AUTOLOGIN | ||
echo "Disable autologin" | ||
sed -i -r -e "s/autologin-/#autologin-/g" /usr/share/lightdm/lightdm.conf.d/40-lightdm-webkit-greeter.conf | ||
|
||
###### Accounts service | ||
echo "Account service" | ||
if [ -f /run/accounts-service ];then | ||
cp /run/accounts-service /var/lib/AccountsService/users/$USERNAME | ||
fi | ||
|
||
##### UPDATE INITRAMFS | ||
echo "Update initramfs" | ||
CRYPTSETUP=y /usr/sbin/update-initramfs -u -k all | ||
|
||
##### REMOVE POST INSTALLATION FILE | ||
echo "Remove post install files" | ||
rm -rf /postinstall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.