Skip to content

Commit

Permalink
Add: support authenticated connection to MQTT broker (#1545)
Browse files Browse the repository at this point in the history
If the scanner options `mqtt_user` and `mqtt_pass`
are set, the connection will be authenticated.
For this to work, MQTT broker must be configured with valid user and pass

This is disable per default
  • Loading branch information
jjnicola authored Dec 20, 2023
1 parent d14dce9 commit 9ecb6ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/openvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,13 @@ attack_network_init (struct scan_globals *globals, const gchar *config_file)
mqtt_server_uri = prefs_get ("mqtt_server_uri");
if (mqtt_server_uri)
{
#ifdef AUTH_MQTT
const char *mqtt_user = prefs_get ("mqtt_user");
const char *mqtt_pass = prefs_get ("mqtt_pass");
if ((mqtt_init_auth (mqtt_server_uri, mqtt_user, mqtt_pass)) != 0)
#else
if ((mqtt_init (mqtt_server_uri)) != 0)
#endif
{
g_message ("%s: INIT MQTT: FAIL", __func__);
send_message_to_client_and_finish_scan (
Expand Down

0 comments on commit 9ecb6ab

Please sign in to comment.