-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
702 additions
and
615 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
kippo.cfg | ||
kippo.pid | ||
data/lastlog.txt | ||
data/ssh_host_dsa_key | ||
data/ssh_host_dsa_key.pub | ||
data/ssh_host_rsa_key | ||
data/ssh_host_rsa_key.pub | ||
dl/* | ||
log/kippo.log | ||
log/tty/* | ||
private.key | ||
public.key | ||
|
||
# Created by .gitignore support plugin (hsz.mobi) | ||
|
||
### Python template | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
# | ||
# userdb.py for kippo | ||
# by Walter de Jong <[email protected]> | ||
# | ||
# adopted and further modified by Upi Tamminen <[email protected]> | ||
# | ||
# Copyright (c) 2009-2014 Upi Tamminen <[email protected]> | ||
# See the COPYRIGHT file for more information | ||
|
||
from kippo.core.config import config | ||
import os | ||
import string | ||
|
||
class UserDB: | ||
import twisted | ||
from twisted.cred import checkers, credentials, error | ||
from twisted.internet import defer | ||
from zope.interface import implements | ||
|
||
from kippo.core.config import config | ||
|
||
# by Walter de Jong <[email protected]> | ||
class UserDB(object): | ||
|
||
def __init__(self): | ||
self.userdb = [] | ||
self.load() | ||
|
@@ -96,4 +99,39 @@ def adduser(self, login, uid, passwd): | |
self.userdb.append((login, uid, passwd)) | ||
self.save() | ||
|
||
class HoneypotPasswordChecker: | ||
implements(checkers.ICredentialsChecker) | ||
|
||
credentialInterfaces = (credentials.IUsernamePassword, | ||
credentials.IPluggableAuthenticationModules) | ||
|
||
def requestAvatarId(self, credentials): | ||
if hasattr(credentials, 'password'): | ||
if self.checkUserPass(credentials.username, credentials.password): | ||
return defer.succeed(credentials.username) | ||
else: | ||
return defer.fail(error.UnauthorizedLogin()) | ||
elif hasattr(credentials, 'pamConversion'): | ||
return self.checkPamUser(credentials.username, | ||
credentials.pamConversion) | ||
return defer.fail(error.UnhandledCredentials()) | ||
|
||
def checkPamUser(self, username, pamConversion): | ||
r = pamConversion((('Password:', 1),)) | ||
return r.addCallback(self.cbCheckPamUser, username) | ||
|
||
def cbCheckPamUser(self, responses, username): | ||
for response, zero in responses: | ||
if self.checkUserPass(username, response): | ||
return defer.succeed(username) | ||
return defer.fail(error.UnauthorizedLogin()) | ||
|
||
def checkUserPass(self, username, password): | ||
if UserDB().checklogin(username, password): | ||
print 'login attempt [%s/%s] succeeded' % (username, password) | ||
return True | ||
else: | ||
print 'login attempt [%s/%s] failed' % (username, password) | ||
return False | ||
|
||
# vim: set sw=4 et: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2009 Upi Tamminen <[email protected]> | ||
# Copyright (c) 2009-2014 Upi Tamminen <[email protected]> | ||
# See the COPYRIGHT file for more information | ||
|
||
import ConfigParser, os | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2009 Upi Tamminen <[email protected]> | ||
# Copyright (c) 2009-2014 Upi Tamminen <[email protected]> | ||
# See the COPYRIGHT file for more information | ||
|
||
import re, time, socket | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# Copyright (c) 2009-2014 Upi Tamminen <[email protected]> | ||
# See the COPYRIGHT file for more information | ||
|
||
class NotEnabledException(Exception): | ||
""" Feature not enabled | ||
""" | ||
|
||
# vim: set sw=4 et: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2009 Upi Tamminen <[email protected]> | ||
# Copyright (c) 2009-2014 Upi Tamminen <[email protected]> | ||
# See the COPYRIGHT file for more information | ||
|
||
import os, time, fnmatch | ||
|
Oops, something went wrong.