Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
firewall
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
silver-platter
firewall
Commits
cd8d6959
Commit
cd8d6959
authored
4 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Support fail2ban integration via dedicated ipsets
parent
7c552da5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
conf-dist/filter.d/01fail2ban
+4
-9
4 additions, 9 deletions
conf-dist/filter.d/01fail2ban
update-ipset
+6
-0
6 additions, 0 deletions
update-ipset
with
10 additions
and
9 deletions
conf-dist/filter.d/01fail2ban
+
4
−
9
View file @
cd8d6959
# The following snippet saves the existing fail2ban rules and
# reproduces them identically in the output (IPv4-only).
iptables-save -t filter | (while read line ; do
case "${line}" in
":fail2ban-"*|"-A fail2ban-"*|*"-j fail2ban-"*)
add_rule4 "${line}"
;;
esac
done)
# Support integration with fail2ban via dedicated ipsets.
add_rule4 -A pre-input -m set --match-set f2b_ip src -j DROP
add_rule6 -A pre-input -m set --match-set f2b_ip6 src -j DROP
This diff is collapsed.
Click to expand it.
update-ipset
+
6
−
0
View file @
cd8d6959
...
...
@@ -32,9 +32,15 @@ gen_set() {
fi
}
gen_fail2ban
()
{
echo
"create f2b_ip hash:ip family inet timeout 0"
echo
"create f2b_ip6 hash:ip family inet6 timeout 0"
}
(
gen_set ipv4 ip
gen_set ipv6 ip
gen_set ipv4 net
gen_set ipv6 net
gen_fail2ban
)
| ipset restore
'-!'
-exist
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