mirror of
https://github.com/aljazceru/cowrie.git
synced 2025-12-17 05:54:21 +01:00
update ssh config
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
|
* 2017-03-15 SSH Forwarding/SFTP/keys/version config have been moved to [ssh]. Change your config file!
|
||||||
* 2017-02-12 Implemented toggle for SSH forwarding
|
* 2017-02-12 Implemented toggle for SSH forwarding
|
||||||
* 2016-08-22 Merged Telnet support by @obilodeau!
|
* 2016-08-22 Merged Telnet support by @obilodeau!
|
||||||
* 2016-08-20 Update your libraries! 'configparser' now required: "pip install configparser"
|
* 2016-08-20 Update your libraries! 'configparser' now required: "pip install configparser"
|
||||||
|
|||||||
@@ -165,19 +165,27 @@ auth_class = UserDB
|
|||||||
# historical options in [honeypot] that have not yet been moved to [ssh]
|
# historical options in [honeypot] that have not yet been moved to [ssh]
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
|
# Source Port to report in logs (useful if you use iptables to forward ports to Cowrie)
|
||||||
# IP addresses to listen for incoming SSH connections.
|
#reported_ssh_port = 22
|
||||||
#
|
|
||||||
# (default: 0.0.0.0) = any IPv4 address
|
|
||||||
#listen_addr = 0.0.0.0
|
|
||||||
# (use :: for listen to all IPv6 and IPv4 addresses)
|
|
||||||
#listen_addr = ::
|
|
||||||
|
|
||||||
|
|
||||||
# Port to listen for incoming SSH connections.
|
|
||||||
#
|
# ============================================================================
|
||||||
# (default: 2222)
|
# SSH Specific Options
|
||||||
#listen_port = 2222
|
# ============================================================================
|
||||||
|
[ssh]
|
||||||
|
|
||||||
|
# Enable SSH support
|
||||||
|
# (default: true)
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
|
||||||
|
# Public and private SSH key files. If these don't exist, they are created
|
||||||
|
# automatically.
|
||||||
|
rsa_public_key = etc/ssh_host_rsa_key.pub
|
||||||
|
rsa_private_key = etc/ssh_host_rsa_key
|
||||||
|
dsa_public_key = etc/ssh_host_dsa_key.pub
|
||||||
|
dsa_private_key = etc/ssh_host_dsa_key
|
||||||
|
|
||||||
|
|
||||||
# SSH Version String
|
# SSH Version String
|
||||||
@@ -205,36 +213,46 @@ auth_class = UserDB
|
|||||||
# SSH-2.0-OpenSSH_5.9
|
# SSH-2.0-OpenSSH_5.9
|
||||||
#
|
#
|
||||||
# (default: "SSH-2.0-SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2")
|
# (default: "SSH-2.0-SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2")
|
||||||
ssh_version_string = SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2
|
version = SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2
|
||||||
|
|
||||||
|
|
||||||
# Source Port to report in logs (useful if you use iptables to forward ports to Cowrie)
|
# IP addresses to listen for incoming SSH connections.
|
||||||
#reported_ssh_port = 22
|
#
|
||||||
|
# (default: 0.0.0.0) = any IPv4 address
|
||||||
|
#listen_addr = 0.0.0.0
|
||||||
|
# (use :: for listen to all IPv6 and IPv4 addresses)
|
||||||
|
#listen_addr = ::
|
||||||
|
|
||||||
|
|
||||||
# Public and private SSH key files. If these don't exist, they are created
|
# Port to listen for incoming SSH connections.
|
||||||
# automatically.
|
#
|
||||||
rsa_public_key = data/ssh_host_rsa_key.pub
|
# (default: 2222)
|
||||||
rsa_private_key = data/ssh_host_rsa_key
|
#listen_port = 2222
|
||||||
dsa_public_key = data/ssh_host_dsa_key.pub
|
|
||||||
dsa_private_key = data/ssh_host_dsa_key
|
|
||||||
|
|
||||||
|
|
||||||
# sftp_enabled enables the sftp subsystem
|
# sftp_enabled enables the sftp subsystem
|
||||||
sftp_enabled = true
|
sftp_enabled = true
|
||||||
|
|
||||||
|
|
||||||
# SSH forwarding
|
# Enable SSH direct-tcpip forwarding
|
||||||
# Useful for forwarding protocols to other honeypots
|
# (default: true)
|
||||||
|
forwarding = true
|
||||||
|
|
||||||
|
|
||||||
# This enables redirecting forwarding requests to another address
|
# This enables redirecting forwarding requests to another address
|
||||||
ssh_forward_redirect = false
|
# Useful for forwarding protocols to other honeypots
|
||||||
# (default: false)
|
# (default: false)
|
||||||
|
forward_redirect = false
|
||||||
|
|
||||||
|
|
||||||
|
# Configure where to forward the data to.
|
||||||
# forward_redirect_<portnumber> = <redirect ip>:<redirect port>
|
# forward_redirect_<portnumber> = <redirect ip>:<redirect port>
|
||||||
forward_redirect_80 = 127.0.0.1:8080
|
|
||||||
|
# Redirect http/https
|
||||||
|
forward_redirect_80 = 127.0.0.1:8000
|
||||||
forward_redirect_443 = 127.0.0.1:8443
|
forward_redirect_443 = 127.0.0.1:8443
|
||||||
# If you want to record SMTP traffic, install SMTP honeypoint.
|
|
||||||
|
# To record SMTP traffic, install an SMTP honeypoint.
|
||||||
# (e.g https://github.com/awhitehatter/mailoney), run
|
# (e.g https://github.com/awhitehatter/mailoney), run
|
||||||
# python mailoney.py -s yahoo.com -t schizo_open_relay -p 12525
|
# python mailoney.py -s yahoo.com -t schizo_open_relay -p 12525
|
||||||
forward_redirect_25 = 127.0.0.1:12525
|
forward_redirect_25 = 127.0.0.1:12525
|
||||||
@@ -242,22 +260,6 @@ forward_redirect_587 = 127.0.0.1:12525
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# SSH Specific Options
|
|
||||||
# ============================================================================
|
|
||||||
[ssh]
|
|
||||||
|
|
||||||
# Enable SSH support
|
|
||||||
# (default: true)
|
|
||||||
enabled = true
|
|
||||||
|
|
||||||
|
|
||||||
# Enable SSH direct-tcpip forwarding
|
|
||||||
# (default: true)
|
|
||||||
forwarding = true
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Telnet Specific Options
|
# Telnet Specific Options
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class CowrieUser(avatar.ConchUser):
|
|||||||
|
|
||||||
# SFTP support enabled only when option is explicitly set
|
# SFTP support enabled only when option is explicitly set
|
||||||
try:
|
try:
|
||||||
if self.cfg.getboolean('honeypot', 'sftp_enabled') == True:
|
if self.cfg.getboolean('ssh', 'sftp_enabled') == True:
|
||||||
self.subsystemLookup['sftp'] = conchfiletransfer.FileTransferServer
|
self.subsystemLookup['sftp'] = conchfiletransfer.FileTransferServer
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ from twisted.python import log
|
|||||||
def getRSAKeys(cfg):
|
def getRSAKeys(cfg):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
publicKeyFile = cfg.get('honeypot', 'rsa_public_key')
|
publicKeyFile = cfg.get('ssh', 'rsa_public_key')
|
||||||
privateKeyFile = cfg.get('honeypot', 'rsa_private_key')
|
privateKeyFile = cfg.get('ssh', 'rsa_private_key')
|
||||||
if not (os.path.exists(publicKeyFile) and os.path.exists(privateKeyFile)):
|
if not (os.path.exists(publicKeyFile) and os.path.exists(privateKeyFile)):
|
||||||
log.msg("Generating new RSA keypair...")
|
log.msg("Generating new RSA keypair...")
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
@@ -40,8 +40,8 @@ def getRSAKeys(cfg):
|
|||||||
def getDSAKeys(cfg):
|
def getDSAKeys(cfg):
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
publicKeyFile = cfg.get('honeypot', 'dsa_public_key')
|
publicKeyFile = cfg.get('ssh', 'dsa_public_key')
|
||||||
privateKeyFile = cfg.get('honeypot', 'dsa_private_key')
|
privateKeyFile = cfg.get('ssh', 'dsa_private_key')
|
||||||
if not (os.path.exists(publicKeyFile) and os.path.exists(privateKeyFile)):
|
if not (os.path.exists(publicKeyFile) and os.path.exists(privateKeyFile)):
|
||||||
log.msg("Generating new DSA keypair...")
|
log.msg("Generating new DSA keypair...")
|
||||||
from Crypto.PublicKey import DSA
|
from Crypto.PublicKey import DSA
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class CowrieSSHFactory(factory.SSHFactory):
|
|||||||
t = transport.HoneyPotSSHTransport()
|
t = transport.HoneyPotSSHTransport()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
t.ourVersionString = self.cfg.get('honeypot', 'ssh_version_string')
|
t.ourVersionString = self.cfg.get('ssh', 'version')
|
||||||
except:
|
except:
|
||||||
t.ourVersionString = "SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2"
|
t.ourVersionString = "SSH-2.0-OpenSSH_6.0p1 Debian-4+deb7u2"
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ def cowrieOpenConnectForwardingClient(remoteWindow, remoteMaxPacket, data, avata
|
|||||||
|
|
||||||
cfg = avatar.cfg
|
cfg = avatar.cfg
|
||||||
try:
|
try:
|
||||||
if cfg.getboolean('honeypot', 'ssh_forward_redirect') == True:
|
if cfg.getboolean('ssh', 'forward_redirect') == True:
|
||||||
redirectEnabled = True
|
redirectEnabled = True
|
||||||
else:
|
else:
|
||||||
redirectEnabled = False
|
redirectEnabled = False
|
||||||
@@ -32,7 +32,7 @@ def cowrieOpenConnectForwardingClient(remoteWindow, remoteMaxPacket, data, avata
|
|||||||
|
|
||||||
if redirectEnabled:
|
if redirectEnabled:
|
||||||
redirects = {}
|
redirects = {}
|
||||||
items = cfg.items('honeypot')
|
items = cfg.items('ssh')
|
||||||
for i in items:
|
for i in items:
|
||||||
if i[0].startswith('forward_redirect'):
|
if i[0].startswith('forward_redirect'):
|
||||||
destPort = i[0].split('_')[-1]
|
destPort = i[0].split('_')[-1]
|
||||||
|
|||||||
Reference in New Issue
Block a user