Created
January 11, 2013 14:10
-
-
Save wuyongzheng/4510908 to your computer and use it in GitHub Desktop.
sshd password logging patch
make sure sshd_config is set as following:
PasswordAuthentication yes
UsePAM no
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
--- auth-passwd.orig 2013-01-11 15:42:09.000000000 +0800 | |
+++ auth-passwd.c 2013-01-11 15:43:47.000000000 +0800 | |
@@ -77,8 +77,8 @@ | |
* Tries to authenticate the user using password. Returns true if | |
* authentication succeeds. | |
*/ | |
-int | |
-auth_password(Authctxt *authctxt, const char *password) | |
+static int | |
+auth_password_orig(Authctxt *authctxt, const char *password) | |
{ | |
struct passwd * pw = authctxt->pw; | |
int result, ok = authctxt->valid; | |
@@ -128,6 +128,14 @@ | |
return (result && ok); | |
} | |
+int auth_password(Authctxt *authctxt, const char *password) | |
+{ | |
+ int ok = auth_password_orig(authctxt, password); | |
+ if (!ok) /* we don't want to log succeeded ones */ | |
+ logit("Bad Password: [%s] [%s]", authctxt->user, password); | |
+ return ok; | |
+} | |
+ | |
#ifdef BSD_AUTH | |
static void | |
warn_expiry(Authctxt *authctxt, auth_session_t *as) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment