|
Packit Service |
87a54e |
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
Packit |
5756e2 |
/*
|
|
Packit |
5756e2 |
* Copyright (C) 2015 Red Hat, Inc.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#ifndef __NM_AUDIT_MANAGER_H__
|
|
Packit |
5756e2 |
#define __NM_AUDIT_MANAGER_H__
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-connection.h"
|
|
Packit |
5756e2 |
#include "devices/nm-device.h"
|
|
Packit |
5756e2 |
#include "nm-types.h"
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NM_TYPE_AUDIT_MANAGER (nm_audit_manager_get_type())
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_MANAGER(obj) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_AUDIT_MANAGER, NMAuditManager))
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_MANAGER_CLASS(klass) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_AUDIT_MANAGER, NMAuditManagerClass))
|
|
Packit Service |
a1bd4f |
#define NM_IS_AUDIT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_AUDIT_MANAGER))
|
|
Packit Service |
a1bd4f |
#define NM_IS_AUDIT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_AUDIT_MANAGER))
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_MANAGER_GET_CLASS(obj) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_AUDIT_MANAGER, NMAuditManagerClass))
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct _NMAuditManagerClass NMAuditManagerClass;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CONN_ADD "connection-add"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CONN_DELETE "connection-delete"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CONN_UPDATE "connection-update"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CONN_ACTIVATE "connection-activate"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CONN_ADD_ACTIVATE "connection-add-activate"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CONN_DEACTIVATE "connection-deactivate"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CONN_CLEAR_SECRETS "connection-clear-secrets"
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CONNS_RELOAD "connections-reload"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CONNS_LOAD "connections-load"
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_RELOAD "reload"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_SLEEP_CONTROL "sleep-control"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_NET_CONTROL "networking-control"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_RADIO_CONTROL "radio-control"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_STATISTICS "statistics"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_HOSTNAME_SAVE "hostname-save"
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_DEVICE_AUTOCONNECT "device-autoconnect"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_DEVICE_DISCONNECT "device-disconnect"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_DEVICE_DELETE "device-delete"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_DEVICE_MANAGED "device-managed"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_DEVICE_REAPPLY "device-reapply"
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CHECKPOINT_CREATE "checkpoint-create"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CHECKPOINT_ROLLBACK "checkpoint-rollback"
|
|
Packit Service |
a1bd4f |
#define NM_AUDIT_OP_CHECKPOINT_DESTROY "checkpoint-destroy"
|
|
Packit |
5756e2 |
#define NM_AUDIT_OP_CHECKPOINT_ADJUST_ROLLBACK_TIMEOUT "checkpoint-adjust-rollback-timeout"
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
GType nm_audit_manager_get_type(void);
|
|
Packit Service |
a1bd4f |
NMAuditManager *nm_audit_manager_get(void);
|
|
Packit Service |
a1bd4f |
gboolean nm_audit_manager_audit_enabled(NMAuditManager *self);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define nm_audit_log_connection_op(op, connection, result, args, subject_context, reason) \
|
|
Packit Service |
a1bd4f |
G_STMT_START \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
NMAuditManager *_audit = nm_audit_manager_get(); \
|
|
Packit Service |
a1bd4f |
\
|
|
Packit Service |
a1bd4f |
if (nm_audit_manager_audit_enabled(_audit)) { \
|
|
Packit Service |
a1bd4f |
_nm_audit_manager_log_connection_op(_audit, \
|
|
Packit Service |
a1bd4f |
__FILE__, \
|
|
Packit Service |
a1bd4f |
__LINE__, \
|
|
Packit Service |
a1bd4f |
G_STRFUNC, \
|
|
Packit Service |
a1bd4f |
(op), \
|
|
Packit Service |
a1bd4f |
(connection), \
|
|
Packit Service |
a1bd4f |
(result), \
|
|
Packit Service |
a1bd4f |
(args), \
|
|
Packit Service |
a1bd4f |
(subject_context), \
|
|
Packit Service |
a1bd4f |
(reason)); \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
G_STMT_END
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define nm_audit_log_control_op(op, arg, result, subject_context, reason) \
|
|
Packit Service |
a1bd4f |
G_STMT_START \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
NMAuditManager *_audit = nm_audit_manager_get(); \
|
|
Packit Service |
a1bd4f |
\
|
|
Packit Service |
a1bd4f |
if (nm_audit_manager_audit_enabled(_audit)) { \
|
|
Packit Service |
a1bd4f |
_nm_audit_manager_log_generic_op(_audit, \
|
|
Packit Service |
a1bd4f |
__FILE__, \
|
|
Packit Service |
a1bd4f |
__LINE__, \
|
|
Packit Service |
a1bd4f |
G_STRFUNC, \
|
|
Packit Service |
a1bd4f |
(op), \
|
|
Packit Service |
a1bd4f |
(arg), \
|
|
Packit Service |
a1bd4f |
(result), \
|
|
Packit Service |
a1bd4f |
(subject_context), \
|
|
Packit Service |
a1bd4f |
(reason)); \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
G_STMT_END
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define nm_audit_log_device_op(op, device, result, args, subject_context, reason) \
|
|
Packit Service |
a1bd4f |
G_STMT_START \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
NMAuditManager *_audit = nm_audit_manager_get(); \
|
|
Packit Service |
a1bd4f |
\
|
|
Packit Service |
a1bd4f |
if (nm_audit_manager_audit_enabled(_audit)) { \
|
|
Packit Service |
a1bd4f |
_nm_audit_manager_log_device_op(_audit, \
|
|
Packit Service |
a1bd4f |
__FILE__, \
|
|
Packit Service |
a1bd4f |
__LINE__, \
|
|
Packit Service |
a1bd4f |
G_STRFUNC, \
|
|
Packit Service |
a1bd4f |
(op), \
|
|
Packit Service |
a1bd4f |
(device), \
|
|
Packit Service |
a1bd4f |
(result), \
|
|
Packit Service |
a1bd4f |
(args), \
|
|
Packit Service |
a1bd4f |
(subject_context), \
|
|
Packit Service |
a1bd4f |
(reason)); \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
G_STMT_END
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#define nm_audit_log_checkpoint_op(op, arg, result, subject_context, reason) \
|
|
Packit Service |
a1bd4f |
G_STMT_START \
|
|
Packit Service |
a1bd4f |
{ \
|
|
Packit Service |
a1bd4f |
NMAuditManager *_audit = nm_audit_manager_get(); \
|
|
Packit Service |
a1bd4f |
\
|
|
Packit Service |
a1bd4f |
if (nm_audit_manager_audit_enabled(_audit)) { \
|
|
Packit Service |
a1bd4f |
_nm_audit_manager_log_generic_op(_audit, \
|
|
Packit Service |
a1bd4f |
__FILE__, \
|
|
Packit Service |
a1bd4f |
__LINE__, \
|
|
Packit Service |
a1bd4f |
G_STRFUNC, \
|
|
Packit Service |
a1bd4f |
(op), \
|
|
Packit Service |
a1bd4f |
(arg), \
|
|
Packit Service |
a1bd4f |
(result), \
|
|
Packit Service |
a1bd4f |
(subject_context), \
|
|
Packit Service |
a1bd4f |
(reason)); \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
} \
|
|
Packit Service |
a1bd4f |
G_STMT_END
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
void _nm_audit_manager_log_connection_op(NMAuditManager * self,
|
|
Packit Service |
a1bd4f |
const char * file,
|
|
Packit Service |
a1bd4f |
guint line,
|
|
Packit Service |
a1bd4f |
const char * func,
|
|
Packit Service |
a1bd4f |
const char * op,
|
|
Packit Service |
a1bd4f |
NMSettingsConnection *connection,
|
|
Packit Service |
a1bd4f |
gboolean result,
|
|
Packit Service |
a1bd4f |
const char * args,
|
|
Packit Service |
a1bd4f |
gpointer subject_context,
|
|
Packit Service |
a1bd4f |
const char * reason);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
void _nm_audit_manager_log_generic_op(NMAuditManager *self,
|
|
Packit Service |
a1bd4f |
const char * file,
|
|
Packit Service |
a1bd4f |
guint line,
|
|
Packit Service |
a1bd4f |
const char * func,
|
|
Packit Service |
a1bd4f |
const char * op,
|
|
Packit Service |
a1bd4f |
const char * arg,
|
|
Packit Service |
a1bd4f |
gboolean result,
|
|
Packit Service |
a1bd4f |
gpointer subject_context,
|
|
Packit Service |
a1bd4f |
const char * reason);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
void _nm_audit_manager_log_device_op(NMAuditManager *self,
|
|
Packit Service |
a1bd4f |
const char * file,
|
|
Packit Service |
a1bd4f |
guint line,
|
|
Packit Service |
a1bd4f |
const char * func,
|
|
Packit Service |
a1bd4f |
const char * op,
|
|
Packit Service |
a1bd4f |
NMDevice * device,
|
|
Packit Service |
a1bd4f |
gboolean result,
|
|
Packit Service |
a1bd4f |
const char * args,
|
|
Packit Service |
a1bd4f |
gpointer subject_context,
|
|
Packit Service |
a1bd4f |
const char * reason);
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#endif /* __NM_AUDIT_MANAGER_H__ */
|