File: sshguard.8

package info (click to toggle)
sshguard 2.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,468 kB
  • sloc: ansic: 3,871; sh: 2,471; lex: 345; yacc: 287; makefile: 95
file content (169 lines) | stat: -rw-r--r-- 5,751 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "SSHGUARD" "8" "January 1, 2025" "2.5.1" "SSHGuard Manual"
.SH NAME
sshguard \- block brute-force attacks by aggregating system logs
.\" Copyright (c) 2007,2008,2009,2010 Mij <mij@sshguard.net>
.
.\" Permission to use, copy, modify, and distribute this software for any
.
.\" purpose with or without fee is hereby granted, provided that the above
.
.\" copyright notice and this permission notice appear in all copies.
.
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.
.SH SYNOPSIS
.sp
\fBsshguard\fP [\fB\-hv\fP]
[\fB\-a\fP \fIthreshold\fP]
[\fB\-b\fP \fIthreshold\fP:\fIblacklist_file\fP]
[\fB\-i\fP \fIpidfile\fP]
[\fB\-p\fP \fIblocktime\fP]
[\fB\-s\fP \fIdetection_time\fP]
[\fB\-w\fP \fIaddress\fP | \fIwhitelist_file\fP]
[\fIfile\fP ...]
.SH DESCRIPTION
.sp
\fBsshguard\fP protects hosts from brute\-force attacks against SSH and other
services. It aggregates system logs and blocks repeat offenders using one of
several firewall backends.
.sp
\fBsshguard\fP can monitor log files and the standard output of running a shell
command. Log messages are parsed line\-by\-line for recognized attack patterns.
Attackers are blocked when enough attack patterns are detected in a
configurable time interval. Attackers are blocked temporarily but can also be
permanently blocked using the blacklist option.
.sp
\fBsshguard\fP must be configured before its first run. See
\fBsshguard\-setup(7)\fP\&.
.SH OPTIONS
.INDENT 0.0
.TP
.B \fB\-a\fP \fIthreshold\fP (default 30)
Each detected attack increases an attacker\(aqs attack score, usually by 10.
Block attackers when their attack score exceeds \fIthreshold\fP\&.
.TP
.B \fB\-b\fP \fIthreshold\fP:\fIblacklist_file\fP
Blacklist an attacker when its attack score exceeds \fIthreshold\fP\&.
Blacklisted addresses are written to \fIblacklist\-file\fP and never unblocked,
even after restarting \fBsshguard\fP\&.
.TP
.B \fB\-i\fP \fIpidfile\fP
Write the PID of \fBsshguard\fP to \fIpidfile\fP\&. \fIpidfile\fP is removed when
\fBsshguard\fP exits.
.TP
.B \fB\-p\fP \fIblocktime\fP (default 120)
Block first\-time attackers for \fIblocktime\fP seconds. Subsequent blocks
increase in duration by a factor of 2. Since \fBsshguard\fP unblocks
attackers at random intervals, actual block times may be somewhat longer.
.TP
.B \fB\-s\fP \fIdetection_time\fP (default 1800)
Reset an attacker\(aqs attack score after \fIdetection_time\fP seconds since the
last attack. This means that attackers who attack every \fIdetection_time\fP
seconds are never blocked by \fBsshguard\fP\&. However, an increased
\fIdetection_time\fP may have an impact on legitimate users.
.TP
.B [\fB\-w\fP \fIaddress\fP | \fIwhitelist_file\fP]
Whitelist a single address, hostname, or address block given as
\fIaddress\fP\&. This option can be given multiple times. Alternatively,
provide an absolute path to a \fIwhitelist_file\fP containing addresses to
whitelist. See WHITELISTING\&.
.TP
.B \fB\-h\fP
Print usage information and exit.
.TP
.B \fB\-v\fP
Print version information and exit.
.UNINDENT
.SH ENVIRONMENT
.INDENT 0.0
.TP
.B SSHGUARD_USER
When set, sandboxed processes drop permissions by changing to this user.
Normally set and overridden in \fIsshguard.conf\fP using the SSHGUARD_USER
variable.
.TP
.B SSHGUARD_DEBUG
Set to enable verbose output from \fBsshg\-blocker\fP\&.
.TP
.B SSHGUARD_STATS_DIR
When set, write Prometheus\-compatible statistics to .prom files in this
directory every minute. The STATS_DIR variable in \fIsshguard.conf\fP will set
and override this environment variable.
.UNINDENT
.SH FILES
.INDENT 0.0
.TP
.B %PREFIX%/etc/sshguard.conf
See sample configuration file.
.UNINDENT
.SH WHITELISTING
.sp
Whitelisted addresses are never blocked. Addresses can be specified on the
command line or be stored in a file.
.sp
On the command line, give the \fB\-w\fP option one or more times with an IP
address, CIDR address block, or hostname as an argument. Hostnames are
resolved once at startup. If a hostname resolves to multiple addresses, all
of them are whitelisted. For example:
.INDENT 0.0
.INDENT 3.5
.sp
.EX
sshguard \-w 192.168.1.10 \-w 192.168.0.0/24 \-w friend.example.com
    \-w 2001:0db8:85a3:0000:0000:8a2e:0370:7334
    \-w 2002:836b:4179::836b:0000/126
.EE
.UNINDENT
.UNINDENT
.sp
If the argument to \fB\-w\fP begins with a forward slash (\(aq/\(aq) or dot (\(aq.\(aq),
the argument is treated as the path to a whitelist file.
.sp
The whitelist file contains comments (lines beginning with \(aq#\(aq), addresses,
address blocks, or hostnames, one per line.
.SH SEE ALSO
.sp
sshguard\-setup(7)
.\" Generated by docutils manpage writer.
.