]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Send security events after incorrect connexion with SD/DIR
authorEric Bollengier <eric@baculasystems.com>
Wed, 6 Apr 2022 12:49:49 +0000 (14:49 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:58 +0000 (13:56 +0200)
bacula/src/dird/ua_server.c
bacula/src/filed/job.c
bacula/src/stored/hello.c

index 0132a8bd8c6b5e0f1e60f96fb1f4db750bd9c1f6..8e90773ab073102fbfe2cb1b1b92bfd2c78a64fc 100644 (file)
@@ -229,6 +229,10 @@ static void *handle_UA_client_request(void *arg)
 
    user->recv();             /* Get first message */
    if (!authenticate_user_agent(ua)) {
+      events_send_msg(ua->jcr, "DS0001", EVENTS_TYPE_SECURITY,
+                      user->host(), (intptr_t)ua->jcr,
+                      "Authentication failed from %s",
+                      user->host());
       goto getout;
    }
 
index d745e97ae9f139660d1bb61dd392dc0eb07c81b4..8ad7a6dbab318598b8ddbf67aaa5234f3f6bbc7f 100644 (file)
@@ -353,10 +353,6 @@ static void *handle_director_request(BSOCK *dir)
    bool found, quit;
    bool first = true;
    JCR *jcr;
-
-   char from[512];
-   dir->get_peer(from, sizeof(from));
-
    suspendres_t suspend;
    prevent_os_suspensions(suspend);   /* do not suspend during backup/restore */
 
@@ -457,9 +453,11 @@ static void *handle_director_request(BSOCK *dir)
 
 bail_out:
    /* Keep track of the important events */
-   if (dir && !jcr->authenticated) {
+   if (dir && jcr && !jcr->authenticated) {
       events_send_msg(jcr, "FS0001", EVENTS_TYPE_SECURITY,
-                      from, (intptr_t)jcr, "Authentication failed");
+                      dir->host(), (intptr_t)jcr,
+                      "Authentication failed from %s",
+                      dir->host());
    }
 
    dequeue_messages(jcr);  /* send any queued messages, will no longer impact
index a93d7c489e8e260a40acf7c02a9bd5a07b7ec2ef..9b5d4e31faa4365b239a40ba1fd08dabd367f0f5 100644 (file)
@@ -127,6 +127,11 @@ bool validate_dir_hello(JCR* jcr)
       Qmsg3(jcr, M_SECURITY, 0, _("Connection from unknown Director %s at %s:%s rejected.\n"
             "Please see " MANUAL_AUTH_URL " for help.\n"),
             dirname, dir->who(), dir->host());
+
+      events_send_msg(jcr, "SS0001", EVENTS_TYPE_SECURITY,
+                      dir->host(), (intptr_t)jcr,
+                      "Authentication failed from %s",
+                      dir->host());
       free_pool_memory(dirname);
       sleep(5);
       return false;