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 namelogback.
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 theincludesetting, and then the events specified inexcludeare excluded from it. It is recommended not to use bothincludeandexcludesettings together, but to use only one of them;logger- optional setting - specified only for the receiver withlogtype. 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 typeslogandkafka. Specifies the name of the receiver, since multiple receivers can be configured for these receiver types. If the setting is not specified,logandkafkaare 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 valueSSLmust be specified in the setting. If TLS is not configured in Kafka, the valueSASL_PLAINTEXTmust be specified;sasl- optional configuration block for receiver with typekafka- specifies connection parameters when using SASL authentication to connect to Kafka:jaasConfigis a connection string that can use the substitution parameters fromsecureParams;mechanismis 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;keyStoreis a settings block with parameters for accessing Blitz Identity Provider key container. It containstype,path,passwordsettings;trustedStore- settings block with parameters of access to the container with trusted certificates. It containstype,path,passwordsettings;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 optionalproducersettings 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 theemitAtLeastOneOfandemitToAllOfsettings 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"}
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 |
|
A method for authenticating the application that invoked Blitz Identity Provider applications:
|
|
Dynamic |
|
device ID |
|
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 |