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
bde41a1f
Commit
bde41a1f
authored
7 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Re-introduce rate limits on the firewall
parent
38072abc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-utils-firewall
+25
-0
25 additions, 0 deletions
src/freedombone-utils-firewall
src/freedombone-utils-setup
+3
-0
3 additions, 0 deletions
src/freedombone-utils-setup
with
28 additions
and
0 deletions
src/freedombone-utils-firewall
+
25
−
0
View file @
bde41a1f
...
...
@@ -482,4 +482,29 @@ function firewall_drop_spoofed_packets {
mark_completed
$FUNCNAME
}
function
firewall_rate_limits
{
if
[[
$(
is_completed
$FUNCNAME
)
==
"1"
]]
;
then
return
fi
# Limit connections per source IP
iptables
-A
INPUT
-p
tcp
-m
connlimit
--connlimit-above
111
-j
REJECT
--reject-with
tcp-reset
# Limit RST packets
iptables
-A
INPUT
-p
tcp
--tcp-flags
RST RST
-m
limit
--limit
2/s
--limit-burst
2
-j
ACCEPT
iptables
-A
INPUT
-p
tcp
--tcp-flags
RST RST
-j
DROP
# Limit new TCP connections per second per source IP
iptables
-A
INPUT
-p
tcp
-m
conntrack
--ctstate
NEW
-m
limit
--limit
60/s
--limit-burst
20
-j
ACCEPT
iptables
-A
INPUT
-p
tcp
-m
conntrack
--ctstate
NEW
-j
DROP
# SSH brute-force protection
iptables
-A
INPUT
-p
tcp
--dport
ssh
-m
conntrack
--ctstate
NEW
-m
recent
--set
iptables
-A
INPUT
-p
tcp
--dport
ssh
-m
conntrack
--ctstate
NEW
-m
recent
--update
--seconds
60
--hitcount
10
-j
DROP
function_check save_firewall_settings
save_firewall_settings
mark_completed
$FUNCNAME
}
# NOTE: deliberately no exit 0
This diff is collapsed.
Click to expand it.
src/freedombone-utils-setup
+
3
−
0
View file @
bde41a1f
...
...
@@ -567,6 +567,9 @@ function setup_firewall {
function_check firewall_drop_spoofed_packets
firewall_drop_spoofed_packets
function_check firewall_rate_limits
firewall_rate_limits
function_check configure_firewall_for_dns
configure_firewall_for_dns
...
...
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