1 |
5b237745
|
Scott Ullrich
|
#!/bin/sh
|
2 |
|
|
|
3 |
1b8df11b
|
Bill Marquette
|
# $Id$
|
4 |
5b237745
|
Scott Ullrich
|
# /etc/rc.initial
|
5 |
99227fad
|
Scott Ullrich
|
# part of pfSense by Scott Ullrich
|
6 |
e5cd29a0
|
Scott Ullrich
|
# Copyright (C) 2004 Scott Ullrich, All rights reserved.
|
7 |
|
|
# originally based on m0n0wall (http://neon1.net/m0n0wall)
|
8 |
5b237745
|
Scott Ullrich
|
# Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
9 |
|
|
# All rights reserved.
|
10 |
89c5f759
|
Scott Ullrich
|
|
11 |
cd80a0a8
|
Scott Ullrich
|
# make sure the user can't kill us by pressing Ctrl-C,
|
12 |
|
|
# ctrl-z, etc.
|
13 |
e8b82b81
|
Scott Ullrich
|
#trap : 2
|
14 |
|
|
#trap : 3
|
15 |
|
|
#trap : 4
|
16 |
5b237745
|
Scott Ullrich
|
|
17 |
d1f9da0a
|
Scott Ullrich
|
# 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 |
89c5f759
|
Scott Ullrich
|
CONFIG="/cf/conf/config.xml"
|
28 |
|
|
WORD="https"
|
29 |
|
|
|
30 |
c0c27851
|
Scott Ullrich
|
# Set our operating platform
|
31 |
|
|
PLATFORM=`cat /etc/platform`
|
32 |
|
|
|
33 |
5b237745
|
Scott Ullrich
|
# endless loop
|
34 |
|
|
while : ; do
|
35 |
|
|
|
36 |
7c961207
|
Scott Ullrich
|
if [ -f /tmp/ttybug ]; then
|
37 |
|
|
rm /tmp/ttybug
|
38 |
|
|
exit && exit && logout
|
39 |
|
|
fi
|
40 |
|
|
|
41 |
6a997de8
|
Scott Ullrich
|
/etc/rc.banner
|
42 |
|
|
|
43 |
2580f584
|
Chris Buechler
|
product=`grep product_name /etc/inc/globals.inc | cut -d'"' -f4`
|
44 |
|
|
hidebanner=`grep hidebanner /etc/inc/globals.inc | cut -d'"' -f4`
|
45 |
19525ae7
|
Scott Ullrich
|
|
46 |
5b237745
|
Scott Ullrich
|
# display a cheap menu
|
47 |
085127d2
|
Scott Ullrich
|
echo
|
48 |
223d7e54
|
Scott Ullrich
|
echo
|
49 |
19525ae7
|
Scott Ullrich
|
echo " ${product} console setup "
|
50 |
a0368e6c
|
Scott Ullrich
|
echo "***************************"
|
51 |
e1a8dc99
|
Colin Smith
|
echo " 0) Logout (SSH only)"
|
52 |
|
|
echo " 1) Assign Interfaces"
|
53 |
d2d1f8ce
|
Scott Ullrich
|
echo " 2) Set interface(s) IP address"
|
54 |
9579868f
|
Bill Marquette
|
echo " 3) Reset webConfigurator password"
|
55 |
bfcb39c4
|
Scott Ullrich
|
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 |
ef5ebb35
|
Scott Ullrich
|
echo "10) Filter Logs"
|
62 |
9579868f
|
Bill Marquette
|
echo "11) Restart webConfigurator"
|
63 |
92c5013c
|
Scott Ullrich
|
echo "12) ${product} Developer Shell"
|
64 |
f4feb493
|
Scott Ullrich
|
echo "13) Upgrade from console"
|
65 |
2a5a9c6a
|
Scott Ullrich
|
SSHD=`netstat -an | grep "*.22" | wc -l`
|
66 |
|
|
if [ "$SSHD" -gt 0 ]; then
|
67 |
6c7aa8d8
|
Scott Ullrich
|
echo "14) Disable Secure Shell (sshd)";
|
68 |
2a5a9c6a
|
Scott Ullrich
|
else
|
69 |
6c7aa8d8
|
Scott Ullrich
|
echo "14) Enable Secure Shell (sshd)";
|
70 |
2a5a9c6a
|
Scott Ullrich
|
fi
|
71 |
|
|
|
72 |
f321b3a2
|
Scott Ullrich
|
for i in /var/db/pfi/capable_*; do
|
73 |
|
|
if [ -f $i -a ! -L /cf/conf ]; then
|
74 |
4d28b3ec
|
Scott Ullrich
|
echo "98) Move configuration file to removable device"
|
75 |
f321b3a2
|
Scott Ullrich
|
break
|
76 |
4d28b3ec
|
Scott Ullrich
|
fi
|
77 |
f321b3a2
|
Scott Ullrich
|
done
|
78 |
2730fde3
|
Scott Ullrich
|
|
79 |
|
|
if [ "$PLATFORM" = "cdrom" ]; then
|
80 |
19525ae7
|
Scott Ullrich
|
echo "99) Install ${product} to a hard drive/memory drive, etc."
|
81 |
2730fde3
|
Scott Ullrich
|
echo
|
82 |
|
|
fi
|
83 |
5b237745
|
Scott Ullrich
|
|
84 |
75c72ffb
|
Scott Ullrich
|
echo
|
85 |
568af189
|
Colin Smith
|
read -p "Enter an option: " opmode
|
86 |
4df08112
|
Scott Ullrich
|
echo
|
87 |
5b237745
|
Scott Ullrich
|
|
88 |
|
|
# see what the user has chosen
|
89 |
|
|
case ${opmode} in
|
90 |
debddb24
|
Scott Ullrich
|
0)
|
91 |
c900e2dc
|
Scott Ullrich
|
exit && exit && logout
|
92 |
|
|
;;
|
93 |
5b237745
|
Scott Ullrich
|
1)
|
94 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.setports
|
95 |
|
|
;;
|
96 |
5b237745
|
Scott Ullrich
|
2)
|
97 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.setlanip
|
98 |
|
|
;;
|
99 |
5b237745
|
Scott Ullrich
|
3)
|
100 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.password
|
101 |
|
|
;;
|
102 |
5b237745
|
Scott Ullrich
|
4)
|
103 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.defaults
|
104 |
|
|
;;
|
105 |
5b237745
|
Scott Ullrich
|
5)
|
106 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.reboot
|
107 |
|
|
;;
|
108 |
5b237745
|
Scott Ullrich
|
6)
|
109 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.halt
|
110 |
|
|
;;
|
111 |
5b237745
|
Scott Ullrich
|
7)
|
112 |
c900e2dc
|
Scott Ullrich
|
/etc/rc.initial.ping
|
113 |
|
|
;;
|
114 |
97a741af
|
Scott Ullrich
|
8)
|
115 |
9607c2a4
|
Scott Ullrich
|
/bin/tcsh
|
116 |
c900e2dc
|
Scott Ullrich
|
;;
|
117 |
97a741af
|
Scott Ullrich
|
9)
|
118 |
c900e2dc
|
Scott Ullrich
|
/usr/local/sbin/pftop
|
119 |
|
|
;;
|
120 |
97a741af
|
Scott Ullrich
|
10)
|
121 |
916c5001
|
Scott Ullrich
|
/usr/sbin/tcpdump -n -e -ttt -i pflog0
|
122 |
|
|
;;
|
123 |
8b52f644
|
Scott Ullrich
|
11)
|
124 |
916c5001
|
Scott Ullrich
|
/etc/rc.restart_webgui
|
125 |
|
|
;;
|
126 |
dc7e008c
|
Scott Ullrich
|
12)
|
127 |
916c5001
|
Scott Ullrich
|
/usr/local/sbin/pfSsh.php
|
128 |
|
|
;;
|
129 |
f4feb493
|
Scott Ullrich
|
13)
|
130 |
916c5001
|
Scott Ullrich
|
php -f /etc/rc.initial.firmware_update
|
131 |
|
|
;;
|
132 |
069f9bae
|
Scott Ullrich
|
14)
|
133 |
|
|
php -f /etc/rc.initial.toggle_sshd
|
134 |
|
|
;;
|
135 |
|
|
15)
|
136 |
916c5001
|
Scott Ullrich
|
/etc/rc.banner
|
137 |
|
|
;;
|
138 |
9eb7a7b4
|
Scott Ullrich
|
98)
|
139 |
916c5001
|
Scott Ullrich
|
if [ ! -f /tmp/config_moved ]; then
|
140 |
|
|
/etc/rc.initial.store_config_to_removable_device
|
141 |
|
|
fi
|
142 |
|
|
;;
|
143 |
c26023b4
|
Scott Ullrich
|
99)
|
144 |
916c5001
|
Scott Ullrich
|
if [ -e /dev/ukbd0 ]; then
|
145 |
|
|
env TERM=cons25 /scripts/lua_installer
|
146 |
|
|
else
|
147 |
|
|
/scripts/lua_installer
|
148 |
|
|
fi
|
149 |
|
|
;;
|
150 |
f446f817
|
Scott Ullrich
|
100)
|
151 |
916c5001
|
Scott Ullrich
|
if grep "$WORD" "$CONFIG"; then
|
152 |
|
|
links "https://localhost"
|
153 |
|
|
else
|
154 |
|
|
links "http://localhost"
|
155 |
|
|
fi
|
156 |
|
|
;;
|
157 |
d8d46c26
|
Scott Ullrich
|
"")
|
158 |
4f1fbb19
|
Scott Ullrich
|
killall login ; exit
|
159 |
916c5001
|
Scott Ullrich
|
;;
|
160 |
5b237745
|
Scott Ullrich
|
esac
|
161 |
|
|
|
162 |
4c7856cf
|
Scott Ullrich
|
done
|