forked from extern/shorewall_code
Compare commits
1011 Commits
4.5.0.1
...
4.5.10-bas
Author | SHA1 | Date | |
---|---|---|---|
|
4d064d6713 | ||
|
6ab5cfd63a | ||
|
7190cd1265 | ||
|
61d67a4741 | ||
|
4ec47783f1 | ||
|
60012d1208 | ||
|
a7b8b53f72 | ||
|
fc3606a489 | ||
|
ad4709cb6d | ||
|
c0abdc1fe8 | ||
|
d5405757dd | ||
|
cd5e9be467 | ||
|
334bdd16d6 | ||
|
c05c928c6c | ||
|
a33cf5cc91 | ||
|
9da507ae98 | ||
|
e0e7b2a9f2 | ||
|
65676cb865 | ||
|
8ebbdee20f | ||
|
6c1a5b8051 | ||
|
cc657e571d | ||
|
f358a78eca | ||
|
b9adc2ebec | ||
|
44f00cd0aa | ||
|
ae5680401f | ||
|
8cbe26e32c | ||
|
146402d9be | ||
|
70f26d8bb2 | ||
|
893d054cb8 | ||
|
53fd0e7c8c | ||
|
87e205208d | ||
|
6702bb1989 | ||
|
1fe1c2209c | ||
|
e60369728a | ||
|
7d4bc568d8 | ||
|
11d4e92a29 | ||
|
409c427134 | ||
|
7bdce1bc97 | ||
|
e1524763ad | ||
|
15121e0743 | ||
|
172c1a5b44 | ||
|
9c0d8a2533 | ||
|
bff91cd325 | ||
|
8006d150f1 | ||
|
e44acdc6af | ||
|
e2297f2582 | ||
|
d7096ae52e | ||
|
6bf996d4b8 | ||
|
85a46690c0 | ||
|
a4dcd1071a | ||
|
78ba8bac50 | ||
|
bf75b2b919 | ||
|
7673b1ac4b | ||
|
fc87576005 | ||
|
3f550622bd | ||
|
21c2963691 | ||
|
e7dee420ee | ||
|
e45fe53705 | ||
|
697fc001c3 | ||
|
642f192b3d | ||
|
dd0f42c462 | ||
|
7b0578fa84 | ||
|
5acf0f60e7 | ||
|
fb3194d96b | ||
|
629717f7cc | ||
|
8e239c90c1 | ||
|
8c2db40783 | ||
|
066a017420 | ||
|
1870c281a9 | ||
|
dbfc805707 | ||
|
748d532175 | ||
|
b7e2b28562 | ||
|
67e1e6cf91 | ||
|
cd2854cad0 | ||
|
75c148a2dd | ||
|
71bbc632ce | ||
|
b6a1a7d538 | ||
|
30de211bda | ||
|
3f7425b6a0 | ||
|
47ef3db53c | ||
|
8a744de906 | ||
|
059095e366 | ||
|
26dee73895 | ||
|
df7ce1a7d1 | ||
|
4a05571e7e | ||
|
b89e05740d | ||
|
3040156981 | ||
|
54dadcc546 | ||
|
952aed225d | ||
|
7bfbf522bc | ||
|
1efd47a7e9 | ||
|
c0a2f19500 | ||
|
374489c3cf | ||
|
77f342b0e0 | ||
|
8f52c9744e | ||
|
1957af04fd | ||
|
a0faba2a03 | ||
|
9a8cf60857 | ||
|
c798200b20 | ||
|
67ae9df0f8 | ||
|
ebb4e1f6e4 | ||
|
f458e99390 | ||
|
5b049d7e9e | ||
|
3b20c0db54 | ||
|
0d8931e49f | ||
|
47791add99 | ||
|
be587726f4 | ||
|
60a509c926 | ||
|
b25ece75de | ||
|
e9ef03f723 | ||
|
37779038da | ||
|
0db7b6c58a | ||
|
57e913d86e | ||
|
263f4e57cb | ||
|
a4294658b6 | ||
|
65e1b1c9e7 | ||
|
a07cfb0885 | ||
|
9dac330756 | ||
|
dfd02c932e | ||
|
c6ffdd67e2 | ||
|
5265cd5bb7 | ||
|
ab381ed95e | ||
|
0277d6628e | ||
|
5712438bcb | ||
|
a2b14c37ed | ||
|
054248d2cb | ||
|
a484cb848f | ||
|
b1ffcd8628 | ||
|
34e3e4bf82 | ||
|
06a4994488 | ||
|
391113dfe3 | ||
|
3c58d2180d | ||
|
32c9e4274f | ||
|
896d874aab | ||
|
5fcdfd779c | ||
|
860ee6de27 | ||
|
4b6fdf8b72 | ||
|
0e7a4d56fd | ||
|
ec17ea1dee | ||
|
2e211bc2b6 | ||
|
6e4632663b | ||
|
5f0b85b5b9 | ||
|
86ae74005a | ||
|
e11dac3fe2 | ||
|
d3c63a2d97 | ||
|
39c0991940 | ||
|
9e984b10f6 | ||
|
19048b6a18 | ||
|
2fcbeb9ddf | ||
|
8397244fd6 | ||
|
ef3652fc98 | ||
|
b9139a4ec8 | ||
|
1e7a196b3d | ||
|
3f1aeb33be | ||
|
e908473d29 | ||
|
e177916c12 | ||
|
d0e03bb03a | ||
|
0387b16983 | ||
|
f24e194819 | ||
|
59a75512be | ||
|
5a103e8ec5 | ||
|
cf68379c4c | ||
|
6c06302d2a | ||
|
ca5a0f4b15 | ||
|
baf42f2ac0 | ||
|
30066062d1 | ||
|
b00dc658b2 | ||
|
6af16e0cda | ||
|
ab7975539c | ||
|
49acc84f05 | ||
|
47de98ff44 | ||
|
dfd0692176 | ||
|
8b650358d6 | ||
|
78aab70dfb | ||
|
b082ca2331 | ||
|
50ceb877f8 | ||
|
cc90a06958 | ||
|
2a175c627e | ||
|
4bb86d8126 | ||
|
18f981d7cc | ||
|
f53618fc0c | ||
|
54e066ec3a | ||
|
edd9360b41 | ||
|
880e63064b | ||
|
620f88b339 | ||
|
b7e6b1aa41 | ||
|
c84603cdc6 | ||
|
e2b029b0ba | ||
|
0efc0451c1 | ||
|
9dd66fc6ff | ||
|
1195661264 | ||
|
c942bf01dc | ||
|
0c9cc4a233 | ||
|
1df48b46ef | ||
|
8c97681421 | ||
|
431309678a | ||
|
7ca1a43118 | ||
|
8091ad6c70 | ||
|
c228668500 | ||
|
afaba46aa3 | ||
|
25c445830b | ||
|
73b70a86d2 | ||
|
1f38a36acf | ||
|
526f72216a | ||
|
642ff1be15 | ||
|
c12985b75b | ||
|
22c3766b47 | ||
|
92d39dc56d | ||
|
a8e9296473 | ||
|
749e239d15 | ||
|
526ad75c49 | ||
|
30d4ba67cc | ||
|
4ef81041be | ||
|
8d35c1b9d8 | ||
|
b68b34b820 | ||
|
a12f1f9fbb | ||
|
d1bf727127 | ||
|
4311dc5ddf | ||
|
38faa3e071 | ||
|
81f92546d8 | ||
|
91e2c31a58 | ||
|
e2eba9468d | ||
|
9c893a0e21 | ||
|
c8c1585dfc | ||
|
ffcf262de4 | ||
|
ca79147db3 | ||
|
bac0f36818 | ||
|
a8f324b25c | ||
|
b451e10dd8 | ||
|
58e277f48b | ||
|
6d0142525c | ||
|
cf130a7e16 | ||
|
e1309b06b1 | ||
|
70c76f577c | ||
|
86c35339cd | ||
|
f23fb1535d | ||
|
607c93125c | ||
|
2d01af8256 | ||
|
9dd5f73581 | ||
|
83d3d04afb | ||
|
693c573fc3 | ||
|
88caf5c9df | ||
|
32f89fa24b | ||
|
97cdc390c3 | ||
|
8bd5ee355c | ||
|
af5eb575c2 | ||
|
669dbc7238 | ||
|
4c906dc3d1 | ||
|
4aeebb0b15 | ||
|
e14f5e5199 | ||
|
abbd1b2c35 | ||
|
483374d356 | ||
|
fc361afbc3 | ||
|
124dafbf52 | ||
|
f8c2e129c9 | ||
|
78f3255bf0 | ||
|
92ed56bbbc | ||
|
cd2205a325 | ||
|
adc983bccb | ||
|
664dc0b71e | ||
|
0400cedc6c | ||
|
a581958042 | ||
|
e0f85edab3 | ||
|
14073e8943 | ||
|
e02906e4f9 | ||
|
75953a87cb | ||
|
e9b0e2f912 | ||
|
a223245c01 | ||
|
89289f95ba | ||
|
2f56caf8fd | ||
|
e431d5ab53 | ||
|
8c7b8c9390 | ||
|
f6e3107c00 | ||
|
b4098ff5dd | ||
|
9d6e0fd9ed | ||
|
0e1e38b035 | ||
|
5c62bf297a | ||
|
0dd7ad7920 | ||
|
c13bdbd316 | ||
|
d7354aca14 | ||
|
ebc4ad2f1e | ||
|
6614239b32 | ||
|
3993abad4e | ||
|
ae1c2cb0ff | ||
|
5e07ad8caa | ||
|
6aaf06c2e8 | ||
|
eb854f1dbe | ||
|
2050d566b8 | ||
|
188f05e130 | ||
|
4260e5f6ba | ||
|
7235d4da11 | ||
|
bdd66e68c9 | ||
|
55e3b11a28 | ||
|
b8e6a812bd | ||
|
09ce6239a7 | ||
|
5645d66719 | ||
|
afd9875d3a | ||
|
5b953cc1dd | ||
|
8e5bd3637d | ||
|
01696e7298 | ||
|
b922177769 | ||
|
c16dfc609d | ||
|
88ab423b2a | ||
|
e66d9e3418 | ||
|
bf70f6e71e | ||
|
7279553be4 | ||
|
a6740c6c53 | ||
|
c31c9bca9c | ||
|
f5e1a42ac9 | ||
|
9c6d4f90fb | ||
|
4f54cb34df | ||
|
3fbfafb6e3 | ||
|
34ee00a986 | ||
|
156fa5ab01 | ||
|
353915fc8b | ||
|
02e7d13710 | ||
|
e2c7284529 | ||
|
092c2ef8f7 | ||
|
4f2a4c0c6c | ||
|
deea614677 | ||
|
1119d64b29 | ||
|
053797a85e | ||
|
48706695b6 | ||
|
9b05146a85 | ||
|
09a6f8bc16 | ||
|
303dc65d13 | ||
|
d838cf41bf | ||
|
40b21560d8 | ||
|
899bce13c3 | ||
|
84e24325de | ||
|
3aca90811c | ||
|
7b12558249 | ||
|
341dec0711 | ||
|
54fcc33adf | ||
|
01b58bf66f | ||
|
dc21d015da | ||
|
f2cecfc33a | ||
|
6392a4514d | ||
|
9e5d1cc1ce | ||
|
779243094e | ||
|
15fd345545 | ||
|
1a324fa37f | ||
|
b45d15eec6 | ||
|
906795a4d7 | ||
|
000c478ef7 | ||
|
7208464c68 | ||
|
519e799ef1 | ||
|
e5d63f4212 | ||
|
2412998b57 | ||
|
1067f8a9bb | ||
|
3006452cea | ||
|
0f7d96a5ec | ||
|
e17010018c | ||
|
5326f35789 | ||
|
112312f2ee | ||
|
dffd98dff7 | ||
|
a789b18615 | ||
|
64edd30a76 | ||
|
c20611b6c0 | ||
|
59524d0d64 | ||
|
0423769f59 | ||
|
46e57d67d8 | ||
|
8c8af31b7a | ||
|
1fd9e5e95c | ||
|
e4830f6342 | ||
|
99efb518bd | ||
|
f273fdfda8 | ||
|
1b7a7d0fdf | ||
|
7ac9e46e1f | ||
|
0a4f26a318 | ||
|
8d3cf6428f | ||
|
f6c4650624 | ||
|
3c35af9d8c | ||
|
1e11109bb2 | ||
|
f59612671b | ||
|
da4f7ee524 | ||
|
b132176dae | ||
|
1f59e4f449 | ||
|
8487c78a0a | ||
|
fdc45a990d | ||
|
44a550870c | ||
|
bd3295b0e3 | ||
|
f1fbb95d48 | ||
|
45288f5927 | ||
|
75b830b10e | ||
|
4b2d48d621 | ||
|
50362040d7 | ||
|
2f1d59366c | ||
|
b372163122 | ||
|
50bd1d6398 | ||
|
e6ef32ebc2 | ||
|
a5824dc2d4 | ||
|
b5af6f03fb | ||
|
50dfffec94 | ||
|
ad818c071a | ||
|
e84ee76c7d | ||
|
2ab50e65d7 | ||
|
2690243e3c | ||
|
8f71797a48 | ||
|
4d3fbd1dfa | ||
|
e8a4728981 | ||
|
ee28638604 | ||
|
a8495626b0 | ||
|
c6186571e5 | ||
|
ccf517307e | ||
|
88dabde9c9 | ||
|
e00616a1fe | ||
|
c007f847a0 | ||
|
4b4e30d4e1 | ||
|
56caf3687f | ||
|
b4c812b676 | ||
|
9a0d53194a | ||
|
49fb2799e9 | ||
|
6c97e13107 | ||
|
cfe2f36320 | ||
|
6fbb578ce6 | ||
|
093985dd93 | ||
|
72307df6d2 | ||
|
7689b1e84b | ||
|
9ceff3c213 | ||
|
82c057d1ed | ||
|
21770a89d6 | ||
|
223ed5b3a3 | ||
|
2ae59bb3cd | ||
|
c2cd031285 | ||
|
9ba0c07956 | ||
|
7d32258e6e | ||
|
07e56d129a | ||
|
62d6d2558e | ||
|
833e54c9c3 | ||
|
f2dd43855e | ||
|
eaf238fa66 | ||
|
542f279544 | ||
|
917e2980a4 | ||
|
c8ea03bf8c | ||
|
ac6e67e371 | ||
|
735b7c2cf5 | ||
|
87c0f934aa | ||
|
55519bd9ac | ||
|
c0e4d4093c | ||
|
55b527d065 | ||
|
620d8f1cd0 | ||
|
e1e7ab42c1 | ||
|
65b16a1acf | ||
|
1db79a91eb | ||
|
e7cd84a72c | ||
|
691a9bf793 | ||
|
2cce81cfc1 | ||
|
9f4ca3ebc5 | ||
|
3c2385de06 | ||
|
6ce3d0180e | ||
|
83a8c7eda3 | ||
|
aa652fda1b | ||
|
66f3df4570 | ||
|
5616c96745 | ||
|
18f947eb2f | ||
|
83df8a4e39 | ||
|
e9d8228b6f | ||
|
65d8341c6c | ||
|
61a9584433 | ||
|
1b1d38a808 | ||
|
000cc6978a | ||
|
a073258e15 | ||
|
e4d66fb5fc | ||
|
537f6c157c | ||
|
a5b637b2a7 | ||
|
74f831a73e | ||
|
f0b5ee4cdb | ||
|
09c00cf425 | ||
|
6ddaa0190e | ||
|
5c176c64b7 | ||
|
b195884b1f | ||
|
56d5ae2d41 | ||
|
41c7c8f923 | ||
|
0bf2753472 | ||
|
c90006ecf8 | ||
|
17d22fb5b8 | ||
|
af302900c6 | ||
|
9aa78656ec | ||
|
b9d59bc60c | ||
|
1b7601cb19 | ||
|
640d34cecd | ||
|
9d3766b77f | ||
|
24ddae6ede | ||
|
7b6f329830 | ||
|
4d336ed8d6 | ||
|
da3e1b720c | ||
|
a38f773ab1 | ||
|
7b4e5828e0 | ||
|
a2f6236e82 | ||
|
50bd126b11 | ||
|
4a55705b9a | ||
|
0a928cb034 | ||
|
d1627efe5a | ||
|
4c10fcd503 | ||
|
2807502836 | ||
|
5f81ab7b31 | ||
|
780e7014d4 | ||
|
5fc295e8cc | ||
|
c5ba167a3e | ||
|
9159372897 | ||
|
6c47349689 | ||
|
d2c415c580 | ||
|
28ab3749ca | ||
|
a29dbf4ff8 | ||
|
f92a9fa0d6 | ||
|
cbba5741ce | ||
|
4a51241c40 | ||
|
b2c96970ee | ||
|
19cace7e8d | ||
|
4791a8ca66 | ||
|
844f6c63e4 | ||
|
08db919479 | ||
|
2dd9e6c91f | ||
|
2e05b81443 | ||
|
c57f627a21 | ||
|
1d0ab43fbb | ||
|
5f051fc61b | ||
|
61d4363865 | ||
|
705744fd8c | ||
|
b5bba40344 | ||
|
724f3cbd76 | ||
|
1f54d19981 | ||
|
00f7b9d0dd | ||
|
6d3ebd5b56 | ||
|
bc5e0f4851 | ||
|
2bf16016c1 | ||
|
f86476a43c | ||
|
1ed6769b14 | ||
|
73325c579e | ||
|
9197cdc9bd | ||
|
9c486e62e5 | ||
|
a2f32f25c5 | ||
|
ae66d7d7a5 | ||
|
63eb0bee5b | ||
|
8a9427ebff | ||
|
4a383540be | ||
|
db6a7276ec | ||
|
d771c6b2c2 | ||
|
fe7d0730d5 | ||
|
38adf3d186 | ||
|
a2a9ef0958 | ||
|
21eda5daec | ||
|
58a0ebccb2 | ||
|
6cd71ef4dd | ||
|
49d361e44f | ||
|
6bd81145e9 | ||
|
49050e61de | ||
|
5c7a4b579c | ||
|
bc2e7487db | ||
|
9faaab41f4 | ||
|
225101b802 | ||
|
fa3164fb1b | ||
|
3294f7c4c3 | ||
|
654f7dd805 | ||
|
ee467a4877 | ||
|
170875c7dd | ||
|
c8156cfdb1 | ||
|
57a9feaf2f | ||
|
92a13ec87c | ||
|
040f693583 | ||
|
69387b9099 | ||
|
28f0a066da | ||
|
621aa3fc6a | ||
|
9869420106 | ||
|
39b3a0da65 | ||
|
121d34aed0 | ||
|
4b69216c83 | ||
|
7ff15b0625 | ||
|
41dcd5826f | ||
|
26502034ec | ||
|
baa2c4f5eb | ||
|
9e9c44d4ac | ||
|
579104833e | ||
|
099133f7ff | ||
|
67883a369c | ||
|
01eb1a580b | ||
|
b3316d755a | ||
|
73274b9b0b | ||
|
f7104b3d26 | ||
|
c823b0e41e | ||
|
fe5d89b243 | ||
|
78f9b76dae | ||
|
402e155148 | ||
|
f266d9a4dc | ||
|
9c4a01bcdd | ||
|
21b9a194ca | ||
|
312efe5c7b | ||
|
f25187adb1 | ||
|
70e6bda3bb | ||
|
df1efb2a25 | ||
|
02006288b0 | ||
|
9866bcbc9e | ||
|
eb03168685 | ||
|
69badac72f | ||
|
de184b32bc | ||
|
ea173ab628 | ||
|
303c661409 | ||
|
e88c2c8cd3 | ||
|
67932f2d42 | ||
|
eb63745352 | ||
|
32e0f154b5 | ||
|
db50454afc | ||
|
ed352f60b6 | ||
|
3a5875dc73 | ||
|
5211b32aa6 | ||
|
c37beacd95 | ||
|
5b891f1072 | ||
|
fc97f6d00e | ||
|
6142d4d535 | ||
|
1f2ca30ebd | ||
|
92ce190bf0 | ||
|
182a4c3080 | ||
|
ab2376d61d | ||
|
f147046288 | ||
|
daaf3c031f | ||
|
73e5bb0374 | ||
|
6b23eff650 | ||
|
ef974b5c8d | ||
|
d8ec051114 | ||
|
84f92aa87c | ||
|
70e4c26df1 | ||
|
db96f6ead2 | ||
|
f0a3e1652a | ||
|
56b8a9b9fa | ||
|
231c5dbca0 | ||
|
1a9789a3da | ||
|
f15e6d3995 | ||
|
3f42350a7b | ||
|
e8648c993d | ||
|
cb72948739 | ||
|
55c88e8e81 | ||
|
e086067567 | ||
|
f5f80d2ccc | ||
|
d1519345c4 | ||
|
3436fbd6ad | ||
|
d220d3d9d5 | ||
|
6148c909f2 | ||
|
cc07e74532 | ||
|
2eb25f3f6a | ||
|
0673898e85 | ||
|
43d882db2b | ||
|
78af118b9a | ||
|
85f58d6906 | ||
|
885830b67c | ||
|
17e25932f0 | ||
|
63ae00e4a4 | ||
|
ac2ed505bb | ||
|
926e589414 | ||
|
9f1c920a39 | ||
|
9ea233d55f | ||
|
60bde6231a | ||
|
3d575a45bd | ||
|
1f621002b7 | ||
|
cd150af790 | ||
|
cd98266396 | ||
|
3d541f50c8 | ||
|
bad8b9bddb | ||
|
f77b350a7b | ||
|
bed4457e0e | ||
|
2d5269be7b | ||
|
a05b3afd7f | ||
|
9e743451f6 | ||
|
cb7fc31f0b | ||
|
69d735ea0a | ||
|
4d4fc315e0 | ||
|
820c965b72 | ||
|
605ef6ef86 | ||
|
2eb7af23dc | ||
|
582d025f58 | ||
|
b55d8c04e4 | ||
|
3b6f5b2d8a | ||
|
6639b3534e | ||
|
59bf343521 | ||
|
089d980dae | ||
|
1d6e6b65db | ||
|
2224fdbc65 | ||
|
fd1d6cf935 | ||
|
5d7442e9e9 | ||
|
ef90006334 | ||
|
2cbf1e86ad | ||
|
dd8e9ff09d | ||
|
4320150dc4 | ||
|
7453b70666 | ||
|
003daec41c | ||
|
cb159eba2e | ||
|
aac00c3cc7 | ||
|
cd35b6a13f | ||
|
af228806fc | ||
|
69f6aae982 | ||
|
53d66833b2 | ||
|
1d90ee174c | ||
|
097ab853db | ||
|
3e37f47fb5 | ||
|
bd30d59f3d | ||
|
e4c4900b32 | ||
|
4d23ec2c48 | ||
|
15aa1dae62 | ||
|
894931731b | ||
|
3333486c9d | ||
|
2dd82a9898 | ||
|
45c637ad6b | ||
|
731b310359 | ||
|
35c08c109e | ||
|
766771d812 | ||
|
b9e6349994 | ||
|
9efb60c53a | ||
|
e0570cc35e | ||
|
9612044933 | ||
|
3a362a7004 | ||
|
c9b4d3d8c8 | ||
|
dc63efdbfd | ||
|
d904a2de86 | ||
|
f860cd037d | ||
|
0f53c3cc7d | ||
|
3bdf703522 | ||
|
8211c5de35 | ||
|
dc85d4a844 | ||
|
a50bb407aa | ||
|
f40144f6af | ||
|
0adbdbb101 | ||
|
34f5838365 | ||
|
2b7e5dd9d8 | ||
|
44c8ef2ede | ||
|
52ebca3fe1 | ||
|
3a967d66cf | ||
|
5a350d1899 | ||
|
9d219445d9 | ||
|
02342d5833 | ||
|
805166a354 | ||
|
1462fcd351 | ||
|
aaab505006 | ||
|
c3e575baf7 | ||
|
63a2a32b4b | ||
|
eb7a21030d | ||
|
1bc03123b9 | ||
|
e6aabec7ef | ||
|
a32ce5c34a | ||
|
baa1a2983b | ||
|
fdc4a84a83 | ||
|
d3943ea0fe | ||
|
79b5c38ecb | ||
|
31752d9ee1 | ||
|
24e2fe4a04 | ||
|
1477d60926 | ||
|
2d1a12f016 | ||
|
f88584b916 | ||
|
32264c2e7e | ||
|
69a133083c | ||
|
9ba9aad5f7 | ||
|
1f2ac17091 | ||
|
06588c2e4a | ||
|
4ff93bccf0 | ||
|
355f8e195c | ||
|
439fe77d1c | ||
|
6b980d6e6a | ||
|
3c09368032 | ||
|
4fa71d122c | ||
|
59d1a57f06 | ||
|
42950e53cd | ||
|
ae9f538ef8 | ||
|
8b7d60065e | ||
|
e880d2fd84 | ||
|
6404c57cf8 | ||
|
e791a63671 | ||
|
e263a3c27d | ||
|
0b5e30aa7b | ||
|
07ff3f294d | ||
|
6ba69c9540 | ||
|
5ee554708c | ||
|
25125c47e4 | ||
|
76de9bf1fa | ||
|
623e545f09 | ||
|
74fdd97b14 | ||
|
2545322163 | ||
|
7b511f449f | ||
|
94097e2561 | ||
|
50405f57ba | ||
|
860141127a | ||
|
58d8ee79f8 | ||
|
f8f599c1db | ||
|
a2abad3f68 | ||
|
c5f44d8737 | ||
|
25bca70ff2 | ||
|
55cd81747d | ||
|
7204220991 | ||
|
97cc4930cf | ||
|
5688dc77a3 | ||
|
9dd6f86c55 | ||
|
f85321e201 | ||
|
53395e788d | ||
|
2de64d5820 | ||
|
24e115d0f9 | ||
|
334394a5d4 | ||
|
6fb2fcbc8a | ||
|
29a820b2f2 | ||
|
b0c07aa6d6 | ||
|
bff3473279 | ||
|
d9fddf67af | ||
|
319d07b1d3 | ||
|
38b6dca223 | ||
|
24d30275fa | ||
|
41266627cd | ||
|
abd864eecb | ||
|
7db79a6d40 | ||
|
fb428bf564 | ||
|
9e506d797a | ||
|
348c99c7d0 | ||
|
a11e2dd452 | ||
|
85fce606dc | ||
|
bb6e17fd3e | ||
|
e48e13012c | ||
|
c616e203df | ||
|
c26f6d45dd | ||
|
02a68aa436 | ||
|
d4f93688b5 | ||
|
766370e22a | ||
|
75b57b926a | ||
|
6b698759ca | ||
|
cf176474ac | ||
|
6ed207aba0 | ||
|
924ec49d09 | ||
|
a4097b7a02 | ||
|
e38fcb2bfc | ||
|
c3b56d4123 | ||
|
fead683f18 | ||
|
98f4a1c545 | ||
|
9ca82d8bf6 | ||
|
6a2f907ee1 | ||
|
7c0a0d81f8 | ||
|
f5414d0fd1 | ||
|
15335f8615 | ||
|
4c2cdd5a07 | ||
|
8a695b4073 | ||
|
74ca7b5269 | ||
|
82e7bc707d | ||
|
c4afe0922e | ||
|
279fbe4543 | ||
|
2d841269ee | ||
|
9713fe358b | ||
|
0d19c99699 | ||
|
416f854311 | ||
|
62f37e6b23 | ||
|
c2fa5ae78f | ||
|
7ded1df94b | ||
|
e1e4855211 | ||
|
e09457cdf9 | ||
|
f2311f1987 | ||
|
b31f656d63 | ||
|
e641bf7ac2 | ||
|
8a164adf98 | ||
|
7b9c1d43cd | ||
|
fd82877312 | ||
|
2518c653af | ||
|
c23deed3a7 | ||
|
dee20c8d74 | ||
|
ee15baf98c | ||
|
25e7555e80 | ||
|
74c7760d9d | ||
|
9dd9ee614b | ||
|
8a18dac870 | ||
|
5aed14ffdc | ||
|
294babcfbb | ||
|
59aab485c3 | ||
|
877796a7ca | ||
|
173d29969d | ||
|
7390789b5e | ||
|
fc4aaa97c6 | ||
|
217d5e636c | ||
|
eb118e4443 | ||
|
f4ed4109c6 | ||
|
398c843643 | ||
|
01d07f55a9 | ||
|
a7b10c99da | ||
|
bdc8cb66bd | ||
|
7bc823fb8b | ||
|
48b7594b64 | ||
|
88b1180817 | ||
|
8803cd8d3b | ||
|
0063de1564 | ||
|
f104596b39 | ||
|
146d66f0aa | ||
|
0ccb398cec | ||
|
287a44be52 | ||
|
86f3667b82 | ||
|
962b1cca1f | ||
|
2026fdab6a | ||
|
722e888043 | ||
|
e3997abfb9 | ||
|
710687bbd6 | ||
|
d4a1e7dba9 | ||
|
c7237e5c8e | ||
|
c299c6d61a | ||
|
6769acc7a7 | ||
|
df33587395 | ||
|
508f33a183 | ||
|
11f970d1c2 | ||
|
72e6330ff4 | ||
|
5caf68bc31 | ||
|
29ccde1603 | ||
|
826d864448 | ||
|
78306e9f5b | ||
|
15ca0fd1f0 | ||
|
955a9f0051 | ||
|
bd56caf74f | ||
|
5bfd2cc2c9 | ||
|
e47ae4f26e | ||
|
c51e387e79 | ||
|
56f66bd966 | ||
|
0415883628 | ||
|
6e089fb0e2 | ||
|
0fac1d182f | ||
|
0d71c590e4 | ||
|
d1661c95d5 | ||
|
13bf383ce8 | ||
|
60f1004339 | ||
|
81714ee81f | ||
|
5f3ba4eb40 | ||
|
164d2f5d1b | ||
|
1d021e3701 | ||
|
f9f557e1c6 | ||
|
29dd342118 | ||
|
8262cff71a | ||
|
b7465262ca | ||
|
ab13fbe95e | ||
|
f7a2cd4ef1 | ||
|
95e4f8dd91 | ||
|
8e413a7bf0 | ||
|
3e9edcb7e8 | ||
|
4ba88d2e9c | ||
|
aa503e7211 | ||
|
2a67a202b0 | ||
|
7e14777b8f | ||
|
c1d0681e17 | ||
|
98f8edbde5 | ||
|
1dd6a8b291 | ||
|
e839648b8e | ||
|
feb5cc0093 | ||
|
a3219f71c9 | ||
|
e3f2c49c7e | ||
|
fecd091078 | ||
|
e0b360513c | ||
|
01d99d4873 | ||
|
acb2e2a8ab | ||
|
0223439e2b | ||
|
fa9f8329b5 | ||
|
4ffcd80b02 | ||
|
48570227ba | ||
|
fd5b7b20cf | ||
|
c112f20e17 | ||
|
05f025e422 | ||
|
3ee9150deb | ||
|
b2842ae8d4 | ||
|
dff5136134 | ||
|
1d249567ed | ||
|
a84e131115 | ||
|
4b74fe2823 | ||
|
9493bda0cc | ||
|
36d4fff7b2 | ||
|
67a1438a41 | ||
|
aab6e67e70 | ||
|
2397449fa4 | ||
|
fc12125223 | ||
|
61bf2d5bfd | ||
|
bd9a3e5a3e | ||
|
90b33af3bd | ||
|
016fe4bcf1 | ||
|
87381a0f65 | ||
|
47453a20f7 | ||
|
b78d4ca41f | ||
|
7273f4d8d4 | ||
|
37a3dbb6f6 | ||
|
c252005e25 | ||
|
09ad6bba1a | ||
|
c975cddfda | ||
|
a6afac0f3c | ||
|
ef850e4537 | ||
|
2624005fa8 | ||
|
20f990f2eb | ||
|
7de961ebfe | ||
|
f6cc44eb6b | ||
|
3acd01a44d | ||
|
d5af9c360d | ||
|
2137840fec | ||
|
ed9e03b095 | ||
|
3180e13719 | ||
|
c751a0ada3 | ||
|
9869b4c068 | ||
|
8c981e0464 | ||
|
76f8a9e171 | ||
|
a1ec1dc178 | ||
|
e2f4af6e48 | ||
|
b1272e8835 | ||
|
75d5957020 | ||
|
1896e56894 | ||
|
7cd7f1ebbe | ||
|
7fef97d92d | ||
|
cd3a9854f8 | ||
|
f8057fed88 | ||
|
59950a7242 | ||
|
6d13069ffb | ||
|
59fea1a05d | ||
|
1c7476fe61 | ||
|
58f0425d4a | ||
|
ee7ea4adb9 | ||
|
8a3f1f7111 | ||
|
33b0821f8d | ||
|
7bf6419a7b | ||
|
460efbac77 | ||
|
f4be778b86 | ||
|
bd959884cc |
199
Shorewall-core/configure
vendored
Executable file
199
Shorewall-core/configure
vendored
Executable file
@@ -0,0 +1,199 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Shorewall Packet Filtering Firewall RPM configuration program - V4.5
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2012 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://www.shorewall.net
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Usage: ./configure [ <option>=<setting> ] ...
|
||||
#
|
||||
#
|
||||
################################################################################################
|
||||
#
|
||||
# Build updates this
|
||||
#
|
||||
VERSION=4.5.2.1
|
||||
|
||||
case "$BASH_VERSION" in
|
||||
[4-9].*)
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: This program requires Bash 4.0 or later" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
declare -A params
|
||||
declare -A options
|
||||
|
||||
getfileparams() {
|
||||
while read option; do
|
||||
case $option in
|
||||
\#*)
|
||||
;;
|
||||
*)
|
||||
on=${option%=*}
|
||||
ov=${option#*=}
|
||||
ov=${ov%#*}
|
||||
[ -n "$on" ] && options[${on}]="${ov}"
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
for p in $@; do
|
||||
|
||||
if [ -n "${p}" ]; then
|
||||
declare -u pn
|
||||
|
||||
pn=${p%=*}
|
||||
pn=${pn#--}
|
||||
pv=${p#*=}
|
||||
|
||||
if [ -n "${pn}" ]; then
|
||||
|
||||
case ${pn} in
|
||||
VENDOR)
|
||||
pn=HOST
|
||||
;;
|
||||
SHAREDSTATEDIR)
|
||||
pn=VARLIB
|
||||
;;
|
||||
DATADIR)
|
||||
pn=SHAREDIR
|
||||
;;
|
||||
esac
|
||||
|
||||
params[${pn}]="${pv}"
|
||||
else
|
||||
echo "ERROR: Invalid option ($p)" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
vendor=${params[HOST]}
|
||||
|
||||
if [ -z "$vendor" ]; then
|
||||
case `uname` in
|
||||
Darwin)
|
||||
$params[HOST]=apple
|
||||
rcfile=shorewallrc.apple
|
||||
;;
|
||||
|
||||
cygwin*)
|
||||
$params[HOST]=cygwin
|
||||
rcfile=shorewallrc.cygwin
|
||||
;;
|
||||
*)
|
||||
if [ -f /etc/debian_version ]; then
|
||||
params[HOST]=debian
|
||||
rcfile=shorewallrc.debian
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
params[HOST]=redhat
|
||||
rcfile=shorewallrc.redhat
|
||||
elif [ -f /etc/slackware-version ] ; then
|
||||
params[HOST]=slackware
|
||||
rcfile=shorewallrc.slackware
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
params[HOST]=suse
|
||||
rcfile=shorewallrc.suse
|
||||
elif [ -f /etc/arch-release ] ; then
|
||||
params[HOST]=archlinux
|
||||
rcfile=shorewallrc.archlinux
|
||||
else
|
||||
params[HOST]=linux
|
||||
rcfile=shorewallrc.default
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
vendor=${params[HOST]}
|
||||
elif [ $vendor = linux ]; then
|
||||
rcfile=shorewallrc.default;
|
||||
else
|
||||
rcfile=shorewallrc.$vendor
|
||||
if [ ! -f $rcfile ]; then
|
||||
echo "ERROR: $vendor is not a recognized host type" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $vendor = linux ]; then
|
||||
echo "INFO: Creating a generic Linux installation - " `date`;
|
||||
else
|
||||
echo "INFO: Creating a ${vendor}-specific installation - " `date`;
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
getfileparams < $rcfile || exit 1
|
||||
|
||||
for p in ${!params[@]}; do
|
||||
options[${p}]="${params[${p}]}"
|
||||
done
|
||||
|
||||
echo '#' > shorewallrc
|
||||
echo "# Created by Shorewall Core version $VERSION configure - " `date` >> shorewallrc
|
||||
echo '#' >> shorewallrc
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
echo "# Input: $@" >> shorewallrc
|
||||
echo '#' >> shorewallrc
|
||||
fi
|
||||
|
||||
if [ -n "${options[VARLIB]}" ]; then
|
||||
if [ -z "${options[VARDIR]}" ]; then
|
||||
options[VARDIR]='${VARLIB}/${PRODUCT}'
|
||||
fi
|
||||
elif [ -n "${options[VARDIR]}" ]; then
|
||||
if [ -z "{$options[VARLIB]}" ]; then
|
||||
options[VARLIB]=${options[VARDIR]}
|
||||
options[VARDIR]='${VARLIB}/${PRODUCT}'
|
||||
fi
|
||||
fi
|
||||
|
||||
for on in \
|
||||
HOST \
|
||||
PREFIX \
|
||||
SHAREDIR \
|
||||
LIBEXECDIR \
|
||||
PERLLIBDIR \
|
||||
CONFDIR \
|
||||
SBINDIR \
|
||||
MANDIR \
|
||||
INITDIR \
|
||||
INITSOURCE \
|
||||
INITFILE \
|
||||
AUXINITSOURCE \
|
||||
AUXINITFILE \
|
||||
SYSTEMD \
|
||||
SYSCONFFILE \
|
||||
SYSCONFDIR \
|
||||
SPARSE \
|
||||
ANNOTATED \
|
||||
VARLIB \
|
||||
VARDIR
|
||||
do
|
||||
echo "$on=${options[${on}]}"
|
||||
echo "$on=${options[${on}]}" >> shorewallrc
|
||||
done
|
164
Shorewall-core/configure.pl
Executable file
164
Shorewall-core/configure.pl
Executable file
@@ -0,0 +1,164 @@
|
||||
#! /usr/bin/perl -w
|
||||
#
|
||||
# Shorewall Packet Filtering Firewall RPM configuration program - V4.5
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2012 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://www.shorewall.net
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Usage: ./configure.pl <option>=<setting> ...
|
||||
#
|
||||
#
|
||||
################################################################################################
|
||||
use strict;
|
||||
|
||||
#
|
||||
# Build updates this
|
||||
#
|
||||
use constant {
|
||||
VERSION => '4.5.2.1'
|
||||
};
|
||||
|
||||
my %params;
|
||||
my %options;
|
||||
|
||||
my %aliases = ( VENDOR => 'HOST',
|
||||
SHAREDSTATEDIR => 'VARLIB',
|
||||
DATADIR => 'SHAREDIR' );
|
||||
|
||||
for ( @ARGV ) {
|
||||
die "ERROR: Invalid option specification ( $_ )" unless /^(?:--)?(\w+)=(.*)$/;
|
||||
|
||||
my $pn = uc $1;
|
||||
my $pv = $2 || '';
|
||||
|
||||
$pn = $aliases{$pn} if exists $aliases{$pn};
|
||||
|
||||
$params{$pn} = $pv;
|
||||
}
|
||||
|
||||
my $vendor = $params{HOST};
|
||||
my $rcfile;
|
||||
my $rcfilename;
|
||||
|
||||
if ( defined $vendor ) {
|
||||
$rcfilename = $vendor eq 'linux' ? 'shorewallrc.default' : 'shorewallrc.' . $vendor;
|
||||
die qq("ERROR: $vendor" is not a recognized host type) unless -f $rcfilename;
|
||||
} else {
|
||||
if ( -f '/etc/debian_version' ) {
|
||||
$vendor = 'debian';
|
||||
$rcfilename = 'shorewallrc.debian';
|
||||
} elsif ( -f '/etc/redhat-release' ){
|
||||
$vendor = 'redhat';
|
||||
$rcfilename = 'shorewallrc.redhat';
|
||||
} elsif ( -f '/etc/slackware-version' ) {
|
||||
$vendor = 'slackware';
|
||||
$rcfilename = 'shorewallrc.slackware';
|
||||
} elsif ( -f '/etc/SuSE-release' ) {
|
||||
$vendor = 'suse';
|
||||
$rcfilename = 'shorewallrc.suse';
|
||||
} elsif ( -f '/etc/arch-release' ) {
|
||||
$vendor = 'archlinux';
|
||||
$rcfilename = 'shorewallrc.archlinux';
|
||||
} elsif ( `uname` =~ '^Darwin' ) {
|
||||
$vendor = 'apple';
|
||||
$rcfilename = 'shorewallrc.apple';
|
||||
} elsif ( `uname` =~ '^Cygwin' ) {
|
||||
$vendor = 'cygwin';
|
||||
$rcfilename = 'shorewallrc.cygwin';
|
||||
} else {
|
||||
$vendor = 'linux';
|
||||
$rcfilename = 'shorewallrc.default';
|
||||
}
|
||||
|
||||
$params{HOST} = $vendor;
|
||||
}
|
||||
|
||||
my @localtime = localtime;
|
||||
my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
|
||||
|
||||
if ( $vendor eq 'linux' ) {
|
||||
printf "INFO: Creating a generic Linux installation - %s %2d %04d %02d:%02d:%02d\n\n", $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];;
|
||||
} else {
|
||||
printf "INFO: Creating a %s-specific installation - %s %2d %04d %02d:%02d:%02d\n\n", $vendor, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];;
|
||||
}
|
||||
|
||||
open $rcfile, '<', $rcfilename or die "Unable to open $rcfilename for input: $!";
|
||||
|
||||
while ( <$rcfile> ) {
|
||||
s/\s*#.*//;
|
||||
unless ( /^\s*$/ ) {
|
||||
chomp;
|
||||
die "ERROR: Invalid entry ($_) in $rcfilename, line $." unless /\s*(\w+)=(.*)/;
|
||||
$options{$1} = $2;
|
||||
}
|
||||
}
|
||||
|
||||
close $rcfile;
|
||||
|
||||
while ( my ( $p, $v ) = each %params ) {
|
||||
$options{$p} = ${v};
|
||||
}
|
||||
|
||||
my $outfile;
|
||||
|
||||
open $outfile, '>', 'shorewallrc' or die "Can't open 'shorewallrc' for output: $!";
|
||||
|
||||
printf $outfile "#\n# Created by Shorewall Core version %s configure.pl - %s %2d %04d %02d:%02d:%02d\n#\n", VERSION, $abbr[$localtime[4]], $localtime[3], 1900 + $localtime[5] , @localtime[2,1,0];
|
||||
|
||||
print $outfile "# Input: @ARGV\n#\n" if @ARGV;
|
||||
|
||||
if ( $options{VARLIB} ) {
|
||||
unless ( $options{VARDIR} ) {
|
||||
$options{VARDIR} = '${VARLIB}/${PRODUCT}';
|
||||
}
|
||||
} elsif ( $options{VARDIR} ) {
|
||||
$options{VARLIB} = $options{VARDIR};
|
||||
$options{VARDIR} = '${VARLIB}/${PRODUCT}';
|
||||
}
|
||||
|
||||
for ( qw/ HOST
|
||||
PREFIX
|
||||
SHAREDIR
|
||||
LIBEXECDIR
|
||||
PERLLIBDIR
|
||||
CONFDIR
|
||||
SBINDIR
|
||||
MANDIR
|
||||
INITDIR
|
||||
INITSOURCE
|
||||
INITFILE
|
||||
AUXINITSOURCE
|
||||
AUXINITFILE
|
||||
SYSTEMD
|
||||
SYSCONFFILE
|
||||
SYSCONFDIR
|
||||
SPARSE
|
||||
ANNOTATED
|
||||
VARLIB
|
||||
VARDIR / ) {
|
||||
|
||||
my $val = $options{$_} || '';
|
||||
|
||||
print "$_=$val\n";
|
||||
print $outfile "$_=$val\n";
|
||||
}
|
||||
|
||||
close $outfile;
|
||||
|
||||
1;
|
@@ -27,14 +27,18 @@ VERSION=xxx #The Build script inserts the actual version
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME"
|
||||
echo "usage: $ME [ <configuration-file> ] "
|
||||
echo " $ME -v"
|
||||
echo " $ME -h"
|
||||
echo " $ME -s"
|
||||
echo " $ME -f"
|
||||
exit $1
|
||||
}
|
||||
|
||||
fatal_error()
|
||||
{
|
||||
echo " ERROR: $@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
split() {
|
||||
local ifs
|
||||
ifs=$IFS
|
||||
@@ -87,39 +91,128 @@ install_file() # $1 = source $2 = target $3 = mode
|
||||
run_install $T $OWNERSHIP -m $3 $1 ${2}
|
||||
}
|
||||
|
||||
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
|
||||
require()
|
||||
{
|
||||
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
||||
}
|
||||
|
||||
cd "$(dirname $0)"
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
# ARGS is "yes" if we've already parsed an argument
|
||||
finished=0
|
||||
|
||||
while [ $finished -eq 0 ]; do
|
||||
option=$1
|
||||
|
||||
case "$option" in
|
||||
-*)
|
||||
option=${option#-}
|
||||
|
||||
while [ -n "$option" ]; do
|
||||
case $option in
|
||||
h)
|
||||
usage 0
|
||||
;;
|
||||
v)
|
||||
echo "Shorewall Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
finished=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc
|
||||
file=./shorewallrc
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
file=~/.shorewallrc
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
file=/usr/share/shorewall/shorewallrc
|
||||
else
|
||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||
fi
|
||||
elif [ $# -eq 1 ]; then
|
||||
file=$1
|
||||
case $file in
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
||||
update=0
|
||||
|
||||
if [ -z "${VARLIB}" ]; then
|
||||
VARLIB=${VARDIR}
|
||||
VARDIR="${VARLIB}/${PRODUCT}"
|
||||
update=1
|
||||
elif [ -z "${VARDIR}" ]; then
|
||||
VARDIR="${VARLIB}/${PRODUCT}"
|
||||
update=2
|
||||
fi
|
||||
|
||||
for var in SHAREDIR LIBEXECDIR PERLLIBDIR CONFDIR SBINDIR VARLIB VARDIR; do
|
||||
require $var
|
||||
done
|
||||
|
||||
[ "${INITFILE}" != 'none/' ] && require INITSOURCE && require INITDIR
|
||||
|
||||
T="-T"
|
||||
|
||||
[ -n "${LIBEXEC:=/usr/share}" ]
|
||||
[ -n "${PERLLIB:=/usr/share/shorewall}" ]
|
||||
MACHOST=
|
||||
|
||||
case "$LIBEXEC" in
|
||||
/*)
|
||||
;;
|
||||
*)
|
||||
LIBEXEC=/usr/${LIBEXEC}
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$PERLLIB" in
|
||||
/*)
|
||||
;;
|
||||
*)
|
||||
PERLLIB=/usr/${PERLLIB}
|
||||
;;
|
||||
esac
|
||||
|
||||
INSTALLD='-D'
|
||||
|
||||
case $(uname) in
|
||||
CYGWIN*)
|
||||
if [ -z "$BUILD" ]; then
|
||||
case $(uname) in
|
||||
cygwin*)
|
||||
BUILD=cygwin
|
||||
;;
|
||||
Darwin)
|
||||
BUILD=apple
|
||||
;;
|
||||
*)
|
||||
if [ -f /etc/debian_version ]; then
|
||||
BUILD=debian
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
BUILD=redhat
|
||||
elif [ -f /etc/slackware-version ] ; then
|
||||
BUILD=slackware
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
BUILD=suse
|
||||
elif [ -f /etc/arch-release ] ; then
|
||||
BUILD=archlinux
|
||||
else
|
||||
BUILD=linux
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case $BUILD in
|
||||
cygwin*)
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
DEST=
|
||||
INIT=
|
||||
@@ -127,18 +220,16 @@ case $(uname) in
|
||||
|
||||
OWNER=$(id -un)
|
||||
GROUP=$(id -gn)
|
||||
CYGWIN=Yes
|
||||
;;
|
||||
Darwin)
|
||||
apple)
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
DEST=
|
||||
INIT=
|
||||
SPARSE=Yes
|
||||
fi
|
||||
|
||||
[ -z "$OWNER" ] && OWNER=root
|
||||
[ -z "$GROUP" ] && GROUP=wheel
|
||||
MAC=Yes
|
||||
MACHOST=Yes
|
||||
INSTALLD=
|
||||
T=
|
||||
;;
|
||||
@@ -150,137 +241,151 @@ esac
|
||||
|
||||
OWNERSHIP="-o $OWNER -g $GROUP"
|
||||
|
||||
finished=0
|
||||
|
||||
while [ $finished -eq 0 ]; do
|
||||
option=$1
|
||||
|
||||
case "$option" in
|
||||
-*)
|
||||
option=${option#-}
|
||||
|
||||
while [ -n "$option" ]; do
|
||||
case $option in
|
||||
h)
|
||||
usage 0
|
||||
;;
|
||||
v)
|
||||
echo "Shorewall Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
a*)
|
||||
ANNOTATED=Yes
|
||||
option=${option#a}
|
||||
;;
|
||||
p*)
|
||||
ANNOTATED=
|
||||
option=${option#p}
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
[ -n "$option" ] && usage 1
|
||||
finished=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
#
|
||||
# Determine where to install the firewall script
|
||||
#
|
||||
|
||||
[ -n "$HOST" ] || HOST=$BUILD
|
||||
|
||||
case "$HOST" in
|
||||
cygwin)
|
||||
echo "Installing Cygwin-specific configuration..."
|
||||
;;
|
||||
apple)
|
||||
echo "Installing Mac-specific configuration...";
|
||||
;;
|
||||
debian|redhat|slackware|archlinux|linux|suse)
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown HOST \"$HOST\"" >&2
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$file" ]; then
|
||||
if $HOST = linux; then
|
||||
file=shorewallrc.default
|
||||
else
|
||||
file=shorewallrc.${HOST}
|
||||
fi
|
||||
|
||||
echo "You have not specified a configuration file and ~/.shorewallrc does not exist" >&2
|
||||
echo "Shorewall-core $VERSION has determined that the $file configuration is appropriate for your system" >&2
|
||||
echo "Please review the settings in that file. If you wish to change them, make a copy and modify the copy" >&2
|
||||
echo "Then re-run install.sh passing either $file or the name of your modified copy" >&2
|
||||
echo "" >&2
|
||||
echo "Example:" >&2
|
||||
echo "" >&2
|
||||
echo " ./install.sh $file" &>2
|
||||
fi
|
||||
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
if [ -z "$CYGWIN" ]; then
|
||||
if [ $BUILD != cygwin ]; then
|
||||
if [ `id -u` != 0 ] ; then
|
||||
echo "Not setting file owner/group permissions, not running as root."
|
||||
OWNERSHIP=""
|
||||
fi
|
||||
fi
|
||||
|
||||
install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin
|
||||
install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST}
|
||||
|
||||
CYGWIN=
|
||||
MAC=
|
||||
else
|
||||
if [ -n "$CYGWIN" ]; then
|
||||
echo "Installing Cygwin-specific configuration..."
|
||||
elif [ -n "$MAC" ]; then
|
||||
echo "Installing Mac-specific configuration..."
|
||||
else
|
||||
if [ -f /etc/debian_version ]; then
|
||||
echo "Installing Debian-specific configuration..."
|
||||
DEBIAN=yes
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
echo "Installing Redhat/Fedora-specific configuration..."
|
||||
FEDORA=yes
|
||||
elif [ -f /etc/slackware-version ] ; then
|
||||
echo "Installing Slackware-specific configuration..."
|
||||
DEST="/etc/rc.d"
|
||||
MANDIR="/usr/man"
|
||||
SLACKWARE=yes
|
||||
elif [ -f /etc/arch-release ] ; then
|
||||
echo "Installing ArchLinux-specific configuration..."
|
||||
DEST="/etc/rc.d"
|
||||
INIT="shorewall"
|
||||
ARCHLINUX=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Change to the directory containing this script
|
||||
#
|
||||
cd "$(dirname $0)"
|
||||
|
||||
echo "Installing Shorewall Core Version $VERSION"
|
||||
|
||||
#
|
||||
# Create /usr/share/shorewall
|
||||
# Create directories
|
||||
#
|
||||
mkdir -p ${DESTDIR}${LIBEXEC}/shorewall
|
||||
chmod 755 ${DESTDIR}/usr/share/shorewall
|
||||
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall
|
||||
chmod 755 ${DESTDIR}${LIBEXECDIR}/shorewall
|
||||
|
||||
mkdir -p ${DESTDIR}${SHAREDIR}/shorewall
|
||||
chmod 755 ${DESTDIR}${SHAREDIR}/shorewall
|
||||
|
||||
mkdir -p ${DESTDIR}${CONFDIR}
|
||||
chmod 755 ${DESTDIR}${CONFDIR}
|
||||
|
||||
if [ -n "${SYSCONFDIR}" ]; then
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}
|
||||
chmod 755 ${DESTDIR}${SYSCONFDIR}
|
||||
fi
|
||||
|
||||
if [ -n "${SYSTEMD}" ]; then
|
||||
mkdir -p ${DESTDIR}${SYSTEMD}
|
||||
chmod 755 ${DESTDIR}${SYSTEMD}
|
||||
fi
|
||||
|
||||
mkdir -p ${DESTDIR}${SBINDIR}
|
||||
chmod 755 ${DESTDIR}${SBINDIR}
|
||||
|
||||
mkdir -p ${DESTDIR}${MANDIR}
|
||||
chmod 755 ${DESTDIR}${MANDIR}
|
||||
|
||||
if [ -n "${INITFILE}" ]; then
|
||||
mkdir -p ${DESTDIR}${INITDIR}
|
||||
chmod 755 ${DESTDIR}${INITDIR}
|
||||
|
||||
if [ -n "$AUXINITSOURCE" -a -f "$AUXINITSOURCE" ]; then
|
||||
install_file $AUXINITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544
|
||||
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$AUXINITFILE
|
||||
echo "$Product script installed in ${DESTDIR}${INITDIR}/$AUXINITFILE"
|
||||
fi
|
||||
fi
|
||||
#
|
||||
# Note: ${VARDIR} is created at run-time since it has always been
|
||||
# a relocatable directory on a per-product basis
|
||||
#
|
||||
# Install wait4ifup
|
||||
#
|
||||
install_file wait4ifup ${DESTDIR}${LIBEXEC}/shorewall/wait4ifup 0755
|
||||
install_file wait4ifup ${DESTDIR}${LIBEXECDIR}/shorewall/wait4ifup 0755
|
||||
|
||||
echo
|
||||
echo "wait4ifup installed in ${DESTDIR}${LIBEXEC}/shorewall/wait4ifup"
|
||||
echo "wait4ifup installed in ${DESTDIR}${LIBEXECDIR}/shorewall/wait4ifup"
|
||||
|
||||
#
|
||||
# Install the libraries
|
||||
#
|
||||
for f in lib.* ; do
|
||||
install_file $f ${DESTDIR}/usr/share/shorewall/$f 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}/usr/share/shorewall/$f"
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/shorewall/$f 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/shorewall/$f"
|
||||
done
|
||||
|
||||
if [ -z "$MACHOST" ]; then
|
||||
eval sed -i \'s\|g_libexec=.\*\|g_libexec=$LIBEXEC\|\' ${DESTDIR}/usr/share/shorewall/lib.cli
|
||||
eval sed -i \'s\|g_perllib=.\*\|g_perllib=$PERLLIB\|\' ${DESTDIR}/usr/share/shorewall/lib.cli
|
||||
else
|
||||
eval sed -i \'\' -e \'s\|g_libexec=.\*\|g_libexec=$LIBEXEC\|\' ${DESTDIR}/usr/share/shorewall/lib.cli
|
||||
eval sed -i \'\' -e \'s\|g_perllib=.\*\|g_perllib=$PERLLIB\|\' ${DESTDIR}/usr/share/shorewall/lib.cli
|
||||
fi
|
||||
|
||||
#
|
||||
# Symbolically link 'functions' to lib.base
|
||||
#
|
||||
ln -sf lib.base ${DESTDIR}/usr/share/shorewall/functions
|
||||
ln -sf lib.base ${DESTDIR}${SHAREDIR}/shorewall/functions
|
||||
#
|
||||
# Create the version file
|
||||
#
|
||||
echo "$VERSION" > ${DESTDIR}/usr/share/shorewall/coreversion
|
||||
chmod 644 ${DESTDIR}/usr/share/shorewall/coreversion
|
||||
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/shorewall/coreversion
|
||||
chmod 644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion
|
||||
|
||||
if [ -z "${DESTDIR}" ]; then
|
||||
if [ $update -ne 0 ]; then
|
||||
echo "Updating $file - original saved in $file.bak"
|
||||
|
||||
cp $file $file.bak
|
||||
|
||||
echo '#' >> $file
|
||||
echo "# Updated by Shorewall-core $VERSION -" `date` >> $file
|
||||
echo '#' >> $file
|
||||
|
||||
[ $update -eq 1 ] && sed -i 's/VARDIR/VARLIB/' $file
|
||||
|
||||
echo 'VARDIR=${VARLIB}/${PRODUCT}' >> $file
|
||||
fi
|
||||
|
||||
[ ! -f ~/.shorewallrc ] && cp ${SHAREDIR}/shorewall/shorewallrc ~/.shorewallrc
|
||||
fi
|
||||
|
||||
[ $file != "${DESTDIR}${SHAREDIR}/shorewall/shorewallrc" ] && cp $file ${DESTDIR}${SHAREDIR}/shorewall/shorewallrc
|
||||
|
||||
if [ ${SHAREDIR} != /usr/share ]; then
|
||||
for f in lib.*; do
|
||||
if [ $BUILD != apple ]; then
|
||||
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SHAREDIR}/shorewall/$f
|
||||
else
|
||||
eval sed -i \'\' -e \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SHAREDIR}/shorewall/$f
|
||||
fi
|
||||
done
|
||||
fi
|
||||
#
|
||||
# Report Success
|
||||
#
|
||||
|
@@ -20,57 +20,61 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# This library contains the code common to all Shorewall components.
|
||||
#
|
||||
# - It is loaded by /sbin/shorewall.
|
||||
# - It is released as part of Shorewall[6] Lite where it is used by /sbin/shorewall[6]-lite
|
||||
# and /usr/share/shorewall[6]-lite/shorecap.
|
||||
# This library contains the code common to all Shorewall components except the
|
||||
# generated scripts.
|
||||
#
|
||||
|
||||
SHOREWALL_LIBVERSION=40500
|
||||
SHOREWALL_CAPVERSION=40501
|
||||
SHOREWALL_LIBVERSION=40509
|
||||
|
||||
[ -n "${g_program:=shorewall}" ]
|
||||
|
||||
if [ -z "$g_readrc" ]; then
|
||||
#
|
||||
# This is modified by the installer when ${SHAREDIR} != /usr/share
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
g_sharedir="$SHAREDIR"/$g_program
|
||||
g_confdir="$CONFDIR"/$g_program
|
||||
g_readrc=1
|
||||
fi
|
||||
|
||||
g_basedir=${SHAREDIR}/shorewall
|
||||
|
||||
case $g_program in
|
||||
shorewall)
|
||||
SHAREDIR=/usr/share/shorewall
|
||||
CONFDIR=/etc/shorewall
|
||||
g_product="Shorewall"
|
||||
g_family=4
|
||||
g_tool=
|
||||
g_basedir=/usr/share/shorewall
|
||||
g_tool=iptables
|
||||
g_lite=
|
||||
;;
|
||||
shorewall6)
|
||||
SHAREDIR=/usr/share/shorewall6
|
||||
CONFDIR=/etc/shorewall6
|
||||
g_product="Shorewall6"
|
||||
g_family=6
|
||||
g_tool=
|
||||
g_basedir=/usr/share/shorewall
|
||||
g_tool=ip6tables
|
||||
g_lite=
|
||||
;;
|
||||
shorewall-lite)
|
||||
SHAREDIR=/usr/share/shorewall-lite
|
||||
CONFDIR=/etc/shorewall-lite
|
||||
g_product="Shorewall Lite"
|
||||
g_family=4
|
||||
g_tool=iptables
|
||||
g_basedir=/usr/share/shorewall-lite
|
||||
g_lite=Yes
|
||||
;;
|
||||
shorewall6-lite)
|
||||
SHAREDIR=/usr/share/shorewall6-lite
|
||||
CONFDIR=/etc/shorewall6-lite
|
||||
g_product="Shorewall6 Lite"
|
||||
g_family=6
|
||||
g_tool=ip6tables
|
||||
g_basedir=/usr/share/shorewall6-lite
|
||||
g_lite=Yes
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${VARLIB}" ]; then
|
||||
VARLIB=${VARDIR}
|
||||
VARDIR=${VARLIB}/$g_program
|
||||
elif [ -z "${VARDIR}" ]; then
|
||||
VARDIR="${VARLIB}/${PRODUCT}"
|
||||
fi
|
||||
|
||||
#
|
||||
# Conditionally produce message
|
||||
#
|
||||
@@ -123,71 +127,6 @@ combine_list()
|
||||
echo $o
|
||||
}
|
||||
|
||||
#
|
||||
# Call this function to assert mutual exclusion with Shorewall. If you invoke the
|
||||
# /sbin/shorewall program while holding mutual exclusion, you should pass "nolock" as
|
||||
# the first argument. Example "shorewall nolock refresh"
|
||||
#
|
||||
# This function uses the lockfile utility from procmail if it exists.
|
||||
# Otherwise, it uses a somewhat race-prone algorithm to attempt to simulate the
|
||||
# behavior of lockfile.
|
||||
#
|
||||
mutex_on()
|
||||
{
|
||||
local try
|
||||
try=0
|
||||
local lockf
|
||||
lockf=${LOCKFILE:=${VARDIR}/lock}
|
||||
local lockpid
|
||||
|
||||
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
|
||||
|
||||
if [ $MUTEX_TIMEOUT -gt 0 ]; then
|
||||
|
||||
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
|
||||
|
||||
if [ -f $lockf ]; then
|
||||
lockpid=`cat ${lockf} 2> /dev/null`
|
||||
if [ -z "$lockpid" -o $lockpid = 0 ]; then
|
||||
rm -f ${lockf}
|
||||
error_message "WARNING: Stale lockfile ${lockf} removed"
|
||||
elif ! qt ps p ${lockpid}; then
|
||||
rm -f ${lockf}
|
||||
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
|
||||
fi
|
||||
fi
|
||||
|
||||
if qt mywhich lockfile; then
|
||||
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf}
|
||||
chmod u+w ${lockf}
|
||||
echo $$ > ${lockf}
|
||||
chmod u-w ${lockf}
|
||||
else
|
||||
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
|
||||
sleep 1
|
||||
try=$((${try} + 1))
|
||||
done
|
||||
|
||||
if [ ${try} -lt ${MUTEX_TIMEOUT} ] ; then
|
||||
# Create the lockfile
|
||||
echo $$ > ${lockf}
|
||||
else
|
||||
echo "Giving up on lock file ${lockf}" >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Call this function to release mutual exclusion
|
||||
#
|
||||
mutex_off()
|
||||
{
|
||||
rm -f ${LOCKFILE:=${VARDIR}/lock}
|
||||
}
|
||||
|
||||
[ -z "$LEFTSHIFT" ] && . /usr/share/shorewall/lib.common
|
||||
|
||||
#
|
||||
# Validate an IP address
|
||||
#
|
||||
@@ -316,6 +255,8 @@ ip_range_explicit() {
|
||||
done
|
||||
}
|
||||
|
||||
[ -z "$LEFTSHIFT" ] && . ${g_basedir}/lib.common
|
||||
|
||||
#
|
||||
# Netmask to VLSM
|
||||
#
|
||||
@@ -344,7 +285,7 @@ ip_vlsm() {
|
||||
#
|
||||
ensure_config_path() {
|
||||
local F
|
||||
F=${SHAREDIR}/configpath
|
||||
F=${g_sharedir}/configpath
|
||||
if [ -z "$CONFIG_PATH" ]; then
|
||||
[ -f $F ] || { echo " ERROR: $F does not exist"; exit 2; }
|
||||
. $F
|
||||
@@ -455,14 +396,14 @@ mktempfile() {
|
||||
else
|
||||
case "$MKTEMP" in
|
||||
BSD)
|
||||
mktemp /tmp/shorewall.XXXXXX
|
||||
mktemp ${TMPDIR:-/tmp}/shorewall.XXXXXX
|
||||
;;
|
||||
STD)
|
||||
mktemp -t shorewall.XXXXXX
|
||||
;;
|
||||
None)
|
||||
rm -f /tmp/shorewall-$$
|
||||
> /tmp/shorewall-$$ && echo /tmp/shorewall-$$
|
||||
rm -f ${TMPDIR:-/tmp}/shorewall-$$
|
||||
> ${TMPDIR:-}/shorewall-$$ && echo ${TMPDIR:-/tmp}/shorewall-$$
|
||||
;;
|
||||
*)
|
||||
error_message "ERROR:Internal error in mktempfile"
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -84,7 +84,7 @@ get_script_version() { # $1 = script
|
||||
|
||||
temp=$( $SHOREWALL_SHELL $1 version | tail -n 1 | sed 's/-.*//' )
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ -z "$temp" ]; then
|
||||
version=0
|
||||
else
|
||||
ifs=$IFS
|
||||
@@ -593,7 +593,7 @@ find_first_interface_address() # $1 = interface
|
||||
#
|
||||
[ -n "$addr" ] || startup_error "Can't determine the IP address of $1"
|
||||
#
|
||||
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
|
||||
# Strip off the trailing VLSM mask (or the peer IP in case of a P-t-P link)
|
||||
# along with everything else on the line
|
||||
#
|
||||
echo $addr | sed 's/\s*inet //;s/\/.*//;s/ peer.*//'
|
||||
@@ -676,7 +676,7 @@ find_file()
|
||||
fi
|
||||
done
|
||||
|
||||
echo ${CONFDIR}/$1
|
||||
echo ${g_confdir}/$1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -717,3 +717,69 @@ truncate() # $1 = length
|
||||
{
|
||||
cut -b -${1}
|
||||
}
|
||||
|
||||
#
|
||||
# Call this function to assert mutual exclusion with Shorewall. If you invoke the
|
||||
# /sbin/shorewall program while holding mutual exclusion, you should pass "nolock" as
|
||||
# the first argument. Example "shorewall nolock refresh"
|
||||
#
|
||||
# This function uses the lockfile utility from procmail if it exists.
|
||||
# Otherwise, it uses a somewhat race-prone algorithm to attempt to simulate the
|
||||
# behavior of lockfile.
|
||||
#
|
||||
mutex_on()
|
||||
{
|
||||
local try
|
||||
try=0
|
||||
local lockf
|
||||
lockf=${LOCKFILE:=${VARDIR}/lock}
|
||||
local lockpid
|
||||
|
||||
MUTEX_TIMEOUT=${MUTEX_TIMEOUT:-60}
|
||||
|
||||
if [ $MUTEX_TIMEOUT -gt 0 ]; then
|
||||
|
||||
[ -d ${VARDIR} ] || mkdir -p ${VARDIR}
|
||||
|
||||
if [ -f $lockf ]; then
|
||||
lockpid=`cat ${lockf} 2> /dev/null`
|
||||
if [ -z "$lockpid" -o $lockpid = 0 ]; then
|
||||
rm -f ${lockf}
|
||||
error_message "WARNING: Stale lockfile ${lockf} removed"
|
||||
elif [ $lockpid -eq $$ ]; then
|
||||
return 0
|
||||
elif ! qt ps p ${lockpid}; then
|
||||
rm -f ${lockf}
|
||||
error_message "WARNING: Stale lockfile ${lockf} from pid ${lockpid} removed"
|
||||
fi
|
||||
fi
|
||||
|
||||
if qt mywhich lockfile; then
|
||||
lockfile -${MUTEX_TIMEOUT} -r1 ${lockf}
|
||||
chmod u+w ${lockf}
|
||||
echo $$ > ${lockf}
|
||||
chmod u-w ${lockf}
|
||||
else
|
||||
while [ -f ${lockf} -a ${try} -lt ${MUTEX_TIMEOUT} ] ; do
|
||||
sleep 1
|
||||
try=$((${try} + 1))
|
||||
done
|
||||
|
||||
if [ ${try} -lt ${MUTEX_TIMEOUT} ] ; then
|
||||
# Create the lockfile
|
||||
echo $$ > ${lockf}
|
||||
else
|
||||
echo "Giving up on lock file ${lockf}" >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Call this function to release mutual exclusion
|
||||
#
|
||||
mutex_off()
|
||||
{
|
||||
rm -f ${LOCKFILE:=${VARDIR}/lock}
|
||||
}
|
||||
|
||||
|
20
Shorewall-core/shorewallrc.apple
Normal file
20
Shorewall-core/shorewallrc.apple
Normal file
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Apple OS X Shorewall 4.5 rc file
|
||||
#
|
||||
BUILD=apple
|
||||
HOST=apple
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
|
||||
PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
|
||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||
SBINDIR=/sbin #Directory where system administration programs are installed
|
||||
MANDIR=${SHAREDIR}/man #Directory where manpages are installed.
|
||||
INITDIR= #Unused on OS X
|
||||
INITFILE= #Unused on OS X
|
||||
INITSOURCE= #Unused on OS X
|
||||
ANNOTATED= #Unused on OS X
|
||||
SYSTEMD= #Unused on OS X
|
||||
SYSCONFDIR= #Unused on OS X
|
||||
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.
|
||||
VARLIB=/var/lib #Unused on OS X
|
21
Shorewall-core/shorewallrc.archlinux
Normal file
21
Shorewall-core/shorewallrc.archlinux
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# Archlinux Shorewall 4.5 rc file
|
||||
#
|
||||
BUILD=archlinux
|
||||
HOST=archlinux
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
|
||||
PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
|
||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||
SBINDIR=/sbin #Directory where system administration programs are installed
|
||||
MANDIR=${SHAREDIR}/man #Directory where manpages are installed.
|
||||
INITDIR=/etc/rc.d #Directory where SysV init scripts are installed.
|
||||
INITFILE=$PRODUCT #Name of the product's installed SysV init script
|
||||
INITSOURCE=init.sh #Name of the distributed file to be installed as the SysV init script
|
||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
||||
SYSCONFDIR= #Directory where SysV init parameter files are installed
|
||||
SYSTEMD= #Directory where .service files are installed (systems running systemd only)
|
||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
20
Shorewall-core/shorewallrc.cygwin
Normal file
20
Shorewall-core/shorewallrc.cygwin
Normal file
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Cygwin Shorewall 4.5 rc file
|
||||
#
|
||||
BUILD=cygwin
|
||||
HOST=cygwin
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
|
||||
PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
|
||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||
SBINDIR=/bin #Directory where system administration programs are installed
|
||||
MANDIR=${SHAREDIR}/man #Directory where manpages are installed.
|
||||
INITDIR=/etc/init.d #Unused on Cygwin
|
||||
INITFILE= #Unused on Cygwin
|
||||
INITSOURCE= #Unused on Cygwin
|
||||
ANNOTATED= #Unused on Cygwin
|
||||
SYSTEMD= #Unused on Cygwin
|
||||
SYSCONFDIR= #Unused on Cygwin
|
||||
SPARSE=Yes #Only install $PRODUCT/$PRODUCT.conf in $CONFDIR.
|
||||
VARLIB=/var/lib #Unused on Cygwin
|
22
Shorewall-core/shorewallrc.debian
Normal file
22
Shorewall-core/shorewallrc.debian
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Debian Shorewall 4.5 rc file
|
||||
#
|
||||
BUILD= #Default is to detect the build system
|
||||
HOST=debian
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
|
||||
PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
|
||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||
SBINDIR=/sbin #Directory where system administration programs are installed
|
||||
MANDIR=${PREFIX}/share/man #Directory where manpages are installed.
|
||||
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
|
||||
INITFILE=$PRODUCT #Name of the product's installed SysV init script
|
||||
INITSOURCE=init.debian.sh #Name of the distributed file to be installed as the SysV init script
|
||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
||||
SYSCONFFILE=default.debian #Name of the distributed file to be installed in $SYSCONFDIR
|
||||
SYSCONFDIR=/etc/default #Directory where SysV init parameter files are installed
|
||||
SYSTEMD= #Directory where .service files are installed (systems running systemd only)
|
||||
SPARSE=Yes #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
22
Shorewall-core/shorewallrc.default
Normal file
22
Shorewall-core/shorewallrc.default
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Default Shorewall 4.5 rc file
|
||||
#
|
||||
HOST=linux #Generic Linux
|
||||
BUILD= #Default is to detect the build system
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
|
||||
PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
|
||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||
SBINDIR=/sbin #Directory where system administration programs are installed
|
||||
MANDIR=${PREFIX}/man #Directory where manpages are installed.
|
||||
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
|
||||
INITFILE=$PRODUCT #Name of the product's installed SysV init script
|
||||
INITSOURCE=init.sh #Name of the distributed file to be installed as the SysV init script
|
||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
||||
SYSTEMD= #Directory where .service files are installed (systems running systemd only)
|
||||
SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR
|
||||
SYSCONFDIR= #Directory where SysV init parameter files are installed
|
||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
22
Shorewall-core/shorewallrc.redhat
Normal file
22
Shorewall-core/shorewallrc.redhat
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# RedHat/FedoraShorewall 4.5 rc file
|
||||
#
|
||||
BUILD= #Default is to detect the build system
|
||||
HOST=redhat
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/libexec #Directory for executable scripts.
|
||||
PERLLIBDIR=/usr/share/perl5/vendor_perl #Directory to install Shorewall Perl module directory
|
||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||
SBINDIR=/sbin #Directory where system administration programs are installed
|
||||
MANDIR=${SHAREDIR}/man #Directory where manpages are installed.
|
||||
INITDIR=/etc/rc.d/init.d #Directory where SysV init scripts are installed.
|
||||
INITFILE=$PRODUCT #Name of the product's installed SysV init script
|
||||
INITSOURCE=init.fedora.sh #Name of the distributed file to be installed as the SysV init script
|
||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
||||
SYSTEMD=/lib/systemd/system #Directory where .service files are installed (systems running systemd only)
|
||||
SYSCONFFILE=sysconfig #Name of the distributed file to be installed as $SYSCONFDIR/$PRODUCT
|
||||
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed
|
||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
23
Shorewall-core/shorewallrc.slackware
Normal file
23
Shorewall-core/shorewallrc.slackware
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# Slackware Shorewall 4.5 rc file
|
||||
#
|
||||
BUILD=slackware
|
||||
HOST=slackware
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/share #Directory for executable scripts.
|
||||
PERLLIBDIR=${PREFIX}/share/shorewall #Directory to install Shorewall Perl module directory
|
||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||
SBINDIR=/sbin #Directory where system administration programs are installed
|
||||
MANDIR=${PREFIX}/man #Directory where manpages are installed.
|
||||
INITDIR=/etc/rc.d #Directory where SysV init scripts are installed.
|
||||
AUXINITSOURCE=init.slackware.firewall.sh #Name of the distributed file to be installed as the SysV init script
|
||||
AUXINITFILE=rc.firewall #Name of the product's installed SysV init script
|
||||
INITSOURCE=init.slackware.$PRODUCT.sh #Name of the distributed file to be installed as a second SysV init script
|
||||
INITFILE=rc.$PRODUCT #Name of the product's installed second init script
|
||||
SYSTEMD= #Name of the directory where .service files are installed (systems running systemd only)
|
||||
SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR
|
||||
SYSCONFDIR= #Name of the directory where SysV init parameter files are installed.
|
||||
ANNOTATED= #If non-empty, install annotated configuration files
|
||||
VARLIB=/var/lib #Directory where product variable data is stored.
|
||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
22
Shorewall-core/shorewallrc.suse
Normal file
22
Shorewall-core/shorewallrc.suse
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# SuSE Shorewall 4.5 rc file
|
||||
#
|
||||
BUILD= #Default is to detect the build system
|
||||
HOST=suse
|
||||
PREFIX=/usr #Top-level directory for shared files, libraries, etc.
|
||||
CONFDIR=/etc #Directory where subsystem configurations are installed
|
||||
SHAREDIR=${PREFIX}/share #Directory for arch-neutral files.
|
||||
LIBEXECDIR=${PREFIX}/lib #Directory for executable scripts.
|
||||
PERLLIBDIR=${PREFIX}/lib/perl5/vendor_perl/5.14.2 #Directory to install Shorewall Perl module directory
|
||||
SBINDIR=/sbin #Directory where system administration programs are installed
|
||||
MANDIR=${SHAREDIR}/man/ #Directory where manpages are installed.
|
||||
INITDIR=/etc/init.d #Directory where SysV init scripts are installed.
|
||||
INITFILE=$PRODUCT #Name of the product's SysV init script
|
||||
INITSOURCE=init.suse.sh #Name of the distributed file to be installed as the SysV init script
|
||||
ANNOTATED= #If non-zero, annotated configuration files are installed
|
||||
SYSTEMD= #Directory where .service files are installed (systems running systemd only)
|
||||
SYSCONFFILE= #Name of the distributed file to be installed in $SYSCONFDIR
|
||||
SYSCONFDIR=/etc/sysconfig/ #Directory where SysV init parameter files are installed
|
||||
SPARSE= #If non-empty, only install $PRODUCT/$PRODUCT.conf in $CONFDIR
|
||||
VARLIB=/var/lib #Directory where persistent product data is stored.
|
||||
VARDIR=${VARLIB}/$PRODUCT #Directory where product variable data is stored.
|
@@ -31,7 +31,7 @@ VERSION=xxx #The Build script inserts the actual version
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME"
|
||||
echo "usage: $ME [ <shorewallrc file> ]"
|
||||
exit $1
|
||||
}
|
||||
|
||||
@@ -60,8 +60,37 @@ remove_file() # $1 = file to restore
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -f /usr/share/shorewall/coreversion ]; then
|
||||
INSTALLED_VERSION="$(cat /usr/share/shorewall/coreversion)"
|
||||
#
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
file=./.shorewallrc
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
else
|
||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||
fi
|
||||
elif [ $# -eq 1 ]; then
|
||||
file=$1
|
||||
case $file in
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [ -f ${SHAREDIR}/shorewall/coreversion ]; then
|
||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall/coreversion)"
|
||||
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||
echo "WARNING: Shorewall Core Version $INSTALLED_VERSION is installed"
|
||||
echo " and this is the $VERSION uninstaller."
|
||||
@@ -72,12 +101,9 @@ else
|
||||
VERSION=""
|
||||
fi
|
||||
|
||||
[ -n "${LIBEXEC:=/usr/share}" ]
|
||||
[ -n "${PERLLIB:=/usr/share/shorewall}" ]
|
||||
|
||||
echo "Uninstalling Shorewall Core $VERSION"
|
||||
|
||||
rm -rf /usr/share/shorewall
|
||||
rm -rf ${SHAREDIR}/shorewall
|
||||
|
||||
echo "Shorewall Core Uninstalled"
|
||||
|
||||
|
@@ -22,6 +22,21 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
setstatedir() {
|
||||
local statedir
|
||||
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
||||
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
|
||||
fi
|
||||
|
||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
||||
|
||||
if [ ! -x $STATEDIR/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Debian_SuSE_ppp() {
|
||||
NEWPRODUCTS=
|
||||
INTERFACE="$1"
|
||||
@@ -71,6 +86,11 @@ Debian_SuSE_ppp() {
|
||||
IFUPDOWN=0
|
||||
PRODUCTS=
|
||||
|
||||
#
|
||||
# The installer may alter this
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
if [ -f /etc/default/shorewall-init ]; then
|
||||
. /etc/default/shorewall-init
|
||||
elif [ -f /etc/sysconfig/shorewall-init ]; then
|
||||
@@ -101,15 +121,11 @@ if [ -f /etc/debian_version ]; then
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$PHASE" in
|
||||
pre-*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
PHASE=''
|
||||
|
||||
case $0 in
|
||||
/etc/ppp*)
|
||||
#
|
||||
@@ -141,6 +157,8 @@ else
|
||||
#
|
||||
# Assume RedHat/Fedora/CentOS/Foobar/...
|
||||
#
|
||||
PHASE=''
|
||||
|
||||
case $0 in
|
||||
/etc/ppp*)
|
||||
INTERFACE="$1"
|
||||
@@ -181,15 +199,13 @@ else
|
||||
esac
|
||||
fi
|
||||
|
||||
[ -n "$LOGFILE" ] || LOGFILE=/dev/null
|
||||
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
VARDIR=/var/lib/$PRODUCT
|
||||
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
|
||||
if [ -x $VARDIR/firewall ]; then
|
||||
( . /usr/share/$PRODUCT/lib.base
|
||||
mutex_on
|
||||
${VARDIR}/firewall -V0 $COMMAND $INTERFACE || echo_notdone
|
||||
mutex_off
|
||||
)
|
||||
setstatedir
|
||||
|
||||
if [ -x $VARLIB/$PRODUCT/firewall ]; then
|
||||
( ${VARLIB}/$PRODUCT/firewall -V0 $COMMAND $INTERFACE >> $LOGFILE 2>&1 ) || true
|
||||
fi
|
||||
done
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.4
|
||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2010 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2010,2012 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
@@ -62,10 +62,33 @@ not_configured () {
|
||||
exit 0
|
||||
}
|
||||
|
||||
# set the STATEDIR variable
|
||||
setstatedir() {
|
||||
local statedir
|
||||
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
||||
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
|
||||
fi
|
||||
|
||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
||||
|
||||
if [ ! -x $STATEDIR/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# The installer may alter this
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
vardir=$VARDIR
|
||||
|
||||
# check if shorewall-init is configured or not
|
||||
if [ -f "/etc/default/shorewall-init" ]
|
||||
if [ -f "$SYSCONFDIR/shorewall-init" ]
|
||||
then
|
||||
. /etc/default/shorewall-init
|
||||
. $SYSCONFDIR/shorewall-init
|
||||
if [ -z "$PRODUCTS" ]
|
||||
then
|
||||
not_configured
|
||||
@@ -76,27 +99,27 @@ fi
|
||||
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local product
|
||||
local VARDIR
|
||||
local PRODUCT
|
||||
local STATEDIR
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
VARDIR=/var/lib/$product
|
||||
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
setstatedir
|
||||
|
||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
#
|
||||
# Run in a sub-shell to avoid name collisions
|
||||
#
|
||||
(
|
||||
. /usr/share/$product/lib.base
|
||||
#
|
||||
# Get mutex so the firewall state is stable
|
||||
#
|
||||
mutex_on
|
||||
if ! ${VARDIR}/firewall status > /dev/null 2>&1; then
|
||||
${VARDIR}/firewall stop || echo_notdone
|
||||
if ! ${VARDIR}/$PRODUCT/firewall status > /dev/null 2>&1; then
|
||||
${VARDIR}/$PRODUCT/firewall stop || echo_notdone
|
||||
fi
|
||||
mutex_off
|
||||
)
|
||||
fi
|
||||
done
|
||||
@@ -108,19 +131,21 @@ shorewall_start () {
|
||||
|
||||
# Clear the firewall
|
||||
shorewall_stop () {
|
||||
local product
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
VARDIR=/var/lib/$product
|
||||
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
( . /usr/share/$product/lib.base
|
||||
mutex_on
|
||||
${VARDIR}/firewall clear || echo_notdone
|
||||
mutex_off
|
||||
)
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
setstatedir
|
||||
|
||||
if [ ! -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
${VARDIR}/$PRODUCT/firewall clear || echo_notdone
|
||||
fi
|
||||
done
|
||||
|
||||
|
70
Shorewall-init/init.fedora.sh
Normal file → Executable file
70
Shorewall-init/init.fedora.sh
Normal file → Executable file
@@ -13,6 +13,10 @@
|
||||
# Description: Place the firewall in a safe state at boot time
|
||||
# prior to bringing up the network.
|
||||
### END INIT INFO
|
||||
#determine where the files were installed
|
||||
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
prog="shorewall-init"
|
||||
logger="logger -i -t $prog"
|
||||
lockfile="/var/lock/subsys/shorewall-init"
|
||||
@@ -20,6 +24,8 @@ lockfile="/var/lock/subsys/shorewall-init"
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
vardir=$VARDIR
|
||||
|
||||
# Get startup options (override default)
|
||||
OPTIONS=
|
||||
|
||||
@@ -31,9 +37,25 @@ else
|
||||
exit 6
|
||||
fi
|
||||
|
||||
# set the STATEDIR variable
|
||||
setstatedir() {
|
||||
local statedir
|
||||
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
||||
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
|
||||
fi
|
||||
|
||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
||||
|
||||
if [ ! -x $STATEDIR/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Initialize the firewall
|
||||
start () {
|
||||
local product
|
||||
local PRODUCT
|
||||
local vardir
|
||||
|
||||
if [ -z "$PRODUCTS" ]; then
|
||||
@@ -43,13 +65,19 @@ start () {
|
||||
fi
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
vardir=/var/lib/$product
|
||||
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
|
||||
if [ -x ${vardir}/firewall ]; then
|
||||
${vardir}/firewall stop 2>&1 | $logger
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
setstatedir
|
||||
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
${VARDIR}/$PRODUCT/firewall stop 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
[ retval -ne 0 ] && break
|
||||
[ $retval -ne 0 ] && break
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -65,17 +93,23 @@ start () {
|
||||
|
||||
# Clear the firewall
|
||||
stop () {
|
||||
local product
|
||||
local PRODUCT
|
||||
local vardir
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for product in $PRODUCTS; do
|
||||
vardir=/var/lib/$product
|
||||
[ -f /etc/$product/vardir ] && . /etc/$product/vardir
|
||||
if [ -x ${vardir}/firewall ]; then
|
||||
${vardir}/firewall clear 2>&1 | $logger
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
setstatedir
|
||||
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/$PRODUCT/firewall ]; then
|
||||
${VARDIR}/$PRODUCT/firewall clear 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
[ retval -ne 0 ] && break
|
||||
[ $retval -ne 0 ] && break
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -102,19 +136,15 @@ case "$1" in
|
||||
status_q || exit 0
|
||||
$1
|
||||
;;
|
||||
restart|reload|force-reload)
|
||||
restart|reload|force-reload|condrestart|try-restart)
|
||||
echo "Not implemented"
|
||||
exit 3
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
echo "Not implemented"
|
||||
exit 3
|
||||
;;
|
||||
status)
|
||||
status $prog
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/shorewall-init {start|stop}"
|
||||
echo "Usage: /etc/init.d/shorewall-init {start|stop|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#! /bin/bash
|
||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.4
|
||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2010 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 2010,2012 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
@@ -53,18 +53,39 @@ else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# The installer may alter this
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
# Locate the current PRODUCT's statedir
|
||||
setstatedir() {
|
||||
local statedir
|
||||
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
||||
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
|
||||
fi
|
||||
|
||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
||||
|
||||
if [ ! -x $STATEDIR/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile $STATEDIR/firewall
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
local STATEDIR
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
VARDIR=/var/lib/$PRODUCT
|
||||
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
if ! /sbin/$PRODUCT status > /dev/null 2>&1; then
|
||||
${VARDIR}/firewall stop || echo_notdone
|
||||
setstatedir
|
||||
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
${STATEDIR}/firewall stop || echo_notdone
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -83,8 +104,14 @@ shorewall_stop () {
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
VARDIR=/var/lib/$PRODUCT
|
||||
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
|
||||
setstatedir
|
||||
|
||||
if [ ! -x ${VARDIR}/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $product = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
${VARDIR}/firewall clear || exit 1
|
||||
fi
|
||||
|
135
Shorewall-init/init.suse.sh
Executable file
135
Shorewall-init/init.suse.sh
Executable file
@@ -0,0 +1,135 @@
|
||||
#! /bin/bash
|
||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2010,2012 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: shorewall-init
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: 2 3 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Initialize the firewall at boot time
|
||||
# Description: Place the firewall in a safe state at boot time
|
||||
# prior to bringing up the network.
|
||||
### END INIT INFO
|
||||
|
||||
if [ "$(id -u)" != "0" ]
|
||||
then
|
||||
echo "You must be root to start, stop or restart \"Shorewall \"."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check if shorewall-init is configured or not
|
||||
if [ -f "/etc/sysconfig/shorewall-init" ]
|
||||
then
|
||||
. /etc/sysconfig/shorewall-init
|
||||
if [ -z "$PRODUCTS" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# The installer may alter this
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
# set the STATEDIR variable
|
||||
setstatedir() {
|
||||
local statedir
|
||||
if [ -f ${CONFDIR}/${PRODUCT}/vardir ]; then
|
||||
statedir=$( . /${CONFDIR}/${PRODUCT}/vardir && echo $VARDIR )
|
||||
fi
|
||||
|
||||
[ -n "$statedir" ] && STATEDIR=${statedir} || STATEDIR=${VARDIR}/${PRODUCT}
|
||||
|
||||
if [ ! -x $STATEDIR/firewall ]; then
|
||||
if [ $PRODUCT = shorewall -o $PRODUCT = shorewall6 ]; then
|
||||
${SBINDIR}/$PRODUCT compile
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local PRODUCT
|
||||
local STATEDIR
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
setstatedir
|
||||
|
||||
if [ -x $STATEDIR/firewall ]; then
|
||||
if ! ${SBIN}/$PRODUCT status > /dev/null 2>&1; then
|
||||
$STATEDIR/$PRODUCT/firewall stop || echo_notdone
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
||||
ipset -R < "$SAVE_IPSETS"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Clear the firewall
|
||||
shorewall_stop () {
|
||||
local PRODUCT
|
||||
local STATEDIR
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
setstatedir
|
||||
|
||||
if [ -x ${STATEDIR}/firewall ]; then
|
||||
${STATEDIR}/firewall clear || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" ]; then
|
||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
shorewall_start
|
||||
;;
|
||||
stop)
|
||||
shorewall_stop
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/shorewall-init {start|stop}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
@@ -28,12 +28,18 @@ VERSION=xxx #The Build script inserts the actual version.
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME"
|
||||
echo "usage: $ME [ <configuration-file> ]"
|
||||
echo " $ME -v"
|
||||
echo " $ME -h"
|
||||
exit $1
|
||||
}
|
||||
|
||||
fatal_error()
|
||||
{
|
||||
echo " ERROR: $@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
split() {
|
||||
local ifs
|
||||
ifs=$IFS
|
||||
@@ -76,9 +82,9 @@ cant_autostart()
|
||||
echo "WARNING: Unable to configure shorewall init to start automatically at boot" >&2
|
||||
}
|
||||
|
||||
delete_file() # $1 = file to delete
|
||||
require()
|
||||
{
|
||||
rm -f $1
|
||||
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
||||
}
|
||||
|
||||
install_file() # $1 = source $2 = target $3 = mode
|
||||
@@ -86,174 +92,248 @@ install_file() # $1 = source $2 = target $3 = mode
|
||||
run_install $T $OWNERSHIP -m $3 $1 ${2}
|
||||
}
|
||||
|
||||
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
|
||||
cd "$(dirname $0)"
|
||||
|
||||
PRODUCT=shorewall-init
|
||||
|
||||
# DEST is the SysVInit script directory
|
||||
# INIT is the name of the script in the $DEST directory
|
||||
# ARGS is "yes" if we've already parsed an argument
|
||||
#
|
||||
ARGS=""
|
||||
# Parse the run line
|
||||
#
|
||||
finished=0
|
||||
|
||||
if [ -z "$DEST" ] ; then
|
||||
DEST="/etc/init.d"
|
||||
fi
|
||||
|
||||
if [ -z "$INIT" ] ; then
|
||||
INIT="shorewall-init"
|
||||
fi
|
||||
|
||||
while [ $# -gt 0 ] ; do
|
||||
while [ $finished -eq 0 ] ; do
|
||||
case "$1" in
|
||||
-h|help|?)
|
||||
usage 0
|
||||
;;
|
||||
-v)
|
||||
echo "Shorewall Init Installer Version $VERSION"
|
||||
exit 0
|
||||
-*)
|
||||
option=${option#-}
|
||||
|
||||
while [ -n "$option" ]; do
|
||||
case $option in
|
||||
h)
|
||||
usage 0
|
||||
;;
|
||||
v)
|
||||
echo "Shorewall-init Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
finished=1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
ARGS="yes"
|
||||
done
|
||||
|
||||
#
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
#
|
||||
# Load packager's settings if any
|
||||
#
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc || exit 1
|
||||
file=~/.shorewallrc
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
file=./.shorewallrc
|
||||
else
|
||||
fatal_error "No configuration file specified and ~/.shorewallrc not found"
|
||||
fi
|
||||
elif [ $# -eq 1 ]; then
|
||||
file=$1
|
||||
case $file in
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [ -z "${VARLIB}" ]; then
|
||||
VARLIB=${VARDIR}
|
||||
VARDIR=${VARLIB}/${PRODUCT}
|
||||
elif [ -z "${VARDIR}" ]; then
|
||||
VARDIR=${VARLIB}/${PRODUCT}
|
||||
fi
|
||||
|
||||
for var in SHAREDIR LIBEXECDIR CONFDIR SBINDIR VARLIB VARDIR; do
|
||||
require $var
|
||||
done
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
[ -n "${LIBEXEC:=/usr/share}" ]
|
||||
if [ -z "$BUILD" ]; then
|
||||
case $(uname) in
|
||||
cygwin*)
|
||||
BUILD=cygwin
|
||||
;;
|
||||
Darwin)
|
||||
BUILD=apple
|
||||
;;
|
||||
*)
|
||||
if [ -f /etc/debian_version ]; then
|
||||
BUILD=debian
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
BUILD=redhat
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
BUILD=suse
|
||||
elif [ -f /etc/slackware-version ] ; then
|
||||
BUILD=slackware
|
||||
elif [ -f /etc/arch-release ] ; then
|
||||
BUILD=archlinux
|
||||
else
|
||||
BUILD=linux
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "$LIBEXEC" in
|
||||
/*)
|
||||
;;
|
||||
*)
|
||||
LIBEXEC=/usr/${LIBEXEC}
|
||||
;;
|
||||
esac
|
||||
[ -n "$OWNER" ] || OWNER=$(id -un)
|
||||
[ -n "$GROUP" ] || GROUP=$(id -gn)
|
||||
|
||||
#
|
||||
# Determine where to install the firewall script
|
||||
#
|
||||
|
||||
case $(uname) in
|
||||
Darwin)
|
||||
[ -z "$OWNER" ] && OWNER=root
|
||||
[ -z "$GROUP" ] && GROUP=wheel
|
||||
case $BUILD in
|
||||
apple)
|
||||
T=
|
||||
;;
|
||||
;;
|
||||
debian|redhat|suse|slackware|archlinux)
|
||||
;;
|
||||
*)
|
||||
[ -z "$OWNER" ] && OWNER=root
|
||||
[ -z "$GROUP" ] && GROUP=root
|
||||
[ -n "$BUILD" ] && echo "ERROR: Unknown BUILD environment ($BUILD)" >&2 || echo "ERROR: Unknown BUILD environment"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
OWNERSHIP="-o $OWNER -g $GROUP"
|
||||
|
||||
[ -n "$HOST" ] || HOST=$BUILD
|
||||
|
||||
case "$HOST" in
|
||||
debian)
|
||||
echo "Installing Debian-specific configuration..."
|
||||
;;
|
||||
redhat|redhat)
|
||||
echo "Installing Redhat/Fedora-specific configuration..."
|
||||
;;
|
||||
slackware)
|
||||
echo "Shorewall-init is currently not supported on Slackware" >&2
|
||||
exit 1
|
||||
;;
|
||||
archlinux)
|
||||
echo "Shorewall-init is currently not supported on Arch Linux" >&2
|
||||
exit 1
|
||||
;;
|
||||
suse|suse)
|
||||
echo "Installing SuSE-specific configuration..."
|
||||
;;
|
||||
linux)
|
||||
echo "ERROR: Shorewall-init is not supported on this system" >&2
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unsupported HOST distribution: \"$HOST\"" >&2
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -z "$TARGET" ] && TARGET=$HOST
|
||||
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
if [ `id -u` != 0 ] ; then
|
||||
echo "Not setting file owner/group permissions, not running as root."
|
||||
OWNERSHIP=""
|
||||
fi
|
||||
|
||||
install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST}
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
DEBIAN=yes
|
||||
elif [ -f /etc/SuSE-release ]; then
|
||||
SUSE=Yes
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
FEDORA=Yes
|
||||
elif [ -f /etc/slackware-version ] ; then
|
||||
echo "Shorewall-init is currently not supported on Slackware" >&2
|
||||
exit 1
|
||||
# DEST="/etc/rc.d"
|
||||
# INIT="rc.firewall"
|
||||
elif [ -f /etc/arch-release ] ; then
|
||||
echo "Shorewall-init is currently not supported on Arch Linux" >&2
|
||||
exit 1
|
||||
# DEST="/etc/rc.d"
|
||||
# INIT="shorewall-init"
|
||||
# ARCHLINUX=yes
|
||||
elif [ -d /etc/sysconfig/network-scripts/ ]; then
|
||||
#
|
||||
# Assume RedHat-based
|
||||
#
|
||||
REDHAT=Yes
|
||||
else
|
||||
echo "Unknown distribution: Shorewall-init support is not available" >&2
|
||||
exit 1
|
||||
install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
|
||||
fi
|
||||
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
if [ -f /lib/systemd/system ]; then
|
||||
SYSTEMD=Yes
|
||||
fi
|
||||
elif [ -n "$SYSTEMD" ]; then
|
||||
mkdir -p ${DESTDIR}/lib/systemd/system
|
||||
fi
|
||||
|
||||
#
|
||||
# Change to the directory containing this script
|
||||
#
|
||||
cd "$(dirname $0)"
|
||||
|
||||
echo "Installing Shorewall Init Version $VERSION"
|
||||
|
||||
#
|
||||
# Check for /usr/share/shorewall-init/version
|
||||
#
|
||||
if [ -f ${DESTDIR}/usr/share/shorewall-init/version ]; then
|
||||
if [ -f ${DESTDIR}${SHAREDIR}/shorewall-init/version ]; then
|
||||
first_install=""
|
||||
else
|
||||
first_install="Yes"
|
||||
fi
|
||||
|
||||
#
|
||||
# Install the Init Script
|
||||
#
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
install_file init.debian.sh ${DESTDIR}/etc/init.d/shorewall-init 0544
|
||||
elif [ -n "$FEDORA" ]; then
|
||||
install_file init.fedora.sh ${DESTDIR}/etc/init.d/shorewall-init 0544
|
||||
#elif [ -n "$ARCHLINUX" ]; then
|
||||
# install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544
|
||||
else
|
||||
install_file init.sh ${DESTDIR}${DEST}/$INIT 0544
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
fi
|
||||
|
||||
echo "Shorewall Init script installed in ${DESTDIR}${DEST}/$INIT"
|
||||
#
|
||||
# Install the Firewall Script
|
||||
#
|
||||
if [ -n "$INITFILE" ]; then
|
||||
install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544
|
||||
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$INITFILE
|
||||
|
||||
if [ -n "${AUXINITSOURCE}" ]; then
|
||||
install_file $INITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544
|
||||
fi
|
||||
|
||||
echo "Shorewall-init script installed in ${DESTDIR}${INITDIR}/$INITFILE"
|
||||
fi
|
||||
|
||||
#
|
||||
# Install the .service file
|
||||
#
|
||||
if [ -n "$SYSTEMD" ]; then
|
||||
run_install $OWNERSHIP -m 600 shorewall-init.service ${DESTDIR}/lib/systemd/system/shorewall-init.service
|
||||
echo "Service file installed as ${DESTDIR}/lib/systemd/system/shorewall-init.service"
|
||||
mkdir -p ${DESTDIR}${SYSTEMD}
|
||||
run_install $OWNERSHIP -m 600 shorewall-init.service ${DESTDIR}${SYSTEMD}/shorewall-init.service
|
||||
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SYSTEMD}/shorewall-init.service
|
||||
echo "Service file installed as ${DESTDIR}${SYSTEMD}/shorewall-init.service"
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
mkdir -p ${DESTDIR}${SBINDIR}
|
||||
chmod 755 ${DESTDIR}${SBINDIR}
|
||||
fi
|
||||
run_install $OWNERSHIP -m 700 shorewall-init ${DESTDIR}${SBINDIR}/shorewall-init
|
||||
echo "CLI installed as ${DESTDIR}${SBINDIR}/shorewall-init"
|
||||
fi
|
||||
|
||||
#
|
||||
# Create /usr/share/shorewall-init if needed
|
||||
#
|
||||
mkdir -p ${DESTDIR}/usr/share/shorewall-init
|
||||
chmod 755 ${DESTDIR}/usr/share/shorewall-init
|
||||
mkdir -p ${DESTDIR}${SHAREDIR}/shorewall-init
|
||||
chmod 755 ${DESTDIR}${SHAREDIR}/shorewall-init
|
||||
|
||||
#
|
||||
# Install logrotate file
|
||||
#
|
||||
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
|
||||
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT
|
||||
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
|
||||
fi
|
||||
|
||||
#
|
||||
# Create the version file
|
||||
#
|
||||
echo "$VERSION" > ${DESTDIR}/usr/share/shorewall-init/version
|
||||
chmod 644 ${DESTDIR}/usr/share/shorewall-init/version
|
||||
echo "$VERSION" > ${DESTDIR}/${SHAREDIR}/shorewall-init/version
|
||||
chmod 644 ${DESTDIR}${SHAREDIR}/shorewall-init/version
|
||||
|
||||
#
|
||||
# Remove and create the symbolic link to the init script
|
||||
#
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
rm -f /usr/share/shorewall-init/init
|
||||
ln -s ${DEST}/${INIT} /usr/share/shorewall-init/init
|
||||
rm -f ${SHAREDIR}/shorewall-init/init
|
||||
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/shorewall-init/init
|
||||
fi
|
||||
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
if [ $HOST = debian ]; then
|
||||
if [ -n "${DESTDIR}" ]; then
|
||||
mkdir -p ${DESTDIR}/etc/network/if-up.d/
|
||||
mkdir -p ${DESTDIR}/etc/network/if-post-down.d/
|
||||
mkdir -p ${DESTDIR}/etc/network/if-down.d/
|
||||
fi
|
||||
|
||||
if [ ! -f ${DESTDIR}/etc/default/shorewall-init ]; then
|
||||
@@ -265,20 +345,20 @@ if [ -n "$DEBIAN" ]; then
|
||||
fi
|
||||
else
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
mkdir -p ${DESTDIR}/etc/sysconfig
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}
|
||||
|
||||
if [ -z "$RPM" ]; then
|
||||
if [ -n "$SUSE" ]; then
|
||||
if [ $HOST = suse ]; then
|
||||
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-up.d
|
||||
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-down.d
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}/network/if-down.d
|
||||
else
|
||||
mkdir -p ${DESTDIR}/etc/NetworkManager/dispatcher.d
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d ${DESTDIR}/etc/sysconfig -a ! -f ${DESTDIR}/etc/sysconfig/shorewall-init ]; then
|
||||
install_file sysconfig ${DESTDIR}/etc/sysconfig/shorewall-init 0644
|
||||
if [ -d ${DESTDIR}${SYSCONFDIR} -a ! -f ${DESTDIR}${SYSCONFDIR}/shorewall-init ]; then
|
||||
install_file sysconfig ${DESTDIR}${SYSCONFDIR}/shorewall-init 0644
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -286,105 +366,119 @@ fi
|
||||
# Install the ifupdown script
|
||||
#
|
||||
|
||||
mkdir -p ${DESTDIR}${LIBEXEC}/shorewall-init
|
||||
cp ifupdown.sh ifupdown
|
||||
|
||||
install_file ifupdown.sh ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown 0544
|
||||
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
|
||||
|
||||
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
|
||||
|
||||
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown 0544
|
||||
|
||||
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
|
||||
install_file ifupdown.sh ${DESTDIR}/etc/NetworkManager/dispatcher.d/01-shorewall 0544
|
||||
install_file ifupdown ${DESTDIR}/etc/NetworkManager/dispatcher.d/01-shorewall 0544
|
||||
fi
|
||||
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
install_file ifupdown.sh ${DESTDIR}/etc/network/if-up.d/shorewall 0544
|
||||
install_file ifupdown.sh ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
|
||||
elif [ -n "$SUSE" ]; then
|
||||
install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-up.d/shorewall 0544
|
||||
install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-down.d/shorewall 0544
|
||||
elif [ -n "$REDHAT" ]; then
|
||||
if [ -f ${DESTDIR}/sbin/ifup-local -o -f ${DESTDIR}/sbin/ifdown-local ]; then
|
||||
echo "WARNING: /sbin/ifup-local and/or /sbin/ifdown-local already exist; up/down events will not be handled"
|
||||
else
|
||||
install_file ifupdown.sh ${DESTDIR}/sbin/ifup-local 0544
|
||||
install_file ifupdown.sh ${DESTDIR}/sbin/ifdown-local 0544
|
||||
fi
|
||||
fi
|
||||
case $HOST in
|
||||
debian)
|
||||
install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544
|
||||
install_file ifupdown ${DESTDIR}/etc/network/if-down.d/shorewall 0544
|
||||
install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
|
||||
;;
|
||||
suse)
|
||||
if [ -z "$RPM" ]; then
|
||||
install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-up.d/shorewall 0544
|
||||
install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-down.d/shorewall 0544
|
||||
fi
|
||||
;;
|
||||
redhat)
|
||||
if [ -f ${DESTDIR}${SBINDIR}/ifup-local -o -f ${DESTDIR}${SBINDIR}/ifdown-local ]; then
|
||||
echo "WARNING: ${SBINDIR}/ifup-local and/or ${SBINDIR}/ifdown-local already exist; up/down events will not be handled"
|
||||
elif [ -z "$DESTDIR" ]; then
|
||||
install_file ifupdown ${DESTDIR}${SBINDIR}/ifup-local 0544
|
||||
install_file ifupdown ${DESTDIR}${SBINDIR}/ifdown-local 0544
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
if [ -n "$first_install" ]; then
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
if [ $HOST = debian ]; then
|
||||
|
||||
update-rc.d shorewall-init defaults
|
||||
update-rc.d shorewall-init enable
|
||||
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
else
|
||||
if [ -n "$SYSTEMD" ]; then
|
||||
if systemctl enable shorewall-init; then
|
||||
if systemctl enable shorewall-init.service; then
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
fi
|
||||
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
|
||||
if insserv /etc/init.d/shorewall-init ; then
|
||||
elif [ -x ${SBINDIR}/insserv -o -x /usr${SBINDIR}/insserv ]; then
|
||||
if insserv ${INITDIR}/shorewall-init ; then
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
|
||||
elif [ -x ${SBINDIR}/chkconfig -o -x /usr${SBINDIR}/chkconfig ]; then
|
||||
if chkconfig --add shorewall-init ; then
|
||||
echo "Shorewall Init will start automatically in run levels as follows:"
|
||||
chkconfig --list shorewall-init
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ -x /sbin/rc-update ]; then
|
||||
elif [ -x ${SBINDIR}/rc-update ]; then
|
||||
if rc-update add shorewall-init default; then
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -n "$first_install" ]; then
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
if [ $HOST = debian ]; then
|
||||
if [ -n "${DESTDIR}" ]; then
|
||||
mkdir -p ${DESTDIR}/etc/rcS.d
|
||||
fi
|
||||
|
||||
ln -sf ../init.d/shorewall-init ${DESTDIR}/etc/rcS.d/S38shorewall-init
|
||||
ln -sf ../init.d/shorewall-init ${DESTDIR}${CONFDIR}/rcS.d/S38shorewall-init
|
||||
echo "Shorewall Init will start automatically at boot"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f ${DESTDIR}/etc/ppp ]; then
|
||||
if [ -n "$DEBIAN" ] -o -n "$SUSE" ]; then
|
||||
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do
|
||||
mkdir -p ${DESTDIR}/etc/ppp/$directory #SuSE doesn't create the IPv6 directories
|
||||
cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown ${DESTDIR}/etc/ppp/$directory/shorewall
|
||||
done
|
||||
elif [ -n "$REDHAT" ]; then
|
||||
#
|
||||
# Must use the dreaded ip_xxx.local file
|
||||
#
|
||||
for file in ip-up.local ip-down.local; do
|
||||
FILE=${DESTDIR}/etc/ppp/$file
|
||||
if [ -f $FILE ]; then
|
||||
if fgrep -q Shorewall-based $FILE ; then
|
||||
cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown $FILE
|
||||
else
|
||||
echo "$FILE already exists -- ppp devices will not be handled"
|
||||
break
|
||||
fi
|
||||
else
|
||||
cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown $FILE
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
[ -z "${DESTDIR}" ] && [ ! -f ~/.shorewallrc ] && cp ${SHAREDIR}/shorewall/shorewallrc .
|
||||
|
||||
if [ -f ${DESTDIR}/etc/ppp ]; then
|
||||
case $HOST in
|
||||
debian|suse)
|
||||
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do
|
||||
mkdir -p ${DESTDIR}/etc/ppp/$directory #SuSE doesn't create the IPv6 directories
|
||||
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown ${DESTDIR}${CONFDIR}/ppp/$directory/shorewall
|
||||
done
|
||||
;;
|
||||
redhat)
|
||||
#
|
||||
# Must use the dreaded ip_xxx.local file
|
||||
#
|
||||
for file in ip-up.local ip-down.local; do
|
||||
FILE=${DESTDIR}/etc/ppp/$file
|
||||
if [ -f $FILE ]; then
|
||||
if fgrep -q Shorewall-based $FILE ; then
|
||||
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown $FILE
|
||||
else
|
||||
echo "$FILE already exists -- ppp devices will not be handled"
|
||||
break
|
||||
fi
|
||||
else
|
||||
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown $FILE
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
#
|
||||
# Report Success
|
||||
#
|
||||
|
5
Shorewall-init/logrotate
Normal file
5
Shorewall-init/logrotate
Normal file
@@ -0,0 +1,5 @@
|
||||
/var/log/shorewall-ifupdown.log {
|
||||
missingok
|
||||
notifempty
|
||||
create 0600 root root
|
||||
}
|
100
Shorewall-init/shorewall-init
Normal file
100
Shorewall-init/shorewall-init
Normal file
@@ -0,0 +1,100 @@
|
||||
#! /bin/bash
|
||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2012 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
#########################################################################################
|
||||
#
|
||||
# This is modified by the installer when ${SHAREDIR} <> /usr/share
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
# check if shorewall-init is configured or not
|
||||
if [ -f "$SYSCONFDIR/shorewall-init" ]; then
|
||||
. $SYSCONFDIR/shorewall-init
|
||||
if [ -z "$PRODUCTS" ]; then
|
||||
echo "ERROR: No products configured" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "ERROR: /etc/sysconfig/shorewall-init not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Initialize the firewall
|
||||
shorewall_start () {
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
|
||||
echo -n "Initializing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
if ! /sbin/$PRODUCT status > /dev/null 2>&1; then
|
||||
${VARDIR}/firewall stop || exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" -a -f "$SAVE_IPSETS" ]; then
|
||||
ipset -R < "$SAVE_IPSETS"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Clear the firewall
|
||||
shorewall_stop () {
|
||||
local PRODUCT
|
||||
local VARDIR
|
||||
|
||||
echo -n "Clearing \"Shorewall-based firewalls\": "
|
||||
for PRODUCT in $PRODUCTS; do
|
||||
VARDIR=/var/lib/$PRODUCT
|
||||
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
|
||||
if [ -x ${VARDIR}/firewall ]; then
|
||||
${VARDIR}/firewall clear || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SAVE_IPSETS" ]; then
|
||||
mkdir -p $(dirname "$SAVE_IPSETS")
|
||||
if ipset -S > "${SAVE_IPSETS}.tmp"; then
|
||||
grep -qE -- '^(-N|create )' "${SAVE_IPSETS}.tmp" && mv -f "${SAVE_IPSETS}.tmp" "$SAVE_IPSETS"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
shorewall_start
|
||||
;;
|
||||
stop)
|
||||
shorewall_stop
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
@@ -16,3 +16,8 @@ IFUPDOWN=0
|
||||
# during 'start' and will save them there during 'stop'.
|
||||
#
|
||||
SAVE_IPSETS=""
|
||||
#
|
||||
# Where Up/Down events get logged
|
||||
#
|
||||
LOGFILE=/var/log/shorewall-ifupdown.log
|
||||
|
||||
|
@@ -31,7 +31,7 @@ VERSION=xxx #The Build script inserts the actual version
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME"
|
||||
echo "usage: $ME [ <shorewallrc file> ]"
|
||||
exit $1
|
||||
}
|
||||
|
||||
@@ -40,6 +40,27 @@ qt()
|
||||
"$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
split() {
|
||||
local ifs
|
||||
ifs=$IFS
|
||||
IFS=:
|
||||
set -- $1
|
||||
echo $*
|
||||
IFS=$ifs
|
||||
}
|
||||
|
||||
mywhich() {
|
||||
local dir
|
||||
|
||||
for dir in $(split $PATH); do
|
||||
if [ -x $dir/$1 ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 2
|
||||
}
|
||||
|
||||
remove_file() # $1 = file to restore
|
||||
{
|
||||
if [ -f $1 -o -L $1 ] ; then
|
||||
@@ -48,8 +69,37 @@ remove_file() # $1 = file to restore
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -f /usr/share/shorewall-init/version ]; then
|
||||
INSTALLED_VERSION="$(cat /usr/share/shorewall-init/version)"
|
||||
#
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
file=./.shorewallrc
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
else
|
||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||
fi
|
||||
elif [ $# -eq 1 ]; then
|
||||
file=$1
|
||||
case $file in
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file || exit 1
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [ -f ${SHAREDIR}/shorewall-init/version ]; then
|
||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-init/version)"
|
||||
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||
echo "WARNING: Shorewall Init Version $INSTALLED_VERSION is installed"
|
||||
echo " and this is the $VERSION uninstaller."
|
||||
@@ -60,56 +110,55 @@ else
|
||||
VERSION=""
|
||||
fi
|
||||
|
||||
[ -n "${LIBEXEC:=/usr/share}" ]
|
||||
[ -n "${LIBEXEC:=${SHAREDIR}}" ]
|
||||
|
||||
echo "Uninstalling Shorewall Init $VERSION"
|
||||
|
||||
INITSCRIPT=/etc/init.d/shorewall-init
|
||||
INITSCRIPT=${CONFDIR}/init.d/shorewall-init
|
||||
|
||||
if [ -n "$INITSCRIPT" ]; then
|
||||
if [ -x /usr/sbin/updaterc.d ]; then
|
||||
if [ -f "$INITSCRIPT" ]; then
|
||||
if mywhich updaterc.d ; then
|
||||
updaterc.d shorewall-init remove
|
||||
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
|
||||
elif mywhich insserv ; then
|
||||
insserv -r $INITSCRIPT
|
||||
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
|
||||
elif mywhich chkconfig ; then
|
||||
chkconfig --del $(basename $INITSCRIPT)
|
||||
elif [ -x /sbin/systemctl ]; then
|
||||
elif mywhich systemctl ; then
|
||||
systemctl disable shorewall-init
|
||||
else
|
||||
rm -f /etc/rc*.d/*$(basename $INITSCRIPT)
|
||||
fi
|
||||
|
||||
remove_file $INITSCRIPT
|
||||
fi
|
||||
|
||||
[ "$(readlink -m -q /sbin/ifup-local)" = /usr/share/shorewall-init ] && remove_file /sbin/ifup-local
|
||||
[ "$(readlink -m -q /sbin/ifdown-local)" = /usr/share/shorewall-init ] && remove_file /sbin/ifdown-local
|
||||
[ "$(readlink -m -q ${SBINDIR}/ifup-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifup-local
|
||||
[ "$(readlink -m -q ${SBINDIR}/ifdown-local)" = ${SHAREDIR}/shorewall-init ] && remove_file ${SBINDIR}/ifdown-local
|
||||
|
||||
remove_file /etc/default/shorewall-init
|
||||
remove_file /etc/sysconfig/shorewall-init
|
||||
remove_file ${CONFDIR}/default/shorewall-init
|
||||
remove_file ${CONFDIR}/sysconfig/shorewall-init
|
||||
|
||||
remove_file /etc/NetworkManager/dispatcher.d/01-shorewall
|
||||
remove_file ${CONFDIR}/NetworkManager/dispatcher.d/01-shorewall
|
||||
|
||||
remove_file /etc/network/if-up.d/shorewall
|
||||
remove_file /etc/network/if-down.d/shorewall
|
||||
remove_file ${CONFDIR}/network/if-up.d/shorewall
|
||||
remove_file ${CONFDIR}/network/if-down.d/shorewall
|
||||
|
||||
remove_file /etc/sysconfig/network/if-up.d/shorewall
|
||||
remove_file /etc/sysconfig/network/if-down.d/shorewall
|
||||
remove_file /lib/systemd/system/shorewall.service
|
||||
remove_file ${CONFDIR}/sysconfig/network/if-up.d/shorewall
|
||||
remove_file ${CONFDIR}/sysconfig/network/if-down.d/shorewall
|
||||
|
||||
if [ -d /etc/ppp ]; then
|
||||
[ -n "$SYSTEMD" ] && remove_file ${SYSTEMD}/shorewall.service
|
||||
|
||||
if [ -d ${CONFDIR}/ppp ]; then
|
||||
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do
|
||||
remove_file /etc/ppp/$directory/shorewall
|
||||
remove_file ${CONFDIR}/ppp/$directory/shorewall
|
||||
done
|
||||
|
||||
for file in if-up.local if-down.local; do
|
||||
if fgrep -q Shorewall-based /etc/ppp/$FILE; then
|
||||
remove_file /etc/ppp/$FILE
|
||||
if fgrep -q Shorewall-based ${CONFDIR}/ppp/$FILE; then
|
||||
remove_file ${CONFDIR}/ppp/$FILE
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf /usr/share/shorewall-init
|
||||
rm -rf ${SHAREDIR}/shorewall-init
|
||||
rm -rf ${LIBEXEC}/shorewall-init
|
||||
|
||||
echo "Shorewall Init Uninstalled"
|
||||
|
@@ -3,16 +3,16 @@ VARDIR=$(shell /sbin/shorewall-lite show vardir)
|
||||
SHAREDIR=/usr/share/shorewall-lite
|
||||
RESTOREFILE?=.restore
|
||||
|
||||
all: $(VARDIR)/${RESTOREFILE}
|
||||
all: $(VARDIR)/$(RESTOREFILE)
|
||||
|
||||
$(VARDIR)/${RESTOREFILE}: $(VARDIR)/firewall
|
||||
$(VARDIR)/$(RESTOREFILE): $(VARDIR)/firewall
|
||||
@/sbin/shorewall-lite -q save >/dev/null; \
|
||||
if \
|
||||
/sbin/shorewall-lite -q restart >/dev/null 2>&1; \
|
||||
then \
|
||||
/sbin/shorewall-lite -q save >/dev/null; \
|
||||
else \
|
||||
/sbin/shorewall-lite -q restart 2>&1 | tail >&2; \
|
||||
/sbin/shorewall-lite -q restart 2>&1 | tail >&2; exit 1; \
|
||||
fi
|
||||
|
||||
# EOF
|
||||
|
@@ -23,7 +23,7 @@ export SHOREWALL_INIT_SCRIPT
|
||||
test -x $SRWL || exit 0
|
||||
test -x $WAIT_FOR_IFUP || exit 0
|
||||
test -n "$INITLOG" || {
|
||||
echo "INITLOG cannot be empty, please configure $0" ;
|
||||
echo "INITLOG cannot be empty, please configure $0" ;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ fi
|
||||
|
||||
echo_notdone () {
|
||||
|
||||
if [ "$INITLOG" = "/dev/null" ] ; then
|
||||
if [ "$INITLOG" = "/dev/null" ] ; then
|
||||
echo "not done."
|
||||
else
|
||||
else
|
||||
echo "not done (check $INITLOG)."
|
||||
fi
|
||||
|
||||
@@ -57,17 +57,23 @@ not_configured () {
|
||||
exit 0
|
||||
}
|
||||
|
||||
#
|
||||
# The installer may alter this
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
# parse the shorewall params file in order to use params in
|
||||
# /etc/default/shorewall
|
||||
if [ -f "/etc/shorewall-lite/params" ]
|
||||
|
||||
if [ -f "$CONFDIR/shorewall-lite/params" ]
|
||||
then
|
||||
. /etc/shorewall-lite/params
|
||||
. $CONFDIR/shorewall-lite/params
|
||||
fi
|
||||
|
||||
# check if shorewall is configured or not
|
||||
if [ -f "/etc/default/shorewall-lite" ]
|
||||
if [ -f "$SYSCONFDIR/shorewall-lite" ]
|
||||
then
|
||||
. /etc/default/shorewall-lite
|
||||
. $SYSCONFDIR/shorewall-lite
|
||||
SRWL_OPTS="$SRWL_OPTS $OPTIONS"
|
||||
if [ "$startup" != "1" ]
|
||||
then
|
||||
|
21
Shorewall-lite/init.fedora.sh
Normal file → Executable file
21
Shorewall-lite/init.fedora.sh
Normal file → Executable file
@@ -20,26 +20,31 @@
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
#
|
||||
# The installer may alter this
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
prog="shorewall-lite"
|
||||
shorewall="/sbin/$prog"
|
||||
shorewall="${SBINDIR}/$prog"
|
||||
logger="logger -i -t $prog"
|
||||
lockfile="/var/lock/subsys/$prog"
|
||||
|
||||
# Get startup options (override default)
|
||||
OPTIONS=
|
||||
|
||||
if [ -f /etc/sysconfig/$prog ]; then
|
||||
. /etc/sysconfig/$prog
|
||||
if [ -f ${SYSCONFDIR}/$prog ]; then
|
||||
. ${SYSCONFDIR}/$prog
|
||||
fi
|
||||
|
||||
start() {
|
||||
echo -n $"Starting Shorewall: "
|
||||
$shorewall $OPTIONS start 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
if [[ $retval == 0 ]]; then
|
||||
if [[ $retval == 0 ]]; then
|
||||
touch $lockfile
|
||||
success
|
||||
else
|
||||
else
|
||||
failure
|
||||
fi
|
||||
echo
|
||||
@@ -50,10 +55,10 @@ stop() {
|
||||
echo -n $"Stopping Shorewall: "
|
||||
$shorewall $OPTIONS stop 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
if [[ $retval == 0 ]]; then
|
||||
if [[ $retval == 0 ]]; then
|
||||
rm -f $lockfile
|
||||
success
|
||||
else
|
||||
else
|
||||
failure
|
||||
fi
|
||||
echo
|
||||
@@ -66,7 +71,7 @@ restart() {
|
||||
echo -n $"Restarting Shorewall: "
|
||||
$shorewall $OPTIONS restart 2>&1 | $logger
|
||||
retval=${PIPESTATUS[0]}
|
||||
if [[ $retval == 0 ]]; then
|
||||
if [[ $retval == 0 ]]; then
|
||||
touch $lockfile
|
||||
success
|
||||
else # Failed to start, clean up lock file if present
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
RCDLINKS="2,S41 3,S41 6,K41"
|
||||
#
|
||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.1
|
||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007 - Tom Eastep (teastep@shorewall.net)
|
||||
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
@@ -61,10 +61,14 @@ usage() {
|
||||
# Get startup options (override default)
|
||||
################################################################################
|
||||
OPTIONS=
|
||||
if [ -f /etc/sysconfig/shorewall ]; then
|
||||
. /etc/sysconfig/shorewall
|
||||
elif [ -f /etc/default/shorewall ] ; then
|
||||
. /etc/default/shorewall
|
||||
|
||||
#
|
||||
# The installer may alter this
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
if [ -f ${SYSCONFDIR}/shorewall-lite ]; then
|
||||
. ${SYSCONFDIR}/shorewall-lite
|
||||
fi
|
||||
|
||||
SHOREWALL_INIT_SCRIPT=1
|
||||
@@ -76,13 +80,13 @@ command="$1"
|
||||
|
||||
case "$command" in
|
||||
start)
|
||||
exec /sbin/shorewall-lite $OPTIONS start $STARTOPTIONS $@
|
||||
exec ${SBINDIR}/shorewall-lite $OPTIONS start $STARTOPTIONS
|
||||
;;
|
||||
restart|reload)
|
||||
exec /sbin/shorewall-lite $OPTIONS restart $RESTARTOPTIONS $@
|
||||
exec ${SBINDIR}/shorewall-lite $OPTIONS restart $RESTARTOPTIONS
|
||||
;;
|
||||
status|stop)
|
||||
exec /sbin/shorewall-lite $OPTIONS $command $@
|
||||
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $@
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
|
92
Shorewall-lite/init.suse.sh
Executable file
92
Shorewall-lite/init.suse.sh
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# The Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.5
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2012 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# On most distributions, this file should be called /etc/init.d/shorewall.
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of Version 2 of the GNU General Public License
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# If an error occurs while starting or restarting the firewall, the
|
||||
# firewall is automatically stopped.
|
||||
#
|
||||
# Commands are:
|
||||
#
|
||||
# shorewall start Starts the firewall
|
||||
# shorewall restart Restarts the firewall
|
||||
# shorewall reload Reload the firewall
|
||||
# (same as restart)
|
||||
# shorewall stop Stops the firewall
|
||||
# shorewall status Displays firewall status
|
||||
#
|
||||
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: shorewall-lite
|
||||
# Required-Start: $network $remote_fs
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: starts and stops the shorewall firewall
|
||||
# Short-Description: Packet filtering firewall
|
||||
### END INIT INFO
|
||||
|
||||
################################################################################
|
||||
# Give Usage Information #
|
||||
################################################################################
|
||||
usage() {
|
||||
echo "Usage: $0 start|stop|reload|restart|status"
|
||||
exit 1
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Get startup options (override default)
|
||||
################################################################################
|
||||
OPTIONS=
|
||||
|
||||
#
|
||||
# The installer may alter this
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
if [ -f ${SYSCONFDIR}/shorewall-lite ]; then
|
||||
. ${SYSCONFDIR}/shorewall-lite
|
||||
fi
|
||||
|
||||
SHOREWALL_INIT_SCRIPT=1
|
||||
|
||||
################################################################################
|
||||
# E X E C U T I O N B E G I N S H E R E #
|
||||
################################################################################
|
||||
command="$1"
|
||||
|
||||
case "$command" in
|
||||
start)
|
||||
exec ${SBINDIR}/shorewall-lite $OPTIONS start $STARTOPTIONS
|
||||
;;
|
||||
restart|reload)
|
||||
exec ${SBINDIR}/shorewall-lite $OPTIONS restart $RESTARTOPTIONS
|
||||
;;
|
||||
status|stop)
|
||||
exec ${SBINDIR}/shorewall-lite $OPTIONS $command $@
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
@@ -27,12 +27,18 @@ VERSION=xxx #The Build script inserts the actual version
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME"
|
||||
echo "usage: $ME [ <configuration-file> ]"
|
||||
echo " $ME -v"
|
||||
echo " $ME -h"
|
||||
exit $1
|
||||
}
|
||||
|
||||
fatal_error()
|
||||
{
|
||||
echo " ERROR: $@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
split() {
|
||||
local ifs
|
||||
ifs=$IFS
|
||||
@@ -85,6 +91,11 @@ install_file() # $1 = source $2 = target $3 = mode
|
||||
run_install $T $OWNERSHIP -m $3 $1 ${2}
|
||||
}
|
||||
|
||||
require()
|
||||
{
|
||||
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
||||
}
|
||||
|
||||
#
|
||||
# Change to the directory containing this script
|
||||
#
|
||||
@@ -98,71 +109,125 @@ else
|
||||
Product="Shorewall6 Lite"
|
||||
fi
|
||||
|
||||
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
# DEST is the SysVInit script directory
|
||||
# INIT is the name of the script in the $DEST directory
|
||||
#
|
||||
if [ -z "$DEST" ] ; then
|
||||
DEST="/etc/init.d"
|
||||
fi
|
||||
finished=0
|
||||
|
||||
if [ -z "$INIT" ] ; then
|
||||
INIT="$PRODUCT"
|
||||
fi
|
||||
|
||||
while [ $# -gt 0 ] ; do
|
||||
while [ $finished -eq 0 ] ; do
|
||||
case "$1" in
|
||||
-h|help|?)
|
||||
usage 0
|
||||
;;
|
||||
-v)
|
||||
echo "$Product Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
-*)
|
||||
option=${option#-}
|
||||
|
||||
while [ -n "$option" ]; do
|
||||
case $option in
|
||||
h)
|
||||
usage 0
|
||||
;;
|
||||
v)
|
||||
echo "$Product Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
finished=1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
#
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc || exit 1
|
||||
file=./shorewallrc
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
else
|
||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||
fi
|
||||
elif [ $# -eq 1 ]; then
|
||||
file=$1
|
||||
case $file in
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "${LIBEXEC:=/usr/share}" ]
|
||||
. $file
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
||||
case "$LIBEXEC" in
|
||||
/*)
|
||||
;;
|
||||
*)
|
||||
LIBEXEC=/usr/${LIBEXEC}
|
||||
;;
|
||||
esac
|
||||
if [ -z "${VARLIB}" ]; then
|
||||
VARLIB=${VARDIR}
|
||||
VARDIR=${VARLIB}/${PRODUCT}
|
||||
elif [ -z "${VARDIR}" ]; then
|
||||
VARDIR=${VARLIB}/${PRODUCT}
|
||||
fi
|
||||
|
||||
for var in SHAREDIR LIBEXECDIRDIRDIR CONFDIR SBINDIR VARLIB VARDIR; do
|
||||
require $var
|
||||
done
|
||||
|
||||
PATH=${SBINDIR}:/bin:/usr${SBINDIR}:/usr/bin:/usr/local/bin:/usr/local${SBINDIR}
|
||||
|
||||
#
|
||||
# Determine where to install the firewall script
|
||||
#
|
||||
CYGWIN=
|
||||
cygwin=
|
||||
INSTALLD='-D'
|
||||
T='-T'
|
||||
|
||||
case $(uname) in
|
||||
CYGWIN*)
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
DEST=
|
||||
INIT=
|
||||
fi
|
||||
if [ -z "$BUILD" ]; then
|
||||
case $(uname) in
|
||||
cygwin*)
|
||||
BUILD=cygwin
|
||||
;;
|
||||
Darwin)
|
||||
BUILD=apple
|
||||
;;
|
||||
*)
|
||||
if [ -f ${CONFDIR}/debian_version ]; then
|
||||
BUILD=debian
|
||||
elif [ -f ${CONFDIR}/redhat-release ]; then
|
||||
BUILD=redhat
|
||||
elif [ -f ${CONFDIR}/SuSE-release ]; then
|
||||
BUILD=suse
|
||||
elif [ -f ${CONFDIR}/slackware-version ] ; then
|
||||
BUILD=slackware
|
||||
elif [ -f ${CONFDIR}/arch-release ] ; then
|
||||
BUILD=archlinux
|
||||
else
|
||||
BUILD=linux
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case $BUILD in
|
||||
cygwin*)
|
||||
OWNER=$(id -un)
|
||||
GROUP=$(id -gn)
|
||||
;;
|
||||
Darwin)
|
||||
apple)
|
||||
[ -z "$OWNER" ] && OWNER=root
|
||||
[ -z "$GROUP" ] && GROUP=wheel
|
||||
INSTALLD=
|
||||
T=
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
[ -z "$OWNER" ] && OWNER=root
|
||||
[ -z "$GROUP" ] && GROUP=root
|
||||
@@ -171,64 +236,81 @@ esac
|
||||
|
||||
OWNERSHIP="-o $OWNER -g $GROUP"
|
||||
|
||||
[ -n "$HOST" ] || HOST=$BUILD
|
||||
|
||||
case "$HOST" in
|
||||
cygwin)
|
||||
echo "$PRODUCT is not supported on Cygwin" >&2
|
||||
exit 1
|
||||
;;
|
||||
apple)
|
||||
echo "$PRODUCT is not supported on OS X" >&2
|
||||
exit 1
|
||||
;;
|
||||
debian)
|
||||
echo "Installing Debian-specific configuration..."
|
||||
;;
|
||||
redhat)
|
||||
echo "Installing Redhat/Fedora-specific configuration..."
|
||||
;;
|
||||
slackware)
|
||||
echo "Installing Slackware-specific configuration..."
|
||||
;;
|
||||
archlinux)
|
||||
echo "Installing ArchLinux-specific configuration..."
|
||||
;;
|
||||
suse)
|
||||
echo "Installing Suse-specific configuration..."
|
||||
;;
|
||||
linux)
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown HOST \"$HOST\"" >&2
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -z "$INITDIR" ] && INITDIR="${CONFDIR}/init.d"
|
||||
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
if [ `id -u` != 0 ] ; then
|
||||
echo "Not setting file owner/group permissions, not running as root."
|
||||
OWNERSHIP=""
|
||||
fi
|
||||
|
||||
install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin
|
||||
install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST}
|
||||
elif [ -d /etc/apt -a -e /usr/bin/dpkg ]; then
|
||||
DEBIAN=yes
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
FEDORA=yes
|
||||
elif [ -f /etc/slackware-version ] ; then
|
||||
DEST="/etc/rc.d"
|
||||
INIT="rc.firewall"
|
||||
elif [ -f /etc/arch-release ] ; then
|
||||
DEST="/etc/rc.d"
|
||||
INIT="$PRODUCT"
|
||||
ARCHLINUX=yes
|
||||
fi
|
||||
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
install -d $OWNERSHIP -m 755 ${DESTDIR}/${SBINDIR}
|
||||
install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
|
||||
else
|
||||
if [ ! -f /usr/share/shorewall/coreversion ]; then
|
||||
echo "$PRODUCT $VERSION requires Shorewall Core which does not appear to be installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f /lib/systemd/system ]; then
|
||||
SYSTEMD=Yes
|
||||
fi
|
||||
elif [ -n "$SYSTEMD" ]; then
|
||||
mkdir -p ${DESTDIR}/lib/systemd/system
|
||||
fi
|
||||
|
||||
echo "Installing $Product Version $VERSION"
|
||||
|
||||
#
|
||||
# Check for /etc/$PRODUCT
|
||||
# Check for ${CONFDIR}/$PRODUCT
|
||||
#
|
||||
if [ -z "$DESTDIR" -a -d /etc/$PRODUCT ]; then
|
||||
if [ -z "$DESTDIR" -a -d ${CONFDIR}/$PRODUCT ]; then
|
||||
if [ ! -f /usr/share/shorewall/coreversion ]; then
|
||||
echo "$PRODUCT $VERSION requires Shorewall Core which does not appear to be installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[ -f /etc/$PRODUCT/shorewall.conf ] && \
|
||||
mv -f /etc/$PRODUCT/shorewall.conf /etc/$PRODUCT/$PRODUCT.conf
|
||||
[ -f ${CONFDIR}/$PRODUCT/shorewall.conf ] && \
|
||||
mv -f ${CONFDIR}/$PRODUCT/shorewall.conf ${CONFDIR}/$PRODUCT/$PRODUCT.conf
|
||||
else
|
||||
rm -rf ${DESTDIR}/etc/$PRODUCT
|
||||
rm -rf ${DESTDIR}/usr/share/$PRODUCT
|
||||
rm -rf ${DESTDIR}/var/lib/$PRODUCT
|
||||
[ "$LIBEXEC" = /usr/share ] || rm -rf /usr/share/$PRODUCT/wait4ifup /usr/share/$PRODUCT/shorecap
|
||||
rm -rf ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||
rm -rf ${DESTDIR}${SHAREDIR}/$PRODUCT
|
||||
rm -rf ${DESTDIR}${VARDIR}
|
||||
[ "$LIBEXECDIR" = /usr/share ] || rm -rf ${DESTDIR}/usr/share/$PRODUCT/wait4ifup ${DESTDIR}/usr/share/$PRODUCT/shorecap
|
||||
fi
|
||||
|
||||
#
|
||||
# Check for /sbin/$PRODUCT
|
||||
# Check for ${SBINDIR}/$PRODUCT
|
||||
#
|
||||
if [ -f ${DESTDIR}/sbin/$PRODUCT ]; then
|
||||
if [ -f ${DESTDIR}${SBINDIR}/$PRODUCT ]; then
|
||||
first_install=""
|
||||
else
|
||||
first_install="Yes"
|
||||
@@ -236,113 +318,114 @@ fi
|
||||
|
||||
delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules
|
||||
|
||||
install_file $PRODUCT ${DESTDIR}/sbin/$PRODUCT 0544
|
||||
install_file $PRODUCT ${DESTDIR}${SBINDIR}/$PRODUCT 0544
|
||||
|
||||
echo "$Product control program installed in ${DESTDIR}/sbin/$PRODUCT"
|
||||
echo "$Product control program installed in ${DESTDIR}${SBINDIR}/$PRODUCT"
|
||||
|
||||
#
|
||||
# Install the Firewall Script
|
||||
# Create ${CONFDIR}/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed
|
||||
#
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
install_file init.debian.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544
|
||||
elif [ -n "$FEDORA" ]; then
|
||||
install_file init.fedora.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544
|
||||
elif [ -n "$ARCHLINUX" ]; then
|
||||
install_file init.archlinux.sh ${DESTDIR}/${DEST}/$INIT 0544
|
||||
else
|
||||
install_file init.sh ${DESTDIR}/${DEST}/$INIT 0544
|
||||
fi
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||
mkdir -p ${DESTDIR}${SHAREDIR}/$PRODUCT
|
||||
mkdir -p ${DESTDIR}${LIBEXECDIR}/$PRODUCT
|
||||
mkdir -p ${DESTDIR}${VARDIR}
|
||||
|
||||
echo "$Product script installed in ${DESTDIR}${DEST}/$INIT"
|
||||
|
||||
#
|
||||
# Create /etc/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed
|
||||
#
|
||||
mkdir -p ${DESTDIR}/etc/$PRODUCT
|
||||
mkdir -p ${DESTDIR}/usr/share/$PRODUCT
|
||||
mkdir -p ${DESTDIR}${LIBEXEC}/$PRODUCT
|
||||
mkdir -p ${DESTDIR}/var/lib/$PRODUCT
|
||||
|
||||
chmod 755 ${DESTDIR}/etc/$PRODUCT
|
||||
chmod 755 ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||
chmod 755 ${DESTDIR}/usr/share/$PRODUCT
|
||||
|
||||
if [ -n "$DESTDIR" ]; then
|
||||
mkdir -p ${DESTDIR}/etc/logrotate.d
|
||||
chmod 755 ${DESTDIR}/etc/logrotate.d
|
||||
mkdir -p ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
chmod 755 ${DESTDIR}${CONFDIR}/logrotate.d
|
||||
mkdir -p ${DESTDIR}${INITDIR}
|
||||
chmod 755 ${DESTDIR}${INITDIR}
|
||||
fi
|
||||
|
||||
if [ -n "$INITFILE" ]; then
|
||||
|
||||
initfile="${DESTDIR}/${INITDIR}/${INITFILE}"
|
||||
install_file ${INITSOURCE} "$initfile" 0544
|
||||
|
||||
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' "$initfile"
|
||||
|
||||
echo "$Product init script installed in $initfile"
|
||||
fi
|
||||
#
|
||||
# Install the .service file
|
||||
#
|
||||
if [ -n "$SYSTEMD" ]; then
|
||||
run_install $OWNERSHIP -m 600 $PRODUCT.service ${DESTDIR}/lib/systemd/system/$PRODUCT.service
|
||||
mkdir -p ${DESTDIR}${SYSTEMD}
|
||||
run_install $OWNERSHIP -m 600 $PRODUCT.service ${DESTDIR}/${SYSTEMD}/$PRODUCT.service
|
||||
[ ${SBINDIR} != /sbin ] && eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}${SYSTEMD}/$PRODUCT.service
|
||||
echo "Service file installed as ${DESTDIR}/lib/systemd/system/$PRODUCT.service"
|
||||
fi
|
||||
|
||||
#
|
||||
# Install the config file
|
||||
#
|
||||
if [ ! -f ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf ]; then
|
||||
install_file $PRODUCT.conf ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf 0744
|
||||
echo "Config file installed as ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf"
|
||||
if [ ! -f ${DESTDIR}${CONFDIR}/$PRODUCT/$PRODUCT.conf ]; then
|
||||
install_file $PRODUCT.conf ${DESTDIR}${CONFDIR}/$PRODUCT/$PRODUCT.conf 0744
|
||||
echo "Config file installed as ${DESTDIR}${CONFDIR}/$PRODUCT/$PRODUCT.conf"
|
||||
fi
|
||||
|
||||
if [ -n "$ARCHLINUX" ] ; then
|
||||
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf
|
||||
if [ $HOST = archlinux ] ; then
|
||||
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${DESTDIR}${CONFDIR}/$PRODUCT/$PRODUCT.conf
|
||||
fi
|
||||
|
||||
#
|
||||
# Install the Makefile
|
||||
#
|
||||
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}/etc/$PRODUCT
|
||||
echo "Makefile installed as ${DESTDIR}/etc/$PRODUCT/Makefile"
|
||||
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}${CONFDIR}/$PRODUCT
|
||||
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile
|
||||
[ $SBINDIR = /sbin ] || eval sed -i \'s\|/sbin/\|${SBINDIR}/\|\' ${DESTDIR}/${CONFDIR}/$PRODUCT/Makefile
|
||||
echo "Makefile installed as ${DESTDIR}${CONFDIR}/$PRODUCT/Makefile"
|
||||
|
||||
#
|
||||
# Install the default config path file
|
||||
#
|
||||
install_file configpath ${DESTDIR}/usr/share/$PRODUCT/configpath 0644
|
||||
echo "Default config path file installed as ${DESTDIR}/usr/share/$PRODUCT/configpath"
|
||||
install_file configpath ${DESTDIR}${SHAREDIR}/$PRODUCT/configpath 0644
|
||||
echo "Default config path file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/configpath"
|
||||
|
||||
#
|
||||
# Install the libraries
|
||||
#
|
||||
for f in lib.* ; do
|
||||
if [ -f $f ]; then
|
||||
install_file $f ${DESTDIR}/usr/share/$PRODUCT/$f 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}/usr/share/$PRODUCT/$f"
|
||||
install_file $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f 0644
|
||||
echo "Library ${f#*.} file installed as ${DESTDIR}/${SHAREDIR}/$PRODUCT/$f"
|
||||
fi
|
||||
done
|
||||
|
||||
ln -sf lib.base ${DESTDIR}/usr/share/$PRODUCT/functions
|
||||
ln -sf lib.base ${DESTDIR}${SHAREDIR}/$PRODUCT/functions
|
||||
|
||||
echo "Common functions linked through ${DESTDIR}/usr/share/$PRODUCT/functions"
|
||||
echo "Common functions linked through ${DESTDIR}${SHAREDIR}/$PRODUCT/functions"
|
||||
|
||||
#
|
||||
# Install Shorecap
|
||||
#
|
||||
|
||||
install_file shorecap ${DESTDIR}${LIBEXEC}/$PRODUCT/shorecap 0755
|
||||
install_file shorecap ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shorecap 0755
|
||||
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${LIBEXECDIR}/$PRODUCT/shorecap
|
||||
|
||||
echo
|
||||
echo "Capability file builder installed in ${DESTDIR}${LIBEXEC}/$PRODUCT/shorecap"
|
||||
echo "Capability file builder installed in ${DESTDIR}${LIBEXECDIR}/$PRODUCT/shorecap"
|
||||
|
||||
#
|
||||
# Install the Modules files
|
||||
#
|
||||
|
||||
if [ -f modules ]; then
|
||||
run_install $OWNERSHIP -m 0600 modules ${DESTDIR}/usr/share/$PRODUCT
|
||||
echo "Modules file installed as ${DESTDIR}/usr/share/$PRODUCT/modules"
|
||||
run_install $OWNERSHIP -m 0600 modules ${DESTDIR}${SHAREDIR}/$PRODUCT
|
||||
echo "Modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/modules"
|
||||
fi
|
||||
|
||||
if [ -f helpers ]; then
|
||||
run_install $OWNERSHIP -m 0600 helpers ${DESTDIR}/usr/share/$PRODUCT
|
||||
echo "Helper modules file installed as ${DESTDIR}/usr/share/$PRODUCT/helpers"
|
||||
run_install $OWNERSHIP -m 0600 helpers ${DESTDIR}${SHAREDIR}/$PRODUCT
|
||||
echo "Helper modules file installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/helpers"
|
||||
fi
|
||||
|
||||
for f in modules.*; do
|
||||
run_install $OWNERSHIP -m 0644 $f ${DESTDIR}/usr/share/$PRODUCT/$f
|
||||
echo "Module file $f installed as ${DESTDIR}/usr/share/$PRODUCT/$f"
|
||||
run_install $OWNERSHIP -m 0644 $f ${DESTDIR}${SHAREDIR}/$PRODUCT/$f
|
||||
echo "Module file $f installed as ${DESTDIR}${SHAREDIR}/$PRODUCT/$f"
|
||||
done
|
||||
|
||||
#
|
||||
@@ -352,18 +435,18 @@ done
|
||||
if [ -d manpages ]; then
|
||||
cd manpages
|
||||
|
||||
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}/usr/share/man/man5/ ${DESTDIR}/usr/share/man/man8/
|
||||
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}${SHAREDIR}/man/man5/ ${DESTDIR}${SHAREDIR}/man/man8/
|
||||
|
||||
for f in *.5; do
|
||||
gzip -c $f > $f.gz
|
||||
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}/usr/share/man/man5/$f.gz
|
||||
echo "Man page $f.gz installed to ${DESTDIR}/usr/share/man/man5/$f.gz"
|
||||
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}${SHAREDIR}/man/man5/$f.gz
|
||||
echo "Man page $f.gz installed to ${DESTDIR}${SHAREDIR}/man/man5/$f.gz"
|
||||
done
|
||||
|
||||
for f in *.8; do
|
||||
gzip -c $f > $f.gz
|
||||
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}/usr/share/man/man8/$f.gz
|
||||
echo "Man page $f.gz installed to ${DESTDIR}/usr/share/man/man8/$f.gz"
|
||||
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}${SHAREDIR}/man/man8/$f.gz
|
||||
echo "Man page $f.gz installed to ${DESTDIR}${SHAREDIR}/man/man8/$f.gz"
|
||||
done
|
||||
|
||||
cd ..
|
||||
@@ -371,73 +454,79 @@ if [ -d manpages ]; then
|
||||
echo "Man Pages Installed"
|
||||
fi
|
||||
|
||||
if [ -d ${DESTDIR}/etc/logrotate.d ]; then
|
||||
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}/etc/logrotate.d/$PRODUCT
|
||||
echo "Logrotate file installed as ${DESTDIR}/etc/logrotate.d/$PRODUCT"
|
||||
if [ -d ${DESTDIR}${CONFDIR}/logrotate.d ]; then
|
||||
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT
|
||||
echo "Logrotate file installed as ${DESTDIR}${CONFDIR}/logrotate.d/$PRODUCT"
|
||||
fi
|
||||
|
||||
#
|
||||
# Create the version file
|
||||
#
|
||||
echo "$VERSION" > ${DESTDIR}/usr/share/$PRODUCT/version
|
||||
chmod 644 ${DESTDIR}/usr/share/$PRODUCT/version
|
||||
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/$PRODUCT/version
|
||||
chmod 644 ${DESTDIR}${SHAREDIR}/$PRODUCT/version
|
||||
#
|
||||
# Remove and create the symbolic link to the init script
|
||||
#
|
||||
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
rm -f /usr/share/$PRODUCT/init
|
||||
ln -s ${DEST}/${INIT} /usr/share/$PRODUCT/init
|
||||
rm -f ${SHAREDIR}/$PRODUCT/init
|
||||
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/$PRODUCT/init
|
||||
fi
|
||||
|
||||
delete_file ${DESTDIR}/usr/share/$PRODUCT/lib.common
|
||||
delete_file ${DESTDIR}/usr/share/$PRODUCT/lib.cli
|
||||
delete_file ${DESTDIR}/usr/share/$PRODUCT/wait4ifup
|
||||
delete_file ${DESTDIR}${SHAREDIR}/$PRODUCT/lib.common
|
||||
delete_file ${DESTDIR}${SHAREDIR}/$PRODUCT/lib.cli
|
||||
delete_file ${DESTDIR}${SHAREDIR}/$PRODUCT/wait4ifup
|
||||
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
touch /var/log/$PRODUCT-init.log
|
||||
if [ -n "$SYSCONFFILE" -a ! -f ${DESTDIR}${SYSCONFDIR}/${PRODUCT} ]; then
|
||||
if [ ${DESTDIR} ]; then
|
||||
mkdir -p ${DESTDIR}${SYSCONFDIR}
|
||||
chmod 755 ${DESTDIR}${SYSCONFDIR}
|
||||
fi
|
||||
|
||||
if [ -n "$first_install" ]; then
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
run_install $OWNERSHIP -m 0644 default.debian /etc/default/$PRODUCT
|
||||
run_install $OWNERSHIP -m 0644 default.debian ${DESTDIR}${SYSCONFDIR}/${PRODUCT}
|
||||
echo "$SYSCONFFILE installed in ${DESTDIR}${SYSCONFDIR}/${PRODUCT}"
|
||||
fi
|
||||
|
||||
update-rc.d $PRODUCT defaults
|
||||
|
||||
if [ -x /sbin/insserv ]; then
|
||||
insserv /etc/init.d/$PRODUCT
|
||||
else
|
||||
ln -s ../init.d/$PRODUCT /etc/rcS.d/S40$PRODUCT
|
||||
fi
|
||||
if [ ${SHAREDIR} != /usr/share ]; then
|
||||
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SHAREDIR}/${PRODUCT}/lib.base
|
||||
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}/${SBINDIR}/$PRODUCT
|
||||
fi
|
||||
|
||||
if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${cygwin}${mac}" ]; then
|
||||
if mywhich update-rc.d ; then
|
||||
echo "$PRODUCT will start automatically at boot"
|
||||
echo "Set startup=1 in ${SYSCONFDIR}/$PRODUCT to enable"
|
||||
touch /var/log/$PRODUCT-init.log
|
||||
perl -p -w -i -e 's/^STARTUP_ENABLED=No/STARTUP_ENABLED=Yes/;s/^IP_FORWARDING=On/IP_FORWARDING=Keep/;s/^SUBSYSLOCK=.*/SUBSYSLOCK=/;' ${CONFDIR}/${PRODUCT}/${PRODUCT}.conf
|
||||
update-rc.d $PRODUCT enable defaults
|
||||
elif [ -n "$SYSTEMD" ]; then
|
||||
if systemctl enable ${PRODUCT}.service; then
|
||||
echo "$Product will start automatically at boot"
|
||||
else
|
||||
if [ -n "$SYSTEMD" ]; then
|
||||
if systemctl enable $PRODUCT; then
|
||||
echo "$Product will start automatically at boot"
|
||||
fi
|
||||
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
|
||||
if insserv /etc/init.d/$PRODUCT ; then
|
||||
echo "$Product will start automatically at boot"
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
|
||||
if chkconfig --add $PRODUCT ; then
|
||||
echo "$Product will start automatically in run levels as follows:"
|
||||
chkconfig --list $PRODUCT
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ -x /sbin/rc-update ]; then
|
||||
if rc-update add $PRODUCT default; then
|
||||
echo "$Product will start automatically at boot"
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
|
||||
cant_autostart
|
||||
fi
|
||||
fi
|
||||
elif mywhich insserv; then
|
||||
if insserv ${INITDIR}/${INITFILE} ; then
|
||||
echo "$PRODUCT will start automatically at boot"
|
||||
echo "Set STARTUP_ENABLED=Yes in ${CONFDIR}/$PRODUCT/${PRODUCT}.conf to enable"
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif mywhich chkconfig; then
|
||||
if chkconfig --add $PRODUCT ; then
|
||||
echo "$PRODUCT will start automatically in run levels as follows:"
|
||||
echo "Set STARTUP_ENABLED=Yes in ${CONFDIR}/$PRODUCT/${PRODUCT}.conf to enable"
|
||||
chkconfig --list $PRODUCT
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif mywhich rc-update ; then
|
||||
if rc-update add $PRODUCT default; then
|
||||
echo "$PRODUCT will start automatically at boot"
|
||||
echo "Set STARTUP_ENABLED=Yes in ${CONFDIR}/$PRODUCT/$PRODUCT.conf to enable"
|
||||
else
|
||||
cant_autostart
|
||||
fi
|
||||
elif [ "$INITFILE" != rc.${PRODUCT} ]; then #Slackware starts this automatically
|
||||
cant_autostart
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -24,11 +24,10 @@
|
||||
|
||||
g_program=shorewall-lite
|
||||
g_family=4
|
||||
#
|
||||
# This may be altered by the installer
|
||||
#
|
||||
g_basedir=/usr/share/shorewall
|
||||
|
||||
[ -n "${VARDIR:=/var/lib/$g_program}" ]
|
||||
[ -n "${SHAREDIR:=/usr/share/$g_program}" ]
|
||||
[ -n "${CONFDIR:=/etc/$g_program}" ]
|
||||
|
||||
. /usr/share/shorewall/lib.base
|
||||
. ${g_basedir}/lib.base
|
||||
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
|
||||
<refentry>
|
||||
<refmeta>
|
||||
<refentrytitle>shorewall-lite-vardir</refentrytitle>
|
||||
@@ -34,6 +36,28 @@
|
||||
directory. If you add this file, you should copy the files from
|
||||
<filename>/var/lib/shorewall-lite</filename> to the new directory before
|
||||
performing a <command>shorewall-lite restart</command>.</para>
|
||||
|
||||
<note>
|
||||
<para>Beginning with Shorewall 4.5.2, use of this file is deprecated in
|
||||
favor of specifying VARDIR in the <filename>shorewallrc</filename> file
|
||||
used during installation of Shorewall Core. While the name of the
|
||||
variable remains VARDIR, the meaning is slightly different. When set in
|
||||
shorewallrc, Shorewall Lite, will create a directory under the specified
|
||||
path name to hold state information.</para>
|
||||
|
||||
<para>Example:</para>
|
||||
|
||||
<blockquote>
|
||||
<para>VARDIR=<filename><filename>/opt/var/lib/</filename></filename></para>
|
||||
|
||||
<para>The state directory for Shorewall Lite will be
|
||||
/opt/var/lib/shorewall-lite/.</para>
|
||||
</blockquote>
|
||||
|
||||
<para> When VARDIR is set in /etc/shorewall-lite/vardir, Shorewall Lite
|
||||
will save its state in the <replaceable>directory</replaceable>
|
||||
specified.</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
@@ -61,4 +85,4 @@
|
||||
shorewall-tcrules(5), shorewall-tos(5), shorewall-tunnels(5),
|
||||
shorewall-zones(5)</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</refentry>
|
||||
|
@@ -337,6 +337,8 @@
|
||||
|
||||
<arg choice="plain"><option>show</option></arg>
|
||||
|
||||
<arg><option>-b</option></arg>
|
||||
|
||||
<arg><option>-x</option></arg>
|
||||
|
||||
<arg><option>-l</option></arg>
|
||||
@@ -517,15 +519,17 @@
|
||||
defined in the <ulink
|
||||
url="shorewall-interfaces.html">shorewall-interfaces</ulink>(5)
|
||||
file. A <emphasis>host-list</emphasis> is comma-separated list whose
|
||||
elements are host or network addresses.<caution>
|
||||
<para>The <command>add</command> command is not very robust. If
|
||||
there are errors in the <replaceable>host-list</replaceable>,
|
||||
you may see a large number of error messages yet a subsequent
|
||||
<command>shorewall-lite show zones</command> command will
|
||||
indicate that all hosts were added. If this happens, replace
|
||||
<command>add</command> by <command>delete</command> and run the
|
||||
same command again. Then enter the correct command.</para>
|
||||
</caution></para>
|
||||
elements are host or network addresses.</para>
|
||||
|
||||
<caution>
|
||||
<para>The <command>add</command> command is not very robust. If
|
||||
there are errors in the <replaceable>host-list</replaceable>, you
|
||||
may see a large number of error messages yet a subsequent
|
||||
<command>shorewall-lite show zones</command> command will indicate
|
||||
that all hosts were added. If this happens, replace
|
||||
<command>add</command> by <command>delete</command> and run the
|
||||
same command again. Then enter the correct command.</para>
|
||||
</caution>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -839,6 +843,12 @@
|
||||
Netfilter table to display. The default is <emphasis
|
||||
role="bold">filter</emphasis>.</para>
|
||||
|
||||
<para>The <emphasis role="bold">-b</emphasis> ('brief') option
|
||||
causes rules which have not been used (i.e. which have zero
|
||||
packet and byte counts) to be omitted from the output. Chains
|
||||
with no rules displayed are also omitted from the
|
||||
output.</para>
|
||||
|
||||
<para>The <emphasis role="bold">-l</emphasis> option causes
|
||||
the rule number for each Netfilter rule to be
|
||||
displayed.</para>
|
||||
|
@@ -45,17 +45,19 @@
|
||||
# used during firewall compilation, then the generated firewall program will likewise not
|
||||
# require Shorewall to be installed.
|
||||
|
||||
SHAREDIR=/usr/share/shorewall-lite
|
||||
VARDIR=/var/lib/shorewall-lite
|
||||
CONFDIR=/etc/shorewall-lite
|
||||
g_program=shorewall-lite
|
||||
g_product="Shorewall Lite"
|
||||
g_family=4
|
||||
g_base=shorewall
|
||||
g_basedir=/usr/share/shorewall-lite
|
||||
|
||||
. /usr/share/shorewall-lite/lib.base
|
||||
. /usr/share/shorewall/lib.cli
|
||||
g_program=shorewall-lite
|
||||
|
||||
#
|
||||
# This is modified by the installer when ${SHAREDIR} != /usr/share
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
g_sharedir="$SHAREDIR"/shorewall-lite
|
||||
g_confdir="$CONFDIR"/shorewall-lite
|
||||
g_readrc=1
|
||||
|
||||
. ${SHAREDIR}/shorewall/lib.cli
|
||||
. /usr/share/shorewall-lite/configpath
|
||||
|
||||
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011 -
|
||||
# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011 -
|
||||
# Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Shorewall documentation is available at http://www.shorewall.net
|
||||
@@ -25,8 +25,18 @@
|
||||
# For a list of supported commands, type 'shorewall help' or 'shorewall6 help'
|
||||
#
|
||||
################################################################################################
|
||||
g_program=shorewall-lite
|
||||
PRODUCT=shorewall-lite
|
||||
|
||||
. /usr/share/shorewall/lib.cli
|
||||
#
|
||||
# This is modified by the installer when ${SHAREDIR} != /usr/share
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
g_program=$PRODUCT
|
||||
g_sharedir="$SHAREDIR"/shorewall-lite
|
||||
g_confdir="$CONFDIR"/shorewall-lite
|
||||
g_readrc=1
|
||||
|
||||
. ${SHAREDIR}/shorewall/lib.cli
|
||||
|
||||
shorewall_cli $@
|
||||
|
@@ -1,5 +1,5 @@
|
||||
###############################################################################
|
||||
# /etc/shorewall-lite/shorewall-lite.conf Version 4 - Change the following
|
||||
# /etc/shorewall-lite/shorewall-lite.conf Version 4 - Change the following
|
||||
# variables to override the values in the shorewall.conf file used to
|
||||
# compile /var/lib/shorewall-lite/firewall. Those values may be found in
|
||||
# /var/lib/shorewall-lite/firewall.conf.
|
||||
|
@@ -13,8 +13,8 @@ Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
EnvironmentFile=-/etc/sysconfig/shorewall-lite
|
||||
StandardOutput=syslog
|
||||
ExecStart=/sbin/shorewall-lite $OPTIONS start
|
||||
ExecStop=/sbin/shorewall-lite $OPTIONS stop
|
||||
ExecStart=/usr/sbin/shorewall-lite $OPTIONS start
|
||||
ExecStop=/usr/sbin/shorewall-lite $OPTIONS stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@@ -31,7 +31,7 @@ VERSION=xxx #The Build script inserts the actual version
|
||||
usage() # $1 = exit status
|
||||
{
|
||||
ME=$(basename $0)
|
||||
echo "usage: $ME"
|
||||
echo "usage: $ME [ <shorewallrc file> ]"
|
||||
exit $1
|
||||
}
|
||||
|
||||
@@ -40,16 +40,25 @@ qt()
|
||||
"$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
restore_file() # $1 = file to restore
|
||||
{
|
||||
if [ -f ${1}-shorewall.bkout ]; then
|
||||
if (mv -f ${1}-shorewall-lite.bkout $1); then
|
||||
echo
|
||||
echo "$1 restored"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
split() {
|
||||
local ifs
|
||||
ifs=$IFS
|
||||
IFS=:
|
||||
set -- $1
|
||||
echo $*
|
||||
IFS=$ifs
|
||||
}
|
||||
|
||||
mywhich() {
|
||||
local dir
|
||||
|
||||
for dir in $(split $PATH); do
|
||||
if [ -x $dir/$1 ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 2
|
||||
}
|
||||
|
||||
remove_file() # $1 = file to restore
|
||||
@@ -60,8 +69,37 @@ remove_file() # $1 = file to restore
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -f /usr/share/shorewall-lite/version ]; then
|
||||
INSTALLED_VERSION="$(cat /usr/share/shorewall-lite/version)"
|
||||
#
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ -f ./shorewallrc ]; then
|
||||
. ./shorewallrc
|
||||
elif [ -f ~/.shorewallrc ]; then
|
||||
. ~/.shorewallrc || exit 1
|
||||
file=./.shorewallrc
|
||||
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
else
|
||||
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
||||
fi
|
||||
elif [ $# -eq 1 ]; then
|
||||
file=$1
|
||||
case $file in
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [ -f ${SHAREDIR}/shorewall-lite/version ]; then
|
||||
INSTALLED_VERSION="$(cat ${SHAREDIR}/shorewall-lite/version)"
|
||||
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
|
||||
echo "WARNING: Shorewall Lite Version $INSTALLED_VERSION is installed"
|
||||
echo " and this is the $VERSION uninstaller."
|
||||
@@ -72,49 +110,40 @@ else
|
||||
VERSION=""
|
||||
fi
|
||||
|
||||
[ -n "${LIBEXEC:=/usr/share}" ]
|
||||
|
||||
echo "Uninstalling Shorewall Lite $VERSION"
|
||||
|
||||
if qt iptables -L shorewall -n && [ ! -f /sbin/shorewall ]; then
|
||||
/sbin/shorewall-lite clear
|
||||
if qt iptables -L shorewall -n && [ ! -f ${SBINDIR}/shorewall ]; then
|
||||
shorewall-lite clear
|
||||
fi
|
||||
|
||||
if [ -L /usr/share/shorewall-lite/init ]; then
|
||||
FIREWALL=$(readlink -m -q /usr/share/shorewall-lite/init)
|
||||
else
|
||||
FIREWALL=/etc/init.d/shorewall-lite
|
||||
if [ -L ${SHAREDIR}/shorewall-lite/init ]; then
|
||||
FIREWALL=$(readlink -m -q ${SHAREDIR}/shorewall-lite/init)
|
||||
elIF [ -n "$INITFILE" ]; then
|
||||
FIREWALL=${INITDIR}/${INITFILE}
|
||||
fi
|
||||
|
||||
if [ -n "$FIREWALL" ]; then
|
||||
if [ -x /usr/sbin/updaterc.d ]; then
|
||||
if [ -f "$FIREWALL" ]; then
|
||||
if mywhich updaterc.d ; then
|
||||
updaterc.d shorewall-lite remove
|
||||
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
|
||||
elif if mywhich insserv ; then
|
||||
insserv -r $FIREWALL
|
||||
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
|
||||
elif [ mywhich chkconfig ; then
|
||||
chkconfig --del $(basename $FIREWALL)
|
||||
elif [ -x /sbin/systemctl ]; then
|
||||
elif mywhich systemctl ; then
|
||||
systemctl disable shorewall-lite
|
||||
else
|
||||
rm -f /etc/rc*.d/*$(basename $FIREWALL)
|
||||
fi
|
||||
|
||||
remove_file $FIREWALL
|
||||
rm -f ${FIREWALL}-*.bkout
|
||||
fi
|
||||
|
||||
rm -f /sbin/shorewall-lite
|
||||
rm -f /sbin/shorewall-lite-*.bkout
|
||||
rm -f ${SBINDIR}/shorewall-lite
|
||||
|
||||
rm -rf /etc/shorewall-lite
|
||||
rm -rf /etc/shorewall-lite-*.bkout
|
||||
rm -rf /var/lib/shorewall-lite
|
||||
rm -rf /var/lib/shorewall-lite-*.bkout
|
||||
rm -rf /usr/share/shorewall-lite
|
||||
rm -rf ${SBINDIR}/shorewall-lite
|
||||
rm -rf ${VARDIR}/shorewall-lite
|
||||
rm -rf ${SHAREDIR}/shorewall-lite
|
||||
rm -rf ${LIBEXEC}/shorewall-lite
|
||||
rm -rf /usr/share/shorewall-lite-*.bkout
|
||||
rm -f /etc/logrotate.d/shorewall-lite
|
||||
rm -f /lib/systemd/system/shorewall-lite.service
|
||||
rm -f ${CONFDIR}/logrotate.d/shorewall-lite
|
||||
[ -n "$SYSTEMD" ] && rm -f ${SYSTEMD}/shorewall-lite.service
|
||||
|
||||
echo "Shorewall Lite Uninstalled"
|
||||
|
||||
|
@@ -8,9 +8,17 @@
|
||||
# files from those nodes.
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - udp 10080
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __AMANDA_HELPER )
|
||||
PARAM - - udp 10080 ; helper=amanda
|
||||
?else
|
||||
PARAM - - udp 10080
|
||||
?endif
|
||||
|
||||
PARAM - - tcp 10080
|
||||
#
|
||||
# You may also need this rule. With AMANDA 2.4.4 on Linux kernel 2.6,
|
||||
# it should not be necessary to use this. The ip_conntrack_amanda
|
||||
|
15
Shorewall/Macros/macro.BLACKLIST
Normal file
15
Shorewall/Macros/macro.BLACKLIST
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Shorewall version 4 - blacklist Macro
|
||||
#
|
||||
# /usr/share/shorewall/macro.blacklist
|
||||
#
|
||||
# This macro handles blacklisting using BLACKLIST_DISPOSITION and BLACKLIST_LOGLEVEL
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
?if $BLACKLIST_LOGLEVEL
|
||||
blacklog
|
||||
?else
|
||||
$BLACKLIST_DISPOSITION
|
||||
?endif
|
@@ -6,6 +6,11 @@
|
||||
# This macro handles FTP traffic.
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - tcp 21
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __FTP_HELPER )
|
||||
PARAM - - tcp 21 ; helper=ftp
|
||||
?else
|
||||
PARAM - - tcp 21
|
||||
?endif
|
||||
|
@@ -6,6 +6,12 @@
|
||||
# This macro handles IRC traffic (Internet Relay Chat).
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - tcp 6667
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __IRC_HELPER )
|
||||
PARAM - - tcp 6667 ; helper=irc
|
||||
?else
|
||||
PARAM - - tcp 6667
|
||||
?endif
|
||||
|
11
Shorewall/Macros/macro.MSSQL
Normal file
11
Shorewall/Macros/macro.MSSQL
Normal file
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# Shorewall version 4 - MSSQL Macro
|
||||
#
|
||||
# /usr/share/shorewall/macro.MSSQL
|
||||
#
|
||||
# This macro handles MSSQL (Microsoft SQL Server)
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - tcp 1433
|
@@ -6,8 +6,14 @@
|
||||
# This macro handles PPTP traffic.
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - 47
|
||||
PARAM DEST SOURCE 47
|
||||
PARAM - - tcp 1723
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __PPTP_HELPER )
|
||||
PARAM - - tcp 1723 ; helper=pptp
|
||||
?else
|
||||
PARAM - - tcp 1723
|
||||
?endif
|
||||
|
12
Shorewall/Macros/macro.Puppet
Normal file
12
Shorewall/Macros/macro.Puppet
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Shorewall version 4 - Puppet Macro
|
||||
#
|
||||
# /usr/share/shorewall/macro.Puppet
|
||||
#
|
||||
# This macro handles client-to-server for the Puppet configuration
|
||||
# management system.
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - tcp 8140
|
@@ -6,9 +6,16 @@
|
||||
# This macro handles SANE network scanning.
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - tcp 6566
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __SANE_HELPER )
|
||||
PARAM - - tcp 6566 ; helper=sane
|
||||
?else
|
||||
PARAM - - tcp 6566
|
||||
?endif
|
||||
|
||||
#
|
||||
# Kernels 2.6.23+ has nf_conntrack_sane module which will handle
|
||||
# sane data connection.
|
||||
|
17
Shorewall/Macros/macro.SIP
Normal file
17
Shorewall/Macros/macro.SIP
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# Shorewall version 4 - SIP Macro
|
||||
#
|
||||
# /usr/share/shorewall/macro.SIP
|
||||
#
|
||||
# This macro handles SIP traffic.
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __SIP_HELPER )
|
||||
PARAM - - udp 5060 ; helper=sip
|
||||
?else
|
||||
PARAM - - udp 5060
|
||||
?endif
|
@@ -10,9 +10,17 @@
|
||||
# between hosts you fully trust.
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - udp 135,445
|
||||
PARAM - - udp 137:139
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __NETBIOS_NS_HELPER )
|
||||
PARAM - - udp 137 ; helper=netbios-ns
|
||||
PARAM - - udp 138:139
|
||||
?else
|
||||
PARAM - - udp 137:139
|
||||
?endif
|
||||
|
||||
PARAM - - udp 1024: 137
|
||||
PARAM - - tcp 135,139,445
|
||||
|
@@ -10,13 +10,28 @@
|
||||
# allow SMB traffic between hosts you fully trust.
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - udp 135,445
|
||||
PARAM - - udp 137:139
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __NETBIOS_NS_HELPER )
|
||||
PARAM - - udp 137 ; helper=netbios-ns
|
||||
PARAM - - udp 138:139
|
||||
?else
|
||||
PARAM - - udp 137:139
|
||||
?endif
|
||||
|
||||
PARAM - - udp 1024: 137
|
||||
PARAM - - tcp 135,139,445
|
||||
PARAM DEST SOURCE udp 135,445
|
||||
PARAM DEST SOURCE udp 137:139
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __NETBIOS_NS_HELPER )
|
||||
PARAM DEST SOURCE udp 137 ; helper=netbios-ns
|
||||
PARAM DEST SOURCE udp 138:139
|
||||
?else
|
||||
PARAM DEST SOURCE udp 137:139
|
||||
?endif
|
||||
|
||||
PARAM DEST SOURCE udp 1024: 137
|
||||
PARAM DEST SOURCE tcp 135,139,445
|
||||
|
@@ -3,10 +3,17 @@
|
||||
#
|
||||
# /usr/share/shorewall/macro.SNMP
|
||||
#
|
||||
# This macro handles SNMP traffic (including traps).
|
||||
# This macro handles SNMP traffic.
|
||||
#
|
||||
# Note: To allow SNMP Traps, use the SNMPTrap macro
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - udp 161:162
|
||||
PARAM - - tcp 161
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __SNMP_HELPER )
|
||||
PARAM - - udp 161 ; helper=snmp
|
||||
?else
|
||||
PARAM - - udp 161
|
||||
?endif
|
||||
|
12
Shorewall/Macros/macro.SNMPTrap
Normal file
12
Shorewall/Macros/macro.SNMPTrap
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# Shorewall version 4 - SNMP Trap Macro
|
||||
#
|
||||
# /usr/share/shorewall/macro.SNMP
|
||||
#
|
||||
# This macro handles SNMP traps.
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - udp 162
|
@@ -8,6 +8,12 @@
|
||||
# Internet.
|
||||
#
|
||||
###############################################################################
|
||||
FORMAT 2
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - udp 69
|
||||
|
||||
?if ( __CT_TARGET && ! $AUTOHELPERS && __TFTP_HELPER )
|
||||
PARAM - - udp 69 ; helper=tftp
|
||||
?else
|
||||
PARAM - - udp 69
|
||||
?endif
|
||||
|
11
Shorewall/Macros/macro.Teredo
Normal file
11
Shorewall/Macros/macro.Teredo
Normal file
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# Shorewall version 4 - Teredo Macro
|
||||
#
|
||||
# /usr/share/shorewall/macro.Teredo
|
||||
#
|
||||
# This macro handles Teredo IPv6 over UDP tunneling traffic
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - - udp 3544
|
@@ -1,9 +1,11 @@
|
||||
#
|
||||
# Shorewall version 4 - Multicast DNS Macro
|
||||
# Shorewall version 4 - Multicast DNS Macro -- this macro assumes that only
|
||||
# the DEST zone sends mDNS queries. If both zones send
|
||||
# queries, use the mDNSbi macro.
|
||||
#
|
||||
# /usr/share/shorewall/macro.mDNS
|
||||
#
|
||||
# This macro handles multicast DNS traffic.
|
||||
# This macro handles multicast DNS traffic
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
|
16
Shorewall/Macros/macro.mDNSbi
Normal file
16
Shorewall/Macros/macro.mDNSbi
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Shorewall version 4 - Bi-directional Multicast DNS Macro.
|
||||
#
|
||||
# /usr/share/shorewall/macro.mDNSbi
|
||||
#
|
||||
# This macro handles multicast DNS traffic
|
||||
#
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE RATE USER/
|
||||
# PORT(S) PORT(S) LIMIT GROUP
|
||||
PARAM - 224.0.0.251 udp 5353
|
||||
PARAM - - udp 32768: 5353
|
||||
PARAM - 224.0.0.251 2
|
||||
PARAM DEST SOURCE:224.0.0.251 udp 5353
|
||||
PARAM DEST SOURCE udp 32768: 5353
|
||||
PARAM DEST SOURCE:224.0.0.251 2
|
@@ -71,9 +71,17 @@
|
||||
# Remaining Any value in the rules file REPLACES the value
|
||||
# columns given in the macro file.
|
||||
#
|
||||
# Multiple parameters may be passed to a macro. Within this file, $1 refers to the first parameter,
|
||||
# $2 to the second an so on. $1 is a synonym for PARAM but may be used anywhere in the file whereas
|
||||
# PARAM may only be used in the ACTION column.
|
||||
#
|
||||
# You can specify default values for parameters by using DEFAULT or DEFAULTS entry:
|
||||
#
|
||||
# DEFAULTS <default for $1>,<default for $2>,...
|
||||
#
|
||||
#######################################################################################################
|
||||
# DO NOT REMOVE THE FOLLOWING LINE
|
||||
FORMAT 2
|
||||
####################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS
|
||||
#################################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||
# PORT PORT(S) DEST LIMIT GROUP
|
||||
|
@@ -2,20 +2,22 @@
|
||||
VARDIR=$(shell /sbin/shorewall show vardir)
|
||||
CONFDIR=/etc/shorewall
|
||||
RESTOREFILE?=firewall
|
||||
all: $(VARDIR)/${RESTOREFILE}
|
||||
|
||||
$(VARDIR)/${RESTOREFILE}: $(CONFDIR)/*
|
||||
all: $(VARDIR)/$(RESTOREFILE)
|
||||
|
||||
$(VARDIR)/$(RESTOREFILE): $(CONFDIR)/*
|
||||
@/sbin/shorewall -q save >/dev/null; \
|
||||
if \
|
||||
/sbin/shorewall -q restart >/dev/null 2>&1; \
|
||||
then \
|
||||
/sbin/shorewall -q save >/dev/null; \
|
||||
else \
|
||||
/sbin/shorewall -q restart 2>&1 | tail >&2; \
|
||||
/sbin/shorewall -q restart 2>&1 | tail >&2; exit 1; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
@rm -f $(CONFDIR)/*~ $(CONFDIR)/.*~
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
# EOF
|
||||
|
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<includepath />
|
||||
|
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Shorewall</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.epic.perleditor.perlbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.epic.perleditor.perlnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@@ -46,6 +46,7 @@ my $jumpchainref;
|
||||
my %accountingjumps;
|
||||
my $asection;
|
||||
my $defaultchain;
|
||||
my $ipsecdir;
|
||||
my $defaultrestriction;
|
||||
my $restriction;
|
||||
my $accounting_commands = { COMMENT => 0, SECTION => 2 };
|
||||
@@ -85,13 +86,14 @@ sub initialize() {
|
||||
# The section number is initialized to a value less thatn LEGACY. It will be set to LEGACY if a
|
||||
# the first non-commentary line in the accounting file isn't a section header
|
||||
#
|
||||
# This allows the section header processor to quickly check for correct order
|
||||
# This allows the section header processor to quickly check for correct order
|
||||
#
|
||||
$asection = -1;
|
||||
#
|
||||
# These are the legacy values
|
||||
#
|
||||
$defaultchain = 'accounting';
|
||||
$ipsecdir = '';
|
||||
$defaultrestriction = NO_RESTRICT;
|
||||
$sectionname = '';
|
||||
}
|
||||
@@ -111,20 +113,25 @@ sub process_section ($) {
|
||||
|
||||
if ( $sectionname eq 'INPUT' ) {
|
||||
$defaultchain = 'accountin';
|
||||
$ipsecdir = 'in';
|
||||
$defaultrestriction = INPUT_RESTRICT;
|
||||
} elsif ( $sectionname eq 'OUTPUT' ) {
|
||||
$defaultchain = 'accountout';
|
||||
$ipsecdir = 'out';
|
||||
$defaultrestriction = OUTPUT_RESTRICT;
|
||||
} elsif ( $sectionname eq 'FORWARD' ) {
|
||||
$defaultchain = 'accountfwd';
|
||||
$ipsecdir = '';
|
||||
$defaultrestriction = NO_RESTRICT;
|
||||
} else {
|
||||
fatal_error "The $sectionname SECTION is not allowed when ACCOUNTING_TABLE=filter" unless $acctable eq 'mangle';
|
||||
if ( $sectionname eq 'PREROUTING' ) {
|
||||
$defaultchain = 'accountpre';
|
||||
$ipsecdir = 'in';
|
||||
$defaultrestriction = PREROUTE_RESTRICT;
|
||||
} else {
|
||||
$defaultchain = 'accountpost';
|
||||
$ipsecdir = 'out';
|
||||
$defaultrestriction = POSTROUTE_RESTRICT;
|
||||
}
|
||||
}
|
||||
@@ -194,7 +201,7 @@ sub process_accounting_rule( ) {
|
||||
$ports = '' if $ports eq 'any' || $ports eq 'all';
|
||||
$sports = '' if $sports eq 'any' || $sports eq 'all';
|
||||
|
||||
fatal_error "USER/GROUP may only be specified in the OUTPUT section" unless $user eq '-' || $asection == OUTPUT;
|
||||
fatal_error "USER/GROUP may only be specified in the OUTPUT section" unless $user eq '-' || $asection == OUTPUT;
|
||||
|
||||
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_test ( $mark, $globals{TC_MASK} ) . do_headers( $headers );
|
||||
my $rule2 = 0;
|
||||
@@ -229,6 +236,11 @@ sub process_accounting_rule( ) {
|
||||
}
|
||||
} elsif ( $action =~ /^NFLOG/ ) {
|
||||
$target = validate_level $action;
|
||||
} elsif ( $action =~ /^NFACCT\((\w+)\)$/ ) {
|
||||
require_capability 'NFACCT_MATCH', 'The NFACCT action', 's';
|
||||
$nfobjects{$1} = 1;
|
||||
$target = '';
|
||||
$rule .= "-m nfacct --nfacct-name $1 ";
|
||||
} else {
|
||||
( $action, my $cmd ) = split /:/, $action;
|
||||
|
||||
@@ -250,7 +262,7 @@ sub process_accounting_rule( ) {
|
||||
|
||||
if ( $source eq 'any' || $source eq 'all' ) {
|
||||
$source = ALLIP;
|
||||
} else {
|
||||
} else {
|
||||
fatal_error "MAC addresses only allowed in the INPUT and FORWARD sections" if $source =~ /~/ && ( $asection == OUTPUT || ! $asection );
|
||||
}
|
||||
|
||||
@@ -285,11 +297,25 @@ sub process_accounting_rule( ) {
|
||||
}
|
||||
|
||||
my $chainref = $chain_table{$config{ACCOUNTING_TABLE}}{$chain};
|
||||
my $dir;
|
||||
my $dir = $ipsecdir;
|
||||
|
||||
if ( $asection && $ipsec ne '-' ) {
|
||||
if ( $ipsecdir ) {
|
||||
fatal_error "Invalid IPSEC ($ipsec)" if $ipsec =~ /^(?:in|out)\b/;
|
||||
} else {
|
||||
if ( $ipsec =~ s/^(?:(in|out)\b)// ) {
|
||||
$dir = $1;
|
||||
} else {
|
||||
fatal_error q(IPSEC rules in the $asection section require that the value begin with 'in' or 'out');
|
||||
}
|
||||
}
|
||||
|
||||
$rule .= do_ipsec( $dir, $ipsec );
|
||||
}
|
||||
|
||||
if ( ! $chainref ) {
|
||||
if ( reserved_chain_name( $chain ) ) {
|
||||
fatal_error "May not use chain $chain in the $sectionname section" if $asection && $chain ne $defaultchain;
|
||||
fatal_error "May not use chain $chain in the $sectionname section" if $asection && $chain ne $defaultchain;
|
||||
$chainref = ensure_accounting_chain $chain, 0 , $restriction;
|
||||
} elsif ( $asection ) {
|
||||
fatal_error "Unknown accounting chain ($chain)";
|
||||
@@ -297,32 +323,36 @@ sub process_accounting_rule( ) {
|
||||
$chainref = ensure_accounting_chain $chain, 0 , $restriction;
|
||||
}
|
||||
|
||||
$dir = ipsec_chain_name( $chain );
|
||||
unless ( $asection ) {
|
||||
$dir = ipsec_chain_name( $chain );
|
||||
|
||||
if ( $ipsec ne '-' ) {
|
||||
if ( $dir ) {
|
||||
$rule .= do_ipsec( $dir, $ipsec );
|
||||
$chainref->{ipsec} = $dir;
|
||||
if ( $ipsec ne '-' ) {
|
||||
if ( $dir ) {
|
||||
$rule .= do_ipsec( $dir, $ipsec );
|
||||
$chainref->{ipsec} = $dir;
|
||||
} else {
|
||||
fatal_error "Adding an IPSEC rule to an unreferenced accounting chain is not allowed";
|
||||
}
|
||||
} else {
|
||||
fatal_error "Adding an IPSEC rule to an unreferenced accounting chain is not allowed";
|
||||
warning_message "Adding rule to unreferenced accounting chain $chain" unless reserved_chain_name( $chain );
|
||||
$chainref->{ipsec} = $dir;
|
||||
}
|
||||
} else {
|
||||
warning_message "Adding rule to unreferenced accounting chain $chain" unless reserved_chain_name( $chain );
|
||||
$chainref->{ipsec} = $dir;
|
||||
}
|
||||
} else {
|
||||
fatal_error "$chain is not an accounting chain" unless $chainref->{accounting};
|
||||
|
||||
if ( $ipsec ne '-' ) {
|
||||
$dir = $chainref->{ipsec};
|
||||
fatal_error "Adding an IPSEC rule into a non-IPSEC chain is not allowed" unless $dir;
|
||||
$rule .= do_ipsec( $dir , $ipsec );
|
||||
} elsif ( $asection ) {
|
||||
$restriction |= $chainref->{restriction};
|
||||
|
||||
unless ( $asection ) {
|
||||
if ( $ipsec ne '-' ) {
|
||||
$dir = $chainref->{ipsec};
|
||||
fatal_error "Adding an IPSEC rule into a non-IPSEC chain is not allowed" unless $dir;
|
||||
$rule .= do_ipsec( $dir , $ipsec );
|
||||
} elsif ( $asection ) {
|
||||
$restriction |= $chainref->{restriction};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dont_optimize( $chainref ) if $target eq 'RETURN';
|
||||
set_optflags( $chainref, DONT_OPTIMIZE ) if $target eq 'RETURN';
|
||||
|
||||
if ( $jumpchainref ) {
|
||||
if ( $asection ) {
|
||||
@@ -338,7 +368,7 @@ sub process_accounting_rule( ) {
|
||||
}
|
||||
|
||||
fatal_error "$chain is not an accounting chain" unless $chainref->{accounting};
|
||||
|
||||
|
||||
$restriction = $dir eq 'in' ? INPUT_RESTRICT : OUTPUT_RESTRICT if $dir;
|
||||
|
||||
expand_rule
|
||||
@@ -366,7 +396,6 @@ sub process_accounting_rule( ) {
|
||||
} else {
|
||||
$jumpchainref->{ipsec} = $chainref->{ipsec};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $rule2 ) {
|
||||
@@ -394,7 +423,7 @@ sub setup_accounting() {
|
||||
|
||||
my $nonEmpty = 0;
|
||||
|
||||
$nonEmpty |= process_accounting_rule while read_a_line;
|
||||
$nonEmpty |= process_accounting_rule while read_a_line( NORMAL_READ );
|
||||
|
||||
clear_comment;
|
||||
|
||||
@@ -407,7 +436,7 @@ sub setup_accounting() {
|
||||
}
|
||||
|
||||
if ( $tableref->{accounting} ) {
|
||||
dont_optimize( 'accounting' );
|
||||
set_optflags( 'accounting' , DONT_OPTIMIZE );
|
||||
for my $chain ( qw/INPUT FORWARD/ ) {
|
||||
insert_ijump( $tableref->{$chain}, j => 'accounting', 0 );
|
||||
}
|
||||
@@ -429,7 +458,7 @@ sub setup_accounting() {
|
||||
insert_ijump( $tableref->{POSTROUTING}, j => 'accountpost', 0 );
|
||||
}
|
||||
} elsif ( $tableref->{accounting} ) {
|
||||
dont_optimize( 'accounting' );
|
||||
set_optflags( 'accounting' , DONT_OPTIMIZE );
|
||||
for my $chain ( qw/INPUT FORWARD OUTPUT/ ) {
|
||||
insert_ijump( $tableref->{$chain}, j => 'accounting', 0 );
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,6 @@ use Shorewall::Accounting;
|
||||
use Shorewall::Rules;
|
||||
use Shorewall::Proc;
|
||||
use Shorewall::Proxyarp;
|
||||
use Shorewall::IPAddrs;
|
||||
use Shorewall::Raw;
|
||||
use Shorewall::Misc;
|
||||
|
||||
@@ -54,10 +53,10 @@ my $family;
|
||||
#
|
||||
# Initilize the package-globals in the other modules
|
||||
#
|
||||
sub initialize_package_globals( $ ) {
|
||||
Shorewall::Config::initialize($family);
|
||||
sub initialize_package_globals( $$$ ) {
|
||||
Shorewall::Config::initialize($family, $_[1], $_[2]);
|
||||
Shorewall::Chains::initialize ($family, 1, $export );
|
||||
Shorewall::Zones::initialize ($family, shift);
|
||||
Shorewall::Zones::initialize ($family, $_[0]);
|
||||
Shorewall::Nat::initialize;
|
||||
Shorewall::Providers::initialize($family);
|
||||
Shorewall::Tc::initialize($family);
|
||||
@@ -71,7 +70,7 @@ sub initialize_package_globals( $ ) {
|
||||
#
|
||||
# First stage of script generation.
|
||||
#
|
||||
# Copy prog.header, lib.core and lib.common to the generated script.
|
||||
# Copy lib.core and lib.common to the generated script.
|
||||
# Generate the various user-exit jacket functions.
|
||||
#
|
||||
# Note: This function is not called when $command eq 'check'. So it must have no side effects other
|
||||
@@ -89,13 +88,7 @@ sub generate_script_1( $ ) {
|
||||
|
||||
emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#";
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
copy $globals{SHAREDIRPL} . 'prog.header';
|
||||
} else {
|
||||
copy $globals{SHAREDIRPL} . 'prog.header6';
|
||||
}
|
||||
|
||||
copy2 $globals{SHAREDIRPL} . '/lib.core', 0;
|
||||
copy $globals{SHAREDIRPL} . '/lib.core', 0;
|
||||
copy2 $globals{SHAREDIRPL} . '/lib.common', 0;
|
||||
}
|
||||
|
||||
@@ -154,7 +147,9 @@ sub generate_script_2() {
|
||||
' #',
|
||||
' # Be sure that umask is sane',
|
||||
' #',
|
||||
' umask 077',
|
||||
' umask 077' );
|
||||
|
||||
emit ( '',
|
||||
' #',
|
||||
' # These variables are required by the library functions called in this script',
|
||||
' #'
|
||||
@@ -162,63 +157,53 @@ sub generate_script_2() {
|
||||
|
||||
push_indent;
|
||||
|
||||
if ( $shorewallrc1{TEMPDIR} ) {
|
||||
emit( '',
|
||||
qq(TMPDIR="$shorewallrc{TEMPDIR}") ,
|
||||
q(export TMPDIR) );
|
||||
}
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
emit( 'g_family=4' );
|
||||
|
||||
if ( $export ) {
|
||||
emit ( 'SHAREDIR=/usr/share/shorewall-lite',
|
||||
'CONFDIR=/etc/shorewall-lite',
|
||||
emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall-lite),
|
||||
'g_product="Shorewall Lite"',
|
||||
'g_program=shorewall-lite',
|
||||
'g_basedir=/usr/share/shorewall-lite',
|
||||
qq(CONFIG_PATH="$shorewallrc1{CONFDIR}/shorewall-lite:$shorewallrc1{SHAREDIR}/shorewall-lite") ,
|
||||
);
|
||||
} else {
|
||||
emit ( 'SHAREDIR=/usr/share/shorewall',
|
||||
'CONFDIR=/etc/shorewall',
|
||||
emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall),
|
||||
'g_product=Shorewall',
|
||||
'g_program=shorewall',
|
||||
'g_basedir=/usr/share/shorewall',
|
||||
qq(CONFIG_PATH="$config{CONFIG_PATH}") ,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
emit( 'g_family=6' );
|
||||
|
||||
if ( $export ) {
|
||||
emit ( 'SHAREDIR=/usr/share/shorewall6-lite',
|
||||
'CONFDIR=/etc/shorewall6-lite',
|
||||
emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall6-lite),
|
||||
'g_product="Shorewall6 Lite"',
|
||||
'g_program=shorewall6-lite',
|
||||
'g_basedir=/usr/share/shorewall6',
|
||||
qq(CONFIG_PATH="$shorewallrc1{CONFDIR}/shorewall6-lite:$shorewallrc{SHAREDIR}/shorewall6-lite") ,
|
||||
);
|
||||
} else {
|
||||
emit ( 'SHAREDIR=/usr/share/shorewall6',
|
||||
'CONFDIR=/etc/shorewall6',
|
||||
emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall6),
|
||||
'g_product=Shorewall6',
|
||||
'g_program=shorewall6',
|
||||
'g_basedir=/usr/share/shorewall'
|
||||
'g_basedir=/usr/share/shorewall',
|
||||
qq(CONFIG_PATH="$config{CONFIG_PATH}") ,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
emit( '[ -f ${CONFDIR}/vardir ] && . ${CONFDIR}/vardir' );
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
if ( $export ) {
|
||||
emit ( 'CONFIG_PATH="/etc/shorewall-lite:/usr/share/shorewall-lite"' ,
|
||||
'[ -n "${VARDIR:=/var/lib/shorewall-lite}" ]' );
|
||||
} else {
|
||||
emit ( qq(CONFIG_PATH="$config{CONFIG_PATH}") ,
|
||||
'[ -n "${VARDIR:=/var/lib/shorewall}" ]' );
|
||||
}
|
||||
} else {
|
||||
if ( $export ) {
|
||||
emit ( 'CONFIG_PATH="/etc/shorewall6-lite:/usr/share/shorewall6-lite"' ,
|
||||
'[ -n "${VARDIR:=/var/lib/shorewall6-lite}" ]' );
|
||||
} else {
|
||||
emit ( qq(CONFIG_PATH="$config{CONFIG_PATH}") ,
|
||||
'[ -n "${VARDIR:=/var/lib/shorewall6}" ]' );
|
||||
}
|
||||
}
|
||||
emit ( '[ -f ${g_confdir}/vardir ] && . ${g_confdir}/vardir' );
|
||||
emit ( qq([ -n "\${VARDIR:=$shorewallrc1{VARDIR}}" ]) );
|
||||
emit ( qq([ -n "\${VARLIB:=$shorewallrc1{VARLIB}}" ]) );
|
||||
|
||||
emit 'TEMPFILE=';
|
||||
|
||||
@@ -356,7 +341,7 @@ sub generate_script_3($) {
|
||||
emit 'cat > ${VARDIR}/.modules << EOF';
|
||||
open_file $fn;
|
||||
|
||||
emit_unindented $currentline while read_a_line;
|
||||
emit_unindented $currentline while read_a_line( NORMAL_READ );
|
||||
|
||||
emit_unindented 'EOF';
|
||||
emit '', 'reload_kernel_modules < ${VARDIR}/.modules';
|
||||
@@ -370,6 +355,7 @@ sub generate_script_3($) {
|
||||
emit '';
|
||||
|
||||
load_ipsets;
|
||||
create_nfobjects;
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
emit ( 'if [ "$COMMAND" = refresh ]; then' ,
|
||||
@@ -427,7 +413,7 @@ sub generate_script_3($) {
|
||||
emit 'cat > ${VARDIR}/proxyarp << __EOF__';
|
||||
} else {
|
||||
emit 'cat > ${VARDIR}/proxyndp << __EOF__';
|
||||
}
|
||||
}
|
||||
|
||||
dump_proxy_arp;
|
||||
emit_unindented '__EOF__';
|
||||
@@ -473,49 +459,56 @@ sub generate_script_3($) {
|
||||
fatal_error "$iptables_save_file does not exist"
|
||||
fi
|
||||
EOF
|
||||
pop_indent;
|
||||
push_indent;
|
||||
setup_load_distribution;
|
||||
setup_forwarding( $family , 1 );
|
||||
push_indent;
|
||||
pop_indent;
|
||||
|
||||
my $config_dir = $globals{CONFIGDIR};
|
||||
|
||||
emit<<"EOF";
|
||||
set_state Started $config_dir
|
||||
run_restored_exit
|
||||
else
|
||||
if [ \$COMMAND = refresh ]; then
|
||||
chainlist_reload
|
||||
elif [ \$COMMAND = refresh ]; then
|
||||
chainlist_reload
|
||||
EOF
|
||||
push_indent;
|
||||
setup_load_distribution;
|
||||
setup_forwarding( $family , 0 );
|
||||
|
||||
emit( ' run_refreshed_exit' ,
|
||||
' do_iptables -N shorewall' ,
|
||||
" set_state Started $config_dir" ,
|
||||
' else' ,
|
||||
' setup_netfilter' );
|
||||
|
||||
pop_indent;
|
||||
#
|
||||
# Use a parameter list rather than 'here documents' to avoid an extra blank line
|
||||
#
|
||||
emit(
|
||||
' run_refreshed_exit',
|
||||
' do_iptables -N shorewall',
|
||||
" set_state Started $config_dir",
|
||||
' [ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall',
|
||||
'else',
|
||||
' setup_netfilter'
|
||||
);
|
||||
push_indent;
|
||||
setup_load_distribution;
|
||||
pop_indent;
|
||||
|
||||
emit<<"EOF";
|
||||
conditionally_flush_conntrack
|
||||
emit<<'EOF';
|
||||
conditionally_flush_conntrack
|
||||
EOF
|
||||
push_indent;
|
||||
initialize_switches;
|
||||
setup_forwarding( $family , 0 );
|
||||
pop_indent;
|
||||
|
||||
emit<<"EOF";
|
||||
run_start_exit
|
||||
do_iptables -N shorewall
|
||||
set_state Started $config_dir
|
||||
run_started_exit
|
||||
fi
|
||||
|
||||
run_start_exit
|
||||
do_iptables -N shorewall
|
||||
set_state Started $config_dir
|
||||
[ \$0 = \${VARDIR}/firewall ] || cp -f \$(my_pathname) \${VARDIR}/firewall
|
||||
run_started_exit
|
||||
fi
|
||||
EOF
|
||||
|
||||
emit<<'EOF';
|
||||
[ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall
|
||||
fi
|
||||
|
||||
date > ${VARDIR}/restarted
|
||||
|
||||
case $COMMAND in
|
||||
@@ -547,8 +540,8 @@ EOF
|
||||
#
|
||||
sub compiler {
|
||||
|
||||
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $convert, $config_path ) =
|
||||
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , 0 , '');
|
||||
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $convert, $config_path, $shorewallrc , $shorewallrc1 ) =
|
||||
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , 0 , '' , '/usr/share/shorewall/shorewallrc', '' );
|
||||
|
||||
$export = 0;
|
||||
$test = 0;
|
||||
@@ -580,12 +573,14 @@ sub compiler {
|
||||
log => { store => \$log },
|
||||
log_verbosity => { store => \$log_verbosity, validate => \&validate_verbosity } ,
|
||||
test => { store => \$test },
|
||||
preview => { store => \$preview, validate=> \&validate_boolean } ,
|
||||
preview => { store => \$preview, validate=> \&validate_boolean } ,
|
||||
confess => { store => \$confess, validate=> \&validate_boolean } ,
|
||||
update => { store => \$update, validate=> \&validate_boolean } ,
|
||||
convert => { store => \$convert, validate=> \&validate_boolean } ,
|
||||
annotate => { store => \$annotate, validate=> \&validate_boolean } ,
|
||||
config_path => { store => \$config_path } ,
|
||||
shorewallrc => { store => \$shorewallrc } ,
|
||||
shorewallrc1 => { store => \$shorewallrc1 } ,
|
||||
);
|
||||
#
|
||||
# P A R A M E T E R P R O C E S S I N G
|
||||
@@ -603,7 +598,7 @@ sub compiler {
|
||||
#
|
||||
# Now that we know the address family (IPv4/IPv6), we can initialize the other modules' globals
|
||||
#
|
||||
initialize_package_globals( $update );
|
||||
initialize_package_globals( $update, $shorewallrc, $shorewallrc1 );
|
||||
|
||||
set_config_path( $config_path ) if $config_path;
|
||||
|
||||
@@ -666,11 +661,6 @@ sub compiler {
|
||||
# (Produces no output to the compiled script)
|
||||
#
|
||||
process_policies;
|
||||
#
|
||||
# N O T R A C K
|
||||
# (Produces no output to the compiled script)
|
||||
#
|
||||
setup_notrack;
|
||||
|
||||
enable_script;
|
||||
|
||||
@@ -709,10 +699,14 @@ sub compiler {
|
||||
# Proxy Arp/Ndp
|
||||
#
|
||||
setup_proxy_arp;
|
||||
#
|
||||
# Handle MSS settings in the zones file
|
||||
#
|
||||
setup_zone_mss;
|
||||
|
||||
emit( "#\n# Disable automatic helper association on kernel 3.5.0 and later\n#" ,
|
||||
'if [ -f /proc/sys/net/netfilter/nf_conntrack_helper ]; then' ,
|
||||
' progress_message "Disabling Kernel Automatic Helper Association"',
|
||||
" echo 0 > /proc/sys/net/netfilter/nf_conntrack_helper",
|
||||
'fi',
|
||||
''
|
||||
);
|
||||
|
||||
if ( $scriptfilename || $debug ) {
|
||||
emit 'return 0';
|
||||
@@ -793,6 +787,10 @@ sub compiler {
|
||||
#
|
||||
process_rules( $convert );
|
||||
#
|
||||
# Process the conntrack file
|
||||
#
|
||||
setup_conntrack;
|
||||
#
|
||||
# Add Tunnel rules.
|
||||
#
|
||||
setup_tunnels;
|
||||
@@ -817,16 +815,16 @@ sub compiler {
|
||||
|
||||
optimize_level0;
|
||||
|
||||
if ( $config{OPTIMIZE} & 0x1E ) {
|
||||
if ( ( my $optimize = $config{OPTIMIZE} ) & 0x1E ) {
|
||||
progress_message2 'Optimizing Ruleset...';
|
||||
#
|
||||
# Optimize Policy Chains
|
||||
#
|
||||
optimize_policy_chains if $config{OPTIMIZE} & 2;
|
||||
optimize_policy_chains if ( $optimize & OPTIMIZE_POLICY_MASK2n4 ) == OPTIMIZE_POLICY_MASK; # Level 2 but not 4
|
||||
#
|
||||
# More Optimization
|
||||
#
|
||||
optimize_ruleset if $config{OPTIMIZE} & 0x1C;
|
||||
optimize_ruleset if $config{OPTIMIZE} & OPTIMIZE_RULESET_MASK;
|
||||
}
|
||||
|
||||
enable_script;
|
||||
@@ -882,16 +880,16 @@ sub compiler {
|
||||
|
||||
optimize_level0;
|
||||
|
||||
if ( $config{OPTIMIZE} & OPTIMIZE_MASK ) {
|
||||
if ( ( my $optimize = $config{OPTIMIZE} & OPTIMIZE_MASK ) ) {
|
||||
progress_message2 'Optimizing Ruleset...';
|
||||
#
|
||||
# Optimize Policy Chains
|
||||
#
|
||||
optimize_policy_chains if $config{OPTIMIZE} & OPTIMIZE_POLICY_MASK;
|
||||
optimize_policy_chains if ( $optimize & OPTIMIZE_POLICY_MASK2n4 ) == OPTIMIZE_POLICY_MASK; # Level 2 but not 4
|
||||
#
|
||||
# Ruleset Optimization
|
||||
#
|
||||
optimize_ruleset if $config{OPTIMIZE} & OPTIMIZE_RULESET_MASK;
|
||||
optimize_ruleset if $optimize & OPTIMIZE_RULESET_MASK;
|
||||
}
|
||||
|
||||
enable_script if $debug;
|
||||
@@ -916,6 +914,7 @@ sub compiler {
|
||||
# call that function during normal 'check', we must validate routestopped here.
|
||||
#
|
||||
process_routestopped;
|
||||
process_stoppedrules;
|
||||
}
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -26,13 +26,13 @@
|
||||
#
|
||||
package Shorewall::IPAddrs;
|
||||
require Exporter;
|
||||
use Shorewall::Config qw( :DEFAULT split_list require_capability in_hex8 numeric_value F_IPV4 F_IPV6 );
|
||||
use Shorewall::Config qw( :DEFAULT split_list require_capability in_hex8 numeric_value F_IPV4 F_IPV6 :protocols );
|
||||
use Socket;
|
||||
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw( ALLIPv4
|
||||
our @EXPORT = ( qw( ALLIPv4
|
||||
ALLIPv6
|
||||
NILIPv4
|
||||
NILIPv6
|
||||
@@ -48,14 +48,6 @@ our @EXPORT = qw( ALLIPv4
|
||||
ALLIP
|
||||
NILIP
|
||||
ALL
|
||||
TCP
|
||||
UDP
|
||||
UDPLITE
|
||||
ICMP
|
||||
DCCP
|
||||
IPv6_ICMP
|
||||
SCTP
|
||||
GRE
|
||||
|
||||
validate_address
|
||||
validate_net
|
||||
@@ -76,10 +68,11 @@ our @EXPORT = qw( ALLIPv4
|
||||
proto_name
|
||||
validate_port
|
||||
validate_portpair
|
||||
validate_portpair1
|
||||
validate_port_list
|
||||
validate_icmp
|
||||
validate_icmp6
|
||||
);
|
||||
) );
|
||||
our @EXPORT_OK = qw( );
|
||||
our $VERSION = 'MODULEVERSION';
|
||||
|
||||
@@ -114,14 +107,7 @@ use constant { ALLIPv4 => '0.0.0.0/0' ,
|
||||
IPv6_LINK_ALLRTRS => 'ff01::2' ,
|
||||
IPv6_SITE_ALLNODES => 'ff02::1' ,
|
||||
IPv6_SITE_ALLRTRS => 'ff02::2' ,
|
||||
ICMP => 1,
|
||||
TCP => 6,
|
||||
UDP => 17,
|
||||
DCCP => 33,
|
||||
GRE => 47,
|
||||
IPv6_ICMP => 58,
|
||||
SCTP => 132,
|
||||
UDPLITE => 136 };
|
||||
};
|
||||
|
||||
my @rfc1918_networks = ( "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16" );
|
||||
|
||||
@@ -221,11 +207,13 @@ sub validate_4net( $$ ) {
|
||||
}
|
||||
|
||||
if ( defined wantarray ) {
|
||||
assert ( ! $allow_name );
|
||||
if ( wantarray ) {
|
||||
assert( ! $allow_name );
|
||||
( decodeaddr( $net ) , $vlsm );
|
||||
} elsif ( valid_4address $net ) {
|
||||
$vlsm == 32 ? $net : "$net/$vlsm";
|
||||
} else {
|
||||
"$net/$vlsm";
|
||||
$net;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,6 +228,8 @@ sub validate_4range( $$ ) {
|
||||
my $last = decodeaddr $high;
|
||||
|
||||
fatal_error "Invalid IP Range ($low-$high)" unless $first <= $last;
|
||||
|
||||
"$low-$high";
|
||||
}
|
||||
|
||||
sub validate_4host( $$ ) {
|
||||
@@ -292,9 +282,9 @@ sub compare_nets( $$ ) {
|
||||
|
||||
@net1 = decompose_net( $_[0] );
|
||||
@net2 = decompose_net( $_[1] );
|
||||
|
||||
|
||||
$net1[0] eq $net2[0] && $net1[1] == $net2[1];
|
||||
}
|
||||
}
|
||||
|
||||
sub allipv4() {
|
||||
@allipv4;
|
||||
@@ -371,6 +361,7 @@ sub validate_port( $$ ) {
|
||||
|
||||
sub validate_portpair( $$ ) {
|
||||
my ($proto, $portpair) = @_;
|
||||
my $what;
|
||||
|
||||
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/:/:/ > 1;
|
||||
|
||||
@@ -379,16 +370,57 @@ sub validate_portpair( $$ ) {
|
||||
|
||||
my @ports = split /:/, $portpair, 2;
|
||||
|
||||
$_ = validate_port( $proto, $_) for ( grep $_, @ports );
|
||||
my $protonum = resolve_proto( $proto ) || 0;
|
||||
|
||||
$_ = validate_port( $protonum, $_) for grep $_, @ports;
|
||||
|
||||
if ( @ports == 2 ) {
|
||||
$what = 'port range';
|
||||
fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1];
|
||||
} else {
|
||||
$what = 'port';
|
||||
}
|
||||
|
||||
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
|
||||
defined $protonum && ( $protonum == TCP ||
|
||||
$protonum == UDP ||
|
||||
$protonum == SCTP ||
|
||||
$protonum == DCCP );
|
||||
join ':', @ports;
|
||||
|
||||
}
|
||||
|
||||
sub validate_portpair1( $$ ) {
|
||||
my ($proto, $portpair) = @_;
|
||||
my $what;
|
||||
|
||||
fatal_error "Invalid port range ($portpair)" if $portpair =~ tr/-/-/ > 1;
|
||||
|
||||
$portpair = "0$portpair" if substr( $portpair, 0, 1 ) eq ':';
|
||||
$portpair = "${portpair}65535" if substr( $portpair, -1, 1 ) eq ':';
|
||||
|
||||
my @ports = split /-/, $portpair, 2;
|
||||
|
||||
my $protonum = resolve_proto( $proto ) || 0;
|
||||
|
||||
$_ = validate_port( $protonum, $_) for grep $_, @ports;
|
||||
|
||||
if ( @ports == 2 ) {
|
||||
$what = 'port range';
|
||||
fatal_error "Invalid port range ($portpair)" unless $ports[0] < $ports[1];
|
||||
} else {
|
||||
$what = 'port';
|
||||
}
|
||||
|
||||
fatal_error "Using a $what ( $portpair ) requires PROTO TCP, UDP, SCTP or DCCP" unless
|
||||
defined $protonum && ( $protonum == TCP ||
|
||||
$protonum == UDP ||
|
||||
$protonum == SCTP ||
|
||||
$protonum == DCCP );
|
||||
join '-', @ports;
|
||||
|
||||
}
|
||||
|
||||
sub validate_port_list( $$ ) {
|
||||
my $result = '';
|
||||
my ( $proto, $list ) = @_;
|
||||
@@ -580,7 +612,7 @@ sub validate_6address( $$ ) {
|
||||
|
||||
sub validate_6net( $$ ) {
|
||||
my ($net, $vlsm, $rest) = split( '/', $_[0], 3 );
|
||||
my $allow_name = $_[1];
|
||||
my $allow_name = $_[0];
|
||||
|
||||
if ( $net =~ /\+(\[?)/ ) {
|
||||
if ( $1 ) {
|
||||
@@ -592,22 +624,28 @@ sub validate_6net( $$ ) {
|
||||
}
|
||||
}
|
||||
|
||||
fatal_error "Invalid Network address ($_[0])" unless supplied $net;
|
||||
|
||||
$net = $1 if $net =~ /^\[(.*)\]$/;
|
||||
|
||||
if ( defined $vlsm ) {
|
||||
fatal_error "Invalid VLSM ($vlsm)" unless $vlsm =~ /^\d+$/ && $vlsm <= 128;
|
||||
fatal_error "Invalid Network address ($_[0])" if defined $rest;
|
||||
fatal_error "Invalid IPv6 address ($net)" unless valid_6address $net;
|
||||
} else {
|
||||
fatal_error "Invalid Network address ($_[0])" if $_[0] =~ '/' || ! defined $net;
|
||||
fatal_error "Invalid Network address ($_[0])" if $_[0] =~ '/';
|
||||
validate_6address $net, $allow_name;
|
||||
$vlsm = 128;
|
||||
}
|
||||
|
||||
if ( defined wantarray ) {
|
||||
assert ( ! $allow_name );
|
||||
if ( wantarray ) {
|
||||
assert( ! $allow_name );
|
||||
( $net , $vlsm );
|
||||
} elsif ( valid_6address ( $net ) ) {
|
||||
$vlsm == 32 ? $net : "$net/$vlsm";
|
||||
} else {
|
||||
"$net/$vlsm";
|
||||
$net;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -654,11 +692,13 @@ sub validate_6range( $$ ) {
|
||||
while ( @low ) {
|
||||
my ( $l, $h) = ( shift @low, shift @high );
|
||||
next if hex "0x$l" == hex "0x$h";
|
||||
return 1 if hex "0x$l" < hex "0x$h";
|
||||
return "$low-$high" if hex "0x$l" < hex "0x$h";
|
||||
last;
|
||||
}
|
||||
|
||||
fatal_error "Invalid IPv6 Range ($low-$high)";
|
||||
|
||||
|
||||
}
|
||||
|
||||
sub validate_6host( $$ ) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -35,7 +35,11 @@ use strict;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw( setup_masq setup_nat setup_netmap add_addresses );
|
||||
our %EXPORT_TAGS = ( rules => [ qw ( handle_nat_rule handle_nonat_rule ) ] );
|
||||
our @EXPORT_OK = ();
|
||||
|
||||
Exporter::export_ok_tags('rules');
|
||||
|
||||
our $VERSION = 'MODULEVERSION';
|
||||
|
||||
my @addresses_to_add;
|
||||
@@ -54,8 +58,8 @@ sub initialize() {
|
||||
#
|
||||
sub process_one_masq( )
|
||||
{
|
||||
my ($interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user ) =
|
||||
split_line1 'masq file', { interface => 0, source => 1, address => 2, proto => 3, port => 4, ipsec => 5, mark => 6, user => 7 };
|
||||
my ($interfacelist, $networks, $addresses, $proto, $ports, $ipsec, $mark, $user, $condition, $origdest ) =
|
||||
split_line1 'masq file', { interface => 0, source => 1, address => 2, proto => 3, port => 4, ipsec => 5, mark => 6, user => 7, switch => 8, origdest => 9 };
|
||||
|
||||
if ( $interfacelist eq 'COMMENT' ) {
|
||||
process_comment;
|
||||
@@ -88,7 +92,7 @@ sub process_one_masq( )
|
||||
$interfacelist = $1;
|
||||
} elsif ( $interfacelist =~ /^([^:]+):([^:]*)$/ ) {
|
||||
my ( $one, $two ) = ( $1, $2 );
|
||||
if ( $2 =~ /\./ ) {
|
||||
if ( $2 =~ /\./ || $2 =~ /^%/ ) {
|
||||
$interfacelist = $one;
|
||||
$destnets = $two;
|
||||
}
|
||||
@@ -117,9 +121,9 @@ sub process_one_masq( )
|
||||
}
|
||||
|
||||
#
|
||||
# Handle Protocol and Ports
|
||||
# Handle Protocol, Ports and Condition
|
||||
#
|
||||
$baserule .= do_proto $proto, $ports, '';
|
||||
$baserule .= do_proto( $proto, $ports, '' );
|
||||
#
|
||||
# Handle Mark
|
||||
#
|
||||
@@ -154,6 +158,8 @@ sub process_one_masq( )
|
||||
|
||||
my $chainref = ensure_chain('nat', $pre_nat ? snat_chain $interface : masq_chain $interface);
|
||||
|
||||
$baserule .= do_condition( $condition , $chainref->{name} );
|
||||
|
||||
my $detectaddress = 0;
|
||||
my $exceptionrule = '';
|
||||
my $randomize = '';
|
||||
@@ -195,7 +201,7 @@ sub process_one_masq( )
|
||||
if ( $conditional = conditional_rule( $chainref, $addr ) ) {
|
||||
$addrlist .= '--to-source ' . get_interface_address $1;
|
||||
} else {
|
||||
$addrlist .= '--to-source ' . record_runtime_address $1;
|
||||
$addrlist .= '--to-source ' . record_runtime_address( '&', $1 );
|
||||
}
|
||||
} elsif ( $addr =~ /^.*\..*\..*\./ ) {
|
||||
$target = 'SNAT ';
|
||||
@@ -208,11 +214,9 @@ sub process_one_masq( )
|
||||
$addrlist .= "--to-source $addr ";
|
||||
$exceptionrule = do_proto( $proto, '', '' ) if $addr =~ /:/;
|
||||
} else {
|
||||
my $ports = $addr;
|
||||
my $ports = $addr;
|
||||
$ports =~ s/^://;
|
||||
my $portrange = $ports;
|
||||
$portrange =~ s/-/:/;
|
||||
validate_portpair( $proto, $portrange );
|
||||
validate_portpair1( $proto, $ports );
|
||||
$addrlist .= "--to-ports $ports ";
|
||||
$exceptionrule = do_proto( $proto, '', '' );
|
||||
}
|
||||
@@ -235,7 +239,7 @@ sub process_one_masq( )
|
||||
$baserule . $rule ,
|
||||
$networks ,
|
||||
$destnets ,
|
||||
'' ,
|
||||
$origdest ,
|
||||
$target ,
|
||||
'' ,
|
||||
'' ,
|
||||
@@ -278,7 +282,7 @@ sub setup_masq()
|
||||
|
||||
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , 'a non-empty masq file' , 's'; } );
|
||||
|
||||
process_one_masq while read_a_line;
|
||||
process_one_masq while read_a_line( NORMAL_READ );
|
||||
|
||||
clear_comment;
|
||||
}
|
||||
@@ -375,7 +379,7 @@ sub setup_nat() {
|
||||
|
||||
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , 'a non-empty nat file' , 's'; } );
|
||||
|
||||
while ( read_a_line ) {
|
||||
while ( read_a_line( NORMAL_READ ) ) {
|
||||
|
||||
my ( $external, $interfacelist, $internal, $allints, $localnat ) = split_line1 'nat file', { external => 0, interface => 1, internal => 2, allints => 3, local => 4 };
|
||||
|
||||
@@ -411,7 +415,7 @@ sub setup_netmap() {
|
||||
|
||||
first_entry "$doing $fn...";
|
||||
|
||||
while ( read_a_line ) {
|
||||
while ( read_a_line( NORMAL_READ ) ) {
|
||||
|
||||
my ( $type, $net1, $interfacelist, $net2, $net3, $proto, $dport, $sport ) = split_line 'netmap file', { type => 0, net1 => 1, interface => 2, net2 => 3, net3 => 4, proto => 5, dport => 6, sport => 7 };
|
||||
|
||||
@@ -428,9 +432,9 @@ sub setup_netmap() {
|
||||
unless ( $type =~ /:/ ) {
|
||||
my @rulein;
|
||||
my @ruleout;
|
||||
|
||||
validate_net $net1, 0;
|
||||
validate_net $net2, 0;
|
||||
|
||||
$net1 = validate_net $net1, 0;
|
||||
$net2 = validate_net $net2, 0;
|
||||
|
||||
unless ( $interfaceref->{root} ) {
|
||||
@rulein = imatch_source_dev( $interface );
|
||||
@@ -441,7 +445,7 @@ sub setup_netmap() {
|
||||
require_capability 'NAT_ENABLED', 'Stateful NAT Entries', '';
|
||||
|
||||
if ( $type eq 'DNAT' ) {
|
||||
dest_iexclusion( ensure_chain( 'nat' , input_chain $interface ) ,
|
||||
dest_iexclusion( ensure_chain( 'nat' , input_chain $interface ) ,
|
||||
j => 'NETMAP' ,
|
||||
"--to $net2",
|
||||
$net1 ,
|
||||
@@ -464,13 +468,13 @@ sub setup_netmap() {
|
||||
|
||||
require_capability 'RAWPOST_TABLE', 'Stateless NAT Entries', '';
|
||||
|
||||
validate_net $net2, 0;
|
||||
$net2 = validate_net $net2, 0;
|
||||
|
||||
unless ( $interfaceref->{root} ) {
|
||||
@match = imatch_dest_dev( $interface );
|
||||
@match = imatch_dest_dev( $interface );
|
||||
$interface = $interfaceref->{name};
|
||||
}
|
||||
|
||||
|
||||
if ( $chain eq 'P' ) {
|
||||
$chain = prerouting_chain $interface;
|
||||
@match = imatch_source_dev( $iface ) unless $iface eq $interface;
|
||||
@@ -483,7 +487,7 @@ sub setup_netmap() {
|
||||
|
||||
my $chainref = ensure_chain( $table, $chain );
|
||||
|
||||
|
||||
|
||||
if ( $target eq 'DNAT' ) {
|
||||
dest_iexclusion( $chainref ,
|
||||
j => 'RAWDNAT' ,
|
||||
@@ -506,7 +510,7 @@ sub setup_netmap() {
|
||||
fatal_error 'TYPE must be specified' if $type eq '-';
|
||||
fatal_error "Invalid TYPE ($type)";
|
||||
}
|
||||
|
||||
|
||||
progress_message " Network $net1 on $iface mapped to $net2 ($type)";
|
||||
}
|
||||
}
|
||||
@@ -516,6 +520,227 @@ sub setup_netmap() {
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Called from process_rule1 to add a rule to the NAT table
|
||||
#
|
||||
sub handle_nat_rule( $$$$$$$$$$$$ ) {
|
||||
my ( $dest, # <server>[:port]
|
||||
$proto, # Protocol
|
||||
$ports, # Destination port list
|
||||
$origdest, # Original Destination
|
||||
$action_target, # If the target is an action, the name of the log action chain to jump to
|
||||
$action, # The Action
|
||||
$sourceref, # Reference to the Source Zone's table entry in the Zones module
|
||||
$action_chain, # Name of the action chain if the rule is in an action
|
||||
$rule, # Matches
|
||||
$source, # Source Address
|
||||
$loglevel, # [<level>[:<tag>]]
|
||||
$log_action, # Action name to include in the log message
|
||||
) = @_;
|
||||
|
||||
my ( $server, $serverport , $origdstports ) = ( '', '', '' );
|
||||
my $randomize = $dest =~ s/:random$// ? ' --random' : '';
|
||||
|
||||
#
|
||||
# Isolate server port
|
||||
#
|
||||
if ( $dest =~ /^(.*)(?::(.+))$/ ) {
|
||||
#
|
||||
# Server IP and Port
|
||||
#
|
||||
$server = $1; # May be empty
|
||||
$serverport = $2; # Not Empty due to RE
|
||||
|
||||
$origdstports = validate_port( $proto, $ports ) if $ports && $ports ne '-' && port_count( $ports ) == 1;
|
||||
|
||||
if ( $serverport =~ /^(\d+)-(\d+)$/ ) {
|
||||
#
|
||||
# Server Port Range
|
||||
#
|
||||
fatal_error "Invalid port range ($serverport)" unless $1 < $2;
|
||||
my @ports = ( $1, $2 );
|
||||
$_ = validate_port( proto_name( $proto ), $_) for ( @ports );
|
||||
( $ports = $serverport ) =~ tr/-/:/;
|
||||
} else {
|
||||
$serverport = $ports = validate_port( proto_name( $proto ), $serverport );
|
||||
}
|
||||
} elsif ( $dest ne ':' ) {
|
||||
#
|
||||
# Simple server IP address (may be empty or "-")
|
||||
#
|
||||
$server = $dest;
|
||||
}
|
||||
#
|
||||
# Generate the target
|
||||
#
|
||||
my $target = '';
|
||||
|
||||
if ( $action eq 'REDIRECT' ) {
|
||||
fatal_error "A server IP address ($server) may not be specified in a REDIRECT rule" if $server;
|
||||
$target = 'REDIRECT';
|
||||
$target .= " --to-port $serverport" if $serverport;
|
||||
if ( $origdest eq '' || $origdest eq '-' ) {
|
||||
$origdest = ALLIP;
|
||||
} elsif ( $origdest eq 'detect' ) {
|
||||
fatal_error 'ORIGINAL DEST "detect" is invalid in an action' if $action_chain;
|
||||
|
||||
if ( $config{DETECT_DNAT_IPADDRS} ) {
|
||||
my $interfacesref = $sourceref->{interfaces};
|
||||
my @interfaces = keys %$interfacesref;
|
||||
$origdest = @interfaces ? "detect:@interfaces" : ALLIP;
|
||||
} else {
|
||||
$origdest = ALLIP;
|
||||
}
|
||||
}
|
||||
} elsif ( $action_target ) {
|
||||
fatal_error "A server port ($serverport) is not allowed in $action rule" if $serverport;
|
||||
$target = $action_target;
|
||||
} else {
|
||||
if ( $server eq '' ) {
|
||||
fatal_error "A server and/or port must be specified in the DEST column in $action rules" unless $serverport;
|
||||
} elsif ( $server =~ /^(.+)-(.+)$/ ) {
|
||||
validate_range( $1, $2 );
|
||||
} else {
|
||||
unless ( $server eq ALLIP ) {
|
||||
my @servers = validate_address $server, 1;
|
||||
$server = join ',', @servers;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $action eq 'DNAT' ) {
|
||||
$target = $action;
|
||||
if ( $server ) {
|
||||
$serverport = ":$serverport" if $serverport;
|
||||
for my $serv ( split /,/, $server ) {
|
||||
$target .= " --to-destination ${serv}${serverport}";
|
||||
}
|
||||
} else {
|
||||
$target .= " --to-destination :$serverport";
|
||||
}
|
||||
}
|
||||
|
||||
unless ( $origdest && $origdest ne '-' && $origdest ne 'detect' ) {
|
||||
if ( ! $action_chain && $config{DETECT_DNAT_IPADDRS} ) {
|
||||
my $interfacesref = $sourceref->{interfaces};
|
||||
my @interfaces = keys %$interfacesref;
|
||||
$origdest = @interfaces ? "detect:@interfaces" : ALLIP;
|
||||
} else {
|
||||
$origdest = ALLIP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$target .= $randomize;
|
||||
#
|
||||
# And generate the nat table rule(s)
|
||||
#
|
||||
my $firewallsource = $sourceref && ( $sourceref->{type} & ( FIREWALL | VSERVER ) );
|
||||
|
||||
expand_rule ( ensure_chain ('nat' ,
|
||||
( $action_chain ? $action_chain :
|
||||
$firewallsource ? 'OUTPUT' :
|
||||
dnat_chain $sourceref->{name} ) ) ,
|
||||
$firewallsource ? OUTPUT_RESTRICT : PREROUTE_RESTRICT ,
|
||||
$rule ,
|
||||
$source ,
|
||||
$origdest ,
|
||||
'' ,
|
||||
$target ,
|
||||
$loglevel ,
|
||||
$log_action ,
|
||||
$serverport ? do_proto( $proto, '', '' ) : '',
|
||||
);
|
||||
|
||||
( $ports, $origdstports, $server );
|
||||
}
|
||||
|
||||
#
|
||||
# Called from process_rule1() to handle the nat table part of the NONAT and ACCEPT+ actions
|
||||
#
|
||||
sub handle_nonat_rule( $$$$$$$$$$ ) {
|
||||
my ( $action, $source, $dest, $origdest, $sourceref, $inaction, $chain, $loglevel, $log_action, $rule ) = @_;
|
||||
|
||||
my $sourcezone = $sourceref->{name};
|
||||
#
|
||||
# NONAT or ACCEPT+ may not specify a destination interface
|
||||
#
|
||||
fatal_error "Invalid DEST ($dest) in $action rule" if $dest =~ /:/;
|
||||
|
||||
$origdest = '' unless $origdest and $origdest ne '-';
|
||||
|
||||
if ( $origdest eq 'detect' ) {
|
||||
my $interfacesref = $sourceref->{interfaces};
|
||||
my $interfaces = [ ( keys %$interfacesref ) ];
|
||||
$origdest = $interfaces ? "detect:@$interfaces" : ALLIP;
|
||||
}
|
||||
|
||||
my $tgt = 'RETURN';
|
||||
|
||||
my $nonat_chain;
|
||||
|
||||
my $chn;
|
||||
|
||||
if ( $inaction ) {
|
||||
$nonat_chain = ensure_chain( 'nat', $chain );
|
||||
} elsif ( $sourceref->{type} == FIREWALL ) {
|
||||
$nonat_chain = $nat_table->{OUTPUT};
|
||||
} else {
|
||||
$nonat_chain = ensure_chain( 'nat', dnat_chain( $sourcezone ) );
|
||||
|
||||
my @interfaces = keys %{zone_interfaces $sourcezone};
|
||||
|
||||
for ( @interfaces ) {
|
||||
my $ichain = input_chain $_;
|
||||
|
||||
if ( $nat_table->{$ichain} ) {
|
||||
#
|
||||
# Static NAT is defined on this interface
|
||||
#
|
||||
$chn = new_chain( 'nat', newnonatchain ) unless $chn;
|
||||
add_ijump $chn, j => $nat_table->{$ichain}, @interfaces > 1 ? imatch_source_dev( $_ ) : ();
|
||||
}
|
||||
}
|
||||
|
||||
if ( $chn ) {
|
||||
#
|
||||
# Call expand_rule() to correctly handle logging. Because
|
||||
# the 'logname' argument is passed, expand_rule() will
|
||||
# not create a separate logging chain but will rather emit
|
||||
# any logging rule in-line.
|
||||
#
|
||||
expand_rule( $chn,
|
||||
PREROUTE_RESTRICT,
|
||||
'', # Rule
|
||||
'', # Source
|
||||
'', # Dest
|
||||
'', # Original dest
|
||||
'ACCEPT',
|
||||
$loglevel,
|
||||
$log_action,
|
||||
'',
|
||||
dnat_chain( $sourcezone ) );
|
||||
$loglevel = '';
|
||||
$tgt = $chn->{name};
|
||||
} else {
|
||||
$tgt = 'ACCEPT';
|
||||
}
|
||||
}
|
||||
|
||||
set_optflags( $nonat_chain, DONT_MOVE | DONT_OPTIMIZE ) if $tgt eq 'RETURN';
|
||||
|
||||
expand_rule( $nonat_chain ,
|
||||
PREROUTE_RESTRICT ,
|
||||
$rule ,
|
||||
$source ,
|
||||
$dest ,
|
||||
$origdest ,
|
||||
$tgt,
|
||||
$loglevel ,
|
||||
$log_action ,
|
||||
'',
|
||||
);
|
||||
}
|
||||
|
||||
sub add_addresses () {
|
||||
if ( @addresses_to_add ) {
|
||||
my @addrs = @addresses_to_add;
|
||||
|
@@ -219,30 +219,30 @@ sub setup_forwarding( $$ ) {
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
if ( $config{IP_FORWARDING} eq 'on' ) {
|
||||
emit ' echo 1 > /proc/sys/net/ipv4/ip_forward';
|
||||
emit ' progress_message2 IPv4 Forwarding Enabled';
|
||||
emit 'echo 1 > /proc/sys/net/ipv4/ip_forward';
|
||||
emit 'progress_message2 IPv4 Forwarding Enabled';
|
||||
} elsif ( $config{IP_FORWARDING} eq 'off' ) {
|
||||
emit ' echo 0 > /proc/sys/net/ipv4/ip_forward';
|
||||
emit ' progress_message2 IPv4 Forwarding Disabled!';
|
||||
emit 'echo 0 > /proc/sys/net/ipv4/ip_forward';
|
||||
emit 'progress_message2 IPv4 Forwarding Disabled!';
|
||||
}
|
||||
|
||||
emit '';
|
||||
|
||||
emit ( ' echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables' ,
|
||||
emit ( 'echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables' ,
|
||||
''
|
||||
) if have_bridges;
|
||||
} else {
|
||||
if ( $config{IP_FORWARDING} eq 'on' ) {
|
||||
emit ' echo 1 > /proc/sys/net/ipv6/conf/all/forwarding';
|
||||
emit ' progress_message2 IPv6 Forwarding Enabled';
|
||||
emit 'echo 1 > /proc/sys/net/ipv6/conf/all/forwarding';
|
||||
emit 'progress_message2 IPv6 Forwarding Enabled';
|
||||
} elsif ( $config{IP_FORWARDING} eq 'off' ) {
|
||||
emit ' echo 0 > /proc/sys/net/ipv6/conf/all/forwarding';
|
||||
emit ' progress_message2 IPv6 Forwarding Disabled!';
|
||||
emit 'echo 0 > /proc/sys/net/ipv6/conf/all/forwarding';
|
||||
emit 'progress_message2 IPv6 Forwarding Disabled!';
|
||||
}
|
||||
|
||||
emit '';
|
||||
|
||||
emit ( ' echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables' ,
|
||||
emit ( 'echo 1 > /proc/sys/net/bridge/bridge-nf-call-ip6tables' ,
|
||||
''
|
||||
) if have_bridges;
|
||||
|
||||
@@ -251,9 +251,6 @@ sub setup_forwarding( $$ ) {
|
||||
if ( @$interfaces ) {
|
||||
progress_message2 "$doing Interface forwarding..." if $first;
|
||||
|
||||
push_indent;
|
||||
push_indent;
|
||||
|
||||
save_progress_message 'Setting up IPv6 Interface Forwarding...';
|
||||
|
||||
for my $interface ( @$interfaces ) {
|
||||
@@ -270,9 +267,6 @@ sub setup_forwarding( $$ ) {
|
||||
" error_message \"WARNING: Cannot set IPv6 forwarding on $interface\"" ) unless $optional;
|
||||
emit "fi\n";
|
||||
}
|
||||
|
||||
pop_indent;
|
||||
pop_indent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,7 +280,7 @@ sub setup_interface_proc( $ ) {
|
||||
if ( interface_has_option( $interface, 'arp_filter' , $value ) ) {
|
||||
push @emitted, "echo $value > /proc/sys/net/ipv4/conf/$physical/arp_filter";
|
||||
}
|
||||
|
||||
|
||||
if ( interface_has_option( $interface, 'arp_ignore' , $value ) ) {
|
||||
push @emitted, "echo $value > /proc/sys/net/ipv4/conf/$physical/arp_ignore";
|
||||
}
|
||||
@@ -315,6 +309,6 @@ sub setup_interface_proc( $ ) {
|
||||
emit "fi\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -120,7 +120,7 @@ sub setup_proxy_arp() {
|
||||
|
||||
my ( %set, %reset );
|
||||
|
||||
while ( read_a_line ) {
|
||||
while ( read_a_line( NORMAL_READ ) ) {
|
||||
|
||||
my ( $address, $interface, $external, $haveroute, $persistent ) =
|
||||
split_line $file_opt . 'file ', { address => 0, interface => 1, external => 2, haveroute => 3, persistent => 4 };
|
||||
|
@@ -20,7 +20,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# This module contains the code that handles the /etc/shorewall/notrack file.
|
||||
# This module contains the code that handles the /etc/shorewall/conntrack file.
|
||||
#
|
||||
package Shorewall::Raw;
|
||||
require Exporter;
|
||||
@@ -32,8 +32,8 @@ use Shorewall::Chains qw(:DEFAULT :internal);
|
||||
use strict;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw( setup_notrack );
|
||||
our @EXPORT_OK = qw( );
|
||||
our @EXPORT = qw( setup_conntrack );
|
||||
our @EXPORT_OK = qw( handle_helper_rule );
|
||||
our $VERSION = 'MODULEVERSION';
|
||||
|
||||
my %valid_ctevent = ( new => 1, related => 1, destroy => 1, reply => 1, assured => 1, protoinfo => 1, helper => 1, mark => 1, natseqinfo => 1, secmark => 1 );
|
||||
@@ -41,54 +41,91 @@ my %valid_ctevent = ( new => 1, related => 1, destroy => 1, reply => 1, assured
|
||||
#
|
||||
# Notrack
|
||||
#
|
||||
sub process_notrack_rule( $$$$$$$ ) {
|
||||
sub process_conntrack_rule( $$$$$$$$$$ ) {
|
||||
|
||||
my ($action, $source, $dest, $proto, $ports, $sports, $user ) = @_;
|
||||
my ($chainref, $zoneref, $action, $source, $dest, $proto, $ports, $sports, $user, $switch ) = @_;
|
||||
|
||||
require_capability 'RAW_TABLE', 'conntrack rules', '';
|
||||
|
||||
$proto = '' if $proto eq 'any';
|
||||
$ports = '' if $ports eq 'any' || $ports eq 'all';
|
||||
$sports = '' if $sports eq 'any' || $sports eq 'all';
|
||||
|
||||
( my $zone, $source) = split /:/, $source, 2;
|
||||
my $zoneref = find_zone $zone;
|
||||
my $chainref = ensure_raw_chain( notrack_chain $zone );
|
||||
my $restriction = $zoneref->{type} == FIREWALL || $zoneref->{type} == VSERVER ? OUTPUT_RESTRICT : PREROUTE_RESTRICT;
|
||||
my $zone;
|
||||
my $restriction = PREROUTE_RESTRICT;
|
||||
|
||||
fatal_error 'USER/GROUP is not allowed unless the SOURCE zone is $FW or a Vserver zone' if $user ne '-' && $restriction != OUTPUT_RESTRICT;
|
||||
require_capability 'RAW_TABLE', 'Notrack rules', '';
|
||||
if ( $chainref ) {
|
||||
$restriction = OUTPUT_RESTRICT if $chainref->{name} eq 'OUTPUT';
|
||||
} else {
|
||||
#
|
||||
# Entry in the conntrack file
|
||||
#
|
||||
if ( $zoneref ) {
|
||||
$zone = $zoneref->{name};
|
||||
} else {
|
||||
($zone, $source) = split /:/, $source, 2;
|
||||
$zoneref = find_zone ( $zone );
|
||||
}
|
||||
|
||||
$chainref = ensure_raw_chain( notrack_chain $zone );
|
||||
$restriction = OUTPUT_RESTRICT if $zoneref->{type} & (FIREWALL | VSERVER );
|
||||
fatal_error 'USER/GROUP is not allowed unless the SOURCE zone is $FW or a Vserver zone' if $user ne '-' && $restriction != OUTPUT_RESTRICT;
|
||||
}
|
||||
|
||||
my $target = $action;
|
||||
my $exception_rule = '';
|
||||
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user );
|
||||
my $rule = do_proto( $proto, $ports, $sports ) . do_user ( $user ) . do_condition( $switch , $chainref->{name} );
|
||||
|
||||
unless ( $action eq 'NOTRACK' ) {
|
||||
if ( $action eq 'NOTRACK' ) {
|
||||
#
|
||||
# A patch that deimplements the NOTRACK target has been posted on the
|
||||
# Netfilter development list
|
||||
#
|
||||
$action = 'CT --notrack' if have_capability 'CT_TARGET';
|
||||
} elsif ( $action ne 'DROP' ) {
|
||||
( $target, my ( $option, $args, $junk ) ) = split ':', $action, 4;
|
||||
|
||||
fatal_error "Invalid notrack ACTION ( $action )" if $junk || $target ne 'CT';
|
||||
|
||||
require_capability 'CT_TARGET', 'CT entries in the notrack file', '';
|
||||
require_capability 'CT_TARGET', 'CT entries in the conntrack file', '';
|
||||
|
||||
if ( $option eq 'notrack' ) {
|
||||
fatal_error "Invalid notrack ACTION ( $action )" if supplied $args;
|
||||
fatal_error "Invalid conntrack ACTION ( $action )" if supplied $args;
|
||||
$action = 'CT --notrack';
|
||||
} else {
|
||||
fatal_error "Invalid or missing CT option and arguments" unless supplied $option && supplied $args;
|
||||
|
||||
if ( $option eq 'helper' ) {
|
||||
fatal_error "Invalid helper' ($args)" if $args =~ /,/;
|
||||
validate_helper( $args, $proto );
|
||||
$action = "CT --helper $args";
|
||||
$exception_rule = do_proto( $proto, '-', '-' );
|
||||
} elsif ( $option eq 'ctevents' ) {
|
||||
for ( split ',', $args ) {
|
||||
fatal_error "Invalid 'ctevents' event ($_)" unless $valid_ctevent{$_};
|
||||
my $modifiers = '';
|
||||
|
||||
if ( $args =~ /^([-\w.]+)\((.+)\)$/ ) {
|
||||
$args = $1;
|
||||
$modifiers = $2;
|
||||
}
|
||||
|
||||
$action = "CT --ctevents $args";
|
||||
} elsif ( $option eq 'expevent' ) {
|
||||
fatal_error "Invalid expevent argument ($args)" unless $args eq 'new';
|
||||
} elsif ( $option eq 'zone' ) {
|
||||
fatal_error "Invalid zone id ($args)" unless $args =~ /^\d+$/;
|
||||
fatal_error "Invalid helper' ($args)" if $args =~ /,/;
|
||||
validate_helper( $args, $proto );
|
||||
$action = "CT --helper $helpers_aliases{$args}";
|
||||
$exception_rule = do_proto( $proto, '-', '-' );
|
||||
|
||||
for my $mod ( split_list1( $modifiers, 'ctevents' ) ) {
|
||||
fatal_error "Invalid helper option ($mod)" unless $mod =~ /^(\w+)=(.+)$/;
|
||||
$mod = $1;
|
||||
my $val = $2;
|
||||
|
||||
if ( $mod eq 'ctevents' ) {
|
||||
for ( split_list( $val, 'ctevents' ) ) {
|
||||
fatal_error "Invalid 'ctevents' event ($_)" unless $valid_ctevent{$_};
|
||||
}
|
||||
|
||||
$action .= " --ctevents $val";
|
||||
} elsif ( $mod eq 'expevents' ) {
|
||||
fatal_error "Invalid expevent argument ($val)" unless $val eq 'new';
|
||||
$action .= ' --expevents new';
|
||||
} else {
|
||||
fatal_error "Invalid helper option ($mod)";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fatal_error "Invalid CT option ($option)";
|
||||
}
|
||||
@@ -105,65 +142,159 @@ sub process_notrack_rule( $$$$$$$ ) {
|
||||
'' ,
|
||||
$target ,
|
||||
$exception_rule );
|
||||
|
||||
progress_message " Notrack rule \"$currentline\" $done";
|
||||
|
||||
$globals{UNTRACKED} = 1;
|
||||
progress_message " Conntrack rule \"$currentline\" $done";
|
||||
}
|
||||
|
||||
sub handle_helper_rule( $$$$$$$$$$$ ) {
|
||||
my ( $helper, $source, $dest, $proto, $ports, $sports, $sourceref, $action_target, $actionchain, $user, $rule ) = @_;
|
||||
|
||||
if ( $helper ne '-' ) {
|
||||
fatal_error "A HELPER is not allowed with this ACTION" if $action_target;
|
||||
#
|
||||
# This means that an ACCEPT or NAT rule with a helper is being processed
|
||||
#
|
||||
process_conntrack_rule( $actionchain ? ensure_raw_chain( $actionchain ) : undef ,
|
||||
$sourceref ,
|
||||
"CT:helper:$helper",
|
||||
$source ,
|
||||
$dest ,
|
||||
$proto ,
|
||||
$ports ,
|
||||
$sports ,
|
||||
$user,
|
||||
'-',
|
||||
);
|
||||
} else {
|
||||
assert( $action_target );
|
||||
#
|
||||
# The target is an action
|
||||
#
|
||||
if ( $actionchain ) {
|
||||
#
|
||||
# And the source is another action chain
|
||||
#
|
||||
expand_rule( ensure_raw_chain( $actionchain ) ,
|
||||
PREROUTE_RESTRICT ,
|
||||
$rule ,
|
||||
$source ,
|
||||
$dest ,
|
||||
'' ,
|
||||
$action_target ,
|
||||
'',
|
||||
'CT' ,
|
||||
'' );
|
||||
} else {
|
||||
expand_rule( ensure_raw_chain( notrack_chain( $sourceref->{name} ) ) ,
|
||||
( $sourceref->{type} == FIREWALL || $sourceref->{type} == VSERVER ?
|
||||
OUTPUT_RESTRICT :
|
||||
PREROUTE_RESTRICT ) ,
|
||||
$rule ,
|
||||
$source ,
|
||||
$dest ,
|
||||
'' ,
|
||||
$action_target ,
|
||||
'' ,
|
||||
'CT' ,
|
||||
'' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub process_format( $ ) {
|
||||
my $format = shift;
|
||||
|
||||
fatal_error q(FORMAT must be '1' or '2') unless $format =~ /^[12]$/;
|
||||
fatal_error q(FORMAT must be '1', '2' or '3') unless $format =~ /^[123]$/;
|
||||
|
||||
$format;
|
||||
}
|
||||
|
||||
sub setup_notrack() {
|
||||
sub setup_conntrack() {
|
||||
|
||||
my $format = 1;
|
||||
my $action = 'NOTRACK';
|
||||
for my $name ( qw/notrack conntrack/ ) {
|
||||
|
||||
if ( my $fn = open_file 'notrack' ) {
|
||||
my $fn = open_file( $name );
|
||||
|
||||
first_entry "$doing $fn...";
|
||||
if ( $fn ) {
|
||||
|
||||
my $nonEmpty = 0;
|
||||
my $format = 1;
|
||||
|
||||
while ( read_a_line ) {
|
||||
my ( $source, $dest, $proto, $ports, $sports, $user );
|
||||
my $action = 'NOTRACK';
|
||||
|
||||
if ( $format == 1 ) {
|
||||
( $source, $dest, $proto, $ports, $sports, $user ) = split_line1 'Notrack File', { source => 0, dest => 1, proto => 2, dport => 3, sport => 4, user => 5 };
|
||||
|
||||
if ( $source eq 'FORMAT' ) {
|
||||
$format = process_format( $dest );
|
||||
next;
|
||||
my $empty = 1;
|
||||
|
||||
first_entry( "$doing $fn..." );
|
||||
|
||||
while ( read_a_line( NORMAL_READ ) ) {
|
||||
my ( $source, $dest, $proto, $ports, $sports, $user, $switch );
|
||||
|
||||
if ( $format == 1 ) {
|
||||
( $source, $dest, $proto, $ports, $sports, $user, $switch ) = split_line1 'Conntrack File', { source => 0, dest => 1, proto => 2, dport => 3, sport => 4, user => 5, switch => 6 };
|
||||
|
||||
if ( $source eq 'FORMAT' ) {
|
||||
$format = process_format( $dest );
|
||||
next;
|
||||
}
|
||||
} else {
|
||||
( $action, $source, $dest, $proto, $ports, $sports, $user, $switch ) = split_line1 'Conntrack File', { action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6, switch => 7 }, { COMMENT => 0, FORMAT => 2 };
|
||||
|
||||
if ( $action eq 'FORMAT' ) {
|
||||
$format = process_format( $source );
|
||||
$action = 'NOTRACK';
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $source eq 'COMMENT' ) {
|
||||
process_comment;
|
||||
next;
|
||||
}
|
||||
} else {
|
||||
( $action, $source, $dest, $proto, $ports, $sports, $user ) = split_line1 'Notrack File', { action => 0, source => 1, dest => 2, proto => 3, dport => 4, sport => 5, user => 6 }, { COMMENT => 0, FORMAT => 2 };
|
||||
|
||||
if ( $action eq 'FORMAT' ) {
|
||||
$format = process_format( $source );
|
||||
$action = 'NOTRACK';
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
if ( $action eq 'COMMENT' ) {
|
||||
process_comment;
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
process_notrack_rule $action, $source, $dest, $proto, $ports, $sports, $user;
|
||||
}
|
||||
}
|
||||
|
||||
clear_comment;
|
||||
$empty = 0;
|
||||
|
||||
if ( $format < 3 ) {
|
||||
if ( $source =~ /^all(-)?(:(.+))?$/ ) {
|
||||
fatal_error 'USER/GROUP is not allowed unless the SOURCE zone is $FW or a Vserver zone' if $user ne '-';
|
||||
for my $zone ( $1 ? off_firewall_zones : all_zones ) {
|
||||
process_conntrack_rule( undef ,
|
||||
undef,
|
||||
$action,
|
||||
$zone . ( $2 || ''),
|
||||
$dest,
|
||||
$proto,
|
||||
$ports,
|
||||
$sports,
|
||||
$user ,
|
||||
$switch );
|
||||
}
|
||||
} else {
|
||||
process_conntrack_rule( undef, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
|
||||
}
|
||||
} elsif ( $action =~ s/:O$// ) {
|
||||
process_conntrack_rule( $raw_table->{OUTPUT}, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
|
||||
} elsif ( $action =~ s/:OP// || $action =~ s/:PO// ) {
|
||||
process_conntrack_rule( $raw_table->{PREROUTING}, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
|
||||
process_conntrack_rule( $raw_table->{OUTPUT}, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
|
||||
} else {
|
||||
$action =~ s/:P//;
|
||||
process_conntrack_rule( $raw_table->{PREROUTING}, undef, $action, $source, $dest, $proto, $ports, $sports, $user, $switch );
|
||||
}
|
||||
}
|
||||
|
||||
clear_comment;
|
||||
|
||||
if ( $name eq 'notrack') {
|
||||
if ( $empty ) {
|
||||
if ( unlink( $fn ) ) {
|
||||
warning_message "Empty notrack file ($fn) removed";
|
||||
} else {
|
||||
warning_message "Unable to remove empty notrack file ($fn): $!";
|
||||
}
|
||||
} else {
|
||||
warning_message "Non-empty notrack file ($fn); please move its contents to the conntrack file";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,6 @@
|
||||
# Shorewall 4.4 -- /usr/share/shorewall/Shorewall/Tunnels.pm
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2007,2008,2009,2010,2011 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Complete documentation is available at http://shorewall.net
|
||||
@@ -62,7 +61,7 @@ sub setup_tunnels() {
|
||||
}
|
||||
}
|
||||
|
||||
my @options = $globals{UNTRACKED} ? state_imatch 'NEW,UNTRACKED' : state_imatch 'NEW';
|
||||
my @options = have_capability( 'RAW_TABLE' ) ? state_imatch 'NEW,UNTRACKED' : state_imatch 'NEW';
|
||||
|
||||
add_tunnel_rule $inchainref, p => 50, @$source;
|
||||
add_tunnel_rule $outchainref, p => 50, @$dest;
|
||||
@@ -126,9 +125,9 @@ sub setup_tunnels() {
|
||||
sub setup_pptp_server {
|
||||
my ($inchainref, $outchainref, $kind, $source, $dest ) = @_;
|
||||
|
||||
add_tunnel_rule $inchainref, p => 47, @$dest;
|
||||
add_tunnel_rule $outchainref, p => 47, @$source;
|
||||
add_tunnel_rule $inchainref, p => 'tcp --dport 1723', @$dest
|
||||
add_tunnel_rule $inchainref, p => 47, @$source;
|
||||
add_tunnel_rule $outchainref, p => 47, @$dest;
|
||||
add_tunnel_rule $inchainref, p => 'tcp --dport 1723', @$source
|
||||
}
|
||||
|
||||
sub setup_one_openvpn {
|
||||
@@ -234,7 +233,7 @@ sub setup_tunnels() {
|
||||
}
|
||||
|
||||
sub setup_one_tunnel($$$$) {
|
||||
my ( $kind , $zone, $gateway, $gatewayzones ) = @_;
|
||||
my ( $kind , $zone, $gateways, $gatewayzones ) = @_;
|
||||
|
||||
my $zonetype = zone_type( $zone );
|
||||
|
||||
@@ -243,35 +242,42 @@ sub setup_tunnels() {
|
||||
my $inchainref = ensure_rules_chain( rules_chain( ${zone}, ${fw} ) );
|
||||
my $outchainref = ensure_rules_chain( rules_chain( ${fw}, ${zone} ) );
|
||||
|
||||
$gateway = ALLIP if $gateway eq '-';
|
||||
$gateways = ALLIP if $gateways eq '-';
|
||||
|
||||
my @source = imatch_source_net $gateway;
|
||||
my @dest = imatch_dest_net $gateway;
|
||||
my ( $net, $excl ) = handle_network_list( $gateways , 'src' );
|
||||
( $net, $excl ) = handle_network_list( $gateways , 'dst' );
|
||||
|
||||
my %tunneltypes = ( 'ipsec' => { function => \&setup_one_ipsec , params => [ $kind, \@source, \@dest , $gatewayzones ] } ,
|
||||
'ipsecnat' => { function => \&setup_one_ipsec , params => [ $kind, \@source, \@dest , $gatewayzones ] } ,
|
||||
'ipip' => { function => \&setup_one_other, params => [ \@source, \@dest , 4 ] } ,
|
||||
'gre' => { function => \&setup_one_other, params => [ \@source, \@dest , 47 ] } ,
|
||||
'6to4' => { function => \&setup_one_other, params => [ \@source, \@dest , 41 ] } ,
|
||||
'6in4' => { function => \&setup_one_other, params => [ \@source, \@dest , 41 ] } ,
|
||||
'pptpclient' => { function => \&setup_pptp_client, params => [ $kind, \@source, \@dest ] } ,
|
||||
'pptpserver' => { function => \&setup_pptp_server, params => [ $kind, \@source, \@dest ] } ,
|
||||
'openvpn' => { function => \&setup_one_openvpn, params => [ $kind, \@source, \@dest ] } ,
|
||||
'openvpnclient' => { function => \&setup_one_openvpn_client, params => [ $kind, \@source, \@dest ] } ,
|
||||
'openvpnserver' => { function => \&setup_one_openvpn_server, params => [ $kind, \@source, \@dest ] } ,
|
||||
'l2tp' => { function => \&setup_one_l2tp , params => [ $kind, \@source, \@dest ] } ,
|
||||
'generic' => { function => \&setup_one_generic , params => [ $kind, \@source, \@dest ] } ,
|
||||
);
|
||||
fatal_error "Exclusion is not allowed in the GATEWAYS column" if $excl;
|
||||
|
||||
$kind = "\L$kind";
|
||||
for my $gateway ( split_list $gateways, 'GATEWAYS' ) {
|
||||
my @source = imatch_source_net $gateway;
|
||||
my @dest = imatch_dest_net $gateway;
|
||||
|
||||
(my $type) = split /:/, $kind;
|
||||
my %tunneltypes = ( 'ipsec' => { function => \&setup_one_ipsec , params => [ $kind, \@source, \@dest , $gatewayzones ] } ,
|
||||
'ipsecnat' => { function => \&setup_one_ipsec , params => [ $kind, \@source, \@dest , $gatewayzones ] } ,
|
||||
'ipip' => { function => \&setup_one_other, params => [ \@source, \@dest , 4 ] } ,
|
||||
'gre' => { function => \&setup_one_other, params => [ \@source, \@dest , 47 ] } ,
|
||||
'6to4' => { function => \&setup_one_other, params => [ \@source, \@dest , 41 ] } ,
|
||||
'6in4' => { function => \&setup_one_other, params => [ \@source, \@dest , 41 ] } ,
|
||||
'pptpclient' => { function => \&setup_pptp_client, params => [ $kind, \@source, \@dest ] } ,
|
||||
'pptpserver' => { function => \&setup_pptp_server, params => [ $kind, \@source, \@dest ] } ,
|
||||
'openvpn' => { function => \&setup_one_openvpn, params => [ $kind, \@source, \@dest ] } ,
|
||||
'openvpnclient' => { function => \&setup_one_openvpn_client, params => [ $kind, \@source, \@dest ] } ,
|
||||
'openvpnserver' => { function => \&setup_one_openvpn_server, params => [ $kind, \@source, \@dest ] } ,
|
||||
'l2tp' => { function => \&setup_one_l2tp , params => [ $kind, \@source, \@dest ] } ,
|
||||
'generic' => { function => \&setup_one_generic , params => [ $kind, \@source, \@dest ] } ,
|
||||
);
|
||||
|
||||
my $tunnelref = $tunneltypes{ $type };
|
||||
$kind = "\L$kind";
|
||||
|
||||
fatal_error "Tunnels of type $type are not supported" unless $tunnelref;
|
||||
(my $type) = split /:/, $kind;
|
||||
|
||||
$tunnelref->{function}->( $inchainref, $outchainref, @{$tunnelref->{params}} );
|
||||
my $tunnelref = $tunneltypes{ $type };
|
||||
|
||||
fatal_error "Tunnels of type $type are not supported" unless $tunnelref;
|
||||
|
||||
$tunnelref->{function}->( $inchainref, $outchainref, @{$tunnelref->{params}} );
|
||||
}
|
||||
|
||||
progress_message " Tunnel \"$currentline\" $done";
|
||||
}
|
||||
@@ -283,16 +289,16 @@ sub setup_tunnels() {
|
||||
|
||||
first_entry "$doing $fn...";
|
||||
|
||||
while ( read_a_line ) {
|
||||
while ( read_a_line( NORMAL_READ ) ) {
|
||||
|
||||
my ( $kind, $zone, $gateway, $gatewayzones ) = split_line1 'tunnels file', { type => 0, zone => 1, gateway => 2, gateway_zone => 3 };
|
||||
my ( $kind, $zone, $gateway, $gatewayzones ) = split_line1 'tunnels file', { type => 0, zone => 1, gateway => 2, gateways => 2, gateway_zone => 3 , gateway_zones => 3 }, undef, 4;
|
||||
|
||||
fatal_error 'TYPE must be specified' if $kind eq '-';
|
||||
fatal_error 'ZONE must be specified' if $zone eq '-';
|
||||
|
||||
if ( $kind eq 'COMMENT' ) {
|
||||
process_comment;
|
||||
} else {
|
||||
fatal_error 'ZONE must be specified' if $zone eq '-';
|
||||
setup_one_tunnel $kind, $zone, $gateway, $gatewayzones;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,8 @@
|
||||
# --log_verbosity=<number> # Log Verbosity range -1 to 2
|
||||
# --family=<number> # IP family; 4 = IPv4 (default), 6 = IPv6
|
||||
# --preview # Preview the ruleset.
|
||||
# --shorewallrc=<path> # Path to global shorewallrc file.
|
||||
# --shorewallrc1=<path> # Path to export shorewallrc file.
|
||||
# --config_path=<path-list> # Search path for config files
|
||||
#
|
||||
use strict;
|
||||
@@ -65,6 +67,8 @@ sub usage( $ ) {
|
||||
[ --annotate ]
|
||||
[ --update ]
|
||||
[ --convert ]
|
||||
[ --shorewallrc=<pathname> ]
|
||||
[ --shorewallrc1=<pathname> ]
|
||||
[ --config_path=<path-list> ]
|
||||
';
|
||||
|
||||
@@ -91,6 +95,8 @@ my $annotate = 0;
|
||||
my $update = 0;
|
||||
my $convert = 0;
|
||||
my $config_path = '';
|
||||
my $shorewallrc = '';
|
||||
my $shorewallrc1 = '';
|
||||
|
||||
Getopt::Long::Configure ('bundling');
|
||||
|
||||
@@ -122,6 +128,8 @@ my $result = GetOptions('h' => \$help,
|
||||
'update' => \$update,
|
||||
'convert' => \$convert,
|
||||
'config_path=s' => \$config_path,
|
||||
'shorewallrc=s' => \$shorewallrc,
|
||||
'shorewallrc1=s' => \$shorewallrc1,
|
||||
);
|
||||
|
||||
usage(1) unless $result && @ARGV < 2;
|
||||
@@ -144,4 +152,6 @@ compiler( script => $ARGV[0] || '',
|
||||
convert => $convert,
|
||||
annotate => $annotate,
|
||||
config_path => $config_path,
|
||||
shorewallrc => $shorewallrc,
|
||||
shorewallrc1 => $shorewallrc1,
|
||||
);
|
||||
|
@@ -25,15 +25,25 @@
|
||||
#
|
||||
# $1 = Path name of params file
|
||||
# $2 = $CONFIG_PATH
|
||||
# $3 = Address family (4 o4 6)
|
||||
# $3 = Address family (4 or 6)
|
||||
#
|
||||
if [ "$3" = 6 ]; then
|
||||
g_program=shorewall6
|
||||
PRODUCT=shorewall6
|
||||
else
|
||||
g_program=shorewall
|
||||
PRODUCT=shorewall
|
||||
fi
|
||||
|
||||
. /usr/share/shorewall/lib.cli
|
||||
#
|
||||
# This is modified by the installer when ${SHAREDIR} != /usr/share
|
||||
#
|
||||
. /usr/share/shorewall/shorewallrc
|
||||
|
||||
g_program=$PRODUCT
|
||||
g_sharedir="$SHAREDIR/shorewall"
|
||||
g_confdir="$CONFDIR/$PRODUCT"
|
||||
g_readrc=1
|
||||
|
||||
. $g_sharedir/lib.cli
|
||||
|
||||
CONFIG_PATH="$2"
|
||||
|
||||
|
1327
Shorewall/Perl/lib.core
Normal file
1327
Shorewall/Perl/lib.core
Normal file
File diff suppressed because it is too large
Load Diff
@@ -33,25 +33,25 @@ usage() {
|
||||
}
|
||||
|
||||
checkkernelversion() {
|
||||
?if __IPV6
|
||||
local kernel
|
||||
|
||||
if [ $g_family -eq 6 ]; then
|
||||
kernel=$(uname -r 2> /dev/null | sed -e 's/-.*//')
|
||||
kernel=$(uname -r 2> /dev/null | sed -e 's/-.*//')
|
||||
|
||||
case "$kernel" in
|
||||
*.*.*)
|
||||
kernel=$(printf "%d%02d%02d" $(echo $kernel | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g'))
|
||||
;;
|
||||
*)
|
||||
kernel=$(printf "%d%02d00" $(echo $kernel | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2/g'))
|
||||
;;
|
||||
esac
|
||||
case "$kernel" in
|
||||
*.*.*)
|
||||
kernel=$(printf "%d%02d%02d" $(echo $kernel | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2 \3/g'))
|
||||
;;
|
||||
*)
|
||||
kernel=$(printf "%d%02d00" $(echo $kernel | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1 \2/g'))
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $kernel -lt 20624 ]; then
|
||||
error_message "ERROR: $g_product requires Linux kernel 2.6.24 or later"
|
||||
return 1
|
||||
fi
|
||||
if [ $kernel -lt 20624 ]; then
|
||||
error_message "ERROR: $g_product requires Linux kernel 2.6.24 or later"
|
||||
return 1
|
||||
fi
|
||||
?endif
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -62,12 +62,14 @@ checkkernelversion() {
|
||||
#
|
||||
# Start trace if first arg is "debug" or "trace"
|
||||
#
|
||||
g_debug_iptables=
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
if [ "x$1" = "xtrace" ]; then
|
||||
set -x
|
||||
shift
|
||||
elif [ "x$1" = "xdebug" ]; then
|
||||
DEBUG=Yes
|
||||
g_debug_iptables=Yes
|
||||
shift
|
||||
fi
|
||||
fi
|
||||
@@ -233,8 +235,8 @@ case "$COMMAND" in
|
||||
status=2
|
||||
elif checkkernelversion; then
|
||||
if [ $# -eq 1 ]; then
|
||||
$IP6TABLES -Z
|
||||
$IP6TABLES -t mangle -Z
|
||||
$g_tool -Z
|
||||
$g_tool -t mangle -Z
|
||||
date > ${VARDIR}/restarted
|
||||
status=0
|
||||
progress_message3 "$g_product Counters Reset"
|
||||
@@ -243,7 +245,7 @@ case "$COMMAND" in
|
||||
status=0
|
||||
for chain in $@; do
|
||||
if chain_exists $chain; then
|
||||
if qt $IP6TABLES -Z $chain; then
|
||||
if qt $g_tool-Z $chain; then
|
||||
progress_message3 "Filter $chain Counters Reset"
|
||||
else
|
||||
error_message "ERROR: Reset of chain $chain failed"
|
||||
@@ -346,7 +348,9 @@ case "$COMMAND" in
|
||||
[ $# -eq 1 ] && exit 0
|
||||
shift
|
||||
[ $# -ne 1 ] && usage 2
|
||||
updown $1
|
||||
mutex_on
|
||||
( updown $1 )
|
||||
mutex_off
|
||||
status=0
|
||||
;;
|
||||
enable)
|
||||
|
@@ -1,402 +0,0 @@
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 1999-2011 - Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Options are:
|
||||
#
|
||||
# -n Don't alter Routing
|
||||
# -v and -q Standard Shorewall Verbosity control
|
||||
# -t Timestamp progress messages
|
||||
# -p Purge conntrack table
|
||||
# -r Recover from failed start/restart
|
||||
# -V <verbosity> Set verbosity level explicitly
|
||||
# -R <restore> Overrides RESTOREFILE setting
|
||||
#
|
||||
# Commands are:
|
||||
#
|
||||
# start Starts the firewall
|
||||
# refresh Refresh the firewall
|
||||
# restart Restarts the firewall
|
||||
# reload Reload the firewall
|
||||
# clear Removes all firewall rules
|
||||
# stop Stops the firewall
|
||||
# status Displays firewall status
|
||||
# version Displays the version of Shorewall that
|
||||
# generated this program
|
||||
#
|
||||
################################################################################
|
||||
# Functions imported from /usr/share/shorewall/prog.header
|
||||
################################################################################
|
||||
#
|
||||
# Find the value 'weight' in the passed arguments then echo the next value
|
||||
#
|
||||
|
||||
find_weight() {
|
||||
while [ $# -gt 1 ]; do
|
||||
[ "x$1" = xweight ] && echo $2 && return
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Find the interfaces that have a route to the passed address - the default
|
||||
# route is not used.
|
||||
#
|
||||
|
||||
find_rt_interface() {
|
||||
$IP -4 route list | while read addr rest; do
|
||||
case $addr in
|
||||
*/*)
|
||||
in_network ${1%/*} $addr && echo $(find_device $rest)
|
||||
;;
|
||||
default)
|
||||
;;
|
||||
*)
|
||||
if [ "$addr" = "$1" -o "$addr/32" = "$1" ]; then
|
||||
echo $(find_device $rest)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Echo the name of the interface(s) that will be used to send to the
|
||||
# passed address
|
||||
#
|
||||
|
||||
find_interface_by_address() {
|
||||
local dev
|
||||
dev="$(find_rt_interface $1)"
|
||||
local first
|
||||
local rest
|
||||
|
||||
[ -z "$dev" ] && dev=$(find_default_interface)
|
||||
|
||||
[ -n "$dev" ] && echo $dev
|
||||
}
|
||||
|
||||
#
|
||||
# echo the list of networks routed out of a given interface
|
||||
#
|
||||
get_routed_networks() # $1 = interface name, $2-n = Fatal error message
|
||||
{
|
||||
local address
|
||||
local rest
|
||||
|
||||
$IP -4 route show dev $1 2> /dev/null |
|
||||
while read address rest; do
|
||||
case "$address" in
|
||||
default)
|
||||
if [ $# -gt 1 ]; then
|
||||
shift
|
||||
fatal_error "$@"
|
||||
else
|
||||
echo "WARNING: default route ignored on interface $1" >&2
|
||||
fi
|
||||
;;
|
||||
multicast|broadcast|prohibit|nat|throw|nexthop)
|
||||
;;
|
||||
*)
|
||||
[ "$address" = "${address%/*}" ] && address="${address}/32"
|
||||
echo $address
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Get the broadcast addresses associated with an interface
|
||||
#
|
||||
get_interface_bcasts() # $1 = interface
|
||||
{
|
||||
local addresses
|
||||
addresses=
|
||||
|
||||
$IP -f inet addr show dev $1 2> /dev/null | grep 'inet.*brd' | sed 's/inet.*brd //; s/scope.*//;' | sort -u
|
||||
}
|
||||
|
||||
#
|
||||
# Delete IP address
|
||||
#
|
||||
del_ip_addr() # $1 = address, $2 = interface
|
||||
{
|
||||
[ $(find_first_interface_address_if_any $2) = $1 ] || qtnoin $IP addr del $1 dev $2
|
||||
}
|
||||
|
||||
# Add IP Aliases
|
||||
#
|
||||
add_ip_aliases() # $* = List of addresses
|
||||
{
|
||||
local local
|
||||
local addresses
|
||||
local external
|
||||
local interface
|
||||
local inet
|
||||
local cidr
|
||||
local rest
|
||||
local val
|
||||
local arping
|
||||
arping=$(mywhich arping)
|
||||
|
||||
address_details()
|
||||
{
|
||||
#
|
||||
# Folks feel uneasy if they don't see all of the same
|
||||
# decoration on these IP addresses that they see when their
|
||||
# distro's net config tool adds them. In an attempt to reduce
|
||||
# the anxiety level, we have the following code which sets
|
||||
# the VLSM and BRD from an existing address in the same networks
|
||||
#
|
||||
# Get all of the lines that contain inet addresses with broadcast
|
||||
#
|
||||
$IP -f inet addr show $interface 2> /dev/null | grep 'inet.*brd' | while read inet cidr rest ; do
|
||||
case $cidr in
|
||||
*/*)
|
||||
if in_network $external $cidr; then
|
||||
echo "/${cidr#*/} brd $(broadcastaddress $cidr)"
|
||||
break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
do_one()
|
||||
{
|
||||
val=$(address_details)
|
||||
|
||||
$IP addr add ${external}${val} dev $interface $label
|
||||
[ -n "$arping" ] && qt $arping -U -c 2 -I $interface $external
|
||||
echo "$external $interface" >> $VARDIR/nat
|
||||
[ -n "$label" ] && label="with $label"
|
||||
progress_message " IP Address $external added to interface $interface $label"
|
||||
}
|
||||
|
||||
progress_message "Adding IP Addresses..."
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
external=$1
|
||||
interface=$2
|
||||
label=
|
||||
|
||||
if [ "$interface" != "${interface%:*}" ]; then
|
||||
label="${interface#*:}"
|
||||
interface="${interface%:*}"
|
||||
label="label $interface:$label"
|
||||
fi
|
||||
|
||||
shift 2
|
||||
|
||||
list_search $external $(find_interface_addresses $interface) || do_one
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Detect the gateway through a PPP or DHCP-configured interface
|
||||
#
|
||||
detect_dynamic_gateway() { # $1 = interface
|
||||
local interface
|
||||
interface=$1
|
||||
local GATEWAYS
|
||||
GATEWAYS=
|
||||
local gateway
|
||||
|
||||
gateway=$(run_findgw_exit $1);
|
||||
|
||||
if [ -z "$gateway" ]; then
|
||||
gateway=$( find_peer $($IP addr list $interface ) )
|
||||
fi
|
||||
|
||||
if [ -z "$gateway" -a -f /var/lib/dhcpcd/dhcpcd-${1}.info ]; then
|
||||
eval $(grep ^GATEWAYS= /var/lib/dhcpcd/dhcpcd-${1}.info 2> /dev/null)
|
||||
[ -n "$GATEWAYS" ] && GATEWAYS=${GATEWAYS%,*} && gateway=$GATEWAYS
|
||||
fi
|
||||
|
||||
if [ -z "$gateway" -a -f /var/lib/dhcp/dhclient-${1}.lease ]; then
|
||||
gateway=$(grep 'option routers' /var/lib/dhcp/dhclient-${1}.lease | tail -n 1 | while read j1 j2 gateway; do echo $gateway ; return 0; done)
|
||||
fi
|
||||
|
||||
[ -n "$gateway" ] && echo $gateway
|
||||
}
|
||||
|
||||
#
|
||||
# Detect the gateway through an interface
|
||||
#
|
||||
detect_gateway() # $1 = interface
|
||||
{
|
||||
local interface
|
||||
interface=$1
|
||||
local gateway
|
||||
#
|
||||
# First assume that this is some sort of dynamic interface
|
||||
#
|
||||
gateway=$( detect_dynamic_gateway $interface )
|
||||
#
|
||||
# Maybe there's a default route through this gateway already
|
||||
#
|
||||
[ -n "$gateway" ] || gateway=$(find_gateway $($IP -4 route list dev $interface | grep ^default))
|
||||
#
|
||||
# Last hope -- is there a load-balancing route through the interface?
|
||||
#
|
||||
[ -n "$gateway" ] || gateway=$(find_nexthop $interface)
|
||||
#
|
||||
# Be sure we found one
|
||||
#
|
||||
[ -n "$gateway" ] && echo $gateway
|
||||
}
|
||||
|
||||
#
|
||||
# Disable IPV6
|
||||
#
|
||||
disable_ipv6() {
|
||||
local foo
|
||||
foo="$($IP -f inet6 addr list 2> /dev/null)"
|
||||
|
||||
if [ -n "$foo" ]; then
|
||||
if [ -x "$IP6TABLES" ]; then
|
||||
$IP6TABLES -P FORWARD DROP
|
||||
$IP6TABLES -P INPUT DROP
|
||||
$IP6TABLES -P OUTPUT DROP
|
||||
$IP6TABLES -F
|
||||
$IP6TABLES -X
|
||||
$IP6TABLES -A OUTPUT -o lo -j ACCEPT
|
||||
$IP6TABLES -A INPUT -i lo -j ACCEPT
|
||||
else
|
||||
error_message "WARNING: DISABLE_IPV6=Yes in shorewall.conf but this system does not appear to have ip6tables"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Add an additional gateway to the default route
|
||||
#
|
||||
add_gateway() # $1 = Delta $2 = Table Number
|
||||
{
|
||||
local route
|
||||
local weight
|
||||
local delta
|
||||
local dev
|
||||
|
||||
route=`$IP -4 -o route ls table $2 | grep ^default | sed 's/default //; s/[\]//g'`
|
||||
|
||||
if [ -z "$route" ]; then
|
||||
run_ip route add default scope global table $2 $1
|
||||
else
|
||||
delta=$1
|
||||
|
||||
if ! echo $route | fgrep -q ' nexthop '; then
|
||||
route=`echo $route | sed 's/via/nexthop via/'`
|
||||
dev=$(find_device $route)
|
||||
if [ -f ${VARDIR}/${dev}_weight ]; then
|
||||
weight=`cat ${VARDIR}/${dev}_weight`
|
||||
route="$route weight $weight"
|
||||
fi
|
||||
fi
|
||||
|
||||
run_ip route replace default scope global table $2 $route $delta
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Remove a gateway from the default route
|
||||
#
|
||||
delete_gateway() # $! = Description of the Gateway $2 = table number $3 = device
|
||||
{
|
||||
local route
|
||||
local gateway
|
||||
local dev
|
||||
|
||||
route=`$IP -4 -o route ls table $2 | grep ^default | sed 's/[\]//g'`
|
||||
gateway=$1
|
||||
|
||||
if [ -n "$route" ]; then
|
||||
if echo $route | fgrep -q ' nexthop '; then
|
||||
gateway="nexthop $gateway"
|
||||
eval route=\`echo $route \| sed \'s/$gateway/ /\'\`
|
||||
run_ip route replace table $2 $route
|
||||
else
|
||||
dev=$(find_device $route)
|
||||
[ "$dev" = "$3" ] && run_ip route delete default table $2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Determine the MAC address of the passed IP through the passed interface
|
||||
#
|
||||
find_mac() # $1 = IP address, $2 = interface
|
||||
{
|
||||
if interface_is_usable $2 ; then
|
||||
qt ping -nc 1 -t 2 -I $2 $1
|
||||
|
||||
local result
|
||||
result=$($IP neigh list | awk "/^$1 / {print \$5}")
|
||||
|
||||
case $result in
|
||||
\<*\>)
|
||||
;;
|
||||
*)
|
||||
[ -n "$result" ] && echo $result
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Clear Proxy Arp
|
||||
#
|
||||
delete_proxyarp() {
|
||||
if [ -f ${VARDIR}/proxyarp ]; then
|
||||
while read address interface external haveroute; do
|
||||
qtnoin $IP -4 neigh del proxy $address dev $external
|
||||
[ -z "${haveroute}${g_noroutes}" ] && qtnoin $IP -4 route del $address/32 dev $interface
|
||||
f=/proc/sys/net/ipv4/conf/$interface/proxy_arp
|
||||
[ -f $f ] && echo 0 > $f
|
||||
done < ${VARDIR}/proxyarp
|
||||
|
||||
rm -f ${VARDIR}/proxyarp
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Remove all Shorewall-added rules
|
||||
#
|
||||
clear_firewall() {
|
||||
stop_firewall
|
||||
|
||||
setpolicy INPUT ACCEPT
|
||||
setpolicy FORWARD ACCEPT
|
||||
setpolicy OUTPUT ACCEPT
|
||||
|
||||
run_iptables -F
|
||||
qt $IPTABLES -t raw -F
|
||||
|
||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||
|
||||
if [ -n "$DISABLE_IPV6" ]; then
|
||||
if [ -x $IP6TABLES ]; then
|
||||
$IP6TABLES -P INPUT ACCEPT 2> /dev/null
|
||||
$IP6TABLES -P OUTPUT ACCEPT 2> /dev/null
|
||||
$IP6TABLES -P FORWARD ACCEPT 2> /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
run_clear_exit
|
||||
|
||||
set_state "Cleared"
|
||||
|
||||
logger -p kern.info "$g_product Cleared"
|
||||
}
|
||||
|
||||
#
|
||||
# Get a list of all configured broadcast addresses on the system
|
||||
#
|
||||
get_all_bcasts()
|
||||
{
|
||||
$IP -f inet addr show 2> /dev/null | grep 'inet.*brd' | grep -v '/32 ' | sed 's/inet.*brd //; s/scope.*//;' | sort -u
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# End of functions in /usr/share/shorewall/prog.header
|
||||
################################################################################
|
@@ -1,311 +0,0 @@
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 1999-2011- Tom Eastep (teastep@shorewall.net)
|
||||
#
|
||||
# Options are:
|
||||
#
|
||||
# -n Don't alter Routing
|
||||
# -v and -q Standard Shorewall Verbosity control
|
||||
# -t Timestamp progress messages
|
||||
# -p Purge conntrack table
|
||||
# -r Recover from failed start/restart
|
||||
# -V <verbosity> Set verbosity level explicitly
|
||||
# -R <restore> Overrides RESTOREFILE setting
|
||||
#
|
||||
# Commands are:
|
||||
#
|
||||
# start Starts the firewall
|
||||
# refresh Refresh the firewall
|
||||
# restart Restarts the firewall
|
||||
# reload Reload the firewall
|
||||
# clear Removes all firewall rules
|
||||
# stop Stops the firewall
|
||||
# status Displays firewall status
|
||||
# version Displays the version of Shorewall that
|
||||
# generated this program
|
||||
#
|
||||
################################################################################
|
||||
# Functions imported from /usr/share/shorewall/prog.header6
|
||||
################################################################################
|
||||
#
|
||||
# Get all interface addresses with VLSMs
|
||||
#
|
||||
|
||||
find_interface_full_addresses() # $1 = interface
|
||||
{
|
||||
$IP -f inet6 addr show $1 2> /dev/null | grep 'inet6 ' | sed 's/\s*inet6 //;s/ scope.*//;s/ peer.*//'
|
||||
}
|
||||
|
||||
#
|
||||
# Normalize an IPv6 Address by compressing out consecutive zero elements
|
||||
#
|
||||
normalize_address() # $1 = valid IPv6 Address
|
||||
{
|
||||
local address
|
||||
address=$1
|
||||
local j
|
||||
|
||||
while true; do
|
||||
case $address in
|
||||
::*)
|
||||
address=0$address
|
||||
;;
|
||||
*::*)
|
||||
list_count $(split $address)
|
||||
|
||||
j=$?
|
||||
|
||||
if [ $j -eq 7 ]; then
|
||||
address=${address%::*}:0:${address#*::}
|
||||
elif [ $j -eq 8 ]; then
|
||||
$address=${address%::*}:${address#*::}
|
||||
break 2
|
||||
else
|
||||
address=${address%::*}:0::${address#*::}
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo $address
|
||||
break 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Reads correctly-formed and fully-qualified host and subnet addresses from STDIN. For each
|
||||
# that defines a /120 or larger network, it sends to STDOUT:
|
||||
#
|
||||
# The corresponding subnet-router anycast address (all host address bits are zero)
|
||||
# The corresponding anycast addresses defined by RFC 2526 (the last 128 addresses in the subnet)
|
||||
#
|
||||
convert_to_anycast() {
|
||||
local address
|
||||
local badress
|
||||
local vlsm
|
||||
local host
|
||||
local o
|
||||
local m
|
||||
m=
|
||||
local z
|
||||
z=65535
|
||||
local l
|
||||
|
||||
while read address; do
|
||||
case $address in
|
||||
2*|3*)
|
||||
vlsm=${address#*/}
|
||||
vlsm=${vlsm:=128}
|
||||
|
||||
if [ $vlsm -le 120 ]; then
|
||||
#
|
||||
# Defines a viable subnet -- first get the subnet-router anycast address
|
||||
#
|
||||
host=$((128 - $vlsm))
|
||||
|
||||
address=$(normalize_address ${address%/*})
|
||||
|
||||
while [ $host -ge 16 ]; do
|
||||
address=${address%:*}
|
||||
host=$(($host - 16))
|
||||
done
|
||||
|
||||
if [ $host -gt 0 ]; then
|
||||
#
|
||||
# VLSM is not a multiple of 16
|
||||
#
|
||||
host=$((16 - $host))
|
||||
o=$((0x${address##*:}))
|
||||
m=0
|
||||
while [ $host -gt 0 ]; do
|
||||
m=$((($m >> 1) | 0x8000))
|
||||
z=$(($z >> 1))
|
||||
host=$(($host - 1))
|
||||
done
|
||||
|
||||
o=$(($o & $m))
|
||||
|
||||
badress=${address%:*}
|
||||
|
||||
address=$badress:$(printf %04x $o)
|
||||
|
||||
z=$(($o | $z))
|
||||
|
||||
if [ $vlsm -gt 112 ]; then
|
||||
z=$(($z & 0xff80))
|
||||
fi
|
||||
|
||||
badress=$badress:$(printf %04x $z)
|
||||
else
|
||||
badress=$address
|
||||
fi
|
||||
#
|
||||
# Note: at this point $address and $badress are the same except possibly for
|
||||
# the contents of the last half-word
|
||||
#
|
||||
list_count $(split $address)
|
||||
|
||||
l=$?
|
||||
#
|
||||
# Now generate the anycast addresses defined by RFC 2526
|
||||
#
|
||||
if [ $l -lt 8 ]; then
|
||||
#
|
||||
# The subnet-router address
|
||||
#
|
||||
echo $address::
|
||||
|
||||
while [ $l -lt 8 ]; do
|
||||
badress=$badress:ffff
|
||||
l=$(($l + 1 ))
|
||||
done
|
||||
else
|
||||
#
|
||||
# The subnet-router address
|
||||
#
|
||||
echo $address
|
||||
fi
|
||||
#
|
||||
# And the RFC 2526 addresses
|
||||
#
|
||||
echo $badress/121
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Generate a list of anycast addresses for a given interface
|
||||
#
|
||||
|
||||
get_interface_acasts() # $1 = interface
|
||||
{
|
||||
local addresses
|
||||
addresses=
|
||||
|
||||
find_interface_full_addresses $1 | convert_to_anycast | sort -u
|
||||
}
|
||||
|
||||
#
|
||||
# Get a list of all configured anycast addresses on the system
|
||||
#
|
||||
get_all_acasts()
|
||||
{
|
||||
find_interface_full_addresses | convert_to_anycast | sort -u
|
||||
}
|
||||
|
||||
#
|
||||
# Detect the gateway through an interface
|
||||
#
|
||||
detect_gateway() # $1 = interface
|
||||
{
|
||||
local interface
|
||||
interface=$1
|
||||
#
|
||||
# First assume that this is some sort of point-to-point interface
|
||||
#
|
||||
gateway=$( find_peer $($IP -6 addr list $interface ) )
|
||||
#
|
||||
# Maybe there's a default route through this gateway already
|
||||
#
|
||||
[ -n "$gateway" ] || gateway=$(find_gateway $($IP -6 route list dev $interface | grep '^default'))
|
||||
#
|
||||
# Last hope -- is there a load-balancing route through the interface?
|
||||
#
|
||||
[ -n "$gateway" ] || gateway=$(find_nexthop $interface)
|
||||
#
|
||||
# Be sure we found one
|
||||
#
|
||||
[ -n "$gateway" ] && echo $gateway
|
||||
}
|
||||
|
||||
#
|
||||
# Add an additional gateway to the default route
|
||||
#
|
||||
add_gateway() # $1 = Delta $2 = Table Number
|
||||
{
|
||||
local route
|
||||
local weight
|
||||
local delta
|
||||
local dev
|
||||
|
||||
run_ip route add default scope global table $2 $1
|
||||
}
|
||||
|
||||
#
|
||||
# Remove a gateway from the default route
|
||||
#
|
||||
delete_gateway() # $! = Description of the Gateway $2 = table number $3 = device
|
||||
{
|
||||
local route
|
||||
local gateway
|
||||
local dev
|
||||
|
||||
route=`$IP -6 -o route ls table $2 | grep ^default | sed 's/[\]//g'`
|
||||
gateway=$1
|
||||
|
||||
dev=$(find_device $route)
|
||||
[ "$dev" = "$3" ] && run_ip route delete default table $2
|
||||
}
|
||||
|
||||
#
|
||||
# Determine how to do "echo -e"
|
||||
#
|
||||
|
||||
find_echo() {
|
||||
local result
|
||||
|
||||
result=$(echo "a\tb")
|
||||
[ ${#result} -eq 3 ] && { echo echo; return; }
|
||||
|
||||
result=$(echo -e "a\tb")
|
||||
[ ${#result} -eq 3 ] && { echo "echo -e"; return; }
|
||||
|
||||
result=$(which echo)
|
||||
[ -n "$result" ] && { echo "$result -e"; return; }
|
||||
|
||||
echo echo
|
||||
}
|
||||
|
||||
#
|
||||
# Clear Proxy NDP
|
||||
#
|
||||
delete_proxyndp() {
|
||||
if [ -f ${VARDIR}/proxyndp ]; then
|
||||
while read address interface external haveroute; do
|
||||
qt $IP -6 neigh del proxy $address dev $external
|
||||
[ -z "${haveroute}${g_noroutes}" ] && qt $IP -6 route del $address/128 dev $interface
|
||||
f=/proc/sys/net/ipv6/conf/$interface/proxy_ndp
|
||||
[ -f $f ] && echo 0 > $f
|
||||
done < ${VARDIR}/proxyndp
|
||||
|
||||
rm -f ${VARDIR}/proxyndp
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Remove all Shorewall-added rules
|
||||
#
|
||||
clear_firewall() {
|
||||
stop_firewall
|
||||
|
||||
setpolicy INPUT ACCEPT
|
||||
setpolicy FORWARD ACCEPT
|
||||
setpolicy OUTPUT ACCEPT
|
||||
|
||||
run_iptables -F
|
||||
qt $IP6TABLES -t raw -F
|
||||
|
||||
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
|
||||
|
||||
run_clear_exit
|
||||
|
||||
set_state "Cleared"
|
||||
|
||||
logger -p kern.info "$g_product Cleared"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# End of functions imported from /usr/share/shorewall/prog.header6
|
||||
################################################################################
|
@@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
@@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
@@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
@@ -158,7 +158,7 @@ Library.
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
@@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
@@ -267,7 +267,7 @@ Library will still fall under Section 6.)
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
@@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
@@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
@@ -422,7 +422,7 @@ conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
@@ -456,7 +456,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
|
@@ -7,6 +7,8 @@
|
||||
# http://www.shorewall.net/manpages/shorewall-interfaces.html
|
||||
#
|
||||
###############################################################################
|
||||
#ZONE INTERFACE BROADCAST OPTIONS
|
||||
- lo - ignore
|
||||
net all - dhcp,physical=+,routeback,optional
|
||||
FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
- lo ignore
|
||||
net all dhcp,physical=+,routeback,optional
|
||||
|
@@ -6,13 +6,13 @@
|
||||
# The manpage is also online at
|
||||
# http://www.shorewall.net/manpages/shorewall-rules.html
|
||||
#
|
||||
###################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
|
||||
#################################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||
# PORT PORT(S) DEST LIMIT GROUP
|
||||
#SECTION ALL
|
||||
#SECTION ESTABLISHED
|
||||
#SECTION RELATED
|
||||
SECTION NEW
|
||||
|
||||
Invalid(DROP) net $FW tcp
|
||||
SSH(ACCEPT) net $FW
|
||||
Ping(ACCEPT) net $FW
|
||||
|
@@ -41,6 +41,8 @@ MACLIST_LOG_LEVEL=info
|
||||
|
||||
RELATED_LOG_LEVEL=
|
||||
|
||||
RPFILTER_LOG_LEVEL=info
|
||||
|
||||
SFILTER_LOG_LEVEL=info
|
||||
|
||||
SMURF_LOG_LEVEL=info
|
||||
@@ -53,7 +55,9 @@ TCP_FLAGS_LOG_LEVEL=info
|
||||
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
||||
###############################################################################
|
||||
|
||||
CONFIG_PATH=/etc/shorewall:/usr/share/shorewall
|
||||
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
IPTABLES=
|
||||
|
||||
@@ -61,8 +65,12 @@ IP=
|
||||
|
||||
IPSET=
|
||||
|
||||
LOCKFILE=
|
||||
|
||||
MODULESDIR=
|
||||
|
||||
NFACCT=
|
||||
|
||||
PERL=/usr/bin/perl
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
@@ -106,7 +114,9 @@ ADD_SNAT_ALIASES=No
|
||||
|
||||
ADMINISABSENTMINDED=Yes
|
||||
|
||||
AUTO_COMMENT=Yes
|
||||
AUTOCOMMENT=Yes
|
||||
|
||||
AUTOHELPERS=Yes
|
||||
|
||||
AUTOMAKE=No
|
||||
|
||||
@@ -136,8 +146,12 @@ FASTACCEPT=Yes
|
||||
|
||||
FORWARD_CLEAR_MARK=
|
||||
|
||||
HELPERS=
|
||||
|
||||
IMPLICIT_CONTINUE=No
|
||||
|
||||
IPSET_WARNINGS=Yes
|
||||
|
||||
IP_FORWARDING=On
|
||||
|
||||
KEEP_RT_TABLES=No
|
||||
@@ -164,7 +178,7 @@ MUTEX_TIMEOUT=60
|
||||
|
||||
NULL_ROUTE_RFC1918=No
|
||||
|
||||
OPTIMIZE=15
|
||||
OPTIMIZE=31
|
||||
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
|
||||
@@ -172,6 +186,8 @@ REQUIRE_INTERFACE=Yes
|
||||
|
||||
RESTORE_DEFAULT_ROUTE=Yes
|
||||
|
||||
RESTORE_ROUTEMARKS=Yes
|
||||
|
||||
RETAIN_ALIASES=No
|
||||
|
||||
ROUTE_FILTER=No
|
||||
@@ -202,6 +218,8 @@ MACLIST_DISPOSITION=REJECT
|
||||
|
||||
RELATED_DISPOSITION=ACCEPT
|
||||
|
||||
RPFILTER_DISPOSITION=DROP
|
||||
|
||||
SMURF_DISPOSITION=DROP
|
||||
|
||||
SFILTER_DISPOSITION=DROP
|
||||
|
@@ -11,5 +11,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-interfaces"
|
||||
###############################################################################
|
||||
#ZONE INTERFACE BROADCAST OPTIONS
|
||||
net eth0 detect dhcp,tcpflags,logmartians,nosmurfs
|
||||
FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 dhcp,tcpflags,logmartians,nosmurfs,sourceroute=0
|
||||
|
@@ -10,14 +10,18 @@
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------------------------------------
|
||||
# For information on entries in this file, type "man shorewall-rules"
|
||||
######################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
|
||||
#################################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||
# PORT PORT(S) DEST LIMIT GROUP
|
||||
#SECTION ALL
|
||||
#SECTION ESTABLISHED
|
||||
#SECTION RELATED
|
||||
SECTION NEW
|
||||
|
||||
# Drop packets in the INVALID state
|
||||
|
||||
Invalid(DROP) net $FW tcp
|
||||
|
||||
# Drop Ping from the "bad" net zone.. and prevent your log from being flooded..
|
||||
|
||||
Ping(DROP) net $FW
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#
|
||||
# For information about the settings in this file, type "man shorewall.conf"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# The manpage is also online at
|
||||
# http://shorewall.net/manpages/shorewall.conf.html
|
||||
#
|
||||
###############################################################################
|
||||
@@ -52,6 +52,8 @@ MACLIST_LOG_LEVEL=info
|
||||
|
||||
RELATED_LOG_LEVEL=
|
||||
|
||||
RPFILTER_LOG_LEVEL=info
|
||||
|
||||
SFILTER_LOG_LEVEL=info
|
||||
|
||||
SMURF_LOG_LEVEL=info
|
||||
@@ -64,7 +66,9 @@ TCP_FLAGS_LOG_LEVEL=info
|
||||
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
||||
###############################################################################
|
||||
|
||||
CONFIG_PATH=/etc/shorewall:/usr/share/shorewall
|
||||
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
IPTABLES=
|
||||
|
||||
@@ -72,8 +76,12 @@ IP=
|
||||
|
||||
IPSET=
|
||||
|
||||
LOCKFILE=
|
||||
|
||||
MODULESDIR=
|
||||
|
||||
NFACCT=
|
||||
|
||||
PERL=/usr/bin/perl
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
@@ -117,7 +125,9 @@ ADD_SNAT_ALIASES=No
|
||||
|
||||
ADMINISABSENTMINDED=Yes
|
||||
|
||||
AUTO_COMMENT=Yes
|
||||
AUTOCOMMENT=Yes
|
||||
|
||||
AUTOHELPERS=Yes
|
||||
|
||||
AUTOMAKE=No
|
||||
|
||||
@@ -147,8 +157,12 @@ FASTACCEPT=No
|
||||
|
||||
FORWARD_CLEAR_MARK=
|
||||
|
||||
HELPERS=
|
||||
|
||||
IMPLICIT_CONTINUE=No
|
||||
|
||||
IPSET_WARNINGS=Yes
|
||||
|
||||
IP_FORWARDING=Off
|
||||
|
||||
KEEP_RT_TABLES=No
|
||||
@@ -175,7 +189,7 @@ MUTEX_TIMEOUT=60
|
||||
|
||||
NULL_ROUTE_RFC1918=No
|
||||
|
||||
OPTIMIZE=1
|
||||
OPTIMIZE=31
|
||||
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
|
||||
@@ -183,6 +197,8 @@ REQUIRE_INTERFACE=No
|
||||
|
||||
RESTORE_DEFAULT_ROUTE=Yes
|
||||
|
||||
RESTORE_ROUTEMARKS=Yes
|
||||
|
||||
RETAIN_ALIASES=No
|
||||
|
||||
ROUTE_FILTER=No
|
||||
@@ -213,6 +229,8 @@ MACLIST_DISPOSITION=REJECT
|
||||
|
||||
RELATED_DISPOSITION=ACCEPT
|
||||
|
||||
RPFILTER_DISPOSITION=DROP
|
||||
|
||||
SMURF_DISPOSITION=DROP
|
||||
|
||||
SFILTER_DISPOSITION=DROP
|
||||
|
@@ -11,7 +11,9 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-interfaces"
|
||||
###############################################################################
|
||||
#ZONE INTERFACE BROADCAST OPTIONS
|
||||
net eth0 detect tcpflags,dhcp,nosmurfs,routefilter,logmartians
|
||||
loc eth1 detect tcpflags,nosmurfs,routefilter,logmartians
|
||||
dmz eth2 detect tcpflags,nosmurfs,routefilter,logmartians
|
||||
FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 tcpflags,dhcp,nosmurfs,routefilter,logmartians,sourceroute=0
|
||||
loc eth1 tcpflags,nosmurfs,routefilter,logmartians
|
||||
dmz eth2 tcpflags,nosmurfs,routefilter,logmartians
|
||||
|
@@ -10,8 +10,9 @@
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-masq"
|
||||
##############################################################################
|
||||
#INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK
|
||||
################################################################################################################
|
||||
#INTERFACE:DEST SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/ SWITCH ORIGINAL
|
||||
# GROUP DEST
|
||||
eth0 10.0.0.0/8,\
|
||||
169.254.0.0/16,\
|
||||
172.16.0.0/12,\
|
||||
|
@@ -10,8 +10,8 @@
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-rules"
|
||||
######################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
|
||||
#################################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||
# PORT PORT(S) DEST LIMIT GROUP
|
||||
#SECTION ALL
|
||||
#SECTION ESTABLISHED
|
||||
@@ -20,7 +20,7 @@ SECTION NEW
|
||||
|
||||
# Don't allow connection pickup from the net
|
||||
#
|
||||
Invalid(DROP) net all
|
||||
Invalid(DROP) net all tcp
|
||||
#
|
||||
# Accept DNS connections from the firewall to the Internet
|
||||
#
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#
|
||||
# For information about the settings in this file, type "man shorewall.conf"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# The manpage is also online at
|
||||
# http://shorewall.net/manpages/shorewall.conf.html
|
||||
#
|
||||
###############################################################################
|
||||
@@ -50,6 +50,8 @@ MACLIST_LOG_LEVEL=info
|
||||
|
||||
RELATED_LOG_LEVEL=
|
||||
|
||||
RPFILTER_LOG_LEVEL=info
|
||||
|
||||
SFILTER_LOG_LEVEL=info
|
||||
|
||||
SMURF_LOG_LEVEL=info
|
||||
@@ -62,7 +64,9 @@ TCP_FLAGS_LOG_LEVEL=info
|
||||
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
||||
###############################################################################
|
||||
|
||||
CONFIG_PATH=/etc/shorewall:/usr/share/shorewall
|
||||
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
IPTABLES=
|
||||
|
||||
@@ -70,8 +74,12 @@ IP=
|
||||
|
||||
IPSET=
|
||||
|
||||
LOCKFILE=
|
||||
|
||||
MODULESDIR=
|
||||
|
||||
NFACCT=
|
||||
|
||||
PERL=/usr/bin/perl
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
@@ -115,7 +123,9 @@ ADD_SNAT_ALIASES=No
|
||||
|
||||
ADMINISABSENTMINDED=Yes
|
||||
|
||||
AUTO_COMMENT=Yes
|
||||
AUTOCOMMENT=Yes
|
||||
|
||||
AUTOHELPERS=Yes
|
||||
|
||||
AUTOMAKE=No
|
||||
|
||||
@@ -145,8 +155,12 @@ FASTACCEPT=No
|
||||
|
||||
FORWARD_CLEAR_MARK=
|
||||
|
||||
HELPERS=
|
||||
|
||||
IMPLICIT_CONTINUE=No
|
||||
|
||||
IPSET_WARNINGS=Yes
|
||||
|
||||
IP_FORWARDING=On
|
||||
|
||||
KEEP_RT_TABLES=No
|
||||
@@ -173,7 +187,7 @@ MUTEX_TIMEOUT=60
|
||||
|
||||
NULL_ROUTE_RFC1918=No
|
||||
|
||||
OPTIMIZE=1
|
||||
OPTIMIZE=31
|
||||
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
|
||||
@@ -181,6 +195,8 @@ REQUIRE_INTERFACE=No
|
||||
|
||||
RESTORE_DEFAULT_ROUTE=Yes
|
||||
|
||||
RESTORE_ROUTEMARKS=Yes
|
||||
|
||||
RETAIN_ALIASES=No
|
||||
|
||||
ROUTE_FILTER=No
|
||||
@@ -211,6 +227,8 @@ MACLIST_DISPOSITION=REJECT
|
||||
|
||||
RELATED_DISPOSITION=ACCEPT
|
||||
|
||||
RPFILTER_DISPOSITION=DROP
|
||||
|
||||
SMURF_DISPOSITION=DROP
|
||||
|
||||
SFILTER_DISPOSITION=DROP
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Shorewall6 version 4.0 - Sample Routestopped File for two-interface configuration.
|
||||
# Copyright (C) 2006,2008 by the Shorewall Team
|
||||
# Shorewall version 4.5 - Sample Stoppedrules File for three-interface configuration.
|
||||
# Copyright (C) 2012 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -9,11 +9,12 @@
|
||||
#
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall6-routestopped"
|
||||
#
|
||||
# See http://shorewall.net/starting_and_stopping_shorewall.htm for additional
|
||||
# information.
|
||||
#
|
||||
##############################################################################
|
||||
#INTERFACE HOST(S) OPTIONS
|
||||
eth1 -
|
||||
# For information about entries in this file, type "man shorewall-stoppedrules"
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||
# PORT(S) PORT(S)
|
||||
ACCEPT eth1 -
|
||||
ACCEPT - eth1
|
||||
ACCEPT eth2 -
|
||||
ACCEPT - eth2
|
||||
|
@@ -11,6 +11,8 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-interfaces"
|
||||
###############################################################################
|
||||
#ZONE INTERFACE BROADCAST OPTIONS
|
||||
net eth0 detect dhcp,tcpflags,nosmurfs,routefilter,logmartians
|
||||
loc eth1 detect tcpflags,nosmurfs,routefilter,logmartians
|
||||
FORMAT 2
|
||||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net eth0 dhcp,tcpflags,nosmurfs,routefilter,logmartians,sourceroute=0
|
||||
loc eth1 tcpflags,nosmurfs,routefilter,logmartians
|
||||
|
@@ -10,8 +10,9 @@
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-masq"
|
||||
###############################################################################
|
||||
#INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK
|
||||
################################################################################################################
|
||||
#INTERFACE:DEST SOURCE ADDRESS PROTO PORT(S) IPSEC MARK USER/ SWITCH ORIGINAL
|
||||
# GROUP DEST
|
||||
eth0 10.0.0.0/8,\
|
||||
169.254.0.0/16,\
|
||||
172.16.0.0/12,\
|
||||
|
@@ -10,8 +10,8 @@
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-rules"
|
||||
######################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH
|
||||
#################################################################################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER
|
||||
# PORT PORT(S) DEST LIMIT GROUP
|
||||
#SECTION ALL
|
||||
#SECTION ESTABLISHED
|
||||
@@ -20,7 +20,7 @@ SECTION NEW
|
||||
|
||||
# Don't allow connection pickup from the net
|
||||
#
|
||||
Invalid(DROP) net all
|
||||
Invalid(DROP) net all tcp
|
||||
#
|
||||
# Accept DNS connections from the firewall to the network
|
||||
#
|
||||
|
@@ -3,7 +3,7 @@
|
||||
# Shorewall version 4.0 - Sample shorewall.conf for two-interface
|
||||
# configuration.
|
||||
# Copyright (C) 2006,2007 by the Shorewall Team
|
||||
# 2011 by Thomas M. Eastep
|
||||
# 2011 by Thomas M. Eastep
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -14,7 +14,7 @@
|
||||
#
|
||||
# For information about the settings in this file, type "man shorewall.conf"
|
||||
#
|
||||
# The manpage is also online at
|
||||
# The manpage is also online at
|
||||
# http://shorewall.net/manpages/shorewall.conf.html
|
||||
#
|
||||
###############################################################################
|
||||
@@ -53,6 +53,8 @@ MACLIST_LOG_LEVEL=info
|
||||
|
||||
RELATED_LOG_LEVEL=
|
||||
|
||||
RPFILTER_LOG_LEVEL=info
|
||||
|
||||
SFILTER_LOG_LEVEL=info
|
||||
|
||||
SMURF_LOG_LEVEL=info
|
||||
@@ -65,7 +67,9 @@ TCP_FLAGS_LOG_LEVEL=info
|
||||
# L O C A T I O N O F F I L E S A N D D I R E C T O R I E S
|
||||
###############################################################################
|
||||
|
||||
CONFIG_PATH=/etc/shorewall:/usr/share/shorewall
|
||||
CONFIG_PATH=${CONFDIR}/shorewall:${SHAREDIR}/shorewall
|
||||
|
||||
GEOIPDIR=/usr/share/xt_geoip/LE
|
||||
|
||||
IPTABLES=
|
||||
|
||||
@@ -73,8 +77,12 @@ IP=
|
||||
|
||||
IPSET=
|
||||
|
||||
LOCKFILE=
|
||||
|
||||
MODULESDIR=
|
||||
|
||||
NFACCT=
|
||||
|
||||
PERL=/usr/bin/perl
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
||||
@@ -118,7 +126,9 @@ ADD_SNAT_ALIASES=No
|
||||
|
||||
ADMINISABSENTMINDED=Yes
|
||||
|
||||
AUTO_COMMENT=Yes
|
||||
AUTOCOMMENT=Yes
|
||||
|
||||
AUTOHELPERS=Yes
|
||||
|
||||
AUTOMAKE=No
|
||||
|
||||
@@ -148,8 +158,12 @@ FASTACCEPT=No
|
||||
|
||||
FORWARD_CLEAR_MARK=
|
||||
|
||||
HELPERS=
|
||||
|
||||
IMPLICIT_CONTINUE=No
|
||||
|
||||
IPSET_WARNINGS=Yes
|
||||
|
||||
IP_FORWARDING=On
|
||||
|
||||
KEEP_RT_TABLES=No
|
||||
@@ -176,7 +190,7 @@ MUTEX_TIMEOUT=60
|
||||
|
||||
NULL_ROUTE_RFC1918=No
|
||||
|
||||
OPTIMIZE=1
|
||||
OPTIMIZE=31
|
||||
|
||||
OPTIMIZE_ACCOUNTING=No
|
||||
|
||||
@@ -184,6 +198,8 @@ REQUIRE_INTERFACE=No
|
||||
|
||||
RESTORE_DEFAULT_ROUTE=Yes
|
||||
|
||||
RESTORE_ROUTEMARKS=Yes
|
||||
|
||||
RETAIN_ALIASES=No
|
||||
|
||||
ROUTE_FILTER=No
|
||||
@@ -214,6 +230,8 @@ MACLIST_DISPOSITION=REJECT
|
||||
|
||||
RELATED_DISPOSITION=ACCEPT
|
||||
|
||||
RPFILTER_DISPOSITION=DROP
|
||||
|
||||
SMURF_DISPOSITION=DROP
|
||||
|
||||
SFILTER_DISPOSITION=DROP
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Shorewall version 4.0 - Sample Routestopped File for two-interface configuration.
|
||||
# Copyright (C) 2006 by the Shorewall Team
|
||||
# Shorewall version 4.5 - Sample Stoppedrules File for two-interface configuration.
|
||||
# Copyright (C) 2012 by the Shorewall Team
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
@@ -9,7 +9,9 @@
|
||||
#
|
||||
# See the file README.txt for further details.
|
||||
#------------------------------------------------------------------------------
|
||||
# For information about entries in this file, type "man shorewall-routestopped"
|
||||
##############################################################################
|
||||
#INTERFACE HOST(S) OPTIONS
|
||||
eth1 -
|
||||
# For information about entries in this file, type "man shorewall-stoppedrules"
|
||||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||
# PORT(S) PORT(S)
|
||||
ACCEPT eth1 -
|
||||
ACCEPT - eth1
|
@@ -22,7 +22,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Broadcast[([<action>|-[,{audit|-}])]
|
||||
# Broadcast[([<action>|-[,{audit|-}])]
|
||||
#
|
||||
# Default action is DROP
|
||||
#
|
||||
@@ -31,7 +31,7 @@ FORMAT 2
|
||||
|
||||
DEFAULTS DROP,-
|
||||
|
||||
BEGIN PERL;
|
||||
?BEGIN PERL;
|
||||
|
||||
use Shorewall::IPAddrs;
|
||||
use Shorewall::Config;
|
||||
@@ -43,6 +43,7 @@ fatal_error "Invalid parameter ($audit) to action Broadcast" if supplied $audi
|
||||
fatal_error "Invalid parameter ($action) to action Broadcast" unless $action =~ /^(?:ACCEPT|DROP|REJECT)$/;
|
||||
|
||||
my $chainref = get_action_chain;
|
||||
|
||||
my ( $level, $tag ) = get_action_logging;
|
||||
my $target = require_audit ( $action , $audit );
|
||||
|
||||
@@ -51,7 +52,7 @@ if ( have_capability( 'ADDRTYPE' ) ) {
|
||||
log_rule_limit $level, $chainref, 'dropBcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type BROADCAST ';
|
||||
log_rule_limit $level, $chainref, 'dropBcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type MULTICAST ';
|
||||
log_rule_limit $level, $chainref, 'dropBcast' , $action, '', $tag, 'add', ' -m addrtype --dst-type ANYCAST ';
|
||||
}
|
||||
}
|
||||
|
||||
add_jump $chainref, $target, 0, '-m addrtype --dst-type BROADCAST ';
|
||||
add_jump $chainref, $target, 0, '-m addrtype --dst-type MULTICAST ';
|
||||
@@ -64,10 +65,10 @@ if ( have_capability( 'ADDRTYPE' ) ) {
|
||||
decr_cmd_level $chainref;
|
||||
add_commands $chainref, 'done';
|
||||
}
|
||||
|
||||
|
||||
log_rule_limit $level, $chainref, 'Broadcast' , $action, '', $tag, 'add', ' -d 224.0.0.0/4 ' if $level ne '';
|
||||
add_jump $chainref, $target, 0, '-d 224.0.0.0/4 ';
|
||||
|
||||
1;
|
||||
|
||||
END PERL;
|
||||
?END PERL;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user