Merge pull request #14 from tommytran732/patch-9

Add AppArmor (thanks @tommytran732).
This commit is contained in:
Tommaso Chiti 2021-05-10 07:51:54 +02:00 committed by GitHub
commit c53f0d3f3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -142,7 +142,7 @@ kernel_selector
# Pacstrap (setting up a base sytem onto the new root). # Pacstrap (setting up a base sytem onto the new root).
echo "Installing the base system (it may take a while)." echo "Installing the base system (it may take a while)."
pacstrap /mnt base $kernel $microcode linux-firmware btrfs-progs grub grub-btrfs efibootmgr snapper sudo pacstrap /mnt base $kernel $microcode linux-firmware btrfs-progs grub grub-btrfs efibootmgr snapper sudo apparmor
network_selector network_selector
@ -178,6 +178,7 @@ sed -i -e 's,modconf block filesystems keyboard,keyboard keymap modconf block en
# Setting up LUKS Keyfile, BTRFS Booting and encryption in GRUB and initramfs. # Setting up LUKS Keyfile, BTRFS Booting and encryption in GRUB and initramfs.
UUID=$(blkid $Cryptroot | cut -f2 -d'"') UUID=$(blkid $Cryptroot | cut -f2 -d'"')
sed -i "s,quiet,quiet cryptdevice=UUID=$UUID:cryptroot root=$BTRFS,g" /mnt/etc/default/grub sed -i "s,quiet,quiet cryptdevice=UUID=$UUID:cryptroot root=$BTRFS,g" /mnt/etc/default/grub
sed -i "s#root=/dev/mapper/cryptroot#root=/dev/mapper/cryptroot lsm=lockdown,yama,apparmor,bpf#g" /mnt/etc/default/grub
# Security kernel settings. # Security kernel settings.
echo "kernel.kptr_restrict = 2" > /mnt/etc/sysctl.d/51-kptr-restrict.conf echo "kernel.kptr_restrict = 2" > /mnt/etc/sysctl.d/51-kptr-restrict.conf
@ -223,6 +224,9 @@ arch-chroot /mnt /bin/bash -e <<EOF
echo "Creating GRUB config file." echo "Creating GRUB config file."
grub-mkconfig -o /boot/grub/grub.cfg &>/dev/null grub-mkconfig -o /boot/grub/grub.cfg &>/dev/null
# Enabling AppArmor
systemctl enable apparmor --root=/mnt &>/dev/null
EOF EOF
# Setting root password. # Setting root password.