From 0fd69267dd1b4ee9afb88f658b2f1ef5cb9e15ac Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Mon, 25 Nov 2013 12:36:05 -0500
Subject: [PATCH] Added ACL for selftests.

New ACL has been added to allow only the administrators in each subsystem
to access the selftests.

Ticket #652
---
 base/ca/shared/conf/acl.ldif                  |  1 +
 base/ca/shared/conf/acl.properties            |  2 ++
 base/ca/shared/webapps/ca/WEB-INF/web.xml     | 13 +++++++++++++
 base/kra/shared/conf/acl.ldif                 |  1 +
 base/kra/shared/conf/acl.properties           |  2 ++
 base/kra/shared/webapps/kra/WEB-INF/web.xml   | 13 +++++++++++++
 base/ocsp/shared/conf/acl.ldif                |  1 +
 base/ocsp/shared/conf/acl.properties          |  2 ++
 base/ocsp/shared/conf/auth-method.properties  |  1 +
 base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml | 13 +++++++++++++
 base/tks/shared/conf/acl.ldif                 |  1 +
 base/tks/shared/conf/acl.properties           |  2 ++
 base/tks/shared/webapps/tks/WEB-INF/web.xml   | 13 +++++++++++++
 13 files changed, 65 insertions(+)

diff --git a/base/ca/shared/conf/acl.ldif b/base/ca/shared/conf/acl.ldif
index d5385e8e2332a29c56943a87f565fd553fbc879c..0da10939fc64dc88b32016c308fc13a1bab2d14f 100644
--- a/base/ca/shared/conf/acl.ldif
+++ b/base/ca/shared/conf/acl.ldif
@@ -55,4 +55,5 @@ resourceACLS: certServer.ca.account:login,logout:allow (login,logout) user="anyb
 resourceACLS: certServer.ca.certrequests:execute:allow (execute) group="Certificate Manager Agents":Agents may execute cert request operations
 resourceACLS: certServer.ca.certs:execute:allow (execute) group="Certificate Manager Agents":Agents may execute cert operations
 resourceACLS: certServer.ca.groups:execute:allow (execute) group="Administrators":Admins may execute group operations
+resourceACLS: certServer.ca.selftests:read,execute:allow (read,execute) group="Administrators":Only admins can access selftests.
 resourceACLS: certServer.ca.users:execute:allow (execute) group="Administrators":Admins may execute user operations
diff --git a/base/ca/shared/conf/acl.properties b/base/ca/shared/conf/acl.properties
index 1c6651e4fad49a2a4cb78dc14cdf2914adfe528b..d14d1832c7cff7db055f2274f1ed30223d16cad8 100644
--- a/base/ca/shared/conf/acl.properties
+++ b/base/ca/shared/conf/acl.properties
@@ -18,4 +18,6 @@ profiles.list = certServer.ee.profiles,list
 profiles.modify = certServer.profile.configuration,modify
 profiles.read = certServer.profile.configuration,read
 securityDomain.installToken = certServer.securitydomain.domainxml,read
+selftests.read = certServer.ca.selftests,read
+selftests.execute = certServer.ca.selftests,execute
 users = certServer.ca.users,execute
diff --git a/base/ca/shared/webapps/ca/WEB-INF/web.xml b/base/ca/shared/webapps/ca/WEB-INF/web.xml
index 32f5786a13c35f9e60c89ca5125377ab712a3a8d..6bf137ca7b50c91d492813583243177315a88afe 100644
--- a/base/ca/shared/webapps/ca/WEB-INF/web.xml
+++ b/base/ca/shared/webapps/ca/WEB-INF/web.xml
@@ -2463,6 +2463,19 @@
 
     <security-constraint>
         <web-resource-collection>
+            <web-resource-name>Self Tests</web-resource-name>
+            <url-pattern>/rest/selftests/*</url-pattern>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>*</role-name>
+        </auth-constraint>
+        <user-data-constraint>
+            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+        </user-data-constraint>
+    </security-constraint>
+
+    <security-constraint>
+        <web-resource-collection>
             <web-resource-name>Profile Services</web-resource-name>
             <url-pattern>/rest/profiles/*</url-pattern>
         </web-resource-collection>
diff --git a/base/kra/shared/conf/acl.ldif b/base/kra/shared/conf/acl.ldif
index 76da45db3ae0f9b85116a08c7966b473c237dd7b..24e738216671f704cd7552b80ae5147d09648db0 100644
--- a/base/kra/shared/conf/acl.ldif
+++ b/base/kra/shared/conf/acl.ldif
@@ -34,4 +34,5 @@ resourceACLS: certServer.clone.configuration:read,modify:allow (modify,read) gro
 resourceACLS: certServer.kra.account:login,logout:allow (login,logout) user="anybody":Anybody can login and logout
 resourceACLS: certServer.kra.groups:execute:allow (execute) group="Administrators":Admins may execute group operations
 resourceACLS: certServer.kra.keyrequests:execute:allow (execute) group="Data Recovery Manager Agents":Agents may execute key request operations
+resourceACLS: certServer.kra.selftests:read,execute:allow (read,execute) group="Administrators":Only admins can access selftests.
 resourceACLS: certServer.kra.users:execute:allow (execute) group="Administrators":Admins may execute user operations
diff --git a/base/kra/shared/conf/acl.properties b/base/kra/shared/conf/acl.properties
index 8f6ff5e7a403e83c5e27d7b47a097062e011ed17..3fde904656b2a5c051cd21659a12b8c573ef8fb1 100644
--- a/base/kra/shared/conf/acl.properties
+++ b/base/kra/shared/conf/acl.properties
@@ -10,4 +10,6 @@ account.logout = certServer.kra.account,logout
 groups = certServer.kra.groups,execute
 keys = certServer.kra.keys,execute
 keyrequests = certServer.kra.keyrequests,execute
+selftests.read = certServer.kra.selftests,read
+selftests.execute = certServer.kra.selftests,execute
 users = certServer.kra.users,execute
diff --git a/base/kra/shared/webapps/kra/WEB-INF/web.xml b/base/kra/shared/webapps/kra/WEB-INF/web.xml
index 12f18848e4bb5a967d02634e60bbd58bd27d6c06..d27d88d7191a347783f749425dc92ceeb961ac31 100644
--- a/base/kra/shared/webapps/kra/WEB-INF/web.xml
+++ b/base/kra/shared/webapps/kra/WEB-INF/web.xml
@@ -1159,6 +1159,19 @@
     </security-constraint>
    [PKI_CLOSE_STANDALONE_COMMENT]
 
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Self Tests</web-resource-name>
+            <url-pattern>/rest/selftests/*</url-pattern>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>*</role-name>
+        </auth-constraint>
+        <user-data-constraint>
+            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+        </user-data-constraint>
+    </security-constraint>
+
     <login-config>
         <realm-name>Key Recovery Authority</realm-name>
     </login-config>
diff --git a/base/ocsp/shared/conf/acl.ldif b/base/ocsp/shared/conf/acl.ldif
index 14221f8bb232ec50239f77bfe89a3850bd46df41..b66478b078c40e318bfad791e0cada2da3f6b417 100644
--- a/base/ocsp/shared/conf/acl.ldif
+++ b/base/ocsp/shared/conf/acl.ldif
@@ -30,4 +30,5 @@ resourceACLS: certServer.ocsp.group:read,modify:allow (modify,read) group="Admin
 resourceACLS: certServer.clone.configuration:read,modify:allow (modify,read) group="Enterprise CA Administrators" || group="Enterprise KRA Administrators" || group="Enterprise OCSP Administrators" || group="Enterprise TKS Administrators":Only Enterprise Administrators are allowed to clone the configuration.
 resourceACLS: certServer.ocsp.account:login,logout:allow (login,logout) user="anybody":Anybody can login and logout
 resourceACLS: certServer.ocsp.groups:execute:allow (execute) group="Administrators":Admins may execute group operations
+resourceACLS: certServer.ocsp.selftests:read,execute:allow (read,execute) group="Administrators":Only admins can access selftests.
 resourceACLS: certServer.ocsp.users:execute:allow (execute) group="Administrators":Admins may execute user operations
diff --git a/base/ocsp/shared/conf/acl.properties b/base/ocsp/shared/conf/acl.properties
index 67c68b37ff142993b4be00b725963717fce1acbf..9528f11fa8660ebad8e232718f1f5db45004b770 100644
--- a/base/ocsp/shared/conf/acl.properties
+++ b/base/ocsp/shared/conf/acl.properties
@@ -8,4 +8,6 @@
 account.login = certServer.ocsp.account,login
 account.logout = certServer.ocsp.account,logout
 groups = certServer.ocsp.groups,execute
+selftests.read = certServer.ocsp.selftests,read
+selftests.execute = certServer.ocsp.selftests,execute
 users = certServer.ocsp.users,execute
diff --git a/base/ocsp/shared/conf/auth-method.properties b/base/ocsp/shared/conf/auth-method.properties
index 5718fc6da0098cb2d109c466243dcf077b344208..9f5a7a1d32df168f6d595035abbe1aad1d0af8ec 100644
--- a/base/ocsp/shared/conf/auth-method.properties
+++ b/base/ocsp/shared/conf/auth-method.properties
@@ -9,4 +9,5 @@
 default = *
 account = certUserDBAuthMgr,passwdUserDBAuthMgr
 groups = certUserDBAuthMgr
+selftests = certUserDBAuthMgr
 users = certUserDBAuthMgr
diff --git a/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml b/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml
index 9c86fa1f17e4cc24c0d43471c6d727380ec38e1f..8002f749b8322b8c7770b059f09742215653ecd0 100644
--- a/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml
+++ b/base/ocsp/shared/webapps/ocsp/WEB-INF/web.xml
@@ -780,6 +780,19 @@
     </security-constraint>
    [PKI_CLOSE_STANDALONE_COMMENT]
 
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Self Tests</web-resource-name>
+            <url-pattern>/rest/selftests/*</url-pattern>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>*</role-name>
+        </auth-constraint>
+        <user-data-constraint>
+            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+        </user-data-constraint>
+    </security-constraint>
+
     <login-config>
         <realm-name>Online Certificate Status Protocol Manager</realm-name>
     </login-config>
diff --git a/base/tks/shared/conf/acl.ldif b/base/tks/shared/conf/acl.ldif
index bed8ba7cb179ca4b26e8e561a98c37049972196e..cd42295423d0918f41800f3162013d0dec457306 100644
--- a/base/tks/shared/conf/acl.ldif
+++ b/base/tks/shared/conf/acl.ldif
@@ -30,4 +30,5 @@ resourceACLS: certServer.tks.importTransportCert:read,modify:allow (modify,read)
 resourceACLS: certServer.clone.configuration:read,modify:allow (modify,read) group="Enterprise CA Administrators" || group="Enterprise KRA Administrators" || group="Enterprise OCSP Administrators" || group="Enterprise TKS Administrators":Only Enterprise Administrators are allowed to clone the configuration.
 resourceACLS: certServer.tks.account:login,logout:allow (login,logout) user="anybody":Anybody can login and logout
 resourceACLS: certServer.tks.groups:execute:allow (execute) group="Administrators":Admins may execute group operations
+resourceACLS: certServer.tks.selftests:read,execute:allow (read,execute) group="Administrators":Only admins can access selftests.
 resourceACLS: certServer.tks.users:execute:allow (execute) group="Administrators":Admins may execute user operations
diff --git a/base/tks/shared/conf/acl.properties b/base/tks/shared/conf/acl.properties
index db13b08a12cadcc9465733daea1b185cbf4ee7db..d2c2372906f8cecd63c4a6010e4544cbfff82047 100644
--- a/base/tks/shared/conf/acl.properties
+++ b/base/tks/shared/conf/acl.properties
@@ -8,4 +8,6 @@
 account.login = certServer.tks.account,login
 account.logout = certServer.tks.account,logout
 groups = certServer.tks.groups,execute
+selftests.read = certServer.tks.selftests,read
+selftests.execute = certServer.tks.selftests,execute
 users = certServer.tks.users,execute
diff --git a/base/tks/shared/webapps/tks/WEB-INF/web.xml b/base/tks/shared/webapps/tks/WEB-INF/web.xml
index f817baf997fe97de2259af8271670efd267de0f8..65273621764dd8a656a365f76107e08793f78911 100644
--- a/base/tks/shared/webapps/tks/WEB-INF/web.xml
+++ b/base/tks/shared/webapps/tks/WEB-INF/web.xml
@@ -443,6 +443,19 @@
         </user-data-constraint>
     </security-constraint>
 
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Self Tests</web-resource-name>
+            <url-pattern>/rest/selftests/*</url-pattern>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>*</role-name>
+        </auth-constraint>
+        <user-data-constraint>
+            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+        </user-data-constraint>
+    </security-constraint>
+
     <login-config>
         <realm-name>Token Key Service</realm-name>
     </login-config>
-- 
1.8.4.2

