diff --git a/docker/honeypots/Dockerfile b/docker/honeypots/Dockerfile index c6310d8e..3af67dbf 100644 --- a/docker/honeypots/Dockerfile +++ b/docker/honeypots/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.19 +FROM alpine:3.20 # # Include dist COPY dist/ /root/dist/ @@ -6,84 +6,34 @@ COPY dist/ /root/dist/ # Install packages RUN apk --no-cache -U add \ build-base \ - freetds \ - freetds-dev \ - gcc \ - git \ - hiredis \ - jpeg-dev \ libcap \ libffi-dev \ - libpq \ musl-dev \ openssl \ openssl-dev \ - postgresql-dev \ - py3-chardet \ - py3-click \ - py3-cryptography \ - py3-dnspython \ - py3-flask \ - py3-future \ - py3-hiredis \ - py3-impacket \ - py3-itsdangerous \ - py3-jinja2 \ - py3-ldap3 \ - py3-markupsafe \ - py3-netifaces \ - py3-openssl \ - py3-packaging \ - py3-paramiko \ py3-pip \ - # py3-psutil \ - py3-psycopg2 \ - py3-pycryptodomex \ - py3-requests \ - py3-service_identity \ - py3-twisted \ - py3-werkzeug \ - py3-wheel \ python3 \ - python3-dev \ - zlib-dev && \ + python3-dev && \ # # Install honeypots from GitHub and setup - mkdir -p /opt \ - /var/log/honeypots && \ - cd /opt/ && \ - git clone https://github.com/qeeqbox/honeypots && \ - cd honeypots && \ - git checkout a990b2c1ab04ffafde229e478ced54ffbb665d5c && \ - # git checkout 5b3bfbecbf85c1f5235b320b333bdeff2d312372 && \ - # cp /root/dist/pyproject.toml . && \ - pip3 install --break-system-packages --upgrade pip && \ - pip3 install --break-system-packages . && \ + pip3 install --break-system-packages --no-cache-dir honeypots && \ setcap cap_net_bind_service=+ep $(readlink -f $(type -P python3)) && \ # # Setup user, groups and configs - addgroup -g 2000 honeypots && \ - adduser -S -H -s /bin/ash -u 2000 -D -g 2000 honeypots && \ - chown honeypots:honeypots -R /opt/honeypots && \ - chown honeypots:honeypots -R /var/log/honeypots && \ - mv /root/dist/config.json /opt/honeypots/ && \ + mkdir -p /etc/honeypots/ && \ + cp /root/dist/config.json /etc/honeypots/ && \ # # Clean up - apk del --purge build-base \ - freetds-dev \ - git \ - jpeg-dev \ + apk del --purge \ + build-base \ libffi-dev \ + musl-dev \ openssl-dev \ - postgresql-dev \ - python3-dev \ - zlib-dev && \ + py3-pip \ + python3-dev && \ rm -rf /root/* \ - /var/cache/apk/* \ - /opt/honeypots/.git # # Start honeypots STOPSIGNAL SIGINT -USER honeypots:honeypots -WORKDIR /opt/honeypots/ -CMD python3 -E -m honeypots --setup all --config config.json +USER 2000:2000 +CMD python3 -E -m honeypots --setup all --config /etc/honeypots/config.json diff --git a/docker/honeypots/Dockerfile.old b/docker/honeypots/Dockerfile.old new file mode 100644 index 00000000..9cd23a44 --- /dev/null +++ b/docker/honeypots/Dockerfile.old @@ -0,0 +1,87 @@ +FROM alpine:3.20 +# +# Include dist +COPY dist/ /root/dist/ +# +# Install packages +RUN apk --no-cache -U add \ + build-base \ + freetds \ + freetds-dev \ + gcc \ + git \ + hiredis \ + jpeg-dev \ + libcap \ + libffi-dev \ + libpq \ + musl-dev \ + openssl \ + openssl-dev \ + postgresql-dev \ + py3-chardet \ + py3-click \ + py3-cryptography \ + py3-dnspython \ + py3-flask \ + py3-future \ + py3-hiredis \ + py3-impacket \ + py3-itsdangerous \ + py3-jinja2 \ + py3-ldap3 \ + py3-markupsafe \ + py3-netifaces \ + py3-openssl \ + py3-packaging \ + py3-paramiko \ + py3-pip \ + # py3-psutil \ + py3-psycopg2 \ + py3-pycryptodomex \ + py3-requests \ + py3-service_identity \ + py3-twisted \ + py3-werkzeug \ + py3-wheel \ + python3 \ + python3-dev \ + zlib-dev && \ +# +# Install honeypots from GitHub and setup + mkdir -p /opt \ + /var/log/honeypots && \ + cd /opt/ && \ + git clone https://github.com/qeeqbox/honeypots && \ + cd honeypots && \ + git checkout 7283529c1773c6fc26e072fa9c78074d66fe9fa6 && \ + pip3 install --break-system-packages --upgrade pip && \ + pip3 install --break-system-packages . && \ + setcap cap_net_bind_service=+ep $(readlink -f $(type -P python3)) && \ +# +# Setup user, groups and configs + addgroup -g 2000 honeypots && \ + adduser -S -H -s /bin/ash -u 2000 -D -g 2000 honeypots && \ + chown honeypots:honeypots -R /opt/honeypots && \ + chown honeypots:honeypots -R /var/log/honeypots && \ + mv /root/dist/config.json /opt/honeypots/ && \ +# +# Clean up + apk del --purge build-base \ + freetds-dev \ + git \ + jpeg-dev \ + libffi-dev \ + openssl-dev \ + postgresql-dev \ + python3-dev \ + zlib-dev && \ + rm -rf /root/* \ + /var/cache/apk/* \ + /opt/honeypots/.git +# +# Start honeypots +STOPSIGNAL SIGINT +USER honeypots:honeypots +WORKDIR /opt/honeypots/ +CMD python3 -E -m honeypots --setup all --config config.json diff --git a/docker/honeypots/dist/config.json b/docker/honeypots/dist/config.json index 87579a53..e169c3ec 100644 --- a/docker/honeypots/dist/config.json +++ b/docker/honeypots/dist/config.json @@ -8,6 +8,15 @@ "filter":"", "interface":"", "honeypots":{ + "dhcp":{ + "port":67, + "ip":"0.0.0.0", + "username":"administrator", + "password":"123456", + "log_file_name":"dhcp.log", + "max_bytes":0, + "backup_count":10 + }, "dns":{ "port":53, "ip":"0.0.0.0", diff --git a/docker/honeypots/dist/pyproject.toml b/docker/honeypots/dist/pyproject.toml deleted file mode 100644 index ddbaa5ed..00000000 --- a/docker/honeypots/dist/pyproject.toml +++ /dev/null @@ -1,150 +0,0 @@ -[build-system] -requires = [ - "setuptools>=61.2", -] -build-backend = "setuptools.build_meta" - -[project] -name = "honeypots" -version = "0.65" -authors = [ - { name = "QeeqBox", email = "gigaqeeq@gmail.com" }, -] -description = "30 different honeypots in one package! (dhcp, dns, elastic, ftp, http proxy, https proxy, http, https, imap, ipp, irc, ldap, memcache, mssql, mysql, ntp, oracle, pjl, pop3, postgres, rdp, redis, sip, smb, smtp, snmp, socks5, ssh, telnet, vnc)" -readme = "README.rst" -requires-python = ">=3.8" -dependencies = [ - "twisted", - "psutil", - "psycopg2-binary", - "pycryptodome", - "requests", - "requests[socks]", - "impacket", - "paramiko", - "scapy", - "service_identity", - "netifaces", -] -license = {text = "AGPL-3.0"} - -[project.urls] -Homepage = "https://github.com/qeeqbox/honeypots" - -[project.optional-dependencies] -dev = [ - "dnspython==2.4.2", - "elasticsearch", - "ldap3", - "mysql-connector", - "pre-commit", - "pymssql", - "pysnmplib", - "pytest", - "redis", - "redis", - "vncdotool", -] - -[project.scripts] -honeypots = "honeypots.__main__:main_logic" - -[tool.setuptools] -packages = [ - "honeypots", - "honeypots.data", -] -include-package-data = true - -[tool.setuptools.package-data] -"honeypots.data" = [ - "*.html", -] - -[tool.ruff] -select = [ - "F", - "E", - "W", - "C90", - "N", - "UP", - "B", - "A", - "C4", - "EXE", - "FA", - "ISC", - "PIE", - "T20", - "PT", - "Q", - "RET", - "SIM", - "TCH", - "ARG", - "PTH", - "ERA", - "PL", - "PLR", - "PLW", - "PERF", - "RUF", -] -ignore = [ - "A003", - "PERF203", - "PERF401", - "RUF001", - "RUF002", - "RUF003", - "RUF015", - # pydantic only supports these from python>=3.9 - "UP006", - "UP007", - # rules may cause conflicts when used with the formatter - "ISC001", - "Q001", -] -fixable = [ - "F", - "E", - "W", - "C90", - "N", - "UP", - "B", - "A", - "C4", - "EXE", - "FA", - "ISC", - "PIE", - "T20", - "PT", - "Q", - "RET", - "SIM", - "TCH", - "ARG", - "PTH", - "ERA", - "PL", - "PLR", - "PLW", - "PERF", - "RUF", -] -exclude = [ - ".git", - ".ruff_cache", - ".venv", - "venv", - "data", -] -line-length = 99 -target-version = "py38" - -[tool.ruff.lint.per-file-ignores] -# don't check for "magic value" in tests -"tests/*" = ["PLR2004"] diff --git a/docker/honeypots/dist/setup.py b/docker/honeypots/dist/setup.py deleted file mode 100644 index d63ab76b..00000000 --- a/docker/honeypots/dist/setup.py +++ /dev/null @@ -1,39 +0,0 @@ -from setuptools import setup - -with open("README.rst", "r") as f: - long_description = f.read() - -setup( - name='honeypots', - author='QeeqBox', - author_email='gigaqeeq@gmail.com', - description=r"23 different honeypots in a single pypi package! (dns, ftp, httpproxy, http, https, imap, mysql, pop3, postgres, redis, smb, smtp, socks5, ssh, telnet, vnc, mssql, elastic, ldap, ntp, memcache, snmp, oracle, sip and irc) ", - long_description=long_description, - version='0.51', - license="AGPL-3.0", - license_files=('LICENSE'), - url="https://github.com/qeeqbox/honeypots", - packages=['honeypots'], - entry_points={ - "console_scripts": [ - 'honeypots=honeypots.__main__:main_logic' - ] - }, - include_package_data=True, - install_requires=[ - 'pycrypto', - 'scapy', - 'twisted', - 'psutil', - 'psycopg2-binary', - 'requests', - 'impacket', - 'paramiko', - 'service_identity', - 'netifaces' - ], - extras_require={ - 'test': ['redis', 'mysql-connector', 'elasticsearch', 'pymssql', 'ldap3', 'pysnmp'] - }, - python_requires='>=3.5' -) diff --git a/docker/honeypots/docker-compose.yml b/docker/honeypots/docker-compose.yml index 4ddba4ee..f860f455 100644 --- a/docker/honeypots/docker-compose.yml +++ b/docker/honeypots/docker-compose.yml @@ -22,6 +22,7 @@ services: - "23:23" - "25:25" - "53:53/udp" + - "67:67/udp" - "80:80" - "110:110" - "123:123"