diff --git a/security/caldera/Makefile b/security/caldera/Makefile index 2646d77b1a21..c75659d18940 100644 --- a/security/caldera/Makefile +++ b/security/caldera/Makefile @@ -1,101 +1,102 @@ PORTNAME= caldera DISTVERSION= 4.1.0 -PORTREVISION= 1 +PORTREVISION= 2 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 \ + base64>0:converters/base64 \ 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=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 081a14c8318e..d08e4fae7d5c 100644 --- a/security/caldera/files/caldera.in +++ b/security/caldera/files/caldera.in @@ -1,84 +1,85 @@ #!/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_env="GOCACHE=/tmp/caldera/.cache GOMODCACHE=/tmp/caldera/.vendor" caldera_user="caldera" caldera_wwwdir="%%WWWDIR%%" caldera_logfile="/var/log/caldera.log" pidfile="/var/run/${name}.pid" 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 ${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_stockpile_payloads_ragdoll.py b/security/caldera/files/patch-plugins_stockpile_payloads_ragdoll.py new file mode 100644 index 000000000000..13f037f6db8b --- /dev/null +++ b/security/caldera/files/patch-plugins_stockpile_payloads_ragdoll.py @@ -0,0 +1,11 @@ +--- plugins/stockpile/payloads/ragdoll.py.orig 2023-05-16 23:53:18 UTC ++++ plugins/stockpile/payloads/ragdoll.py +@@ -63,7 +63,7 @@ class OperationLoop: + def _execute_instruction(self, i): + print('[+] Running instruction: %s' % i['id']) + cmd = self._decode_bytes(i['command']) +- execution_timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') ++ execution_timestamp = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ') + try: + output = subprocess.check_output(cmd, shell=True, timeout=i['timeout']) + except subprocess.CalledProcessError as e: diff --git a/security/caldera/files/pkg-message.in b/security/caldera/files/pkg-message.in index 668b6828a2e9..5662ac917f51 100644 --- a/security/caldera/files/pkg-message.in +++ b/security/caldera/files/pkg-message.in @@ -1,71 +1,71 @@ [ { type: install message: <