Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cd9a353d
authored
Feb 13, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: fix white space 2
parent
4f31396d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
firewall/fw.py
+13
-13
No files found.
firewall/fw.py
View file @
cd9a353d
...
@@ -165,9 +165,9 @@ class firewall:
...
@@ -165,9 +165,9 @@ class firewall:
self
.
iptables
(
'-A PUB_OUT -j r_pub_dIP'
)
self
.
iptables
(
'-A PUB_OUT -j r_pub_dIP'
)
self
.
iptables
(
'-A FORWARD -m state --state INVALID -g LOG_DROP'
)
self
.
iptables
(
'-A FORWARD -m state --state INVALID -g LOG_DROP'
)
self
.
iptables
(
'-A FORWARD -m state --state ESTABLISHED,RELATED'
self
.
iptables
(
'-A FORWARD -m state --state ESTABLISHED,RELATED
'
'-j ACCEPT'
)
'-j ACCEPT'
)
self
.
iptables
(
'-A FORWARD -p icmp --icmp-type echo-request'
self
.
iptables
(
'-A FORWARD -p icmp --icmp-type echo-request
'
'-g LOG_ACC'
)
'-g LOG_ACC'
)
if
not
self
.
IPV6
:
if
not
self
.
IPV6
:
self
.
iptables
(
'-A FORWARD -j r_pub_sIP -o pub'
)
self
.
iptables
(
'-A FORWARD -j r_pub_sIP -o pub'
)
...
@@ -175,19 +175,19 @@ class firewall:
...
@@ -175,19 +175,19 @@ class firewall:
self
.
iptables
(
'-A INPUT -i lo -j ACCEPT'
)
self
.
iptables
(
'-A INPUT -i lo -j ACCEPT'
)
if
not
self
.
IPV6
:
if
not
self
.
IPV6
:
self
.
iptables
(
'-A INPUT -j r_pub_sIP'
)
self
.
iptables
(
'-A INPUT -j r_pub_sIP'
)
self
.
iptables
(
'-A INPUT -m state --state ESTABLISHED,RELATED'
self
.
iptables
(
'-A INPUT -m state --state ESTABLISHED,RELATED
'
'-j ACCEPT'
)
'-j ACCEPT'
)
self
.
iptables
(
'-A OUTPUT -m state --state INVALID -g LOG_DROP'
)
self
.
iptables
(
'-A OUTPUT -m state --state INVALID -g LOG_DROP'
)
self
.
iptables
(
'-A OUTPUT -o lo -j ACCEPT'
)
self
.
iptables
(
'-A OUTPUT -o lo -j ACCEPT'
)
self
.
iptables
(
'-A OUTPUT -m state --state ESTABLISHED,RELATED'
self
.
iptables
(
'-A OUTPUT -m state --state ESTABLISHED,RELATED
'
'-j ACCEPT'
)
'-j ACCEPT'
)
def
postrun
(
self
):
def
postrun
(
self
):
self
.
iptables
(
'-A PUB_OUT -s 152.66.243.160/27 -p tcp --dport 25'
self
.
iptables
(
'-A PUB_OUT -s 152.66.243.160/27 -p tcp --dport 25
'
'-j LOG_ACC'
)
'-j LOG_ACC'
)
self
.
iptables
(
'-A PUB_OUT -s 152.66.243.160/27 -p tcp --dport 445'
self
.
iptables
(
'-A PUB_OUT -s 152.66.243.160/27 -p tcp --dport 445
'
'-j LOG_ACC'
)
'-j LOG_ACC'
)
self
.
iptables
(
'-A PUB_OUT -p tcp --dport 25 -j LOG_DROP'
)
self
.
iptables
(
'-A PUB_OUT -p tcp --dport 25 -j LOG_DROP'
)
self
.
iptables
(
'-A PUB_OUT -p tcp --dport 445 -j LOG_DROP'
)
self
.
iptables
(
'-A PUB_OUT -p tcp --dport 445 -j LOG_DROP'
)
...
@@ -214,7 +214,7 @@ class firewall:
...
@@ -214,7 +214,7 @@ class firewall:
for
rule
in
host
.
rules
.
filter
(
nat
=
True
,
direction
=
'1'
):
for
rule
in
host
.
rules
.
filter
(
nat
=
True
,
direction
=
'1'
):
dport_sport
=
self
.
dportsport
(
rule
,
False
)
dport_sport
=
self
.
dportsport
(
rule
,
False
)
if
host
.
vlan
.
snat_ip
:
if
host
.
vlan
.
snat_ip
:
self
.
iptablesnat
(
'-A PREROUTING -d
%
s
%
s
%
s -j DNAT'
self
.
iptablesnat
(
'-A PREROUTING -d
%
s
%
s
%
s -j DNAT
'
'--to-destination
%
s:
%
s'
%
(
host
.
pub_ipv4
,
'--to-destination
%
s:
%
s'
%
(
host
.
pub_ipv4
,
dport_sport
,
rule
.
extra
,
host
.
ipv4
,
dport_sport
,
rule
.
extra
,
host
.
ipv4
,
rule
.
nat_dport
))
rule
.
nat_dport
))
...
@@ -222,26 +222,26 @@ class firewall:
...
@@ -222,26 +222,26 @@ class firewall:
# rules for machines with dedicated public IP
# rules for machines with dedicated public IP
for
host
in
self
.
hosts
.
exclude
(
shared_ip
=
True
):
for
host
in
self
.
hosts
.
exclude
(
shared_ip
=
True
):
if
host
.
pub_ipv4
:
if
host
.
pub_ipv4
:
self
.
iptablesnat
(
'-A PREROUTING -d
%
s -j DNAT'
self
.
iptablesnat
(
'-A PREROUTING -d
%
s -j DNAT
'
'--to-destination
%
s'
%
(
host
.
pub_ipv4
,
host
.
ipv4
))
'--to-destination
%
s'
%
(
host
.
pub_ipv4
,
host
.
ipv4
))
self
.
iptablesnat
(
'-A POSTROUTING -s
%
s -j SNAT'
self
.
iptablesnat
(
'-A POSTROUTING -s
%
s -j SNAT
'
'--to-source
%
s'
%
(
host
.
ipv4
,
host
.
pub_ipv4
))
'--to-source
%
s'
%
(
host
.
ipv4
,
host
.
pub_ipv4
))
# default NAT rules for VLANs
# default NAT rules for VLANs
for
s_vlan
in
self
.
vlans
:
for
s_vlan
in
self
.
vlans
:
if
s_vlan
.
snat_ip
:
if
s_vlan
.
snat_ip
:
for
d_vlan
in
s_vlan
.
snat_to
.
all
():
for
d_vlan
in
s_vlan
.
snat_to
.
all
():
self
.
iptablesnat
(
'-A POSTROUTING -s
%
s -o
%
s -j SNAT'
self
.
iptablesnat
(
'-A POSTROUTING -s
%
s -o
%
s -j SNAT
'
'--to-source
%
s'
%
(
s_vlan
.
net_ipv4
(),
'--to-source
%
s'
%
(
s_vlan
.
net_ipv4
(),
d_vlan
.
interface
,
s_vlan
.
snat_ip
))
d_vlan
.
interface
,
s_vlan
.
snat_ip
))
# hard-wired rules
# hard-wired rules
self
.
iptablesnat
(
'-A POSTROUTING -s 10.5.0.0/16 -o vlan0003 -j SNAT'
self
.
iptablesnat
(
'-A POSTROUTING -s 10.5.0.0/16 -o vlan0003 -j SNAT
'
'--to-source 10.3.255.254'
)
# man elerheto legyen
'--to-source 10.3.255.254'
)
# man elerheto legyen
self
.
iptablesnat
(
'-A POSTROUTING -s 10.5.0.0/16 -o vlan0008 -j SNAT'
self
.
iptablesnat
(
'-A POSTROUTING -s 10.5.0.0/16 -o vlan0008 -j SNAT
'
'--to-source 10.0.0.247'
)
# wolf network for printing
'--to-source 10.0.0.247'
)
# wolf network for printing
self
.
iptablesnat
(
'-A POSTROUTING -s 10.3.0.0/16 -o vlan0002 -j SNAT'
self
.
iptablesnat
(
'-A POSTROUTING -s 10.3.0.0/16 -o vlan0002 -j SNAT
'
'--to-source
%
s'
%
self
.
pub
.
ipv4
)
# kulonben nemmegy a du
'--to-source
%
s'
%
self
.
pub
.
ipv4
)
# kulonben nemmegy a du
self
.
iptablesnat
(
'COMMIT'
)
self
.
iptablesnat
(
'COMMIT'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment