Skip to content

Commit

Permalink
give the option to specify scan interval and splay values (#436)
Browse files Browse the repository at this point in the history
* give the option to specify scan interval and splay values

* changes to linux shellscript

* fix S
  • Loading branch information
schnipschnap authored Mar 15, 2024
1 parent b0c39f0 commit 52445cf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
12 changes: 11 additions & 1 deletion install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ function Install-Mondoo {
[string] $Time = '',
[string] $Interval = '',
[string] $taskname = "MondooUpdater",
[string] $taskpath = "Mondoo"
[string] $taskpath = "Mondoo",
[string] $Timer = '60',
[string] $Splay = '60'
)
Process {

Expand Down Expand Up @@ -233,6 +235,8 @@ function Install-Mondoo {
info (" UpdateTask: {0}" -f $UpdateTask)
info (" Time: {0}" -f $Time)
info (" Interval: {0}" -f $Interval)
info (" Scan Interval: {0}" -f $Timer)
info (" Splay: {0}" -f $Splay)
info ""

# determine download url
Expand Down Expand Up @@ -328,6 +332,12 @@ function Install-Mondoo {
If (![string]::IsNullOrEmpty($Proxy)) {
$login_params = $login_params + @("--api-proxy", "$Proxy")
}
If (![string]::IsNullOrEmpty($Timer)) {
$login_params = $login_params + @("--timer", "$Timer")
}
If (![string]::IsNullOrEmpty($Splay)) {
$login_params = $login_params + @("--splay", "$Splay")
}

$program = "$Path\cnspec.exe"

Expand Down
17 changes: 13 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ MONDOO_INSTALLER=''
MONDOO_SERVICE=''
MONDOO_REGISTRATION_TOKEN=''

TIMER='60'
SPLAY='60'

print_usage() {
echo "usage: [-i]" >&2
echo " Options: " >&2
Expand All @@ -59,14 +62,20 @@ print_usage() {
echo " Mondoo Platform" >&2
echo " -u <updater>: Enables the Mondoo auto updater for the system." >&2
echo " options are: enable" >&2
echo " -r <timer>: Change the scan interval." >&2
echo " Default 60 minutes" >&2
echo " -y <splay>: Change the splay." >&2
echo " Default 60 minutes" >&2
}

while getopts 'i:s:u:vt:v' flag; do
while getopts 'i:s:u:vt:vr:y:' flag; do
case "${flag}" in
i) MONDOO_INSTALLER="${OPTARG}" ;;
s) MONDOO_SERVICE="${OPTARG}" ;;
t) MONDOO_REGISTRATION_TOKEN="${OPTARG}" ;;
u) MONDOO_AUTOUPDATER="${OPTARG}" ;;
r) TIMER="${OPTARG}" ;;
y) SPLAY="${OPTARG}" ;;
*) print_usage
exit 1 ;;
esac
Expand Down Expand Up @@ -497,7 +506,7 @@ configure_cloudshell_installer() {
purple_bold "\n* Authenticate with Mondoo Platform"
config_path="$HOME/.config/mondoo"
mkdir -p "$config_path"
${MONDOO_BINARY_PATH} login --config "$config_path/mondoo.yml" --token "$MONDOO_REGISTRATION_TOKEN"
${MONDOO_BINARY_PATH} login --config "$config_path/mondoo.yml" --token "$MONDOO_REGISTRATION_TOKEN" --timer "$TIMER" --splay "$SPLAY"
}
}

Expand Down Expand Up @@ -552,7 +561,7 @@ configure_macos_token() {
purple_bold "\n* Authenticate with Mondoo Platform"
config_path="$HOME/.config/mondoo"
mkdir -p "$config_path"
${MONDOO_BINARY_PATH} login --config "$config_path/mondoo.yml" --token "$MONDOO_REGISTRATION_TOKEN"
${MONDOO_BINARY_PATH} login --config "$config_path/mondoo.yml" --token "$MONDOO_REGISTRATION_TOKEN" --timer "$TIMER" --splay "$SPLAY"
if [ "$MONDOO_SERVICE" = "enable" ]; then
sudo_cmd cp "$config_path/mondoo.yml" /Library/Mondoo/etc/mondoo.yml
fi
Expand All @@ -561,7 +570,7 @@ configure_macos_token() {
configure_linux_token() {
purple_bold "\n* Authenticate with Mondoo Platform"
sudo_cmd mkdir -p "/etc/opt/mondoo/"
sudo_cmd ${MONDOO_BINARY_PATH} login --config /etc/opt/mondoo/mondoo.yml --token "$MONDOO_REGISTRATION_TOKEN"
sudo_cmd ${MONDOO_BINARY_PATH} login --config /etc/opt/mondoo/mondoo.yml --token "$MONDOO_REGISTRATION_TOKEN" --timer "$TIMER" --splay "$SPLAY"

if [ "$(cat /proc/1/comm)" = "init" ]; then
purple_bold "\n* Restart upstart service"
Expand Down

0 comments on commit 52445cf

Please sign in to comment.