Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
awall
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
awall
Commits
26bf38cd
Commit
26bf38cd
authored
Mar 31, 2014
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include/exclude actions in dnat, snat, and no-track rules
parent
b2a61c87
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
17 deletions
+25
-17
model.lua
awall/model.lua
+10
-3
filter.lua
awall/modules/filter.lua
+2
-2
nat.lua
awall/modules/nat.lua
+11
-9
notrack.lua
awall/modules/notrack.lua
+2
-3
No files found.
awall/model.lua
View file @
26bf38cd
...
...
@@ -341,9 +341,16 @@ function Rule:table() return 'filter' end
function
Rule
:
position
()
return
'append'
end
function
Rule
:
target
()
if
not
self
.
action
then
self
:
error
(
'Action not defined'
)
end
if
self
.
action
==
'accept'
then
return
'ACCEPT'
end
self
:
error
(
'Invalid action: '
..
self
.
action
)
-- alpine v2.7 compatibility
if
self
.
action
==
'accept'
then
self
:
warning
(
"'accept' action deprecated in favor of 'exclude'"
)
self
.
action
=
'exclude'
end
if
self
.
action
==
'exclude'
then
return
'ACCEPT'
end
if
self
.
action
and
self
.
action
~=
'include'
then
self
:
error
(
'Invalid action: '
..
self
.
action
)
end
end
...
...
awall/modules/filter.lua
View file @
26bf38cd
...
...
@@ -176,10 +176,10 @@ end
function
Filter
:
actiontarget
()
if
self
.
action
==
'tarpit'
then
return
'tarpit'
end
if
util
.
contains
({
'drop'
,
'reject'
},
self
.
action
)
then
if
util
.
contains
({
'
accept'
,
'
drop'
,
'reject'
},
self
.
action
)
then
return
string.upper
(
self
.
action
)
end
return
model
.
Rule
.
target
(
self
)
self
:
error
(
'Invalid filter action: '
..
self
.
action
)
end
function
Filter
:
target
()
...
...
awall/modules/nat.lua
View file @
26bf38cd
--[[
NAT module for Alpine Wall
Copyright (C) 2012-201
3
Kaarle Ritvanen
Copyright (C) 2012-201
4
Kaarle Ritvanen
See LICENSE file for license details
]]
--
...
...
@@ -41,17 +41,19 @@ end
function
NATRule
:
table
()
return
'nat'
end
function
NATRule
:
target
()
if
self
.
action
then
return
model
.
Rule
.
target
(
self
)
end
local
target
=
model
.
Rule
.
target
(
self
)
local
addr
=
self
[
'to-addr'
]
local
target
if
addr
then
target
=
self
.
params
.
target
..
' --to-'
..
self
.
params
.
subject
..
' '
..
addr
else
target
=
self
.
params
.
deftarget
end
if
not
target
then
local
addr
=
self
[
'to-addr'
]
if
addr
then
target
=
self
.
params
.
target
..
' --to-'
..
self
.
params
.
subject
..
' '
..
addr
else
target
=
self
.
params
.
deftarget
end
if
self
[
'to-port'
]
then
target
=
target
..
(
addr
and
':'
or
' --to-ports '
)
..
self
[
'to-port'
]
if
self
[
'to-port'
]
then
target
=
target
..
(
addr
and
':'
or
' --to-ports '
)
..
self
[
'to-port'
]
end
end
return
target
end
...
...
awall/modules/notrack.lua
View file @
26bf38cd
--[[
Connection tracking bypass module for Alpine Wall
Copyright (C) 2012-201
3
Kaarle Ritvanen
Copyright (C) 2012-201
4
Kaarle Ritvanen
See LICENSE file for license details
]]
--
...
...
@@ -17,8 +17,7 @@ local NoTrackRule = model.class(model.Rule)
function
NoTrackRule
:
table
()
return
'raw'
end
function
NoTrackRule
:
target
()
if
self
.
action
then
return
model
.
Rule
.
target
(
self
)
end
return
'CT --notrack'
return
model
.
Rule
.
target
(
self
)
or
'CT --notrack'
end
...
...
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