Collaboration diagram for MySQL logging module:
|
Defines | |
| #define | CONN_SELECT_FIELDS "ip_protocol,ip_saddr,ip_daddr,tcp_sport,tcp_dport,udp_sport,udp_dport,icmp_type,icmp_code" |
Functions | |
| static nu_error_t | mysql_close_current (struct log_mysql_params *params) |
| G_MODULE_EXPORT gchar * | unload_module_with_params (gpointer params_p) |
| static nu_error_t | mysql_close_open_user_sessions (struct log_mysql_params *params) |
| Close all open user sessions. | |
| G_MODULE_EXPORT gboolean | init_module_from_conf (module_t *module) |
| static MYSQL * | mysql_conn_init (struct log_mysql_params *params) |
| static gchar * | generate_osname (gchar *Name, gchar *Version, gchar *Release) |
| static gchar * | generate_appname (gchar *appname) |
| static char * | quote_string (MYSQL *mysql, char *text) |
| char * | create_log_prefix (int prefix_version, const char *oob_sufix, connection_t *element) |
| static char * | build_insert_request (MYSQL *ld, connection_t *element, tcp_state_t state, char *auth_oob_prefix, char *unauth_oob_prefix, struct log_mysql_params *params) |
| static int | log_state_open (MYSQL *ld, connection_t *element, struct log_mysql_params *params) |
| static int | log_state_established (MYSQL *ld, struct accounted_connection *element, struct log_mysql_params *params) |
| static int | log_state_close (MYSQL *ld, struct accounted_connection *element, struct log_mysql_params *params) |
| static int | log_state_drop (MYSQL *ld, connection_t *element, struct log_mysql_params *params) |
| static MYSQL * | get_mysql_handler (struct log_mysql_params *params) |
| G_MODULE_EXPORT gint | user_packet_logs (void *element, tcp_state_t state, gpointer params_p) |
| User packet logging. | |
| static nu_error_t | build_conntrack_msg_from_mysql (MYSQL_ROW row, struct limited_connection *msgdatas, struct log_mysql_params *params) |
| nu_error_t | destroy_user_connections (user_session_t *c_session, session_state_t state, gpointer params_p) |
| G_MODULE_EXPORT int | user_session_logs (user_session_t *c_session, session_state_t state, gpointer params_p) |
| User session logging. | |
| const gchar * | g_module_check_init (GModule *module) |
| void | g_module_unload (GModule *module) |
| #define CONN_SELECT_FIELDS "ip_protocol,ip_saddr,ip_daddr,tcp_sport,tcp_dport,udp_sport,udp_dport,icmp_type,icmp_code" |
| static nu_error_t build_conntrack_msg_from_mysql | ( | MYSQL_ROW | row, | |
| struct limited_connection * | msgdatas, | |||
| struct log_mysql_params * | params | |||
| ) | [static] |
Definition at line 870 of file mysql.c.
References tracking_t::daddr, DEBUG_AREA_MAIN, DEBUG_LEVEL_VERBOSE_DEBUG, DEBUG_OR_NOT, tracking_t::dest, log_mysql_params::mysql_use_ipv4_schema, NU_EXIT_ERROR, NU_EXIT_OK, print_tracking_t(), tracking_t::protocol, tracking_t::saddr, tracking_t::source, limited_connection::tracking, and uint32_to_ipv6().
Referenced by destroy_user_connections().
Here is the call graph for this function:

| static char* build_insert_request | ( | MYSQL * | ld, | |
| connection_t * | element, | |||
| tcp_state_t | state, | |||
| char * | auth_oob_prefix, | |||
| char * | unauth_oob_prefix, | |||
| struct log_mysql_params * | params | |||
| ) | [static] |
Definition at line 385 of file mysql.c.
References connection_t::app_name, create_log_prefix(), tracking_t::daddr, tracking_t::dest, generate_appname(), generate_osname(), connection_t::iface_nfo, iface_nfo_t::indev, INSERT_REQUEST_FIELDS_SIZE, INSERT_REQUEST_VALUES_SIZE, IPV6_SQL_STRLEN, ipv6_to_sql(), log_mysql_params::mysql_table_name, connection_t::os_release, connection_t::os_sysname, connection_t::os_version, iface_nfo_t::outdev, tracking_t::protocol, quote_string(), REQUEST_TMP_BUFFER, tracking_t::saddr, secure_snprintf(), tracking_t::source, connection_t::tracking, and connection_t::username.
Referenced by log_state_drop(), and log_state_open().
Here is the call graph for this function:

| char* create_log_prefix | ( | int | prefix_version, | |
| const char * | oob_sufix, | |||
| connection_t * | element | |||
| ) |
Definition at line 352 of file mysql.c.
References connection_t::log_prefix, and PREFIX_VERSION_ORIG.
Referenced by build_insert_request().
| nu_error_t destroy_user_connections | ( | user_session_t * | c_session, | |
| session_state_t | state, | |||
| gpointer | params_p | |||
| ) |
Destroy all users connections when session terminate
Definition at line 923 of file mysql.c.
References user_session_t::addr, AUTH_CONN_DESTROY, build_conntrack_msg_from_mysql(), CONN_SELECT_FIELDS, DEBUG_AREA_MAIN, get_mysql_handler(), get_nufw_session(), limited_connection::gwaddr, IPV6_SQL_STRLEN, ipv6_to_sql(), log_message, LONG_REQUEST_SIZE, mysql_close_current(), log_mysql_params::mysql_table_name, NU_EXIT_ERROR, NU_EXIT_OK, secure_snprintf(), send_conntrack_message(), and user_session_t::user_name.
Referenced by user_session_logs().
Here is the call graph for this function:

| const gchar* g_module_check_init | ( | GModule * | module | ) |
| void g_module_unload | ( | GModule * | module | ) |
| static gchar* generate_appname | ( | gchar * | appname | ) | [static] |
Definition at line 329 of file mysql.c.
References APPNAME_MAX_SIZE.
Referenced by build_insert_request().
| static gchar* generate_osname | ( | gchar * | Name, | |
| gchar * | Version, | |||
| gchar * | Release | |||
| ) | [static] |
Definition at line 317 of file mysql.c.
References OSNAME_MAX_SIZE.
Referenced by build_insert_request(), and pgsql_insert().
| static MYSQL * get_mysql_handler | ( | struct log_mysql_params * | params | ) | [static] |
Definition at line 792 of file mysql.c.
References DEBUG_AREA_MAIN, log_message, mysql_conn_init(), and log_mysql_params::mysql_priv.
Here is the call graph for this function:

| G_MODULE_EXPORT gboolean init_module_from_conf | ( | module_t * | module | ) |
Definition at line 196 of file mysql.c.
References DEBUG, DEBUG_AREA_MAIN, module_t::hook, log_mysql_params::hook, log_message, MOD_LOG_SESSION, log_mysql_params::mysql_admin_bofh, log_mysql_params::mysql_bofh_victim_group, mysql_close_open_user_sessions(), MYSQL_DB_NAME, log_mysql_params::mysql_db_name, MYSQL_PASSWD, log_mysql_params::mysql_passwd, log_mysql_params::mysql_prefix_version, log_mysql_params::mysql_priv, MYSQL_REQUEST_TIMEOUT, log_mysql_params::mysql_request_timeout, MYSQL_SERVER, log_mysql_params::mysql_server, MYSQL_SERVER_PORT, log_mysql_params::mysql_server_port, MYSQL_SSL_CA, log_mysql_params::mysql_ssl_ca, MYSQL_SSL_CAPATH, log_mysql_params::mysql_ssl_capath, MYSQL_SSL_CERTFILE, log_mysql_params::mysql_ssl_certfile, MYSQL_SSL_CIPHER, log_mysql_params::mysql_ssl_cipher, MYSQL_SSL_KEYFILE, log_mysql_params::mysql_ssl_keyfile, MYSQL_TABLE_NAME, log_mysql_params::mysql_table_name, MYSQL_USE_IPV4_SCHEMA, log_mysql_params::mysql_use_ipv4_schema, MYSQL_USE_SSL, log_mysql_params::mysql_use_ssl, MYSQL_USER, log_mysql_params::mysql_user, MYSQL_USERS_TABLE_NAME, log_mysql_params::mysql_users_table_name, nuauth_is_reloading(), nuauthconf, nubase_config_table_get_or_default(), nubase_config_table_get_or_default_int(), module_t::params, PREFIX_VERSION_NULOG2, nuauth_params::single_user_client_limit, and TRUE.
Here is the call graph for this function:

| static int log_state_close | ( | MYSQL * | ld, | |
| struct accounted_connection * | element, | |||
| struct log_mysql_params * | params | |||
| ) | [inline, static] |
Definition at line 686 of file mysql.c.
References accounted_connection::bytes_in, accounted_connection::bytes_out, tracking_t::daddr, DEBUG_AREA_MAIN, debug_log_message, IPV6_SQL_STRLEN, ipv6_to_sql(), log_message, LONG_REQUEST_SIZE, mysql_close_current(), accounted_connection::packets_in, accounted_connection::packets_out, tracking_t::saddr, secure_snprintf(), TCP_STATE_CLOSE, TCP_STATE_ESTABLISHED, TCP_STATE_OPEN, accounted_connection::timestamp, and accounted_connection::tracking.
Referenced by user_packet_logs().
Here is the call graph for this function:

| static int log_state_drop | ( | MYSQL * | ld, | |
| connection_t * | element, | |||
| struct log_mysql_params * | params | |||
| ) | [static] |
Definition at line 761 of file mysql.c.
References build_insert_request(), DEBUG_AREA_MAIN, log_message, mysql_close_current(), and TCP_STATE_DROP.
Referenced by user_packet_logs().
Here is the call graph for this function:

| static int log_state_established | ( | MYSQL * | ld, | |
| struct accounted_connection * | element, | |||
| struct log_mysql_params * | params | |||
| ) | [inline, static] |
Definition at line 621 of file mysql.c.
References tracking_t::daddr, DEBUG, DEBUG_AREA_MAIN, debug_log_message, IPV6_SQL_STRLEN, ipv6_to_sql(), log_message, LONG_REQUEST_SIZE, mysql_close_current(), tracking_t::saddr, secure_snprintf(), TCP_STATE_ESTABLISHED, TCP_STATE_OPEN, accounted_connection::timestamp, and accounted_connection::tracking.
Referenced by user_packet_logs().
Here is the call graph for this function:

| static int log_state_open | ( | MYSQL * | ld, | |
| connection_t * | element, | |||
| struct log_mysql_params * | params | |||
| ) | [inline, static] |
Definition at line 549 of file mysql.c.
References ACL_FLAGS_STRICT, build_insert_request(), DEBUG_AREA_MAIN, connection_t::flags, IPV6_SQL_STRLEN, ipv6_to_sql(), log_message, nuauth_params::log_users_strict, mysql_close_current(), nuauthconf, tracking_t::protocol, tracking_t::saddr, secure_snprintf(), SHORT_REQUEST_SIZE, TCP_STATE_CLOSE, TCP_STATE_OPEN, connection_t::timestamp, and connection_t::tracking.
Referenced by user_packet_logs().
Here is the call graph for this function:

| static nu_error_t mysql_close_current | ( | struct log_mysql_params * | params | ) | [static] |
Definition at line 112 of file mysql.c.
References get_mysql_handler(), log_mysql_params::mysql_priv, and NU_EXIT_OK.
Here is the call graph for this function:

| static nu_error_t mysql_close_open_user_sessions | ( | struct log_mysql_params * | params | ) | [static] |
Close all open user sessions.
Definition at line 158 of file mysql.c.
References DEBUG_AREA_MAIN, log_message, LONG_REQUEST_SIZE, mysql_conn_init(), log_mysql_params::mysql_users_table_name, NU_EXIT_ERROR, NU_EXIT_OK, and secure_snprintf().
Referenced by init_module_from_conf(), and unload_module_with_params().
Here is the call graph for this function:

| static MYSQL * mysql_conn_init | ( | struct log_mysql_params * | params | ) | [static] |
Definition at line 260 of file mysql.c.
References DEBUG_AREA_MAIN, log_message, mysql_conn_list, log_mysql_params::mysql_db_name, log_mysql_params::mysql_passwd, log_mysql_params::mysql_server, log_mysql_params::mysql_server_port, log_mysql_params::mysql_ssl_ca, log_mysql_params::mysql_ssl_capath, log_mysql_params::mysql_ssl_certfile, log_mysql_params::mysql_ssl_cipher, log_mysql_params::mysql_ssl_keyfile, log_mysql_params::mysql_use_ssl, and log_mysql_params::mysql_user.
| static char* quote_string | ( | MYSQL * | mysql, | |
| char * | text | |||
| ) | [static] |
| G_MODULE_EXPORT gchar* unload_module_with_params | ( | gpointer | params_p | ) |
Definition at line 122 of file mysql.c.
References DEBUG_AREA_MAIN, log_message, MOD_LOG_SESSION, mysql_close_open_user_sessions(), NU_EXIT_OK, and nuauth_is_reloading().
Here is the call graph for this function:

| G_MODULE_EXPORT gint user_packet_logs | ( | void * | element, | |
| tcp_state_t | state, | |||
| gpointer | params_p | |||
| ) |
User packet logging.
This function is exported by the module and called by nuauth core when a packet needs to be logged
| element | A pointer to a connection_t containing all information about the packet to be logged | |
| state | A tcp_state_t that indicate the state of the packet | |
| params_p | A pointer to the parameters of the module instance we're working for |
Definition at line 821 of file mysql.c.
References get_mysql_handler(), log_state_close(), log_state_drop(), log_state_established(), log_state_open(), TCP_STATE_CLOSE, TCP_STATE_DROP, TCP_STATE_ESTABLISHED, and TCP_STATE_OPEN.
Here is the call graph for this function:

| G_MODULE_EXPORT int user_session_logs | ( | user_session_t * | c_session, | |
| session_state_t | state, | |||
| gpointer | params_p | |||
| ) |
User session logging.
This function is exported by the module and called by nuauth core when a user connect or disconnect
| c_session | A pointer to a user_session_t containing all information about the user | |
| state | A session_state_t that indicate the state of the user session (basically starting or ending) | |
| params_p | A pointer to the parameters of the module instance we're working for |
Definition at line 1011 of file mysql.c.
References user_session_t::addr, DEBUG_AREA_MAIN, destroy_user_connections(), get_mysql_handler(), user_session_t::groups, IPV6_SQL_STRLEN, ipv6_to_sql(), log_message, LONG_REQUEST_SIZE, log_mysql_params::mysql_admin_bofh, log_mysql_params::mysql_bofh_victim_group, mysql_close_current(), log_mysql_params::mysql_users_table_name, NU_EXIT_ERROR, quote_string(), user_session_t::release, secure_snprintf(), SESSION_CLOSE, SESSION_OPEN, user_session_t::socket, user_session_t::sysname, user_session_t::user_id, user_session_t::user_name, and user_session_t::version.
Here is the call graph for this function:

1.4.7