mirror of
https://github.com/ChrisSewell/DECEIVE.git
synced 2025-07-01 18:47:28 -04:00
Log both successful and failed login attempts
This commit is contained in:
@ -89,15 +89,31 @@ class MySSHServer(asyncssh.SSHServer):
|
|||||||
logger.info("SSH connection closed.")
|
logger.info("SSH connection closed.")
|
||||||
|
|
||||||
def begin_auth(self, username: str) -> bool:
|
def begin_auth(self, username: str) -> bool:
|
||||||
# If the user's password is the empty string, no auth is required
|
if accounts.get(username) != '':
|
||||||
return accounts.get(username) != ''
|
logger.info(f"AUTH: User {username} attempting to authenticate.")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
logger.info(f"AUTH: SUCCESS for user {username}.")
|
||||||
|
return False
|
||||||
|
|
||||||
def password_auth_supported(self) -> bool:
|
def password_auth_supported(self) -> bool:
|
||||||
return True
|
return True
|
||||||
|
def host_based_auth_supported(self) -> bool:
|
||||||
|
return False
|
||||||
|
def public_key_auth_supported(self) -> bool:
|
||||||
|
return False
|
||||||
|
def kbdinit_auth_supported(self) -> bool:
|
||||||
|
return False
|
||||||
|
|
||||||
def validate_password(self, username: str, password: str) -> bool:
|
def validate_password(self, username: str, password: str) -> bool:
|
||||||
pw = accounts.get(username, '*')
|
pw = accounts.get(username, '*')
|
||||||
return ((pw != '*') and (password == pw))
|
|
||||||
|
if ((pw != '*') and (password == pw)):
|
||||||
|
logger.info(f"AUTH: SUCCESS for user {username}.")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
logger.info(f"AUTH: FAILED for user {username}.")
|
||||||
|
return False
|
||||||
|
|
||||||
async def start_server() -> None:
|
async def start_server() -> None:
|
||||||
await asyncssh.listen(
|
await asyncssh.listen(
|
||||||
|
Reference in New Issue
Block a user