diff --git a/security/caldera/Makefile b/security/caldera/Makefile index 8648038da272..2646d77b1a21 100644 --- a/security/caldera/Makefile +++ b/security/caldera/Makefile @@ -1,95 +1,101 @@ PORTNAME= caldera DISTVERSION= 4.1.0 +PORTREVISION= 1 CATEGORIES= security python MAINTAINER= acm@FreeBSD.org COMMENT= Automated Adversary Emulation Platform WWW= https://github.com/mitre/caldera LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}aiohttp>0:www/py-aiohttp@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}aiohttp-jinja2>0:www/py-aiohttp-jinja2@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}aiohttp-session>0:www/py-aiohttp-session@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}aiohttp-security>0:security/py-aiohttp-security@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}aiohttp-apispec>0:devel/py-aiohttp-apispec@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}Jinja2>0:devel/py-Jinja2@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}yaml>0:devel/py-yaml@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}cryptography>0:security/py-cryptography@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}websockets>0:devel/py-websockets@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}sphinx>0:textproc/py-sphinx@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}docutils>0:textproc/py-docutils@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}sphinx_rtd_theme>0:textproc/py-sphinx_rtd_theme@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}myst-parser>0:textproc/py-myst-parser@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}marshmallow>0:devel/py-marshmallow@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}dirhash>0:security/py-dirhash@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}docker>0:sysutils/py-docker@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}donut-shellcode>0:devel/py-donut-shellcode@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}marshmallow-enum>0:devel/py-marshmallow-enum@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}ldap3>0:net/py-ldap3@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}lxml>0:devel/py-lxml@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}reportlab>0:print/py-reportlab@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}svglib>0:converters/py-svglib@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}markdown>0:textproc/py-markdown@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}dnspython>0:dns/py-dnspython@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}asyncssh>0:security/py-asyncssh@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}aioftp>0:ftp/py-aioftp@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pyautogui>0:x11/py-pyautogui@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}selenium>0:www/py-selenium@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}webdriver_manager>0:www/py-webdriver_manager@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}beautifulsoup>0:www/py-beautifulsoup@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}networkx>0:math/py-networkx@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}numpy>0:math/py-numpy@${PY_FLAVOR} \ upx>0:archivers/upx \ git>0:devel/git \ bash>0:shells/bash USE_GITHUB= yes GH_ACCOUNT= mitre GH_PROJECT= ${PORTNAME} GH_TUPLE= mitre:access:fff4c20:access/plugins/access \ mitre:atomic:9e2c958:atomic/plugins/atomic \ mitre:builder:1aca019:builder/plugins/builder \ mitre:compass:fb88e02:compass/plugins/compass \ mitre:debrief:d815b60:debrief/plugins/debrief \ mitre:emu:5dbff82:emu/plugins/emu \ mitre:fieldmanual:510d0b9:fieldmanual/plugins/fieldmanual \ mitre:gameboard:3d98c32:gameboard/plugins/gameboard \ mitre:human:4368dea:human/plugins/human \ mitre:manx:e7205ea:manx/plugins/manx \ mitre:mock:4ea3337:mock/plugins/mock \ mitre:response:889213a:response/plugins/response \ mitre:sandcat:de3405f:sandcat/plugins/sandcat \ mitre:ssl:ac5bfcb:ssl/plugins/ssl \ mitre:stockpile:9662f27:stockpile/plugins/stockpile \ mitre:training:e309b0f:training/plugins/training USES= go:run python:3.8+ NO_ARCH= yes NO_BUILD= yes +CALDERA_USER= caldera +CALDERA_GROUP= caldera +USERS= ${CALDERA_USER} +GROUPS= ${CALDERA_GROUP} + USE_RC_SUBR= ${PORTNAME:S/-/_/} SUB_FILES= pkg-message SUB_LIST= PYTHON_CMD=${PYTHON_CMD} \ WWWDIR=${WWWDIR} OPTIONS_DEFINE= HAPROXY OPTIONS_DEFAULT=HAPROXY HAPROXY_DESC= Support for HTTPS -HAPROXY_RUN_DEPENDS=haproxy18>0:net/haproxy18 +HAPROXY_RUN_DEPENDS=haproxy20>0:net/haproxy20 post-extract: ${RM} -R ${WRKSRC}/.github cd ${WRKSRC} && ${RM} .coveragerc .dockerignore .eslintrc.js .flake8 \ .git* .pre* .stylelintrc.json Dockerfile post-patch: cd ${WRKSRC} && \ ${FIND} . -type f -name "*.orig" -exec ${RM} "{}" \; do-install: @cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}/${WWWDIR} .include diff --git a/security/caldera/files/caldera.in b/security/caldera/files/caldera.in index aaedbb017d79..081a14c8318e 100644 --- a/security/caldera/files/caldera.in +++ b/security/caldera/files/caldera.in @@ -1,84 +1,84 @@ #!/bin/sh # PROVIDE: caldera # REQUIRE: NETWORKING # KEYWORD: shutdown # # Configuration settings for caldera in /etc/rc.conf: # # caldera_enable: run caldera as service (default=NO) # caldera_flags: additional flags for caldera server # . /etc/rc.subr name=caldera rcvar=caldera_enable load_rc_config ${name} export PATH="${PATH}:/usr/local/bin:/usr/local/sbin" : ${caldera_enable:=NO} : ${caldera_flags="--insecure"} -caldera_user="www" +caldera_user="caldera" +caldera_wwwdir="%%WWWDIR%%" +caldera_logfile="/var/log/caldera.log" pidfile="/var/run/${name}.pid" - -caldera_wwwdir="%%WWWDIR%%" python_command="%%PYTHON_CMD%%" python_script="${caldera_wwwdir}/server.py" start_cmd=${name}_start status_cmd=${name}_status stop_cmd=${name}_stop restart_cmd=${name}_restart extra_commands="status" caldera_start() { if [ ! -f ${pidfile} ] then cd ${caldera_wwwdir} && \ - daemon -u ${caldera_user} -p ${pidfile} -t ${name} -o /var/log/caldera.log \ + daemon -u ${caldera_user} -p ${pidfile} -t ${name} -o ${caldera_logfile} \ ${python_command} ${python_script} \ ${caldera_flags} echo "Starting ${name}" else echo "${name} is running as pid" `cat ${pidfile}` fi } caldera_status() { # If running, show pid if [ -f ${pidfile} ] then echo "${name} is running as pid" `cat ${pidfile}` else echo "${name} is not running" fi } caldera_stop() { if [ -f ${pidfile} ] then kill `cat ${pidfile}` rm ${pidfile} echo "Stopping ${name}" else echo "${name} not running? (check ${pidfile})." fi } caldera_restart() { echo "Performing restart ${name}" caldera_stop sleep 3 caldera_start } run_rc_command "$1" diff --git a/security/caldera/files/patch-plugins_atomic_app_atomic__svc.py b/security/caldera/files/patch-plugins_atomic_app_atomic__svc.py index abc3e67c6ccf..04e18806665b 100644 --- a/security/caldera/files/patch-plugins_atomic_app_atomic__svc.py +++ b/security/caldera/files/patch-plugins_atomic_app_atomic__svc.py @@ -1,11 +1,20 @@ --- plugins/atomic/app/atomic_svc.py.orig 2022-08-11 15:59:49 UTC +++ plugins/atomic/app/atomic_svc.py @@ -13,7 +13,7 @@ from app.utility.base_world import BaseWorld from app.utility.base_service import BaseService from app.objects.c_agent import Agent -PLATFORMS = dict(windows='windows', macos='darwin', linux='linux') +PLATFORMS = dict(windows='windows', macos='darwin', linux='linux', freebsd='freebsd') EXECUTORS = dict(command_prompt='cmd', sh='sh', powershell='psh', bash='sh') RE_VARIABLE = re.compile('(#{(.*?)})', re.DOTALL) PREFIX_HASH_LEN = 6 +@@ -45,7 +45,7 @@ class AtomicService(BaseService): + the `repo_url` parameter (eg. if you want to use a fork). + """ + if not repo_url: +- repo_url = 'https://github.com/redcanaryco/atomic-red-team.git' ++ repo_url = 'https://github.com/alonsobsd/atomic-red-team.git' + + if not os.path.exists(self.repo_dir) or not os.listdir(self.repo_dir): + self.log.debug('cloning repo %s' % repo_url) diff --git a/security/caldera/files/pkg-message.in b/security/caldera/files/pkg-message.in index f97eaf3e8be7..668b6828a2e9 100644 --- a/security/caldera/files/pkg-message.in +++ b/security/caldera/files/pkg-message.in @@ -1,53 +1,71 @@ [ { type: install message: <