From nobody Tue Mar 26 06:10:59 2024 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V3fYv62c5z5G92B; Tue, 26 Mar 2024 06:10:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V3fYv4D79z40Kv; Tue, 26 Mar 2024 06:10:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711433459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7Erla8Z8GRT41iPkg95+9nZoRW0nhPZbu+mM7rc49pA=; b=O9BFYk+i1LRbBNM92IOK0sf/FPJee2Q+Sqh7zrafakQrzOlI0FgWXGCehZtB92IITXDGSR b7tZU/nsmw4gDqXv2YCn494O4aIV8lqsoq+tdFv7DRo77fA/tkQi8zhl2FjT3C853MZit7 LYZiAUIhqlD3DcGgAfF3Uii+I1rEtFXm4rRTjx9MXi5XoKDSZiq/YAaKpyOnVUsLcRmWLs 1TyZ/4gZYRdF4MXo6J+UHqY6R6HvGNlTVIY/ByUgi4/0P2SCGtrNxyP+XVmlZiRdHGvFd1 A+ZRQg5rqkBcRQkVxzBTZT9rqBlOa88xO1F5rT5q2CmxMHsl5eszqhBCAZNohA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711433459; a=rsa-sha256; cv=none; b=YjZwJDPNP+rE9ikh8O2HaR4WbMxcNNmKmFdoWcseURBaPxY6BigL3uAop/lC8xa54pESjM czqWQicnrKM3s3v+FW5Tm8fWZFkZXBXpi0HXwQAWlheWGKNZp5wUpHtClWNZlrsseC0XwB jNYj/8GEj7Sgu6B2a3MOw4isgdQKvBFPd/Qm/aePphAEc0Jp3Uj5vPH22AEG3NbDnbQ6F0 z0wVhIjoK9nMTyjVuyW/c0lo4IQTlK3QFDGLA3gdHdRYbRP3dWP4ffmfv39xidhK/m2eAI 6CqpknswdNmzBugZAN2nIG7oZrklp77dUqflgxwiQgUJ7W1BVzBJAqfqkO6Yfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711433459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7Erla8Z8GRT41iPkg95+9nZoRW0nhPZbu+mM7rc49pA=; b=ijiXq9WIrgkHa4ohbdQfWnBru41aAM2oioy0KejIr8zoY3UIQ+78ldS/nPUKuGfQMx4IhX 74rWjLcIWufNcScUJTLDa2q3TaenmyALXGr9G8EAibVewmK2i4KLD0Z2w3LznKLxqgGHVG GFLudVi51NWG0MNGpkq7Qh3jrJvFvzU6yM5FU178jz4fnUgJTpRDyWdR4mCnupmlsVi+h8 D4zJWTaUp8gAL7KlsZ/AJvWFs3LxkY5adSzdcgTwBDwVkVCCablSMczuq5a98+WVbTzr9s w6qHrle6FaRMlFWuDgxW7U1zUQfmRWD7XdfIqaeSsAV61oBpsBE/oWqcL0qYjQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V3fYv3qpWzpSs; Tue, 26 Mar 2024 06:10:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42Q6AxeL030078; Tue, 26 Mar 2024 06:10:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42Q6Axls030075; Tue, 26 Mar 2024 06:10:59 GMT (envelope-from git) Date: Tue, 26 Mar 2024 06:10:59 GMT Message-Id: <202403260610.42Q6Axls030075@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Jose Alonso Cardenas Marquez Subject: git: 1be69b56c4b4 - main - security/caldera: Improve port List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: acm X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1be69b56c4b45d3f3cfcded2c6dfe695080226c4 Auto-Submitted: auto-generated The branch main has been updated by acm: URL: https://cgit.FreeBSD.org/ports/commit/?id=1be69b56c4b45d3f3cfcded2c6dfe695080226c4 commit 1be69b56c4b45d3f3cfcded2c6dfe695080226c4 Author: Jose Alonso Cardenas Marquez AuthorDate: 2024-03-26 05:57:33 +0000 Commit: Jose Alonso Cardenas Marquez CommitDate: 2024-03-26 05:57:33 +0000 security/caldera: Improve port - Improve rc script. Now it kills some child processes - Use my new atomic-red-team repository. It include a new entry run_as into yaml files for identify FreeBSD tests easily because oficial redcanaryco/atomic-red-team project included new changes and these remove freebsd entries from yaml files because it was merged into linux tests. Now identify what are FreeBSD tests is almost imposible. - Some other minor modifications - Bump PORTREVISION --- security/caldera/Makefile | 7 ++- security/caldera/files/caldera.in | 7 ++- .../files/patch-plugins_atomic_app_atomic__svc.py | 60 ++++++++++++++++++++-- 3 files changed, 67 insertions(+), 7 deletions(-) diff --git a/security/caldera/Makefile b/security/caldera/Makefile index 3544dba8e55a..dff6a25ad848 100644 --- a/security/caldera/Makefile +++ b/security/caldera/Makefile @@ -1,6 +1,6 @@ PORTNAME= caldera DISTVERSION= 5.0.0 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= security python MAINTAINER= acm@FreeBSD.org @@ -111,11 +111,14 @@ post-build: @${ECHO} "(!!!) Please upload the cache archive: ${DISTDIR}/${DIST_SUBDIR}/${PORTNAME}-cache-${DISTVERSION}${EXTRACT_SUFX}" .else MASTER_SITES+= LOCAL/acm/caldera/:npm_cache -DISTFILES+= ${PORTNAME}-cache-${DISTVERSION}${EXTRACT_SUFX}:npm_cache +DISTFILES+= ${PORTNAME}-cache-${DISTVERSION}${EXTRACT_SUFX}:npm_cache \ + ${PORTNAME}-freebsd-logos.tar.gz:npm_cache NPM_ARGS= run build post-extract: @${MV} ${WRKDIR}/node_modules ${WRKSRC}/plugins/magma/ + @${MV} ${WRKDIR}/freebsd.red.svg ${WRKSRC}/plugins/magma/src/assets/img/graph/freebsd-icon-privileged.svg + @${MV} ${WRKDIR}/freebsd.black.svg ${WRKSRC}/plugins/magma/src/assets/img/graph/freebsd-icon.svg ${RM} -R ${WRKSRC}/.github cd ${WRKSRC} && ${RM} .coveragerc .dockerignore .eslintrc.js .flake8 \ .git* .pre* .stylelintrc.json Dockerfile diff --git a/security/caldera/files/caldera.in b/security/caldera/files/caldera.in index d08e4fae7d5c..7b57c2e33777 100644 --- a/security/caldera/files/caldera.in +++ b/security/caldera/files/caldera.in @@ -66,8 +66,13 @@ caldera_stop() { if [ -f ${pidfile} ] then - kill `cat ${pidfile}` + kill -TERM `cat ${pidfile}` rm ${pidfile} + + pid_child=$(pgrep -U ${caldera_user}) + if [ ! -z "${pid_child}" ]; then + kill -TERM ${pid_child} + fi echo "Stopping ${name}" else echo "${name} not running? (check ${pidfile})." 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 04e18806665b..7f5883b80a9f 100644 --- a/security/caldera/files/patch-plugins_atomic_app_atomic__svc.py +++ b/security/caldera/files/patch-plugins_atomic_app_atomic__svc.py @@ -1,6 +1,14 @@ ---- plugins/atomic/app/atomic_svc.py.orig 2022-08-11 15:59:49 UTC +--- plugins/atomic/app/atomic_svc.py.orig 2024-02-13 20:49:23 UTC +++ plugins/atomic/app/atomic_svc.py -@@ -13,7 +13,7 @@ from app.utility.base_world import BaseWorld +@@ -5,6 +5,7 @@ import os + import re + import shutil + import yaml ++import platform + + from collections import defaultdict + from subprocess import DEVNULL, STDOUT, check_call +@@ -13,7 +14,7 @@ from app.utility.base_world import BaseWorld from app.utility.base_service import BaseService from app.objects.c_agent import Agent @@ -9,12 +17,56 @@ 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): +@@ -45,11 +46,17 @@ 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 platform.system() == "FreeBSD": ++ repo_url = 'https://github.com/alonsobsd/atomic-red-team.git' ++ else: ++ repo_url = 'https://github.com/redcanaryco/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) +- check_call(['git', 'clone', '--depth', '1', repo_url, self.repo_dir], stdout=DEVNULL, stderr=STDOUT) ++ if platform.system() == "FreeBSD": ++ check_call(['git', 'clone', '-b', 'atomic', '--depth', '1', repo_url, self.repo_dir], stdout=DEVNULL, stderr=STDOUT) ++ else: ++ check_call(['git', 'clone', '--depth', '1', repo_url, self.repo_dir], stdout=DEVNULL, stderr=STDOUT) + self.log.debug('clone complete') + + async def populate_data_directory(self, path_yaml=None): +@@ -132,6 +139,11 @@ class AtomicService(BaseService): + return path.replace('\\', '/') + return path + ++ @staticmethod ++ def _platform_system(): ++ _platform = platform.system() ++ return _platform ++ + def _catch_path_to_atomics_folder(self, string_to_analyse, platform): + """ + Catch a path to the atomics/ folder in the `string_to_analyse` variable, +@@ -302,6 +314,10 @@ class AtomicService(BaseService): + Return True if an ability was saved. + """ + ability_id = hashlib.md5(json.dumps(test).encode()).hexdigest() ++ list_name = 'supported_platforms' ++ ++ if self._platform_system() == 'FreeBSD': ++ list_name = 'run_on' + + tactics_li = self.technique_to_tactics.get(entries['attack_technique'], ['redcanary-unknown']) + tactic = 'multiple' if len(tactics_li) > 1 else tactics_li[0] +@@ -317,7 +333,8 @@ class AtomicService(BaseService): + ), + platforms=dict() + ) +- for p in test['supported_platforms']: ++ ++ for p in test[list_name]: + if test['executor']['name'] != 'manual': + # manual tests are expected to be run manually by a human, no automation is provided + executor = EXECUTORS.get(test['executor']['name'], 'unknown')