Skip to content

Commit

Permalink
security/caldera: Use caldera user and group into port files
Browse files Browse the repository at this point in the history
- Update caldera rc file
- Update pkg-plist file
- Atomic plugin was patched for download yaml from alonsobsd/atomic-red-team
  instead of redcanaryco/atomic-red-team github repository until my pull
  request will be approved
- Add/modify entries into pkg-message file
- Bump PORTREVISION
  • Loading branch information
alonsobsd committed May 11, 2023
1 parent 958d2cf commit 42df5a3
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 18 deletions.
8 changes: 7 additions & 1 deletion security/caldera/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PORTNAME= caldera
DISTVERSION= 4.1.0
PORTREVISION= 1
CATEGORIES= security python

MAINTAINER= acm@FreeBSD.org
Expand Down Expand Up @@ -70,6 +71,11 @@ 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} \
Expand All @@ -78,7 +84,7 @@ SUB_LIST= PYTHON_CMD=${PYTHON_CMD} \
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
Expand Down
8 changes: 4 additions & 4 deletions security/caldera/files/caldera.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ 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
Expand All @@ -40,7 +40,7 @@ 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}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@
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)
36 changes: 27 additions & 9 deletions security/caldera/files/pkg-message.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{ type: install
message: <<EOM
Caldera port were installed
Caldera port was installed

1) Take on mind it is a modifying version of Caldera for include FreeBSD as
supported OS and you could found some issues. Problem reports are welcome.
Expand All @@ -10,6 +10,10 @@ Caldera port were installed

# sysrc caldera_enable="YES"

or enable it from service command

# service caldera enable

3) Before of start Caldera you must run some scripts for generate/update payload
files

Expand All @@ -21,33 +25,47 @@ Caldera port were installed

%%WWWDIR%%/conf

5) If you want run it in secure mode (https) take a look in ssl plugin section:
5) You can change default user passwords modifying default.yml file into
%%WWWDIR%%/conf folder. By default Caldera uses admin/admin,
blue/admin or red/admin like user/password.

# sed -i "" -e "s|admin: admin|admin: `openssl rand -base64 14`|g" default.yml
# sed -i "" -e "s|blue: admin|blue: `openssl rand -base64 14`|g" default.yml
# sed -i "" -e "s|red: admin|red: `openssl rand -base64 14`|g" default.yml

6) If you want run it in secure mode (https) take a look in ssl plugin section:

https://caldera.readthedocs.io/en/latest/Plugin-library.html#ssl

6) Start Caldera service
7) Start Caldera service

# service caldera start

7) When Caldera is starting, atomic plugin will use git to download files from
8) When Caldera is starting, atomic plugin will use git to download files from
the following link:

https://github.com/redcanaryco/atomic-red-team

Currently, the project does not include FreeBSD like a supported platform.
For this reason, Atomic plugin was patched for download atomic-red-team
files from the following repository until my pull request will be merge into
redcanaryco/atomic-red-team:

https://github.com/alonsobsd/atomic-red-team

Those files are necessary for generate yml files used by Caldera abilities

8) Caldera web listens on port 8888 by default and it uses red/admin or
blue/admin like user/password.
9) Caldera web listens on port 8888 by default

http://your_caldera_server_ip:8888

9) Log file is located at /var/log/caldera.log
10) Log file is located at /var/log/caldera.log

10) For more configure information you can look at the following link:
11) For more configure information you can look at the following link:

https://caldera.readthedocs.io/en/latest/

11) Enjoy it
12) Enjoy it
EOM
}
]
8 changes: 4 additions & 4 deletions security/caldera/pkg-plist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@mode 640
@owner www
@group www
@owner caldera
@group caldera
%%WWWDIR%%/CONTRIBUTING.md
%%WWWDIR%%/LICENSE
%%WWWDIR%%/README.md
Expand Down Expand Up @@ -1269,8 +1269,8 @@
%%WWWDIR%%/tests/web_server/test_core_endpoints.py
%%WWWDIR%%/tox.ini
@mode 750
@owner www
@group www
@owner caldera
@group caldera
@dir %%WWWDIR%%
@dir %%WWWDIR%%/plugins
@dir %%WWWDIR%%/plugins/atomic/data
Expand Down

0 comments on commit 42df5a3

Please sign in to comment.