Skip to content

Commit a2b2049

Browse files
Christian RebischkeChristian Rebischke
authored andcommitted
Make sure to re-initialize the pacman keyring
We need to re-initialize the pacman keyring for every machine, otherwise every machine would have the same pacman master key. The same pacman master key opens the possibility for Mitm-attacks. Signed-off-by: Christian Rebischke <Chris.Rebischke@posteo.de>
1 parent c42fd65 commit a2b2049

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

http/install-chroot.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,31 @@ Name=eth0
4747
DHCP=ipv4
4848
EOF
4949

50+
# Setup pacman-init.service for clean pacman keyring initialization
51+
cat <<EOF > /etc/systemd/system/pacman-init.service
52+
[Unit]
53+
Description=Initializes Pacman keyring
54+
Wants=haveged.service
55+
After=haveged.service
56+
ConditionFirstBoot=yes
57+
58+
[Service]
59+
Type=oneshot
60+
RemainAfterExit=yes
61+
ExecStart=/usr/bin/pacman-key --init
62+
ExecStart=/usr/bin/pacman-key --populate archlinux
63+
64+
[Install]
65+
WantedBy=multi-user.target
66+
EOF
67+
5068
# enabling important services
69+
systemctl daemon-reload
5170
systemctl enable sshd
71+
systemctl enable haveged
5272
systemctl enable systemd-networkd
5373
systemctl enable systemd-resolved
74+
systemctl enable pacman-init.service
5475

5576
grub-install "$device"
5677
sed -i -e 's/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=1/' /etc/default/grub

http/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mkswap "${device}1"
2525
mkfs.btrfs -L "rootfs" "${device}2"
2626
mount "${device}2" /mnt
2727

28-
pacstrap /mnt base grub openssh sudo polkit btrfs-progs
28+
pacstrap /mnt base grub openssh sudo polkit btrfs-progs haveged
2929
swapon "${device}1"
3030
genfstab -p /mnt >> /mnt/etc/fstab
3131
swapoff "${device}1"

provision/cleanup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ set -x
77
yes | sudo pacman -Scc
88
# Remove machine-id: see https://github.com/archlinux/arch-boxes/issues/25
99
rm /etc/machine-id
10+
# Remove pacman key ring for re-initialization
11+
rm -rf /etc/pacman.d/gnupg/

0 commit comments

Comments
 (0)