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

Dis 3281/improved security scheme #847

Merged
merged 3 commits into from
Sep 12, 2024
Merged

Conversation

twiggler
Copy link
Contributor

This is a companion PR of the agent and cannot be tested stand-alone.

To test together with the agent,

  1. Generate an agent
  2. Deploy it on a machine.
  3. Start the broker
  4. Run the command below
target-query all -L mqtt --mqtt-port=443 --mqtt-broker=0.0.0.0 --mqtt-ca=domain.crt --mqtt-crt=/tmp/cert.crt --mqtt-key=/tmp/private.key --mqtt-case=case1 --mqtt-peers=100 --mqtt-username=ag_case1_roel --mqtt-password --mqtt-diag --mqtt-command callid  -f hostname

closes #846

Copy link

codecov bot commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 10.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 75.59%. Comparing base (acb8d15) to head (5026402).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dissect/target/loaders/mqtt.py 10.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #847      +/-   ##
==========================================
- Coverage   75.61%   75.59%   -0.03%     
==========================================
  Files         311      311              
  Lines       26551    26561      +10     
==========================================
+ Hits        20077    20078       +1     
- Misses       6474     6483       +9     
Flag Coverage Δ
unittests 75.59% <10.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

return

# The payload with the username and password is comma separated
print(f'CALLID: "{hostname}",{decoded_payload}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please leave out the prefix here

self.mqtt_client.publish(f"{self.case}/{host}/COMM", self.command.encode("utf-8"))
time.sleep(1)

def _on_callId(self, hostname: str, payload: bytes) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _on_callId(self, hostname: str, payload: bytes) -> None:
def _on_call_id(self, hostname: str, payload: bytes) -> None:

please use snake_case

@@ -365,6 +376,8 @@ def _on_message(self, client: mqtt.Client, userdata: Any, msg: mqtt.client.MQTTM
self._on_read(hostname, tokens, msg.payload)
elif response == "ID":
self._on_id(hostname, msg.payload)
elif response == "CALLID":
self._on_callId(hostname, msg.payload)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change function call here please to match updated version

@twiggler twiggler force-pushed the dis-3281/improved-security-scheme branch from 3874eae to 854d39c Compare September 12, 2024 09:18
@twiggler twiggler force-pushed the dis-3281/improved-security-scheme branch from 854d39c to 5026402 Compare September 12, 2024 14:49
@twiggler twiggler merged commit 4533ba8 into main Sep 12, 2024
16 of 18 checks passed
@twiggler twiggler deleted the dis-3281/improved-security-scheme branch September 12, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Targetd: Improved security scheme
2 participants