SshDaemon: Add a metric for authentication failures
Change-Id: I02b1f87a1b9e00ed59857f506c394705e005e739
This commit is contained in:
@@ -272,6 +272,12 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
|
|||||||
.setRate()
|
.setRate()
|
||||||
.setUnit("sessions"));
|
.setUnit("sessions"));
|
||||||
|
|
||||||
|
final Counter0 authFailures = metricMaker.newCounter(
|
||||||
|
"sshd/sessions/authentication-failed",
|
||||||
|
new Description("Rate of SSH authentication failures")
|
||||||
|
.setRate()
|
||||||
|
.setUnit("failures"));
|
||||||
|
|
||||||
setSessionFactory(new SessionFactory() {
|
setSessionFactory(new SessionFactory() {
|
||||||
@Override
|
@Override
|
||||||
protected AbstractSession createSession(final IoSession io)
|
protected AbstractSession createSession(final IoSession io)
|
||||||
@@ -300,6 +306,7 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
|
|||||||
public void operationComplete(CloseFuture future) {
|
public void operationComplete(CloseFuture future) {
|
||||||
connected.decrementAndGet();
|
connected.decrementAndGet();
|
||||||
if (sd.isAuthenticationError()) {
|
if (sd.isAuthenticationError()) {
|
||||||
|
authFailures.increment();
|
||||||
sshLog.onAuthFail(sd);
|
sshLog.onAuthFail(sd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user