>From 2a73c978784d58b11375aa724cbd2c04607eafc1 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Wed, 12 Apr 2017 01:51:40 +0200
Subject: [PATCH] Added audit event constants for SSL session.

Change-Id: I73b3a69ffc289ad6bf89eebaa2d95237df25551f
---
 .../src/com/netscape/certsrv/logging/AuditEvent.java       | 14 ++++++++++----
 base/server/cms/src/com/netscape/cms/logging/LogFile.java  |  4 +---
 .../src/org/dogtagpki/server/PKIServerSocketListener.java  |  9 +++++----
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/base/common/src/com/netscape/certsrv/logging/AuditEvent.java b/base/common/src/com/netscape/certsrv/logging/AuditEvent.java
index 8ae5cd669d89fe4685b40b6cc7a0f9e326b19983..b409a1274b73113ba302767b57c76a233f30b915 100644
--- a/base/common/src/com/netscape/certsrv/logging/AuditEvent.java
+++ b/base/common/src/com/netscape/certsrv/logging/AuditEvent.java
@@ -35,10 +35,17 @@ import com.netscape.certsrv.base.MessageFormatter;
  */
 public class AuditEvent implements IBundleLogEvent {
 
-    /**
-     *
-     */
+    public final static String ACCESS_SESSION_ESTABLISH_FAILURE =
+            "LOGGING_SIGNED_AUDIT_ACCESS_SESSION_ESTABLISH_FAILURE";
+    public final static String ACCESS_SESSION_ESTABLISH_SUCCESS =
+            "LOGGING_SIGNED_AUDIT_ACCESS_SESSION_ESTABLISH_SUCCESS";
+    public final static String ACCESS_SESSION_TERMINATED =
+            "LOGGING_SIGNED_AUDIT_ACCESS_SESSION_TERMINATED";
+    public final static String AUDIT_LOG_SIGNING =
+            "LOGGING_SIGNED_AUDIT_SIGNING_3";
+
     private static final long serialVersionUID = -844306657733902324L;
+    private static final String INVALID_LOG_LEVEL = "log level: {0} is invalid, should be 0-6";
 
     protected Object mParams[] = null;
 
@@ -54,7 +61,6 @@ public class AuditEvent implements IBundleLogEvent {
      * The bundle name for this event.
      */
     private String mBundleName = LogResources.class.getName();
-    private static final String INVALID_LOG_LEVEL = "log level: {0} is invalid, should be 0-6";
 
     /**
      * Constructs a message event
diff --git a/base/server/cms/src/com/netscape/cms/logging/LogFile.java b/base/server/cms/src/com/netscape/cms/logging/LogFile.java
index 9d19eddc6e3b3521a512780708a7274b344b369a..fdf3f836dbb75e97ca7c71f183cade5b196c76ef 100644
--- a/base/server/cms/src/com/netscape/cms/logging/LogFile.java
+++ b/base/server/cms/src/com/netscape/cms/logging/LogFile.java
@@ -104,8 +104,6 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
 
     private final static String LOGGING_SIGNED_AUDIT_AUDIT_LOG_STARTUP =
                                "LOGGING_SIGNED_AUDIT_AUDIT_LOG_STARTUP_2";
-    private final static String LOGGING_SIGNED_AUDIT_SIGNING =
-                               "LOGGING_SIGNED_AUDIT_SIGNING_3";
     private final static String LOGGING_SIGNED_AUDIT_AUDIT_LOG_SHUTDOWN =
                                "LOGGING_SIGNED_AUDIT_AUDIT_LOG_SHUTDOWN_2";
     private final static String LOG_SIGNED_AUDIT_EXCEPTION =
@@ -723,7 +721,7 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
         // so as to avoid infinite recursiveness of calling
         // the log() method
         String auditMessage = CMS.getLogMessage(
-                LOGGING_SIGNED_AUDIT_SIGNING,
+                AuditEvent.AUDIT_LOG_SIGNING,
                 ILogger.SYSTEM_UID,
                 ILogger.SUCCESS,
                 base64Encode(sigBytes));
diff --git a/base/server/cms/src/org/dogtagpki/server/PKIServerSocketListener.java b/base/server/cms/src/org/dogtagpki/server/PKIServerSocketListener.java
index adba676ac18a7f4cffcfdfb2a15b66705414fb47..7016bc8ea02e216c8aca010d68b071001f97a698 100644
--- a/base/server/cms/src/org/dogtagpki/server/PKIServerSocketListener.java
+++ b/base/server/cms/src/org/dogtagpki/server/PKIServerSocketListener.java
@@ -33,6 +33,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.netscape.certsrv.apps.CMS;
+import com.netscape.certsrv.logging.AuditEvent;
 import com.netscape.certsrv.logging.IAuditor;
 
 public class PKIServerSocketListener implements SSLSocketListener {
@@ -66,7 +67,7 @@ public class PKIServerSocketListener implements SSLSocketListener {
             IAuditor auditor = CMS.getAuditor();
 
             String auditMessage = CMS.getLogMessage(
-                    "LOGGING_SIGNED_AUDIT_ACCESS_SESSION_TERMINATED",
+                    AuditEvent.ACCESS_SESSION_TERMINATED,
                     clientIP,
                     serverIP,
                     subjectID,
@@ -108,7 +109,7 @@ public class PKIServerSocketListener implements SSLSocketListener {
             if (description == SSLAlertDescription.CLOSE_NOTIFY.getID()) {
 
                 String auditMessage = CMS.getLogMessage(
-                        "LOGGING_SIGNED_AUDIT_ACCESS_SESSION_TERMINATED",
+                        AuditEvent.ACCESS_SESSION_TERMINATED,
                         clientIP,
                         serverIP,
                         subjectID,
@@ -119,7 +120,7 @@ public class PKIServerSocketListener implements SSLSocketListener {
             } else {
 
                 String auditMessage = CMS.getLogMessage(
-                        "LOGGING_SIGNED_AUDIT_ACCESS_SESSION_ESTABLISH_FAILURE",
+                        AuditEvent.ACCESS_SESSION_ESTABLISH_FAILURE,
                         clientIP,
                         serverIP,
                         subjectID,
@@ -157,7 +158,7 @@ public class PKIServerSocketListener implements SSLSocketListener {
             IAuditor auditor = CMS.getAuditor();
 
             String auditMessage = CMS.getLogMessage(
-                    "LOGGING_SIGNED_AUDIT_ACCESS_SESSION_ESTABLISH_SUCCESS",
+                    AuditEvent.ACCESS_SESSION_ESTABLISH_SUCCESS,
                     clientIP,
                     serverIP,
                     subjectID);
-- 
2.9.3

