File tree Expand file tree Collapse file tree 4 files changed +29
-4
lines changed Expand file tree Collapse file tree 4 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ set -e
19
19
20
20
DIST=$( lsb_release -c -s)
21
21
22
+ setup_system_init_key () {
23
+ if [ ! -f /usr/local/pf/conf/system_init_key ]; then
24
+ hexdump -e ' /1 "%x"' < /dev/urandom | head -c 32 > /usr/local/pf/conf/system_init_key
25
+ fi
26
+ }
27
+
22
28
case " $1 " in
23
29
configure)
24
30
if [ ! -f /usr/local/pf/conf/pfconfig.conf ]; then
@@ -29,10 +35,7 @@ case "$1" in
29
35
echo " pfconfig.conf already exists, won't touch it!"
30
36
fi
31
37
32
- if [ ! -f /usr/local/pf/conf/system_init_key ]; then
33
- hexdump -e ' /1 "%x"' < /dev/urandom | head -c 32 > /usr/local/pf/conf/system_init_key
34
- fi
35
-
38
+ setup_system_init_key
36
39
/sbin/ldconfig
37
40
if [ ${DIST} = " jessie" ] || [ ${DIST} = " stretch" ] || [ ${DIST} = " bullseye" ] || [ ${DIST} = " bookworm" ]; then
38
41
systemctl enable packetfence-config
Original file line number Diff line number Diff line change @@ -21,9 +21,15 @@ stop_service_if_exists() {
21
21
fi
22
22
}
23
23
24
+ setup_system_init_key () {
25
+ if [ ! -f /usr/local/pf/conf/system_init_key ]; then
26
+ hexdump -e ' /1 "%x"' < /dev/urandom | head -c 32 > /usr/local/pf/conf/system_init_key
27
+ fi
28
+ }
24
29
25
30
case " $1 " in
26
31
install)
32
+ setup_system_init_key
27
33
if grep -E " ^pf:" /etc/passwd > /dev/null ; then
28
34
echo " pf user already exist"
29
35
else
@@ -37,6 +43,7 @@ case "$1" in
37
43
exit 0
38
44
;;
39
45
upgrade)
46
+ setup_system_init_key
40
47
stop_service_if_exists packetfence-config
41
48
set +e
42
49
/usr/sbin/update-rc.d -f packetfence-config remove
Original file line number Diff line number Diff line change @@ -23,8 +23,15 @@ export LC_CTYPE
23
23
24
24
DIST=$( lsb_release -c -s)
25
25
26
+ setup_system_init_key () {
27
+ if [ ! -f /usr/local/pf/conf/system_init_key ]; then
28
+ hexdump -e ' /1 "%x"' < /dev/urandom | head -c 32 > /usr/local/pf/conf/system_init_key
29
+ fi
30
+ }
31
+
26
32
case " $1 " in
27
33
configure)
34
+ setup_system_init_key
28
35
export PACKETFENCE=/usr/local/pf
29
36
export PERL5LIB=/usr/local/pf/lib
30
37
find $PACKETFENCE /conf -type f -exec chmod 664 ' {}' \;
Original file line number Diff line number Diff line change @@ -51,8 +51,15 @@ rm_conffile() {
51
51
fi
52
52
}
53
53
54
+ setup_system_init_key () {
55
+ if [ ! -f /usr/local/pf/conf/system_init_key ]; then
56
+ hexdump -e ' /1 "%x"' < /dev/urandom | head -c 32 > /usr/local/pf/conf/system_init_key
57
+ fi
58
+ }
59
+
54
60
case " $1 " in
55
61
install)
62
+ setup_system_init_key
56
63
stop_service_if_exists packetfence
57
64
if [ -z " $( getent passwd pf) " ]; then
58
65
if ! /usr/bin/id -g pf & > /dev/null; then
@@ -85,6 +92,7 @@ case "$1" in
85
92
;;
86
93
87
94
upgrade)
95
+ setup_system_init_key
88
96
# mv the old raddb dir if upgrading from FreeRADIUS 2
89
97
echo " Upgrading from $2 "
90
98
if dpkg --compare-versions " $2 " lt " 6" ; then
You can’t perform that action at this time.
0 commit comments