Skip to content

Commit 09a28ff

Browse files
Azure safety updates (#2324)
1 parent 6a9d570 commit 09a28ff

File tree

5 files changed

+285
-146
lines changed

5 files changed

+285
-146
lines changed

analyzer/windows/analyzer.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -497,46 +497,34 @@ def run(self):
497497
Auxiliary()
498498
prefix = f"{auxiliary.__name__}."
499499

500-
# disable_screens = True
501-
# if self.options.get("disable_screens") == "0":
502-
# disable_screens = False
503-
504500
for _, name, _ in pkgutil.iter_modules(auxiliary.__path__, prefix):
505501
try:
506-
log.debug('Importing auxiliary module "%s"...', name)
507-
__import__(name, globals(), locals(), ["dummy"])
508-
# log.debug('Imported auxiliary module "%s"', name)
502+
mod_name = name.split(".")[-1]
503+
if hasattr(self.config, mod_name) and getattr(self.config, mod_name, False):
504+
log.debug('Importing auxiliary module "%s"...', name)
505+
__import__(name, globals(), locals(), ["dummy"])
506+
# log.debug('Imported auxiliary module "%s"', name)
509507
except ImportError as e:
510508
log.warning('Unable to import the auxiliary module "%s": %s', name, e)
509+
511510
# Walk through the available auxiliary modules.
512511
aux_modules = []
513512

514513
for module in sorted(Auxiliary.__subclasses__(), key=lambda x: x.start_priority, reverse=True):
515-
# Try to start the auxiliary module.
516-
# if module.__name__ == "Screenshots" and disable_screens:
517-
# continue
518514
try:
519515
aux = module(self.options, self.config)
520516
log.debug('Initialized auxiliary module "%s"', module.__name__)
521517
aux_modules.append(aux)
522-
523-
# The following commented out code causes the monitor to not upload logs.
524-
# If the auxiliary module is not enabled, we shouldn't start it
525-
# if hasattr(aux, "enabled") and not getattr(aux, "enabled", False):
526-
# log.debug('Auxiliary module "%s" is disabled.', module.__name__)
527-
# # We continue so that the module is not added to AUX_ENABLED
528-
# continue
529-
# else:
530-
log.debug('Trying to start auxiliary module "%s"...', module.__name__)
518+
log.debug('Trying to start auxiliary module "%s"...', module.__module__)
531519
aux.start()
532520
except (NotImplementedError, AttributeError) as e:
533521
log.warning("Auxiliary module %s was not implemented: %s", module.__name__, e)
534522
except Exception as e:
535-
log.warning("Cannot execute auxiliary module %s: %s", module.__name__, e)
523+
log.warning("Cannot execute auxiliary module %s: %s", module.__module__, e)
536524
else:
537-
log.debug("Started auxiliary module %s", module.__name__)
525+
log.debug("Started auxiliary module %s", module.__module__)
538526
AUX_ENABLED.append(aux)
539-
527+
540528
"""
541529
# Inform zer0m0n of the ResultServer address.
542530
zer0m0n.resultserver(self.config.ip, self.config.port)

conf/default/az.conf.default

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ spot_instances = false
118118
# start pulling tasks off of the stack
119119
wait_for_agent_before_starting = true
120120

121+
# This integer value is used to determine how many times a VMSS that does not initialize properly can retry
122+
init_retries = 2
123+
121124
# These are the value(s) of the DNS server(s) that you want the scale sets to use. (E.g. 1.1.1.1,8.8.8.8)
122125
# NOTE: NO SPACES
123126
dns_server_ips = <dns_server_ip>

installer/cape2.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,8 +1248,32 @@ function install_systemd() {
12481248
if [ "$MONGO_ENABLE" -ge 1 ]; then
12491249
cape_web_enable_string="cape-web"
12501250
fi
1251+
12511252
systemctl enable cape cape-rooter cape-processor "$cape_web_enable_string" suricata
12521253
systemctl restart cape cape-rooter cape-processor "$cape_web_enable_string" suricata
1254+
1255+
if [ ! -f "/etc/sudoers.d/cape" ] ; then
1256+
cat > /etc/sudoers.d/cape << EOF
1257+
Cmnd_Alias CAPE_SVC = /usr/bin/systemctl stop cape, /usr/bin/systemctl start cape, /usr/bin/systemctl restart cape
1258+
Cmnd_Alias CAPE_WEB_SVC = /usr/bin/systemctl stop cape-web, /usr/bin/systemctl start cape-web, /usr/bin/systemctl restart cape-web
1259+
Cmnd_Alias CAPE_PROCESSING_SVC = /usr/bin/systemctl stop cape-processor, /usr/bin/systemctl start cape-processor, /usr/bin/systemctl restart cape-processor
1260+
Cmnd_Alias CAPE_ROOTER_SVC = /usr/bin/systemctl stop cape-rooter, /usr/bin/systemctl start cape-rooter, /usr/bin/systemctl restart cape-rooter
1261+
Cmnd_Alias SURICATA = /usr/bin/systemctl stop suricata, /usr/bin/systemctl start suricata, /usr/bin/systemctl restart suricata
1262+
Cmnd_Alias UWSGI = /usr/bin/systemctl stop uwsgi, /usr/bin/systemctl start uwsgi, /usr/bin/systemctl restart uwsgi
1263+
1264+
# disttributed cape related
1265+
Cmnd_Alias CAPE_FSTAB_SVC = /usr/bin/systemctl stop cape-fstab, /usr/bin/systemctl start cape-fstab, /usr/bin/systemctl restart cape-fstab
1266+
1267+
%${USER} ALL=CAPE_SVC
1268+
%${USER} ALL=CAPE_WEB_SVC
1269+
%${USER} ALL=CAPE_PROCESSING_SVC
1270+
%${USER} ALL=CAPE_ROOTER_SVC
1271+
%${USER} ALL=SURICATA
1272+
%${USER} ALL=UWSGI
1273+
1274+
%cape ALL=CAPE_FSTAB_SVC
1275+
EOF
1276+
fi
12531277
}
12541278

12551279

@@ -1264,6 +1288,7 @@ function install_prometheus_grafana() {
12641288
sudo dpkg -i grafana_"$grafana_version"_amd64.deb
12651289

12661290
systemctl enable grafana
1291+
12671292
cat << EOL
12681293
Edit grafana config to listen on correct interface, default localhost, then
12691294
systemctl start grafana

0 commit comments

Comments
 (0)