Trên GitHub, crazy-max/docker-fail2ban đã đạt 763 sao, nhóm Developer Tools, ngôn ngữ Dockerfile. Fail2ban Docker image
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Fail2ban Docker image to ban hosts that
cause multiple authentication errors.
[!TIP]
Want to be notified of new releases? Check out 🔔 Diun (Docker Image Update Notifier)
project!
Build locally
Image
Supported tags
Environment variables
Volumes
Usage
Docker Compose
Command line
Upgrade
Notes
DOCKER-USER chain
DOCKER-USER and INPUT chains
Jails examples
Use fail2ban-client
Global jail configuration
Custom jails, actions and filters
GeoIP2
Sending email using a sidecar container
systemd journal backend
Contributing
License
Build locally
git clone https://github.com/crazy-max/docker-fail2ban.git
cd docker-fail2ban
# Build Alpine image and output to docker (default)
docker buildx bake
# Build Alpine multi-platform image
docker buildx bake image-all
# Build Debian image and output to docker
docker buildx bake image-debian-local
# Build Debian multi-platform image
docker buildx bake image-debian-all
Image
Registry
Image
Docker Hub
crazymax/fail2ban
GitHub Container Registry
ghcr.io/crazy-max/fail2ban
Supported tags
latest, <version>, edge
debian, <version>-debian, edge-debian
<version> has to be replaced with one of the Fail2ban releases available
(e.g. 1.1.1). Tags without a debian suffix are Alpine-based.
Environment variables
TZ: The timezone assigned to the container (default UTC)
F2B_LOG_TARGET: Set the log target. This could be a file, SYSLOG, STDERR or STDOUT (default STDOUT)
F2B_LOG_LEVEL: Log level output (default INFO)
F2B_DB_PURGE_AGE: Age at which bans should be purged from the database (default 1d)
IPTABLES_MODE: Set iptables mode to auto, nft or legacy (default auto)
Volumes
/data: Contains customs jails, actions and filters and Fail2ban persistent database
Usage
Docker Compose
Docker compose is the recommended way to run this image. Copy the content of
folder examples/compose in /var/fail2ban/ on your host
for example. Edit the Compose and env files with your preferences and run the
following commands:
In Docker 17.06 and higher through docker/libnetwork#1675,
you can add rules to a new table called DOCKER-USER, and these rules will be
loaded before any rules Docker creates automatically. This is useful to make
iptables rules created by Fail2Ban persistent.
If you have an older version of Docker, you may just change the chain
definition for your jail to chain = FORWARD. This way, all Fail2Ban rules
come before any Docker rules but these rules will now apply to ALL forwarded
traffic.
More info : https://docs.docker.com/network/iptables/
DOCKER-USER and INPUT chains
If your Fail2Ban container is attached to DOCKER-USER chain instead of
INPUT, the rules will be applied only to containers. This means that any
packets coming into the INPUT chain will bypass these rules that now reside
under the FORWARD chain.
This is why the sshd jail contains a chain = INPUT
in its definition and traefik jail contains
chain = DOCKER-USER.
Jails examples
Here are some examples using the DOCKER-USER chain:
guacamole
traefik
And others using the INPUT chain:
proxmox
sshd
Use fail2ban-client
Fail2ban commands can be used
through the container. Here is an example if you want to ban an IP manually:
$ docker exec -t <CONTAINER> fail2ban-client set <JAIL> banip <IP>
Global jail configuration
You can provide customizations in /data/jail.d/*.local files.
Both image variants default to iptables-multiport / iptables-allports
ban actions and backend = auto for SSH and Postfix. You can override these
in your jail configuration. Journal monitoring requires the Debian variant
and mounted host journals, as shown in the systemd example.
For example, to change the default bantime for all jails:
[DEFAULT]
bantime = 1h
[!NOTE]
Loading order for jail configuration:
jail.conf
jail.d/*.conf (in alphabetical order)
jail.local
jail.d/*.local (in alphabetical order)
A sample configuration file is available on the official repository.
Custom jails, actions and filters
Custom jails, actions and filters can be added respectively in /data/jail.d,
/data/action.d and /data/filter.d. If you add an action/filter that already
exists, it will be overriden.
[!WARNING]
Container has to be restarted to propagate changes
GeoIP2
If you want to use MaxMind GeoIP2 databases with Fail2Ban, see the example in
examples/geoip. It runs the
geoip-updater image as a sidecar,
mounts the downloaded GeoLite2-Country.mmdb database in /data/geoip, and
uses a custom ignorecommand.
In this example, GEOIP_ALLOWED_COUNTRIES=FR,BE,CH means IPs from these
countries are ignored by Fail2Ban and will not be banned. IPs from other
countries follow the regular jail behavior. This is not proactive country
blocking, Fail2Ban still only reacts to matching log entries.
You need to set LICENSE_KEY in geoip-updater.env.
Sending email using a sidecar container
If you want to send emails using a sidecar container, see the example in
examples/smtp. It uses the smtp.py action
and msmtpd SMTP relay image.
systemd journal backend
If you want to use Fail2ban's backend = systemd, see the example in
examples/systemd. It uses the Debian image variant with
Python systemd bindings and mounts the host journal read-only.
Contributing
Want to contribute? Awesome! The most basic way to show your support is to star
the project, or to raise issues. You can also support this project by becoming a sponsor on GitHub
or by making a PayPal donation to ensure this
journey continues indefinitely!
Thanks again for your support, it is much appreciated! :pray:
crazy-max/docker-fail2ban có 763 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/crazy-max/docker-fail2ban. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
crazy-max/docker-fail2ban có phải mã nguồn mở không?
Có — crazy-max/docker-fail2ban phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/crazy-max/docker-fail2ban.
crazy-max/docker-fail2ban còn đang phát triển không?
Commit gần nhất trên crazy-max/docker-fail2ban là 25 ngày trước (theo timestamp GitHub). Repo có 87 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
crazy-max/docker-fail2ban dùng license gì?
crazy-max/docker-fail2ban phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
crazy-max/docker-fail2ban là gì?
crazy-max/docker-fail2ban (crazy-max/docker-fail2ban) là dự án Dockerfile trên GitHub. Theo mô tả gốc: Fail2ban Docker image
crazy-max/docker-fail2ban viết bằng ngôn ngữ gì?
crazy-max/docker-fail2ban chủ yếu viết bằng Dockerfile. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Cùng nhóm Developer Tools còn repo nào?
crazy-max/docker-fail2ban thuộc nhóm Developer Tools trên TopGit, cùng 6 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về crazy-max/docker-fail2ban ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/crazy-max/docker-fail2ban là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc docker-fail2ban có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về docker-fail2ban.