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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
# Copyright (c) 2014-2017 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2004-2011 Scott Ullrich <sullrich@gmail.com>
# Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>
# All rights reserved.
# make sure the user can't kill us
trap : 2
trap : 3
# shell started with parameters, passthrough to real shell
if [ -n "${*}" ]; then
/bin/csh "${@}"
exit ${?}
fi
# endless loop
while : ; do
# We `set -e' to force exit if we encounter an error.
# This is mainly useful in case we lose our tty (happens when
# an ssh connection breaks, for example), in which case our stdout
# is closed and the `echo' commands in the while loop will silently fail.
# Failure to exit at that moment would lead to an infinite loop.
set -e
echo
echo " 0) Logout 7) Ping host"
echo " 1) Assign interfaces 8) Shell"
echo " 2) Set interface IP address 9) pfTop"
echo " 3) Reset the root password 10) Firewall log"
echo " 4) Reset to factory defaults 11) Reload all services"
echo " 5) Power off system 12) Upgrade from console"
echo " 6) Reboot system 13) Restore a backup"
echo
read -p "Enter an option: " OPCODE
echo
# The scripts we'll call below may return non-zero, don't exit if they do
set +e
# see what the user has chosen
case ${OPCODE} in
0|exit|logout|quit)
exit
;;
1)
/usr/local/etc/rc.initial.setports
;;
2)
/usr/local/etc/rc.initial.setlanip
;;
3)
/usr/local/etc/rc.initial.password
;;
4)
/usr/local/etc/rc.initial.defaults
;;
5)
/usr/local/etc/rc.initial.halt
;;
6)
/usr/local/etc/rc.initial.reboot
;;
7)
/usr/local/etc/rc.initial.ping
;;
8)
/bin/csh
;;
9)
/usr/local/sbin/pftop
;;
10)
/usr/sbin/tcpdump -s 256 -v -S -l -n -e -ttt -i pflog0
;;
11)
/usr/local/etc/rc.reload_all
;;
12)
/usr/local/etc/rc.initial.firmware
;;
13)
/usr/local/etc/rc.initial.restore
;;
*)
;;
esac
/usr/local/etc/rc.initial.banner
done