s4:rpc_server: remove unused dcesrv_connection_context->private_date
[samba.git] / auth / common_auth.h
index c2ba846de54dd2ef7ba137b5de84164edccd85ff..d8377eb5347ce5f17b8607935b3465879a3dbc35 100644 (file)
@@ -83,6 +83,13 @@ struct auth_usersupplied_info
 
        const char *service_description;
        const char *auth_description;
+
+       /*
+        * for logging only, normally worked out from the password but
+        * for krb5 logging only (krb5 normally doesn't use this) we
+        * record the enc type here
+        */
+       const char *password_type;
 };
 
 struct auth_method_context;
@@ -115,6 +122,9 @@ struct auth4_context {
        /* SAM database for this local machine - to fill in local groups, or to authenticate local NTLM users */
        struct ldb_context *sam_ctx;
 
+       /* The time this authentication started */
+       struct timeval start_time;
+
        /* Private data for the callbacks on this auth context */
        void *private_data;
 
@@ -124,6 +134,16 @@ struct auth4_context {
                                        uint8_t *pauthoritative,
                                        void **server_returned_info,
                                        DATA_BLOB *nt_session_key, DATA_BLOB *lm_session_key);
+       struct tevent_req *(*check_ntlm_password_send)(TALLOC_CTX *mem_ctx,
+                                       struct tevent_context *ev,
+                                       struct auth4_context *auth_ctx,
+                                       const struct auth_usersupplied_info *user_info);
+       NTSTATUS (*check_ntlm_password_recv)(struct tevent_req *req,
+                                       TALLOC_CTX *mem_ctx,
+                                       uint8_t *pauthoritative,
+                                       void **server_returned_info,
+                                       DATA_BLOB *nt_session_key,
+                                       DATA_BLOB *lm_session_key);
 
        NTSTATUS (*get_ntlm_challenge)(struct auth4_context *auth_ctx, uint8_t chal[8]);
 
@@ -146,10 +166,48 @@ struct auth4_context {
                                              struct auth_session_info **session_info);
 };
 
-void log_authentication_event(const struct auth_usersupplied_info *ui,
+#define AUTHZ_TRANSPORT_PROTECTION_NONE "NONE"
+#define AUTHZ_TRANSPORT_PROTECTION_SMB "SMB"
+#define AUTHZ_TRANSPORT_PROTECTION_TLS "TLS"
+#define AUTHZ_TRANSPORT_PROTECTION_SEAL "SEAL"
+#define AUTHZ_TRANSPORT_PROTECTION_SIGN "SIGN"
+
+/*
+ * Log details of an authentication attempt.
+ * Successful and unsuccessful attempts are logged.
+ *
+ * NOTE: msg_ctx and lp_ctx is optional, but when supplied allows streaming the
+ * authentication events over the message bus.
+ */
+void log_authentication_event(struct imessaging_context *msg_ctx,
+                             struct loadparm_context *lp_ctx,
+                             const struct timeval *start_time,
+                             const struct auth_usersupplied_info *ui,
                              NTSTATUS status,
                              const char *account_name,
                              const char *domain_name,
                              const char *unix_username,
                              struct dom_sid *sid);
+
+/*
+ * Log details of a successful authorization to a service.
+ *
+ * Only successful authorizations are logged.  For clarity:
+ * - NTLM bad passwords will be recorded by log_authentication_event
+ * - Kerberos decrypt failures need to be logged in gensec_gssapi et al
+ *
+ * The service may later refuse authorization due to an ACL.
+ *
+ *
+ * NOTE: msg_ctx and lp_ctx is optional, but when supplied allows streaming the
+ * authorization events over the message bus.
+ */
+void log_successful_authz_event(struct imessaging_context *msg_ctx,
+                               struct loadparm_context *lp_ctx,
+                               const struct tsocket_address *remote,
+                               const struct tsocket_address *local,
+                               const char *service_description,
+                               const char *auth_type,
+                               const char *transport_protection,
+                               struct auth_session_info *session_info);
 #endif