mirror of https://github.com/cowrie/cowrie.git
banner_file is now '/etc/issue.net' in honeyfs by default
add default Debian motd file
This commit is contained in:
parent
c855f4d337
commit
8546df235d
|
@ -0,0 +1,7 @@
|
|||
|
||||
The programs included with the Debian GNU/Linux system are free software;
|
||||
the exact distribution terms for each program are described in the
|
||||
individual files in /usr/share/doc/*/copyright.
|
||||
|
||||
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
|
||||
permitted by applicable law.
|
|
@ -148,8 +148,7 @@ ssh_version_string = SSH-2.0-OpenSSH_5.1p1 Debian-5
|
|||
|
||||
# Banner file to be displayed before the first login attempt.
|
||||
#
|
||||
# (default: not specified)
|
||||
#banner_file =
|
||||
#banner_file = DEPRECATED; always '/etc/issue.net' in honeyfs
|
||||
|
||||
# exit_jail tries to 'trick' the attacker with another shell. Set to true to create
|
||||
# another fake prompt after logout
|
||||
|
|
|
@ -38,17 +38,15 @@ class HoneyPotSSHUserAuthServer(userauth.SSHUserAuthServer):
|
|||
if self.bannerSent:
|
||||
return
|
||||
cfg = config()
|
||||
if not cfg.has_option('honeypot', 'banner_file'):
|
||||
return
|
||||
try:
|
||||
data = file(cfg.get('honeypot', 'banner_file')).read()
|
||||
honeyfs = cfg.get('honeypot', 'contents_path')
|
||||
issuefile = honeyfs + "/etc/issue.net"
|
||||
data = file( issuefile ).read()
|
||||
except IOError:
|
||||
log.msg( 'Banner file %s does not exist!' % \
|
||||
cfg.get('honeypot', 'banner_file') )
|
||||
return
|
||||
if not data or not len(data.strip()):
|
||||
return
|
||||
data = '\r\n'.join(data.splitlines() + [''])
|
||||
data = '\r\n'.join(data.splitlines() )
|
||||
self.transport.sendPacket(
|
||||
userauth.MSG_USERAUTH_BANNER, NS(data) + NS('en'))
|
||||
self.bannerSent = True
|
||||
|
|
Loading…
Reference in New Issue