Projet

Général

Profil

Révision 6f70cfc6

ID6f70cfc6f806cffdaf791d27861f050f627f86a3
Parent 6a79efee
Enfant 31db64fe

Ajouté par HaseHarald il y a environ 4 ans

[sshd_log] Allow for configuration of warning and critical levels

Allows for configuring either general or specific warning or critical
levels, or any combination of that.

This should be backwards compatible, since it doesn't change a thing to
the output, unless specific variables are specified.

Voir les différences:

plugins/ssh/sshd_log
26 26
 type - "GAUGE" or "DERIVE"
27 27
         default: GAUGE
28 28

  
29
 warning  - defines a general warning level
30
            default: UNSET (meaning not configured -> no warnings)
31

  
32
 critical - defines a general critical level
33
            default: UNSET (meaning not configured -> no criticals)
34

  
35
 logpass_warning  - defines a warning level for successful password logins
36
                    default: same value as "warning", so effectively UNSET (not
37
                    configured) if "warning" also is not configured
38

  
39
 logpass_critical - defines a critical level for successful password logins
40
                    default: same value as "critical", so effectively UNSET (not
41
                    configured) if "critical" also is not configured
42

  
43
 logpasspam_warning   - same as "logpass_warning" but for successful PAM logins
44

  
45
 logpasspam_critical  - same as "logpass_critical" but for successful PAM logins
46

  
47
 logkey_warning   - same as "logpass_warning" but for successful PublicKey
48
                    logins
49

  
50
 logkey_critical  - same as "logpass_critical" but for successful PublicKey
51
                    logins
52

  
53
 noid_warning   - same as "logpass_warning" but for attempts with no user
54
                  identification
55

  
56
 noid_critical  - same as "logpass_critical" but for attempts with no user
57
                  identification
58

  
59
 rootattempt_warning  - same as "logpass_warning" but for root login attempts
60

  
61
 rootattempt_critical - same as "logpass_critical" but for root login attempts
62

  
63
 invusr_warning   - same as "logpass_warning" but for invalid user login
64
                    attempts
65

  
66
 invusr_critical  - same as "logpass_critical" but for invalid user login
67
                    attempts
68

  
69
 nordns_warning - same as "logpass_warning" but for connections with reverse
70
                  DNS for peer
71

  
72
 nordns_critical  - same as "logpass_critical" but for connections with reverse
73
                    DNS for peer
74

  
75
 breakin_warning  - same as "logpass_warning" but for potential breakin
76
                    attempts
77

  
78
 breakin_critical - same as "logpass_critical" but for potential breakin
79
                    attempts
80

  
29 81
If the "logfile" environment variable is set to "journald" the sshd
30 82
logs are read from journald, filtering on program "sshd". The filtering
31 83
may be changed using "journalctlargs".
......
58 110
      env.logfile journald
59 111
      env.type DERIVE
60 112

  
113
Config example setting general warning and critical values and specific ones for
114
root login attempts:
115

  
116
  [sshd_log]
117
      env.warning 100
118
      env.critical 500
119
      env.rootattempt_warning 1
120
      env.rootattempt_critical 100
121

  
61 122
=head1 MAGIC MARKERS
62 123

  
63 124
  #%# family=auto
......
85 146
LOG=${logfile:-/var/log/secure}
86 147
JOURNALCTL_ARGS=${journalctlargs:-_COMM=sshd}
87 148
TYPE=${type:-GAUGE}
149

  
150
WARNING=${warning:-UNSET}
151
CRITICAL=${critical:-UNSET}
152
LOGPASS_WARNING=${logpass_warning:-$WARNING}
153
LOGPASS_CRITICAL=${logpass_critical:-$CRITICAL}
154
LOGPASSPAM_WARNING=${logpasspam_warning:-$WARNING}
155
LOGPASSPAM_CRITICAL=${logpasspam_critical:-$CRITICAL}
156
LOGKEY_WARNING=${logkey_warning:-$WARNING}
157
LOGKEY_CRITICAL=${logkey_critical:-$CRITICAL}
158
NOID_WARNING=${noid_warning:-$WARNING}
159
NOID_CRITICAL=${noid_critical:-$CRITICAL}
160
ROOTATTEMPT_WARNING=${rootattempt_warning:-$WARNING}
161
ROOTATTEMPT_CRITICAL=${rootattempt_critical:-$CRITICAL}
162
INVUSR_WARNING=${invusr_warning:-$WARNING}
163
INVUSR_CRITICAL=${invusr_critical:-$CRITICAL}
164
NORDNS_WARNING=${nordns_warning:-$WARNING}
165
NORDNS_CRITICAL=${nordns_critical:-$CRITICAL}
166
BREAKIN_WARNING=${breakin_warning:-$WARNING}
167
BREAKIN_CRITICAL=${breakin_critical:-$CRITICAL}
168

  
88 169
if [ "$LOG" = "journald" -a "$TYPE" = "DERIVE" ]; then
89 170
        TYPE=ABSOLUTE
90 171
fi
......
118 199
        echo 'LogPass.label Successful password logins'
119 200
        echo 'LogPass.min 0'
120 201
        echo 'LogPass.type' "$TYPE"
202
        if [ "$LOGPASS_WARNING" != "UNSET" ]; then
203
                echo 'LogPass.warning' "$LOGPASS_WARNING"
204
        fi
205
        if [ "$LOGPASS_CRITICAL" != "UNSET" ]; then
206
                echo 'LogPass.critical' "$LOGPASS_CRITICAL"
207
        fi
121 208

  
122 209
        echo 'LogPassPAM.label Successful login via PAM'
123 210
        echo 'LogPassPAM.min 0'
124 211
        echo 'LogPassPAM.type' "$TYPE"
212
        if [ "$LOGPASSPAM_WARNING" != "UNSET" ]; then
213
                echo 'LogPassPAM.warning' "$LOGPASSPAM_WARNING"
214
        fi
215
        if [ "$LOGPASSPAM_CRITICAL" != "UNSET" ]; then
216
                echo 'LogPassPAM.critical' "$LOGPASSPAM_CRITICAL"
217
        fi
125 218

  
126 219
        echo 'LogKey.label Successful PublicKey logins'
127 220
        echo 'LogKey.min 0'
128 221
        echo 'LogKey.type' "$TYPE"
222
        if [ "$LOGKEY_WARNING" != "UNSET" ]; then
223
                echo 'LogKey.warning' "$LOGKEY_WARNING"
224
        fi
225
        if [ "$LOGKEY_CRITICAL" != "UNSET" ]; then
226
                echo 'LogKey.critical' "$LOGKEY_CRITICAL"
227
        fi
129 228

  
130 229
        echo 'NoID.label No identification from user'
131 230
        echo 'NoID.min 0'
132 231
        echo 'NoID.type' "$TYPE"
232
        if [ "$NOID_WARNING" != "UNSET" ]; then
233
                echo 'NoID.warning' "$NOID_WARNING"
234
        fi
235
        if [ "$NOID_CRITICAL" != "UNSET" ]; then
236
                echo 'NoID.critical' "$NOID_CRITICAL"
237
        fi
133 238

  
134 239
        echo 'rootAttempt.label Root login attempts'
135 240
        echo 'rootAttempt.min 0'
136 241
        echo 'rootAttempt.type' "$TYPE"
242
        if [ "$ROOTATTEMPT_WARNING" != "UNSET" ]; then
243
                echo 'rootAttempt.warning' "$ROOTATTEMPT_WARNING"
244
        fi
245
        if [ "$ROOTATTEMPT_CRITICAL" != "UNSET" ]; then
246
                echo 'rootAttempt.critical' "$ROOTATTEMPT_CRITICAL"
247
        fi
137 248

  
138 249
        echo 'InvUsr.label Invalid user login attempts'
139 250
        echo 'InvUsr.min 0'
140 251
        echo 'InvUsr.type' "$TYPE"
252
        if [ "$INVUSR_WARNING" != "UNSET" ]; then
253
                echo 'InvUsr.warning' "$INVUSR_WARNING"
254
        fi
255
        if [ "$INVUSR_CRITICAL" != "UNSET" ]; then
256
                echo 'InvUsr.critical' "$INVUSR_CRITICAL"
257
        fi
141 258

  
142 259
        echo 'NoRDNS.label No reverse DNS for peer'
143 260
        echo 'NoRDNS.min 0'
144 261
        echo 'NoRDNS.type' "$TYPE"
262
        if [ "$NORDNS_WARNING" != "UNSET" ]; then
263
                echo 'NoRDNS.warning' "$NORDNS_WARNING"
264
        fi
265
        if [ "$NORDNS_CRITICAL" != "UNSET" ]; then
266
                echo 'NoRDNS.critical' "$NORDNS_CRITICAL"
267
        fi
145 268

  
146 269
        echo 'Breakin.label Potential Breakin Attempts'
147 270
        echo 'Breakin.min 0'
148 271
        echo 'Breakin.type' "$TYPE"
272
        if [ "$BREAKIN_WARNING" != "UNSET" ]; then
273
                echo 'Breakin.warning' "$BREAKIN_WARNING"
274
        fi
275
        if [ "$BREAKIN_CRITICAL" != "UNSET" ]; then
276
                echo 'Breakin.critical' "$BREAKIN_CRITICAL"
277
        fi
149 278

  
150 279
        exit 0
151 280
fi

Formats disponibles : Unified diff