-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4542c4b
commit b0872a5
Showing
6 changed files
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
FROM debian:unstable-slim | ||
FROM debian:stable-slim | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends iptables sshguard systemd \ | ||
&& apt-get install -y --no-install-recommends ipset iptables nftables sshguard systemd tini \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN echo > /etc/sshguard/sshguard.conf | ||
ADD start-sshguard.sh / | ||
|
||
ENTRYPOINT ["/start-sshguard.sh"] | ||
ENTRYPOINT ["tini", "--", "/start-sshguard.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[Unit] | ||
Description=sshguard | ||
After=network-online.target iptables-restore.service | ||
Requires=network-online.target | ||
|
||
[Service] | ||
TimeoutStartSec=0 | ||
ExecStartPre=-/usr/bin/podman rm --force %n | ||
|
||
ExecStart=/opt/bin/podman run --rm \ | ||
--name=%n \ | ||
--net=host \ | ||
--cap-add=CAP_NET_ADMIN,CAP_NET_RAW \ | ||
--mount volume=dev-log,target=/dev/log --volume dev-log,kind=host,source=/dev/log,readOnly=true \ | ||
--mount volume=journal,target=/var/log/journal --volume journal,kind=host,source=/var/log/journal,readOnly=true \ | ||
--mount volume=config,target=/var/db/sshguard --volume config,kind=host,source=/var/db/sshguard \ | ||
--mount volume=run-xtables,target=/run/xtables.lock --volume run-xtables,kind=host,source=/run/xtables.lock \ | ||
chillichef/coreos-sshguard:latest \ | ||
-a 120 -b /var/db/sshguard/blacklist.db | ||
|
||
ExecStop=/usr/bin/podman stop %n | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
#!/bin/sh | ||
|
||
journalctl -D /var/log/journal --no-pager -n0 -xfq -t sshd | /usr/sbin/sshguard "$@" | ||
set -eu | ||
|
||
BACKEND=${BACKEND:-/usr/lib/x86_64-linux-gnu/sshg-fw-ipset} | ||
LOGREADER=${LOGREADER:-LANG=C /bin/journalctl -afb -p info -n1 -D /var/log/journal -o cat SYSLOG_FACILITY=4 SYSLOG_FACILITY=10} | ||
THRESHOLD=${THRESHOLD:-30} | ||
BLOCK_TIME=${BLOCK_TIME:-120} | ||
DETECTION_TIME=${DETECTION_TIME:-1800} | ||
WHITELIST_FILE=${WHITELIST_FILE:-/etc/sshguard/whitelist} | ||
|
||
export BACKEND LOGREADER THRESEHOLD BLOCK_TIME DETECTION_TIME WHITELIST_TIME | ||
|
||
exec /usr/sbin/sshguard "$@" |