Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
71add551
Commit
71add551
authored
7 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
More obvious variable name
parent
aec19a48
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-utils-firewall
+6
-5
6 additions, 5 deletions
src/freedombone-utils-firewall
with
6 additions
and
5 deletions
src/freedombone-utils-firewall
+
6
−
5
View file @
71add551
...
...
@@ -33,6 +33,7 @@
FIREWALL_CONFIG
=
$HOME
/
${
PROJECT_NAME
}
-firewall
.cfg
FIREWALL_DOMAINS
=
$HOME
/
${
PROJECT_NAME
}
-firewall-domains
.cfg
FIREWALL_EIFACE
=
eth0
EXTERNAL_IPV4_ADDRESS
=
function
save_firewall_settings
{
iptables-save
>
/etc/firewall.conf
...
...
@@ -110,8 +111,8 @@ function enable_ipv6 {
}
function
firewall_deny_forwarding
{
read_config_param
CURRENT
_IPV4_ADDRESS
if
[
!
$
CURRENT
_IPV4_ADDRESS
]
;
then
read_config_param
EXTERNAL
_IPV4_ADDRESS
if
[
!
$
EXTERNAL
_IPV4_ADDRESS
]
;
then
return
fi
iptables
-D
INPUT
-i
${
FIREWALL_EIFACE
}
-m
state
--state
NEW
-p
udp
--dport
1194
-j
ACCEPT
...
...
@@ -119,13 +120,13 @@ function firewall_deny_forwarding {
iptables
-D
FORWARD
-i
tun+
-j
ACCEPT
iptables
-D
FORWARD
-i
tun+
-o
${
FIREWALL_EIFACE
}
-m
state
--state
RELATED,ESTABLISHED
-j
ACCEPT
iptables
-D
FORWARD
-i
${
FIREWALL_EIFACE
}
-o
tun+
-m
state
--state
RELATED,ESTABLISHED
-j
ACCEPT
iptables
-t
nat
-D
POSTROUTING
-s
${
CURRENT
_IPV4_ADDRESS
}
/24
-o
${
FIREWALL_EIFACE
}
-j
MASQUERADE
iptables
-t
nat
-D
POSTROUTING
-s
${
EXTERNAL
_IPV4_ADDRESS
}
/24
-o
${
FIREWALL_EIFACE
}
-j
MASQUERADE
iptables
-D
OUTPUT
-o
tun+
-j
ACCEPT
save_firewall_settings
}
function
firewall_allow_forwarding
{
curr_ipv4_address
=
$(
get_ipv4_address
)
curr_ipv4_address
=
$(
get_
external_
ipv4_address
)
iptables
-A
INPUT
-i
${
FIREWALL_EIFACE
}
-m
state
--state
NEW
-p
udp
--dport
1194
-j
ACCEPT
iptables
-A
INPUT
-i
tun+
-j
ACCEPT
iptables
-A
FORWARD
-i
tun+
-j
ACCEPT
...
...
@@ -133,7 +134,7 @@ function firewall_allow_forwarding {
iptables
-A
FORWARD
-i
${
FIREWALL_EIFACE
}
-o
tun+
-m
state
--state
RELATED,ESTABLISHED
-j
ACCEPT
iptables
-t
nat
-A
POSTROUTING
-s
${
curr_ipv4_address
}
/24
-o
${
FIREWALL_EIFACE
}
-j
MASQUERADE
iptables
-A
OUTPUT
-o
tun+
-j
ACCEPT
write_config_param
CURRENT
_IPV4_ADDRESS
"
$curr_ipv4_address
"
write_config_param
EXTERNAL
_IPV4_ADDRESS
"
$curr_
external_
ipv4_address
"
save_firewall_settings
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment