Este conteúdo não está disponível no idioma selecionado.
Chapter 17. Configuring subsystem logs
The Certificate System subsystems create log files that record events related to activities, such as administration, communications using any of the protocols the server supports, and various other processes employed by the subsystems. While a subsystem instance is running, it keeps a log of information and error messages on all the components it manages. Additionally, the Apache and Tomcat web servers generate error and access logs.
Each subsystem instance maintains its own log files for installation, audit, and other logged functions.
Log plug-in modules are listeners which are implemented as Java™ classes and are registered in the configuration framework.
All the log files and rotated log files, except for audit logs, are located in whatever directory was specified in pki_subsystem_log_path
when the instance was created with pkispawn
.
Regular audit logs are located in the log directory with other types of logs, while signed audit logs are written to /var/log/pki/ instance_name/subsystem_name/signedAudit
. You can change the default location for logs by modifying the configuration.
17.1. About logs
Certificate System subsystems keep several different kinds of logs, which provide specific information depending on the type of subsystem, types of services, and individual log settings. The kinds of logs that can be kept for an instance depend on the kind of subsystem that it is.
17.1.1. Signed audit logs
The Certificate System maintains audit logs for all events, such as requesting, issuing and revoking certificates and publishing CRLs. These logs are then signed. This allows authorized access or activity to be detected. An outside auditor can then audit the system if required.
The assigned auditor user account is the only account which can view the signed audit logs. This user’s certificate is used to sign and encrypt the logs.
Audit logging is configured to specify the events that are logged.
Signed audit logs are written to /var/log/pki/instance_name/subsystem_name/signedAudit
. However, the default location for logs can be changed by modifying the configuration.
For more information, see ref: Section 17.3.2, “Using signed audit logs”.
17.1.2. Debug logs
Debug logs, which are enabled by default, are maintained for all subsystems, with varying degrees and types of information.
Debug logs contain very specific information for every operation performed by the subsystem, including plug-ins and servlets which are run, connection information, and server request and response messages.
The general types of services which are recorded to the debug log are briefly discussed in Section 17.2.1.1, “Services that are logged”. These services include authorization requests, processing certificate requests, certificate status checks, and archiving and recovering keys, and access to web services.
The debug logs for the CA, OCSP, KRA, and TKS record detailed information about the processes for the subsystem. Each log entry has the following format:
[date:time] [processor]: servlet: message
The message can be a return message from the subsystem or contain values submitted to the subsystem.
For example, the TKS records this message for connecting to an LDAP server:
[10/Jun/{YEAR}:05:14:51][main]: Established LDAP connection using basic authentication to host localhost port 389 as cn=Directory Manager
The processor is main
, and the message is the message from the server about the LDAP connection, and there is no servlet.
The CA, on the other hand, records information about certificate operations as well as subsystem connections:
[06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.requestowner$ value=KRA-server.example.com-8443
In this case, the processor is the HTTP protocol over the CA’s agent port, while it specifies the servlet for handling profiles and contains a message giving a profile parameter (the subsystem owner of a request) and its value (that the KRA initiated the request).
Example 17.1. CA certificate request log messages
[06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.profileapprovedby$ value=admin [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.cert_request$ value=MIIBozCCAZ8wggEFAgQqTfoHMIHHgAECpQ4wDDEKMAgGA1UEAxMBeKaBnzANBgkqhkiG9w0BAQEFAAOB... [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.profile$ value=true [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.cert_request_type$ value=crmf [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.requestversion$ value=1.0.0 [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.req_locale$ value=en [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.requestowner$ value=KRA-server.example.com-8443 [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.dbstatus$ value=NOT_UPDATED [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.subject$ value=uid=jsmith, e=jsmith@example.com [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.requeststatus$ value=begin [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.auth_token.user$ value=uid=KRA-server.example.com-8443,ou=People,dc=example,dc=com [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.req_key$ value=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDreuEsBWq9WuZ2MaBwtNYxvkLP^M HcN0cusY7gxLzB+XwQ/VsWEoObGldg6WwJPOcBdvLiKKfC605wFdynbEgKs0fChV^M k9HYDhmJ8hX6+PaquiHJSVNhsv5tOshZkCfMBbyxwrKd8yZ5G5I+2gE9PUznxJaM^M HTmlOqm4HwFxzy0RRQIDAQAB [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.auth_token.authmgrinstname$ value=raCertAuth [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.auth_token.uid$ value=KRA-server.example.com-8443 [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.auth_token.userid$ value=KRA-server.example.com-8443 [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.requestor_name$ value= [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.profileid$ value=caUserCert [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.auth_token.userdn$ value=uid=KRA-server.example.com-4747,ou=People,dc=example,dc=com [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.requestid$ value=20 [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.auth_token.authtime$ value=1212782378071 [06/Jun/{YEAR}:14:59:38][http-8443;-Processor24]: ProfileSubmitServlet: key=$request.req_x509info$ value=MIICIKADAgECAgEAMA0GCSqGSIb3DQEBBQUAMEAxHjAcBgNVBAoTFVJlZGJ1ZGNv^M bXB1dGVyIERvbWFpbjEeMBwGA1UEAxMVQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4X^M DTA4MDYwNjE5NTkzOFoXDTA4MTIwMzE5NTkzOFowOzEhMB8GCSqGSIb3DQEJARYS^M anNtaXRoQGV4YW1wbGUuY29tMRYwFAYKCZImiZPyLGQBARMGanNtaXRoMIGfMA0G^M CSqGSIb3DQEBAQUAA4GNADCBiQKBgQDreuEsBWq9WuZ2MaBwtNYxvkLPHcN0cusY^M 7gxLzB+XwQ/VsWEoObGldg6WwJPOcBdvLiKKfC605wFdynbEgKs0fChVk9HYDhmJ^M 8hX6+PaquiHJSVNhsv5tOshZkCfMBbyxwrKd8yZ5G5I+2gE9PUznxJaMHTmlOqm4^M HwFxzy0RRQIDAQABo4HFMIHCMB8GA1UdIwQYMBaAFG8gWeOJIMt+aO8VuQTMzPBU^M 78k8MEoGCCsGAQUFBwEBBD4wPDA6BggrBgEFBQcwAYYuaHR0cDovL3Rlc3Q0LnJl^M ZGJ1ZGNvbXB1dGVyLmxvY2FsOjkwODAvY2Evb2NzcDAOBgNVHQ8BAf8EBAMCBeAw^M HQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMEMCQGA1UdEQQdMBuBGSRyZXF1^M ZXN0LnJlcXVlc3Rvcl9lbWFpbCQ=
Likewise, the OCSP shows OCSP request information:
[07/Jul/{YEAR}:06:25:40][http-11180-Processor25]: OCSPServlet: OCSP Request: [07/Jul/{YEAR}:06:25:40][http-11180-Processor25]: OCSPServlet: MEUwQwIBADA+MDwwOjAJBgUrDgMCGgUABBSEWjCarLE6/BiSiENSsV9kHjqB3QQU
17.1.2.1. Installation logs
All subsystems keep an install log.
Every time a subsystem is created either through the initial installation or creating additional instances with pkispawn
, an installation file with the complete debug output from the installation, including any errors and, if the installation is successful, the URL and PIN to the configuration interface for the instance. The file is created in the /var/log/pki/
directory for the instance with a name in the form pki-subsystem_name-spawn.timestamp.log
.
Each line in the install log follows a step in the installation process.
Example 17.2. CA install log
... 2015-07-22 20:43:13 pkispawn : INFO ... finalizing 'pki.server.deployment.scriptlets.finalization' 2015-07-22 20:43:13 pkispawn : INFO ....... cp -p /etc/sysconfig/pki/tomcat/pki-tomcat/ca/deployment.cfg /var/log/pki/pki-tomcat/ca/archive/spawn_deployment.cfg.20150722204136 2015-07-22 20:43:13 pkispawn : DEBUG ........... chmod 660 /var/log/pki/pki-tomcat/ca/archive/spawn_deployment.cfg.20150722204136 2015-07-22 20:43:13 pkispawn : DEBUG ........... chown 26445:26445 /var/log/pki/pki-tomcat/ca/archive/spawn_deployment.cfg.20150722204136 2015-07-22 20:43:13 pkispawn : INFO ....... generating manifest file called '/etc/sysconfig/pki/tomcat/pki-tomcat/ca/manifest' 2015-07-22 20:43:13 pkispawn : INFO ....... cp -p /etc/sysconfig/pki/tomcat/pki-tomcat/ca/manifest /var/log/pki/pki-tomcat/ca/archive/spawn_manifest.20150722204136 2015-07-22 20:43:13 pkispawn : DEBUG ........... chmod 660 /var/log/pki/pki-tomcat/ca/archive/spawn_manifest.20150722204136 2015-07-22 20:43:13 pkispawn : DEBUG ........... chown 26445:26445 /var/log/pki/pki-tomcat/ca/archive/spawn_manifest.20150722204136 2015-07-22 20:43:13 pkispawn : INFO ....... executing 'systemctl enable pki-tomcatd.target' 2015-07-22 20:43:13 pkispawn : INFO ....... executing 'systemctl daemon-reload' 2015-07-22 20:43:13 pkispawn : INFO ....... executing 'systemctl restart pki-tomcatd@pki-tomcat.service' 2015-07-22 20:43:14 pkispawn : INFO END spawning subsystem 'CA' of instance 'pki-tomcat' 2015-07-22 20:43:14 pkispawn : DEBUG
17.1.2.2. Tomcat error and access logs
The CA, KRA, OCSP, TKS, and TPS subsystems use a Tomcat web server instance for their agent and end-entities' interfaces.
Error and access logs are created by the Tomcat web server, which are installed with the Certificate System and provide HTTP services. The error log contains the HTTP error messages the server has encountered. The access log lists access activity through the HTTP interface.
Logs created by Tomcat:
- admin.timestamp
- catalina.timestamp
- catalina.out
- host-manager.timestamp
- localhost.timestamp
- localhost_access_log.timestamp
- manager.timestamp
These logs are not available or configurable within the Certificate System; they are only configurable within Apache or Tomcat. See the Apache documentation for information about configuring these logs.
17.1.2.3. Self-tests log
The self-tests log records information obtained during the self-tests run when the server starts or when the self-tests are manually run. The tests can be viewed by opening this log. This log is not configurable through the Console, it can only be configured by changing settings in the CS.cfg
file. For instruction on how to configure logs by editing the CS.cfg
file, see the Enabling the Publishing Queue section in the Red Hat Certificate System Planning, Installation, and Deployment Guide.
The information about logs in this section does not pertain to this log. See Section 15.8, “Running self-tests” for more information about self-tests.
17.2. Managing logs
The Certificate System subsystem log files record events related to operations within that specific subsystem instance. For each subsystem, different logs are kept for issues such as installation, access, and web servers.
All subsystems have similar log configuration, options, and administrative paths.
17.2.1. An overview of log settings
The way that logs are configured can affect Certificate System performance. For example, log file rotation keeps logs from becoming too large, which slows down subsystem performance. This section explains the different kinds of logs recorded by Certificate System subsystems and covers important concepts such as log file rotation, buffered logging, and available log levels.
17.2.1.1. Services that are logged
All major components and protocols of Certificate System log messages to log files. The following table lists services that are logged by default. To view messages logged by a specific service, customize log settings accordingly. For details, see Section 17.3.1, “Viewing logs in the console”.
Service | Description |
---|---|
ACLs | Logs events related to access control lists. |
Administration | Logs events related to administration activities, such as HTTPS communication between the Console and the instance. |
All | Logs events related to all the services. |
Authentication | Logs events related to activity with the authentication module. |
Certificate Authority | Logs events related to the Certificate Manager. |
Database | Logs events related to activity with the internal database. |
HTTP | Logs events related to the HTTP activity of the server. Note that HTTP events are actually logged to the errors log belonging to the Apache server incorporated with the Certificate System to provide HTTP services. |
Key Recovery Authority | Logs events related to the KRA. |
LDAP | Logs events related to activity with the LDAP directory, which is used for publishing certificates and CRLs. |
OCSP | Logs events related to OCSP, such as OCSP status GET requests. |
Others | Logs events related to other activities, such as command-line utilities and other processes. |
Request Queue | Logs events related to the request queue activity. |
User and Group | Logs events related to users and groups of the instance. |
17.2.1.2. Log levels (message categories)
The different events logged by Certificate System services are determined by the log levels, which makes identifying and filtering events simpler. The different Certificate System log levels are listed in the following table.
Log levels are represented by numbers indicating how detailed the level of logging to be performed by the server should be.
A higher priority level means less detail because only events of high priority are logged.
Log level | Message category | Description |
---|---|---|
0-1 | Tracing | These messages contain finer-grained debugging information. This level should not be used regularly because it may impact the performance. |
2-5 | Debugging | These messages contain debugging information. This level is not recommended for regular use because it generates too much information. |
6-10 | Informational | These messages provide general information about the state of the Certificate System, including status messages such as Certificate System initialization complete and Request for operation succeeded. |
11-15 | Warning | These messages are warnings only and do not indicate any failure in the normal operation of the server. |
>15 | Failure | These messages indicate errors and failures that prevent the server from operating normally, including failures to perform a certificate service operation (User authentication failed or Certificate revoked) and unexpected situations that can cause irrevocable errors (The server cannot send back the request it processed for a client through the same channel the request came from the client). Setting the level above 15 will minimize the logs, as only failures will be recorded. |
Log levels can be used to filter log entries based on the severity of an event. The default log level is 10.
Log data can be extensive, especially at lower (more verbose) logging levels. Make sure that the host machine has sufficient disk space for all the log files. It is also important to define the logging level, log rotation, and server-backup policies appropriately so that all the log files are backed up and the host system does not get overloaded; otherwise, information can be lost.
17.2.1.3. Buffered and unbuffered logging
The Java subsystems support buffered logging for all types of logs. The server can be configured for either buffered or unbuffered logging.
If buffered logging is configured, the server creates buffers for the corresponding logs and holds the messages in the buffers for as long as possible. The server flushes out the messages to the log files only when one of the following conditions occurs:
-
The buffer gets full. The buffer is full when the buffer size is equal to or greater than the value specified by the
bufferSize
configuration parameter. The default value for this parameter is 512 KB. -
The flush interval for the buffer is reached. The flush interval is reached when the time interval since the last buffer flush is equal to or greater than the value specified by the
flushInterval
configuration parameter. The default value for this parameter is 5 seconds. - When current logs are read from Console. The server retrieves the latest log when it is queried for current logs.
If the server is configured for unbuffered logging, the server flushes out messages as they are generated to the log files. Because the server performs an I/O operation (writing to the log file) each time a message is generated, configuring the server for unbuffered logging decreases performance.
Setting log parameters is described in Section 17.2.2, “Configuring logs in the console”.
17.2.1.4. Log file rotation
The subsystem logs have an optional log setting that allows them to be rotated and start a new log file instead of letting log files grow indefinitely. Log files are rotated when either of the following occur:
-
The size limit for the corresponding file is reached. The size of the corresponding log file is equal to or greater than the value specified by the
maxFileSize
configuration parameter. The default value for this parameter is 100 KB. -
The age limit for the corresponding file is reached. The corresponding log file is equal to or older than the interval specified by the
rolloverInterval
configuration parameter. The default value for this parameter is 2592000 seconds (every thirty days).
Setting both these parameters to 0 effectively disables the log file rotation.
When a log file is rotated, the old file is named using the name of the file with an appended time stamp. The appended time stamp is an integer that indicates the date and time the corresponding active log file was rotated. The date and time have the forms YYYYMMDD (year, month, day) and HHMMSS (hour, minute, second).
Log files, especially the audit log file, contain critical information. These files should be periodically archived to some backup medium by copying the entire Java`log` directory to an archive medium.
The Certificate System does not provide any tool or utility for archiving log files.
The Certificate System provides a command-line utility, signtool
, that signs log files before archiving them as a means of tamper detection. For details, see Section 17.2.4.5, “Signing log files”.
Signing log files is an alternative to the signed audit logs feature. Signed audit logs create audit logs that are automatically signed with a subsystem signing certificate. See Section 17.2.4.3, “Configuring a signed audit log in the console” for details about signed audit logs.
Rotated log files are not deleted.
17.2.2. Configuring logs in the console
Logs can be configured through both the subsystem Console and through the subsystem’s Java`CS.cfg` file. Specialized logs, such as signed audit logs and custom logs, can also be created through the Console or configuration file.
Audit logs can be configured through the subsystem Console for the CA, OCSP, TKS, and KRA subsystems. TPS logs are only configured through the configuration file.
- In the navigation tree of the Configuration tab, select Log.
The Log Event Listener Management tab lists the currently configured listeners.
To create a new log instance, click Select Log Event Listener Plug-in Implementation window.
, and select a module plug-in from the list in the- Set or modify the fields in the Log Event Listener Editor window. The different parameters are listed in the below table.
Field | Description |
---|---|
Log Event Listener ID | Gives the unique name that identifies the listener. The names can have any combination of letters (aA to zZ), digits (0 to 9), an underscore (_), and a hyphen (-), but it cannot contain other characters or spaces. |
type | Gives the type of log file. transaction records audit logs. |
enabled |
Sets whether the log is active. Only enabled logs actually record events. The value is either |
level | Sets the log level in the text field. The level must be manually entered in the field; there is no selection menu. The choices are Debug, Information, Warning, Failure, Misconfiguration, Catastrophe, and Security. For more information, see Section 17.2.1.2, “Log levels (message categories)”. |
fileName | Gives the full path, including the file name, to the log file. The subsystem user should have read/write permission to the file. |
bufferSize | Sets the buffer size in kilobytes (KB) for the log. Once the buffer reaches this size, the contents of the buffer are flushed out and copied to the log file. The default size is 512 KB. For more information on buffered logging, see Section 17.2.1.3, “Buffered and unbuffered logging”. |
flushInterval | Sets the amount of time before the contents of the buffer are flushed out and added to the log file. The default interval is 5 seconds. |
maxFileSize | Sets the size, in kilobytes (KB), a log file can become before it is rotated. Once it reaches this size, the file is copied to a rotated file, and the log file is started new. For more information on log file rotation, see Section 17.2.1.4, “Log file rotation”. The default size is 2000 KB. |
rolloverInterval | Sets the frequency for the server to rotate the active log file. The available options are hourly, daily, weekly, monthly, and yearly. The default is monthly. For more information, see Section 17.2.1.4, “Log file rotation”. |
17.2.3. Configuring logs in the CS.cfg file
For instruction on how to configure logs by editing the Java`CS.cfg` file, see the Configuring Logs in the CS.cfg File section in the Red Hat Certificate System Planning, Installation, and Deployment Guide.
17.2.4. Managing audit logs
The audit log contains records for events that have been set up as recordable events. If the logSigning
attribute is set to true
, the audit log is signed with a log signing certificate belonging to the server. This certificate can be used by auditors to verify that the log has not been tampered with.
By default, regular audit logs are located in the Java`/var/log/pki/ instance_name/subsystem_name/` directory with other types of logs, while signed audit logs are written to Java`/var/log/pki/ instance_name/subsystem_name/signedAudit/`. The default location for logs can be changed by modifying the configuration.
The signed audit log creates a log recording system events, and the events are selected from a list of potential events. When enabled, signed audit logs record a verbose set of messages about the selected event activity.
Signed audit logs are configured by default when the instance is first created, but it is possible to configure signed audits logs after installation. (See Section 17.2.4.2, “Enabling signed audit logging after installation”.) It is also possible to edit the configuration or change the signing certificates after configuration, as covered in Section 17.2.4.3, “Configuring a signed audit log in the console”.
17.2.4.1. A list of audit events
For a list of audit events in Certificate System, see Appendix E, Audit events.
17.2.4.2. Enabling signed audit logging after installation
Signed audit logs can be enabled by default when an instance is first created by using the pki_audit_group deployment parameter with the pkispawn
command. If, however, signed audit logs were not configured when an instance was created, they can be enabled afterwards by reassigning ownership of the audit log directory to the auditor system users group, such as pkiaudit
.
Stop the instance:
# pki-server stop instance_name
Set the group ownership of the signed audit log directory to the PKI auditors operating system group, such as
pkiaudit
. This allows the users in the PKI auditors group to have the required read access to the Java`signedAudit` directory to verify the signatures on the log files. No user (except for the Certificate System user account,pkiuser
) should have write access to the log files in this directory.chgrp -R pkiaudit /var/log/pki/ instance_name/subsystem_name/signedAudit
Restart the instance:
# pki-server start instance_name
17.2.4.3. Configuring a signed audit log in the console
Signed audit logs are configured by default when the instance is first created, but it is possible to edit the configuration or change the signing certificates after configuration.
Provide enough space in the file system for the signed audit logs, since they can be large.
A log is set to a signed audit log by setting the logSigning
parameter to enable
and providing the nickname of the certificate used to sign the log. A special log signing certificate is created when the subsystems are first configured.
Only a user with auditor privileges can access and view a signed audit log. Auditors can use the AuditVerify
tool to verify that signed audit logs have not been tampered with.
The signed audit log is created and enabled when the subsystem is configured, but it needs additional configuration to begin creating and signing audit logs.
Open the Console.
NoteTo create or configure the audit log by editing the Java`CS.cfg` file, see the Configuring Logs in the CS.cfg File section in the Red Hat Certificate System Planning, Installation, and Deployment Guide.
- In the navigation tree of the Configuration tab, select Log.
- In the Log Event Listener Management tab, select the SignedAudit entry.
- Click .
There are three fields which must be reset in the Log Event Listener Editor window.
Fill in the signedAuditCertNickname. This is the nickname of the certificate used to sign audit logs. An audit signing certificate is created when the subsystem is configured; it has a nickname like
auditSigningCert cert-instance_name[rep]subsystem_name
.NoteTo get the audit signing certificate nickname, list the certificates in the subsystem’s certificate database using
certutil
. For example:certutil -L -d /var/lib/pki-tomcat/alias Certificate Authority - Example Domain CT,c, subsystemCert cert-pki-tomcat u,u,u Server-Cert cert-pki-tomcat u,u,u auditSigningCert cert-pki-tomcat CA u,u,Pu
-
Set the logSigning field to
true
to enable signed logging. - Set any events which are logged to the audit log. Appendix E, Audit events lists the loggable events. Log events are separated by commas with no spaces.
Set any other settings for the log, such as the file name, the log level, the file size, or the rotation schedule.
NoteBy default, regular audit logs are located in the Java`/var/log/pki/ instance_name/subsystem_name/` directory with other types of logs, while signed audit logs are written to Java`/var/log/pki/ instance_name/subsystem_name/signedAudit/`. The default location for logs can be changed by modifying the configuration.
- Save the log configuration.
After enabling signed audit logging, assign auditor users by creating the user and assigning that entry to the auditor group. Members of the auditor group are the only users who can view and verify the signed audit log. See Section 16.3.2.1, “Creating users” for details about setting up auditors.
Auditors can verify logs by using the AuditVerify
tool. See the AuditVerify(1)
man page for details about using this tool.
17.2.4.4. Handling audit logging failures
There are events that could cause the audit logging function to fail, so events cannot be written to the log. For example, audit logging can fail when the file system containing the audit log file is full or when the file permissions for the log file are accidentally changed. If audit logging fails, the Certificate System instance shuts down in the following manner.
- Servlets are disabled and will not process new requests.
- All pending and new requests are killed.
- The subsystem is shut down.
When this happens, administrators and auditors should work together with the operating system administrator to resolve the disk space or file permission issues. When the IT problem is resolved, the auditor should make sure that the last audit log entries are signed. If not, they should be preserved by manual signing (Section 17.2.4.5, “Signing log files”), archived, and removed to prevent audit verification failures in the future. When this is completed, the administrators can restart the Certificate System.
17.2.4.5. Signing log files
The Certificate System can digitally sign log files before they are archived or distributed for audit purposes. This feature allows files to be checked for tampering.
This is an alternative to the signed audit logs feature. The signed audit log feature creates audit logs that are automatically signed; this tool manually signs archived logs. See Section 17.2.4.3, “Configuring a signed audit log in the console” for details about signed audit logs.
For signing log files, use a command-line utility called the Signing Tool (signtool
). For details about this utility, see http://www.mozilla.org/projects/security/pki/nss/tools/.
The utility uses information in the certificate, key, and security module databases of the subsystem instance.
As a user with auditor privilegesuse the signtool
command to sign the log directories:
signtool -d secdb_dir -k cert_nickname -Z output input
- secdb_dir specifies the path to the directory that contains the certificate, key, and security module databases for the CA.
- cert_nickname specifies the nickname of the certificate to use for signing.
- output specifies the name of the JAR file (a signed zip file).
- input specifies the path to the directory that contains the log files.
17.2.4.6. Filtering audit events
In Certificate System, administrators can set filters to configure which audit events will be logged in the audit file based on the event attributes.
The format of the filters is the same as for LDAP filters. However, Certificate System only supports the following filters:
Type | Format | Example |
---|---|---|
Presence | (attribute=*) | (ReqID=*) |
Equality | (attribute=value) | (Outcome=Failure) |
Substring | (attribute=initial*any*…anyfinal) | (SubjectID=admin) |
| (&(filter_1)(filter_2)…(filter_n)) | (&(SubjectID=admin)(Outcome=Failure)) |
| (|(filter_1)(filter_2)…(filter_n)) | (|(SubjectID=admin)(Outcome=Failure)) |
| (!(filter)) | (!(SubjectID=admin)) |
For further details on LDAP filters, see the Using Compound Search Filters in the Red Hat Directory Server Administration Guide.
Example 17.3. Filtering audit events
To log only failed events for profile certificate requests and events for processed certificates requests that have the InfoName
field set to rejectReadon
or cancelReason
:
Edit the Java`/var/lib/pki/ instance_name/subsystem_type/conf/CS.cfg` file and set the following parameters:
log.instance.SignedAudit.filters.PROFILE_CERT_REQUEST=(Outcome=Failure) log.instance.SignedAudit.filters.CERT_REQUEST_PROCESSED=(|(InfoName=rejectReason)(InfoName=cancelReason))
Restart Certificate System:
# pki-server restart instance_name
17.2.5. Managing log modules
The types of logs that are allowed and their behaviors are configured through log module plug-ins. New logging modules can be created and used to make custom logs.
New log plug-in modules can be registered through the Console. Registering a new module involves specifying the name of the module and the full name of the Java™ class that implements the log interface.
Before registering a plug-in module, put the Java™ class for the module in the Java`classes` directory; the implementation must be on the class path.
To register a log plug-in module with a subsystem instance:
-
Create the custom job class. For this example, the custom log plug-in is called
MyLog.java
. Compile the new class into the lib directory of the instance.
javac -d . /var/lib/pki/pki-tomcat/lib -classpath $CLASSPATH MyLog.java
Create a directory in the CA’s Java`WEB-INF` web directory to hold the custom classes, so that the CA can access them.
mkdir /var/lib/pki/pki-tomcat/webapps/ca/WEB-INF/classes
Set the owner to the Certificate System system user (
pkiuser
).chown -R pkiuser:pkiuser /var/lib/pki/pki-tomcat/lib
Register the plug-in.
- Log into the Console.
- In the Configuration tab, select Logs from the navigation tree. Then select the Log Event Listener Plug-in Registration tab.
Click
.The Register Log Event Listener Plug-in Implementation window appears.
Give the name for the plug-in module and the Java™ class name.
The Java™ class name is the full path to the implementing Java™ class. If this class is part of a package, include the package name. For example, registering a class named
customLog
in a package named Java`com.customplugins`, the class name would becom.customplugins.customLog
.- Click .
Unwanted log plug-in modules can be deleted through the Console. Before deleting a module, delete all the listeners based on this module; see Section 17.2.1.4, “Log file rotation”.
17.3. Using logs
17.3.1. Viewing logs in the console
To troubleshoot the subsystem, check the error or informational messages that the server has logged. Examining the log files can also monitor many aspects of the server’s operation. Some log files can be viewed through the Console. However, the audit log is only accessible by users with the Auditor role, using a method detailed in Section 17.3.2, “Using signed audit logs”.
To view the contents of a log file:
- Log into the Console.
- Select the Status tab.
- Under Logs, select the log to view.
Set the viewing preferences in the Display Options section.
- Entries- The maximum number of entries to be displayed. When this limit is reached, the Certificate System returns any entries that match the search request. Zero (0) means no messages are returned. If the field is blank, the server returns every matching entry, regardless of the number found.
- Source- Select the Certificate System component or service for which log messages are to be displayed. Choosing All means messages logged by all components that log to this file are displayed.
- Level- Select a message category that represents the log level for filtering messages.
- Filename- Select the log file to view.
- Click .
- To view a full entry, double-click it, or select the entry, and click .
17.3.2. Using signed audit logs
This section explains how a user in the Auditor group displays and verifies signed audit logs.
17.3.2.1. Listing audit logs
As a user with auditor privileges, use the the pki subsystem-audit-file-find
command to list existing audit log files on the server.
For example, to list the audit log files on the CA hosted on server.example.com
:
# pki -h server.example.com -p 8443 -n auditor ca-audit-file-find ----------------- 3 entries matched ----------------- File name: ca_audit.20170331225716 Size: 2883 File name: ca_audit.20170401001030 Size: 189 File name: ca_audit Size: 6705 ---------------------------- Number of entries returned 3 ----------------------------
The command uses the client certificate with the auditor nickname stored in the ~/.dogtag/nssdb/
directory for authenticating to the CA. For further details about the parameters used in the command and alternative authentication methods, see the pki(1)
man page.
17.3.2.2. Downloading audit logs
As a user with auditor privileges, use the pki subsystem-audit-file-retrieve
command to download a specific audit log from the server.
For example, to download an audit log file from the CA hosted on server.example.com
:
- Optionally, list the available log files on the CA. See Section 17.3.2.1, “Listing audit logs”.
Download the log file. For example, to download the
ca`audit
file:# pki -U https://server.example.com:8443 -n auditor ca-audit-file-retrieve ca_audit
The command uses the client certificate with the auditor nickname stored in the
~/.dogtag/nssdb/
directory for authenticating to the CA. For further details about the parameters used in the command and alternative authentication methods, see thepki(1)
man page.
After downloading a log file, you can search for specific log entries, for example, using the grep
utility:
# grep "\[AuditEvent=ACCESS_SESSION_ESTABLISH\]" log_file
17.3.2.3. Verifying signed audit logs
If audit log signing is enabled, users with auditor privileges can verify the logs:
- Initialize the NSS database and import the CA certificate. For details, see Section 2.5.1.1, “pki CLI initialization” and the Importing a certificate into an NSS Database section in the Red Hat Certificate System Planning, Installation, and Deployment Guide.
If the audit signing certificate does not exist in the PKI client database, import it:
Search the audit signing certificate for the subsystem logs you want to verify. For example:
# pki ca-cert-find --name "CA Audit Signing Certificate" --------------- 1 entries found --------------- Serial Number: 0x5 Subject DN: CN=CA Audit Signing Certificate,O=EXAMPLE Status: VALID Type: X.509 version 3 Key Algorithm: PKCS #1 RSA with 2048-bit key Not Valid Before: Fri Jul 08 03:56:08 CEST 2016 Not Valid After: Thu Jun 28 03:56:08 CEST 2018 Issued On: Fri Jul 08 03:56:08 CEST 2016 Issued By: system ---------------------------- Number of entries returned 1 ----------------------------
Import the audit signing certificate into the PKI client:
# pki client-cert-import "CA Audit Signing Certificate" --serial 0x5 --trust ",,P" --------------------------------------------------- Imported certificate "CA Audit Signing Certificate" ---------------------------------------------------
- Download the audit logs. See Section 17.3.2.2, “Downloading audit logs”.
Verify the audit logs.
Create a text file that contains a list of the audit log files you want to verify in chronological order. For example:
# cat > ~/audit.txt << EOF ca_audit.20170331225716 ca_audit.20170401001030 ca_audit EOF
Use the
AuditVerify
utility to verify the signatures. For example:# AuditVerify -d ~/.dogtag/nssdb/ -n "CA Audit Signing Certificate" \ -a ~/audit.txt Verification process complete. Valid signatures: 10 Invalid signatures: 0
For further details about using
AuditVerify
, see theAuditVerify(1)
man page.
17.3.3. Displaying operating system-level audit logs
To see operating system-level audit logs using the instructions below, the auditd
logging framework must be configured per the Enabling OS-level Audit Logs section in the Red Hat Certificate System Planning, Installation, and Deployment Guide.
To display operating system-level access logs, use the ausearch
utility as root or as a privileged user with the sudo
utility.
17.3.3.1. Displaying audit log deletion events
Since these events are keyed (with rhcs_audit_deletion
), use the -k
parameter to find events matching that key:
# ausearch -k rhcs_audit_deletion
17.3.3.2. Displaying access to the NSS database for secret and private keys
Since these events are keyed (with rhcs_audit_nssdb
), use the -k
parameter to find events matching that key:
# ausearch -k rhcs_audit_nssdb
17.3.3.3. Displaying time change events
Since these events are keyed (with rhcs_audit_time_change
), use the -k
parameter to find events matching that key:
# ausearch -k rhcs_audit_time_change
17.3.3.4. Displaying package update events
Since these events are a typed message (of type SOFTWARE_UPDATE
), use the -m
parameter to find events matching that type:
# ausearch -m SOFTWARE_UPDATE
17.3.3.5. Displaying changes to the PKI configuration
Since these events are keyed (with rhcs_audit_config
), use the -k
parameter to find events matching that key:
# ausearch -k rhcs_audit_config
17.3.4. Smart card error codes
Smart cards can report certain error codes to the TPS; these are recorded in the TPS’s debug log file, depending on the cause for the message.
Return Code | Description |
---|---|
General Error Codes | 6400 |
No specific diagnosis | 6700 |
Wrong length in Lc | 6982 |
Security status not satisfied | 6985 |
Conditions of use not satisfied | 6a86 |
Incorrect P1 P2 | 6d00 |
Invalid instruction | 6e00 |
Invalid class | Install Load Errors |
6581 | Memory Failure |
6a80 | Incorrect parameters in data field |
6a84 | Not enough memory space |
6a88 | Referenced data not found |
Delete Errors | 6200 |
Application has been logically deleted | 6581 |
Memory failure | 6985 |
Referenced data cannot be deleted | 6a88 |
Referenced data not found | 6a82 |
Application not found | 6a80 |
Incorrect values in command data | Get Data Errors |
6a88 | Referenced data not found |
Get Status Errors | 6310 |
More data available | 6a88 |
Referenced data not found | 6a80 |
Incorrect values in command data | Load Errors |
6581 | Memory failure |
6a84 | Not enough memory space |
6a86 | Incorrect P1/P2 |
6985 | Conditions of use not satisfied |