]> git.ipfire.org Git - ipfire-2.x.git/blame - src/scripts/setreservedports
HinzugefĆ¼gt:
[ipfire-2.x.git] / src / scripts / setreservedports
CommitLineData
f8e5510c
MT
1#!/bin/sh
2#
3# $Id: setreservedports,v 1.1.2.3 2005/09/07 21:38:50 eoberlander Exp $
4# Change https server port only at this time,
5# it will be integrate in web interface later
6# suggested port for https interface could be 5445
7
8SSH=222
9
10if [ $# -lt 1 ]; then
11 echo "Give an https port number, recommended value is non-assigned port 5445"
12else
13 if [ "$1" -lt "444" -o "$1" -gt "65535" ]; then
14 echo "support only a port value from 445 to 65535"
15 echo "recommended value is non-assigned port 5445"
16 else
17 HTTPS=$1
18 /bin/sed -i -e "s+# TCP 67,68,81.*$+# TCP 67,68,81,$SSH,$HTTPS+" \
19 -e "s+my @tcp_reserved = (81.*$+my @tcp_reserved = (81,$SSH,$HTTPS);+" \
20 /home/httpd/cgi-bin/portfw.cgi
21
22 # only the second Listen only has {3,5} digits if the first is 81
23 /bin/sed -i -e "+s+Listen [0-9]\{3,5\}$+Listen $HTTPS+" \
24 -e "s+<VirtualHost _default_.*$+<VirtualHost _default_:$HTTPS>+" \
25 /etc/httpd/conf/httpd.conf
26
27 /bin/sed -i -e "s+:[0-9]\{3,5\}/\$ENV{'PATH_INFO'}+:$HTTPS/\$ENV{'PATH_INFO'}+" \
28 /var/ipcop/header.pl
29
30 /bin/sed -i -e "s+acl IPFire_https port.*$+acl IPCop_https port $HTTPS+" \
31 /var/ipcop/proxy/acl
32 /bin/chown nobody:nobody /var/ipcop/proxy/acl
33
34 /bin/sed -i -e "s+acl IPFire_https port.*$+acl IPCop_https port $HTTPS+" \
35 /var/ipcop/proxy/squid.conf
36 /bin/chown nobody:nobody /var/ipcop/proxy/squid.conf
37
38 # restart everything impacted
39 /bin/killall httpd
40 sleep 2
41 /usr/sbin/httpd
42 /usr/local/bin/restartsquid
43 /usr/bin/logger -s -p local0.info "$0 :https port shift to $HTTPS"
44 fi
45fi