Skip to content

Commit

Permalink
adding supporting scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
0x90-n committed Jan 31, 2024
1 parent 1f082d3 commit a6c4e91
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/start_registration-tracker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Run Conjure registration tracker process using configs in environment variables.

if [ $(id -u) -ne 0 ]; then
echo "$0 must be run as sudo"
exit 1
fi

# load config. will access config in /var/lib/conjure for overrides
set -a
source /opt/conjure/sysconfig/conjure_regtrack.conf
set +a

if [ ! -f $CJ_STATION_CONFIG ]; then
echo "Failed to open \$CJ_STATION_CONFIG=$CJ_STATION_CONFIG."
echo "You may want to set CJ_STATION_CONFIG in the conjure.conf file before running the script"
exit 1
fi

echo "station_config path: $CJ_STATION_CONFIG"

/opt/conjure/bin/registration-tracker
20 changes: 20 additions & 0 deletions sysconfig/conjure-reg-tracker.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[Unit]
Description=Conjure Registration Tracker

[Service]
Type=simple

WorkingDirectory=/opt/conjure/

SyslogIdentifier=conjure

ExecStart=/bin/bash /opt/conjure/scripts/start_registration-tracker.sh

# send SIGHUP to the station process
ExecReload=/bin/kill -HUP $MAINPID

# on stop processes will get SIGTERM, and after 10 secs - SIGKILL (default 90)
TimeoutStopSec=10

[Install]
WantedBy=multi-user.target
19 changes: 19 additions & 0 deletions sysconfig/conjure_regtrack.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# private key used by the detectors
CJ_PRIVKEY=/var/lib/conjure/regtracker_privkey

# Path to the configuration file for the registratoin tracker
CJ_STATION_CONFIG=/var/lib/conjure/regtrack_config.toml

# Path to the configuration file containing phantom subnets
PHANTOM_SUBNET_LOCATION=/var/lib/conjure/phantom_subnets.toml

# Read local configs to allow for override of any of these settings
if [ -r /var/lib/conjure/conjure_regtrack.conf ] && [ -z "${CJ_STOP_RECURSE+x}" ]; then
echo "Applying local configs from /var/lib/conjure/conjure_regtrack.conf"
CJ_STOP_RECURSE="true"
. /var/lib/conjure/conjure_regtrack.conf
fi

unset CJ_STOP_RECURSE

0 comments on commit a6c4e91

Please sign in to comment.