Transferring security events to file or Kafka#
In Blitz Identity Provider, you can configure the logging of security events to one or more receivers. The configuration is set in the blitz.prod.local.idp.audit
configuration block.
The following settings must be configured:
emitters
- defines the list of receivers of audit records. For each receiver the settings block is filled in:type
- receiver type. Possible values:audit-store
- the record is made in the DBMS;log
- the record is made to the logger with the nameAUDIT
.
enabled
- optional setting - determines whether the receiver is enabled or not;include
- optional setting - lists the types of security events (see the table below), which are used to write to the receiver. If the setting is not specified, all security events are written;exclude
- optional setting - lists the types of security events (see table below) that should not be written to the receiver. If the setting is not specified, no events are excluded. If the setting is specified together withinclude
, the list of events is first defined by theinclude
setting, and then the events specified inexclude
are excluded from it. It is recommended not to use bothinclude
andexclude
settings together, but to use only one of them;logger
- optional setting - specified only for the receiver withlog
type. Allows you to define the name of the logger. If the setting is not specified, the recording is made to the logger with the nameAUDIT
;name
- optional setting - specified for receivers with typeslog
andkafka
. Specifies the name of the receiver, since multiple receivers can be configured for these receiver types. If the setting is not specified,log
andkafka
are used as receiver names;bootstrapServers
- a mandatory setting for a receiver with typekafka
- specifies a list of addresses for initial connection to the Kafka cluster;topic
- mandatory setting for receiver with typekafka
- the name of the Kafka topic to which the event should be sent;securityProtocol
- optional setting for receiver with typekafka
- in case of using SASL connection may not be specified. In case of connection via SSL, the valueSSL
must be specified in the setting. If TLS is not configured in Kafka, the valueSASL_PLAINTEXT
must be specified;sasl
- optional configuration block for receiver with typekafka
- specifies connection parameters when using SASL authentication to connect to Kafka:jaasConfig
is a connection string that can use the substitution parameters fromsecureParams
;mechanism
is the value ofPLAIN
;secureParams
- block with parameters that will be encrypted in the configuration file when the server is started.
Block example:
"sasl": { "jaasConfig": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"alice\" password=\"${pswd}\";", "mechanism": "PLAIN", "secureParams": { "pswd": "Content will be encrypted at startup", } }
ssl
- optional configuration block for receiver with typekafka
- sets SSL parameters for connection to Kafka:enabledProtocols
- lines with the list of enabled protocols;keyStore
is a settings block with parameters for accessing Blitz Identity Provider key container. It containstype
,path
,password
settings;trustedStore
- settings block with parameters of access to the container with trusted certificates. It containstype
,path
,password
settings;keyPassword
- optional setting - the password to access the key.
Block example:
"securityProtocol" : "SSL", "ssl" : { "enabledProtocols" : ["TLSv1.2,TLSv1.3"], "keyStore" : { "password" : "CHANGE-ME", "path" : "/etc/blitz-config/bip-d1app01-1.jks", "type" : "JKS" }, "trustedStore" : { "password" : "CHANGE-ME", "path" : "/etc/blitz-config/ca.jks", "type" : "JKS" }, "keyPassword": "CHANGE-ME" },
tuning
- optional settings block for a receiver with typekafka
- specifies optionalproducer
settings for interaction with Kafka. Parameter names must be specified with a dot as in the Kafka documentation.
Block example:
"tuning": { "client.id": "BlitzKafka" }
emitAtLeastOneOf
- optional setting - the list of receivers is specified, it is enough to record events in any of them for the operation to be considered successful;emitToAllOf
- optional setting - specifies the list of receivers that must receive confirmation of successful event recording for the operation to be considered successful. If theemitAtLeastOneOf
andemitToAllOf
settings are not specified, then confirmation from all configured receivers is mandatory;emitTimeoutInSec
- optional setting - defines the maximum response time from the receiver in response to event record requests. If the setting is not specified, the wait is 60 seconds.
Example of audit recording settings in log, DBMS and Kafka at the same time:
"audit": { "emitters": [ { "type": "log", "name": "users-log", "enabled": true, "logger": "AUDIT", "exclude": ["admin_added", "admin_pswd_changed", "admin_removed", "admin_roles_changed", "config_changed"] }, { "type": "log", "name": "admins-log", "enabled": true, "logger": "AUDITADMIN", "include": ["admin_added", "admin_pswd_changed", "admin_removed", "admin_roles_changed", "config_changed"] }, { "type": "audit-store", "enabled": true }, { "type" : "kafka", "enabled": true, "name" : "kafka", "include": ["login"], "bootstrapServers" : ["infra-kfk01:9443"], "topic" : "blitz_audit", "securityProtocol" : "SSL", "ssl" : { "enabledProtocols" : ["TLSv1.2,TLSv1.3"], "keyStore" : { "password" : "CHANGE-ME", "path" : "/etc/blitz-config/bip-app01.jks", "type" : "JKS" }, "trustedStore" : { "password" : "CHANGE-ME", "path" : "/etc/blitz-config/ca.jks", "type" : "JKS" } }, } ], "emitAtLeastOneOf": ["users-log","admins-log","kafka"], "emitToAllOf": ["audit-store"], "emitTimeoutInSec": 30 }
When logging an audit to the logger, you can configure the logger using the logback.xml
configuration file (see for more information <https://logback.qos.ch/documentation.html>`__). Example of configuring the ``AUDIT
logger in the logback.xml
configuration file:
…
<appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${dir.logs}/audit-${app.name}.log</file>
<encoder>
<pattern>%date - [%level] -[%file:%line] - %message%n%xException{20}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${dir.logs}/archive/audit-${app.name}.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
<maxHistory>90</maxHistory>
<totalSizeCap>5GB</totalSizeCap>
</rollingPolicy>
</appender>
<logger name="AUDIT" additivity="false">
<appender-ref ref="AUDIT" />
</logger>
…
Example of a log entry:
2023-11-20 13:29:47,170 - [INFO] -[LoggerEventEmitterDriver.scala:37] - {"ip_st":"Tashkent","ip":"213.230.116.179","authnDone":"true","process_id":"b80ca03e-4718-44ff-9456-7d4255610eaa","ip_ctr":"Узбекистан","type":"login","object_id":"BIP-123456","protocol":"oAuth","subject_id":"BIP-123456","auth_methods":"cls:password","session_id":"f8d85ba2-a26a-447f-b82e-944b9218abb8","timestamp":1700476187069,"ch_platform_version":"\"14.1.0\"","ch_platform":"\"macOS\"","ip_ct":"Tashkent","id_store":"ldap01","ip_lng":"69.2494","ip_rad":"5","ch_ua":"\"Google Chrome\";v=\"119\", \"Chromium\";v=\"119\", \"Not?A_Brand\";v=\"24\"","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","lp_id":"test-system","id":"6056828858453673-600312119","ip_lat":"41.3171","client_auth_method":"redirectUri"}
Possible types of security events:
admin_added
- administrator addedadmin_pswd_changed
- administrator password changedadmin_removed
- administrator removedadmin_roles_changed
- administrator roles changedapp_password_changed
- the password for the application is setattribute_changed
- attribute added, changed or deletedattribute_confirmed
- attribute confirmedauth
- authentication performed (with OAuth 2.0 Resource Owner Password Credentials)auth_failed
- authentication errorauth_req
- authentication requestauthz_granted
- OAuth authorization issuedauthz_rejected
- OAuth authorization deniedauthz_revoked
- OAuth authorization revokedbind_ext_account
- account is bound to an external accountconfig_changed
- changed configuration settingsduo_put
- Duo Mobile app is boundduo_remove
- Duo Mobile application is unboundgrant_right
- assigning access rightsgroup_attr_changed
- user group’s attribute has been changed or deletedgroup_registered
- user group createdgroup_removed
- user group deletedhotp_attached
- HOTP generator is boundhotp_detached
- HOTP generator is unboundinternal_user_deleted
- account deletedlocked_methods_changed
- changed the list of blocked authentication methodslogin
- login is performedlogin_failed
- login errorlogin_stopped
- unsuccessful loginlogout
- user is logged outlogout_req
- logout requestmember_added
- the user is joined to the user groupmember_removed
- user excluded from the user groupneeded_password_change
- flag of password change necessity is setrecovery
- account access restoredrecovery_fail
- access recovery failedrecovery_req
- access recovery is requestregistration
- account is registeredregistration_req
- registration is requestrequired_factor_changed
- changed user authentication modereset_user_password
- password set by administratorreset_user_sessions
– log out devices (reset sessions)revoke_right
- revoke access rightssend_email_code
- confirmation code sent to emailsend_push_code
- confirmation code sent to Pushsend_sms_code
- confirmation code sent by SMStoken_exchange_failed
- access token exchange deniedtoken_exchanged
- access token has been exchangedtoken_granted
- access token issuedtotp_attached
- TOTP generator is boundtotp_detached
- TOTP generator is unboundunbind_ext_account
- account is unbound from external accountuser_locked
- account lockeduser_password_changed
- user password changeduser_sec_qsn_changed
– security question changeduser_sec_qsn_removed
– security question removeduser_unlocked
- account unlockedweb_authn_reg_key
- security key addedweb_authn_revoke_key
- security key removed
The set of record attributes may vary depending on the type of security event and the specifics of the login process. Attribute assignments in the audit record are shown in the table below:
Assigning attributes to an audit record
Attribute |
Purpose and possible meanings |
---|---|
|
Security event log entry identifier |
|
Security event type |
|
The reason why the user was asked to change the password. Possible values:
|
|
Installed, deleted or modified attribute name |
|
Contains a list of authentication methods passed by the user. Possible values:
The presence of the prefix |
|
Authenticator application (when logging in by QR code) |
|
Whether authentication was performed at this login |
|
An indication that a CAPTCHA was asked when logging in |
client_auth_method |
A method for authenticating the application that invoked Blitz Identity Provider applications:
|
|
Dynamic |
|
device ID |
deviceFingerprint |
Device imprint |
|
Device type (for dynamic registration) |
|
E-mail address |
|
The type of interface used to register the user:
|
|
Error (for unsuccessful events) |
|
External account ID |
|
Name of the external identity provider |
|
Type of External Identity Provider |
|
Indicates which authentication method the user was unable to pass |
|
User group identifier |
|
User Group Usage Profile Identifier |
|
User profile storage |
|
user IP address |
|
Country according to IP address |
|
Region according to IP address |
|
City according to IP address |
|
Latitude according to IP address |
|
Longitude according to IP address |
|
Surrounding by IP address |
|
The identifier of the application ( |
|
Mobile phone number |
|
Identifier of the modified setting block |
|
New value of the installed or modified attribute |
|
New value of the attribute indicating the necessity to verify the second authentication factor |
|
Roles added to the administrator account |
|
List of authorizations granted or revoked by the user |
|
Identifier of the operation object (user for which the operation was performed) |
|
Previous value of the deleted or modified attribute |
|
Previous value of the attribute indicating the need to verify the second authentication factor |
|
Roles revoked from the administrator account |
|
Identifier of the application that initiated user registration or password recovery |
|
Process ID |
|
The protocol for the application to communicate with Blitz Identity Provider. Possible values:
|
|
An indication that a password change was recommended |
|
An indication that there was a temporary lockdown |
|
The contact (email or cell phone number) specified during recovery |
|
Password recovery type: |
|
Name of access right |
|
Administrator account roles |
|
Unique identifier of the user session. Allows you to correlate all user events performed by the user within a common user session |
|
Identifier of the subject of the operation (the user who invoked the operation) |
|
Tag of assigned or revoked access right |
|
The date and time of the event. For example, |
|
An indication that a login attempt was made with a password from the saved password history (previous password) |
|
Login used at sign in |
|
User device data ( |
|
Security key identifier |
|
Security key name |
|
Entry delay was enabled |