~ubuntu-branches/ubuntu/utopic/ufw/utopic

« back to all changes in this revision

Viewing changes to tests/good/route/runtest.sh

  • Committer: Package Import Robot
  • Author(s): Jamie Strandboge
  • Date: 2014-02-20 09:23:54 UTC
  • mfrom: (30.1.16)
  • Revision ID: package-import@ubuntu.com-20140220092354-bfbvpmrbgpxlxxha
Tags: 0.34~rc-0ubuntu1
* New upstream pre-release (LP: #1059060, #1065297, #1062521, #1101304,
  LP: #1075975, #1089262, #262421)
* Dropped the following patches now included upstream:
  - 0002-lp1044361.patch
  - 0003-fix-typeerror-on-error.patch
  - 0004-lp1039729.patch
  - 0005-lp1191197.patch
* Remaining changes:
  - 0001-optimize-boot.patch: only read in /etc/ufw/ufw.conf when disabled
* debian/before[6].rules.md5sum: adjusted for new release
* debian/control: update Standards-Version to 3.9.5
* debian/rules:
  - only ship /usr/share/ufw/iptables/*rules and not /usr/share/ufw/
  - *.init files should also be config files
* debian/ufw.links: added to makes symlinks from /usr/share/ufw/iptables/*
  to /usr/share/ufw/ (so ucf is happy on upgrades)
* debian/ufw.postinst:
  - use TEMPLATE_PATH/iptables/*rules instead of TEMPLATE_PATH/*rules (not
    strictly required since we are using dh_link, but makes the intent
    clearer)
  - copy /usr/share/ufw/*.init in to /etc/ufw

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
#    Copyright 2014 Canonical Ltd.
 
4
#
 
5
#    This program is free software: you can redistribute it and/or modify
 
6
#    it under the terms of the GNU General Public License version 3,
 
7
#    as published by the Free Software Foundation.
 
8
#
 
9
#    This program is distributed in the hope that it will be useful,
 
10
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
#    GNU General Public License for more details.
 
13
#
 
14
#    You should have received a copy of the GNU General Public License
 
15
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 
 
17
source "$TESTPATH/../testlib.sh"
 
18
 
 
19
echo "Man page" >> $TESTTMP/result
 
20
do_cmd "0" --dry-run route deny proto udp from 1.2.3.4 to any port 514
 
21
do_cmd "0" --dry-run route delete deny proto udp from 1.2.3.4 to any port 514
 
22
do_cmd "0" --dry-run route allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469
 
23
do_cmd "0" --dry-run route delete allow proto udp from 1.2.3.5 port 5469 to 1.2.3.4 port 5469
 
24
 
 
25
echo "SIMPLE" >> $TESTTMP/result
 
26
do_cmd "0" --dry-run route allow ssh
 
27
do_cmd "0" --dry-run route delete allow ssh
 
28
do_cmd "0" --dry-run route allow ssh/tcp
 
29
do_cmd "0" --dry-run route delete allow ssh/tcp
 
30
do_cmd "0" --dry-run route allow ssh/udp
 
31
do_cmd "0" --dry-run route delete allow ssh/udp
 
32
 
 
33
echo "Interfaces" >> $TESTTMP/result
 
34
in_if="fake0"
 
35
out_if="fake1"
 
36
do_cmd "0" --dry-run route allow in on $in_if
 
37
do_cmd "0" --dry-run route delete allow in on $in_if
 
38
do_cmd "0" --dry-run route deny out on $out_if
 
39
do_cmd "0" --dry-run route delete deny out on $out_if
 
40
 
 
41
echo "TO/FROM" >> $TESTTMP/result
 
42
from="192.168.0.1"
 
43
to="10.0.0.1"
 
44
do_cmd "0" --dry-run route allow from $from
 
45
do_cmd "0" --dry-run route delete allow from $from
 
46
do_cmd "0" --dry-run route deny to $to
 
47
do_cmd "0" --dry-run route delete deny to $to
 
48
do_cmd "0" --dry-run route limit to $to from $from
 
49
do_cmd "0" --dry-run route delete limit to $to from $from
 
50
 
 
51
do_cmd "0" --dry-run route allow in on $in_if from $from
 
52
do_cmd "0" --dry-run route delete allow in on $in_if from $from
 
53
do_cmd "0" --dry-run route deny out on $out_if to $to
 
54
do_cmd "0" --dry-run route delete deny out on $out_if to $to
 
55
do_cmd "0" --dry-run route limit in on $in_if out on $out_if from $from to $to
 
56
do_cmd "0" --dry-run route delete limit in on $in_if out on $out_if from $from to $to
 
57
 
 
58
do_cmd "0" --dry-run route allow from $from port 80
 
59
do_cmd "0" --dry-run route delete allow from $from port 80
 
60
do_cmd "0" --dry-run route deny to $to port 25
 
61
do_cmd "0" --dry-run route delete deny to $to port 25
 
62
do_cmd "0" --dry-run route limit in on $in_if out on $out_if from $from port 25 to $to port 25 proto tcp
 
63
do_cmd "0" --dry-run route delete limit in on $in_if out on $out_if from $from port 25 to $to port 25 proto tcp
 
64
 
 
65
echo "Services" >> $TESTTMP/result
 
66
do_cmd "0" --dry-run route allow to any port smtp from any port smtp
 
67
do_cmd "0" --dry-run route delete allow to any port smtp from any port smtp
 
68
do_cmd "0" --dry-run route allow in on $in_if out on $out_if to any port smtp from any port smtp
 
69
do_cmd "0" --dry-run route delete allow in on $in_if out on $out_if to any port smtp from any port smtp
 
70
 
 
71
echo "Netmasks" >> $TESTTMP/result
 
72
do_cmd "0" --dry-run route reject from 192.168.0.1/32 to 192.168.0.0/16
 
73
do_cmd "0" --dry-run route delete reject from 192.168.0.1/32 to 192.168.0.0/16
 
74
 
 
75
echo "Multiports:" >> $TESTTMP/result
 
76
do_cmd "0" --dry-run route limit 23,21,15:19,22/tcp
 
77
do_cmd "0" --dry-run route delete limit 23,21,15:19,22/tcp
 
78
do_cmd "0" --dry-run route allow in on $in_if out on $out_if from 192.168.0.1 port 23,21,15:19,22 to 10.0.0.0/8 port 24:26 proto tcp
 
79
do_cmd "0" --dry-run route delete allow in on $in_if out on $out_if from 192.168.0.1 port 23,21,15:19,22 to 10.0.0.0/8 port 24:26 proto tcp
 
80
do_cmd "0" --dry-run route deny in on $in_if to any port 34,35:39 from any port 24 proto udp
 
81
do_cmd "0" --dry-run route delete deny in on $in_if to any port 34,35:39 from any port 24 proto udp
 
82
 
 
83
echo "Insert" >> $TESTTMP/result
 
84
do_cmd "0" null route allow 22
 
85
do_cmd "0" null route allow 23
 
86
 
 
87
do_cmd "0" null route insert 1 allow 9999
 
88
do_cmd "0" null route insert 1 allow log 9998
 
89
do_cmd "0" null route insert 2 reject to 192.168.0.1 from 10.0.0.1
 
90
cat $TESTSTATE/user.rules >> $TESTTMP/result
 
91
 
 
92
do_cmd "0" null route delete allow 22
 
93
do_cmd "0" null route delete allow 23
 
94
do_cmd "0" null route delete allow 9999
 
95
do_cmd "0" null route delete allow log 9998
 
96
do_cmd "0" null route delete reject to 192.168.0.1 from 10.0.0.1
 
97
cat $TESTSTATE/user.rules >> $TESTTMP/result
 
98
 
 
99
echo "ipv6 protocols" >> $TESTTMP/result
 
100
do_cmd "0" --dry-run route allow in on $in_if to 10.0.0.1 proto ipv6
 
101
do_cmd "0" --dry-run route delete allow in on $in_if to 10.0.0.1 proto ipv6
 
102
do_cmd "0" --dry-run route deny out on $out_if to 10.0.0.1 from 10.4.0.0/16 proto ah
 
103
do_cmd "0" --dry-run route delete deny out on $out_if to 10.0.0.1 from 10.4.0.0/16 proto ah
 
104
do_cmd "0" --dry-run route limit in on $in_if out on $out_if to 10.0.0.1 proto esp
 
105
do_cmd "0" --dry-run route delete limit in on $in_if out on $out_if to 10.0.0.1 proto esp
 
106
 
 
107
exit 0