1
|
#!/bin/sh
|
2
|
|
3
|
# $Id$
|
4
|
# /etc/rc.initial
|
5
|
# part of pfSense by Scott Ullrich
|
6
|
# Copyright (C) 2004 Scott Ullrich, All rights reserved.
|
7
|
# originally based on m0n0wall (http://neon1.net/m0n0wall)
|
8
|
# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
9
|
# All rights reserved.
|
10
|
|
11
|
# make sure the user can't kill us by pressing Ctrl-C,
|
12
|
# ctrl-z, etc.
|
13
|
#trap : 2
|
14
|
#trap : 3
|
15
|
#trap : 4
|
16
|
|
17
|
# If recovery console shell option has been specified
|
18
|
if [ -f "/tmp/donotbootup" ]; then
|
19
|
/usr/bin/env prompt="%B[%n@%m]%b%/(%h)||RecoveryConsoleShell: " /bin/tcsh
|
20
|
rm "/tmp/donotbootup"
|
21
|
echo "Rebooting in 5 seconds... CTRL-C to abort..."
|
22
|
sleep 5
|
23
|
/etc/rc.reboot
|
24
|
exit
|
25
|
fi
|
26
|
|
27
|
CONFIG="/cf/conf/config.xml"
|
28
|
WORD="https"
|
29
|
|
30
|
# Set our operating platform
|
31
|
PLATFORM=`cat /etc/platform`
|
32
|
|
33
|
# endless loop
|
34
|
while : ; do
|
35
|
|
36
|
if [ -f /tmp/ttybug ]; then
|
37
|
rm /tmp/ttybug
|
38
|
exit && exit && logout
|
39
|
fi
|
40
|
|
41
|
/etc/rc.banner
|
42
|
|
43
|
product=`grep product_name /etc/inc/globals.inc | cut -d'"' -f4`
|
44
|
hidebanner=`grep hidebanner /etc/inc/globals.inc | cut -d'"' -f4`
|
45
|
|
46
|
# display a cheap menu
|
47
|
echo
|
48
|
echo
|
49
|
echo " ${product} console setup "
|
50
|
echo "***************************"
|
51
|
echo " 0) Logout (SSH only)"
|
52
|
echo " 1) Assign Interfaces"
|
53
|
echo " 2) Set interface(s) IP address"
|
54
|
echo " 3) Reset webConfigurator password"
|
55
|
echo " 4) Reset to factory defaults"
|
56
|
echo " 5) Reboot system"
|
57
|
echo " 6) Halt system"
|
58
|
echo " 7) Ping host"
|
59
|
echo " 8) Shell"
|
60
|
echo " 9) PFtop"
|
61
|
echo "10) Filter Logs"
|
62
|
echo "11) Restart webConfigurator"
|
63
|
echo "12) ${product} Developer Shell"
|
64
|
echo "13) Upgrade from console"
|
65
|
SSHD=`netstat -an | grep "*.22" | wc -l`
|
66
|
if [ "$SSHD" -gt 0 ]; then
|
67
|
echo "14) Disable Secure Shell (sshd)";
|
68
|
else
|
69
|
echo "14) Enable Secure Shell (sshd)";
|
70
|
fi
|
71
|
|
72
|
for i in /var/db/pfi/capable_*; do
|
73
|
if [ -f $i -a ! -L /cf/conf ]; then
|
74
|
echo "98) Move configuration file to removable device"
|
75
|
break
|
76
|
fi
|
77
|
done
|
78
|
|
79
|
if [ "$PLATFORM" = "cdrom" ]; then
|
80
|
echo "99) Install ${product} to a hard drive/memory drive, etc."
|
81
|
echo
|
82
|
fi
|
83
|
|
84
|
echo
|
85
|
read -p "Enter an option: " opmode
|
86
|
echo
|
87
|
|
88
|
# see what the user has chosen
|
89
|
case ${opmode} in
|
90
|
0)
|
91
|
exit && exit && logout
|
92
|
;;
|
93
|
1)
|
94
|
/etc/rc.initial.setports
|
95
|
;;
|
96
|
2)
|
97
|
/etc/rc.initial.setlanip
|
98
|
;;
|
99
|
3)
|
100
|
/etc/rc.initial.password
|
101
|
;;
|
102
|
4)
|
103
|
/etc/rc.initial.defaults
|
104
|
;;
|
105
|
5)
|
106
|
/etc/rc.initial.reboot
|
107
|
;;
|
108
|
6)
|
109
|
/etc/rc.initial.halt
|
110
|
;;
|
111
|
7)
|
112
|
/etc/rc.initial.ping
|
113
|
;;
|
114
|
8)
|
115
|
/bin/tcsh
|
116
|
;;
|
117
|
9)
|
118
|
/usr/local/sbin/pftop
|
119
|
;;
|
120
|
10)
|
121
|
/usr/sbin/tcpdump -n -e -ttt -i pflog0
|
122
|
;;
|
123
|
11)
|
124
|
/etc/rc.restart_webgui
|
125
|
;;
|
126
|
12)
|
127
|
/usr/local/sbin/pfSsh.php
|
128
|
;;
|
129
|
13)
|
130
|
php -f /etc/rc.initial.firmware_update
|
131
|
;;
|
132
|
14)
|
133
|
php -f /etc/rc.initial.toggle_sshd
|
134
|
;;
|
135
|
15)
|
136
|
/etc/rc.banner
|
137
|
;;
|
138
|
98)
|
139
|
if [ ! -f /tmp/config_moved ]; then
|
140
|
/etc/rc.initial.store_config_to_removable_device
|
141
|
fi
|
142
|
;;
|
143
|
99)
|
144
|
if [ -e /dev/ukbd0 ]; then
|
145
|
env TERM=cons25 /scripts/lua_installer
|
146
|
else
|
147
|
/scripts/lua_installer
|
148
|
fi
|
149
|
;;
|
150
|
100)
|
151
|
if grep "$WORD" "$CONFIG"; then
|
152
|
links "https://localhost"
|
153
|
else
|
154
|
links "http://localhost"
|
155
|
fi
|
156
|
;;
|
157
|
"")
|
158
|
killall login ; exit
|
159
|
;;
|
160
|
esac
|
161
|
|
162
|
done
|
163
|
|