summarylogtreecommitdiffstats
path: root/mandos.install
blob: fa0726aaee4c3c5148f3a57eaca252f680661943 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
post_install() {
	if ! getent group _mandos > /dev/null; then
		groupadd --system _mandos
	fi
	if ! getent passwd _mandos > /dev/null; then
		useradd -c "Mandos Server" --system -d /var/lib/mandos -s /usr/bin/nologin -g _mandos _mandos
		passwd -l _mandos > /dev/null
	fi
	mkdir -p /var/lib/mandos
	chown -R _mandos:_mandos /var/lib/mandos > /dev/null
	
	# reload dbus, otherwise the mandos server will not start up properly
	systemctl reload-or-restart dbus
	
	echo 'In /etc/avahi/avahi-daemon.conf , enable IPv6 by changing the option'
	echo 'use-ipv6=yes'
	echo 'Then restart the avahi-daemon service: systemctl restart avahi-daemon'
	echo 'Clients will not be able to connect to the mandos server otherwise.'
	echo 'After adding client configs to /etc/mandos/clients.conf'
	echo 'start and enable the Mandos Server with'
	echo 'systemctl start mandos ; systemctl enable mandos'
}

post_upgrade() {
	post_install $1
}

post_remove() {
	if getent passwd _mandos >/dev/null; then
		userdel _mandos
	fi
	if getent group _mandos >/dev/null; then
		groupdel _mandos
	fi
}