Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure safety updates #2324

Merged
merged 32 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ea9accf
sync
doomedraven Jun 2, 2024
6ef4041
ci: Update requirements.txt
actions-user Jun 2, 2024
a23afff
Feature to ability monitor traffic between cape result server and san…
piolug93 Jun 2, 2024
317a326
ci: Update requirements.txt
actions-user Jun 2, 2024
c4a5a32
Merge branch 'master' into staging
doomedraven Aug 24, 2024
430d151
Update analysis_manager.py
doomedraven Aug 24, 2024
81e92b5
ci: Update requirements.txt
actions-user Aug 24, 2024
dae0534
Merge branch 'master' into staging
doomedraven Aug 24, 2024
ac52d04
Merge branch 'staging' of https://github.com/kevoreilly/CAPEv2 into s…
doomedraven Aug 24, 2024
3797037
Update poetry.lock
doomedraven Aug 24, 2024
222934c
ci: Update requirements.txt
actions-user Aug 24, 2024
2e98fce
Update rooter.py
doomedraven Aug 24, 2024
ca2f78b
Merge branch 'staging' of https://github.com/kevoreilly/CAPEv2 into s…
doomedraven Aug 24, 2024
2050b3c
Update cape2.sh
doomedraven Aug 24, 2024
3faa463
Merge branch 'master' into staging
doomedraven Aug 24, 2024
a4ef19e
Only import enabled auxiliary modules (#2294)
enzok Aug 27, 2024
d605730
Support pcap_ng captures (#2296)
enzok Aug 27, 2024
a7c75e5
Always wait for machine agents if config option enabled.
ChrisThibodeaux Sep 9, 2024
9e15a48
Simplify initializing logic for monitor function.
ChrisThibodeaux Sep 19, 2024
6e2c39f
On machine start up, check if it is scheduled for deletion from the V…
ChrisThibodeaux Sep 20, 2024
419fffd
Better comments and check on second deletion list.
ChrisThibodeaux Sep 20, 2024
d5e5bc1
Move `db.clean_machines()` call outside of the initialization session…
ChrisThibodeaux Sep 20, 2024
f48a96a
Protecting against initial total machine failures with initialization…
ChrisThibodeaux Sep 21, 2024
8a90d4b
Update az.py
doomedraven Sep 21, 2024
70eb52f
Merge branch 'master' into pr/2324
doomedraven Sep 21, 2024
d4933cb
Merge branch 'staging' into azure-safety-updates
doomedraven Sep 21, 2024
1217470
Typo fixing and updates.
ChrisThibodeaux Sep 21, 2024
ea2ca21
Move machine deletions out of any threads.
ChrisThibodeaux Sep 22, 2024
a14027a
Revert changes to abstracts.py and scheduler.py
ChrisThibodeaux Sep 22, 2024
ae69060
Handle existing, locked machines at start up. Use thread-agnostic mac…
ChrisThibodeaux Sep 22, 2024
9cea521
Merge branch 'master' into pr/2324
doomedraven Sep 22, 2024
88424ed
Merge branch 'azure-safety-updates' of https://github.com/ChrisThibod…
doomedraven Sep 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions analyzer/windows/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,46 +497,34 @@ def run(self):
Auxiliary()
prefix = f"{auxiliary.__name__}."

# disable_screens = True
# if self.options.get("disable_screens") == "0":
# disable_screens = False

for _, name, _ in pkgutil.iter_modules(auxiliary.__path__, prefix):
try:
log.debug('Importing auxiliary module "%s"...', name)
__import__(name, globals(), locals(), ["dummy"])
# log.debug('Imported auxiliary module "%s"', name)
mod_name = name.split(".")[-1]
if hasattr(self.config, mod_name) and getattr(self.config, mod_name, False):
log.debug('Importing auxiliary module "%s"...', name)
__import__(name, globals(), locals(), ["dummy"])
# log.debug('Imported auxiliary module "%s"', name)
except ImportError as e:
log.warning('Unable to import the auxiliary module "%s": %s', name, e)

# Walk through the available auxiliary modules.
aux_modules = []

for module in sorted(Auxiliary.__subclasses__(), key=lambda x: x.start_priority, reverse=True):
# Try to start the auxiliary module.
# if module.__name__ == "Screenshots" and disable_screens:
# continue
try:
aux = module(self.options, self.config)
log.debug('Initialized auxiliary module "%s"', module.__name__)
aux_modules.append(aux)

# The following commented out code causes the monitor to not upload logs.
# If the auxiliary module is not enabled, we shouldn't start it
# if hasattr(aux, "enabled") and not getattr(aux, "enabled", False):
# log.debug('Auxiliary module "%s" is disabled.', module.__name__)
# # We continue so that the module is not added to AUX_ENABLED
# continue
# else:
log.debug('Trying to start auxiliary module "%s"...', module.__name__)
log.debug('Trying to start auxiliary module "%s"...', module.__module__)
aux.start()
except (NotImplementedError, AttributeError) as e:
log.warning("Auxiliary module %s was not implemented: %s", module.__name__, e)
except Exception as e:
log.warning("Cannot execute auxiliary module %s: %s", module.__name__, e)
log.warning("Cannot execute auxiliary module %s: %s", module.__module__, e)
else:
log.debug("Started auxiliary module %s", module.__name__)
log.debug("Started auxiliary module %s", module.__module__)
AUX_ENABLED.append(aux)

"""
# Inform zer0m0n of the ResultServer address.
zer0m0n.resultserver(self.config.ip, self.config.port)
Expand Down
3 changes: 3 additions & 0 deletions conf/default/az.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ spot_instances = false
# start pulling tasks off of the stack
wait_for_agent_before_starting = true

# This integer value is used to determine how many times a VMSS that does not initialize properly can retry
init_retries = 2

# 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)
# NOTE: NO SPACES
dns_server_ips = <dns_server_ip>
Expand Down
25 changes: 25 additions & 0 deletions installer/cape2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1248,8 +1248,32 @@ function install_systemd() {
if [ "$MONGO_ENABLE" -ge 1 ]; then
cape_web_enable_string="cape-web"
fi

systemctl enable cape cape-rooter cape-processor "$cape_web_enable_string" suricata
systemctl restart cape cape-rooter cape-processor "$cape_web_enable_string" suricata

if [ ! -f "/etc/sudoers.d/cape" ] ; then
cat > /etc/sudoers.d/cape << EOF
Cmnd_Alias CAPE_SVC = /usr/bin/systemctl stop cape, /usr/bin/systemctl start cape, /usr/bin/systemctl restart cape
Cmnd_Alias CAPE_WEB_SVC = /usr/bin/systemctl stop cape-web, /usr/bin/systemctl start cape-web, /usr/bin/systemctl restart cape-web
Cmnd_Alias CAPE_PROCESSING_SVC = /usr/bin/systemctl stop cape-processor, /usr/bin/systemctl start cape-processor, /usr/bin/systemctl restart cape-processor
Cmnd_Alias CAPE_ROOTER_SVC = /usr/bin/systemctl stop cape-rooter, /usr/bin/systemctl start cape-rooter, /usr/bin/systemctl restart cape-rooter
Cmnd_Alias SURICATA = /usr/bin/systemctl stop suricata, /usr/bin/systemctl start suricata, /usr/bin/systemctl restart suricata
Cmnd_Alias UWSGI = /usr/bin/systemctl stop uwsgi, /usr/bin/systemctl start uwsgi, /usr/bin/systemctl restart uwsgi

# disttributed cape related
Cmnd_Alias CAPE_FSTAB_SVC = /usr/bin/systemctl stop cape-fstab, /usr/bin/systemctl start cape-fstab, /usr/bin/systemctl restart cape-fstab

%${USER} ALL=CAPE_SVC
%${USER} ALL=CAPE_WEB_SVC
%${USER} ALL=CAPE_PROCESSING_SVC
%${USER} ALL=CAPE_ROOTER_SVC
%${USER} ALL=SURICATA
%${USER} ALL=UWSGI

%cape ALL=CAPE_FSTAB_SVC
EOF
fi
}


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

systemctl enable grafana

cat << EOL
Edit grafana config to listen on correct interface, default localhost, then
systemctl start grafana
Expand Down
Loading