[Pki-devel] [PATCH] 964 Added access banner for PKI console.

2017-02-23 Thread Endi Sukma Dewata

The PKI console has been modified to retrieve access banner from
the server and ask for user confirmation at the beginning of the
program.

https://fedorahosted.org/pki/ticket/2582

--
Endi S. Dewata
>From d4385d04056ef9e5a7aa2b82a81a92ab1e8e1c7f Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" 
Date: Mon, 30 Jan 2017 18:19:32 +0100
Subject: [PATCH] Added access banner for PKI console.

The PKI console has been modified to retrieve access banner from
the server and ask for user confirmation at the beginning of the
program.

https://fedorahosted.org/pki/ticket/2582
---
 .../src/com/netscape/admin/certsrv/Console.java| 35 +-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/base/console/src/com/netscape/admin/certsrv/Console.java b/base/console/src/com/netscape/admin/certsrv/Console.java
index d6d653f168376e666542eb6e34891e7e91b5d2be..83be43ff0de089bb2350806b072725dd9909d1fd 100644
--- a/base/console/src/com/netscape/admin/certsrv/Console.java
+++ b/base/console/src/com/netscape/admin/certsrv/Console.java
@@ -44,6 +44,11 @@ import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.UIManager;
 
+import org.dogtagpki.common.Info;
+import org.dogtagpki.common.InfoClient;
+
+import com.netscape.certsrv.client.ClientConfig;
+import com.netscape.certsrv.client.PKIClient;
 import com.netscape.management.client.Framework;
 import com.netscape.management.client.IPage;
 import com.netscape.management.client.IResourceObject;
@@ -1572,7 +1577,8 @@ public class Console implements CommClient {
   * @param parameters list
   */
 
-static public void main(String argv[]) {
+static public void main(String argv[]) throws Exception {
+
 		GetOpt opt = new GetOpt("h:a:A:f:l:u:w:s:D:x:", argv);
 
 if (opt.hasOption('f')) {
@@ -1760,6 +1766,33 @@ public class Console implements CommClient {
"\n Default port number is 9443.\n");
 */
 }
+
+UtilConsoleGlobals.initJSS();
+
+ClientConfig config = new ClientConfig();
+config.setServerURL(protocol, hostName, portNumber);
+
+PKIClient client = new PKIClient(config);
+
+InfoClient infoClient = new InfoClient(client);
+Info info = infoClient.getInfo();
+String banner = info.getBanner();
+
+if (banner != null) {
+
+System.out.println(banner.trim());
+System.out.println();
+System.out.print("Do you want to proceed (y/N)? ");
+System.out.flush();
+
+BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+String line = reader.readLine().trim();
+
+if (!line.equalsIgnoreCase("Y")) {
+return;
+}
+}
+
 cinfo.put("cmsHost", url.getHost());
 cinfo.put("cmsPort", Integer.toString(portNumber));
 cinfo.put("cmsPath", path);
-- 
2.9.3

___
Pki-devel mailing list
Pki-devel@redhat.com
https://www.redhat.com/mailman/listinfo/pki-devel

[Pki-devel] [PATCH] 963 Added access banner to TPS UI.

2017-02-23 Thread Endi Sukma Dewata

All pages in TPS UI have been modified to retrieve access banner
and display it once at the beginning of the SSL connection.

https://fedorahosted.org/pki/ticket/2582

--
Endi S. Dewata
>From 31651b18fc06234db91478069374c4a2b01a79c9 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" 
Date: Tue, 21 Feb 2017 09:34:20 -0600
Subject: [PATCH] Added access banner to TPS UI.

All pages in TPS UI have been modified to retrieve access banner
and display it once at the beginning of the SSL connection.

https://fedorahosted.org/pki/ticket/2582
---
 base/tps/shared/webapps/tps/404.html| 9 -
 base/tps/shared/webapps/tps/500.html| 9 -
 base/tps/shared/webapps/tps/GenUnexpectedError.template | 9 -
 base/tps/shared/webapps/tps/index.jsp   | 5 +
 base/tps/shared/webapps/tps/ui/index.jsp| 1 +
 5 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/base/tps/shared/webapps/tps/404.html b/base/tps/shared/webapps/tps/404.html
index dc78f60d228107e7874611762001cc9ea6fe4cae..0aaf29cdf530b389c35194d1b37ca9d84eaca9bc 100755
--- a/base/tps/shared/webapps/tps/404.html
+++ b/base/tps/shared/webapps/tps/404.html
@@ -17,6 +17,7 @@
  --- END COPYRIGHT BLOCK --- -->
 http://www.w3.org/TR/html4/loose.dtd";>
 
+
 
 var url = document.URL;
 var protocol = location.protocol;
@@ -24,8 +25,14 @@ var hostname = location.hostname;
 var port = location.port;
 
 
-
 TPS 404 Error!
+
+
+
+
+
+
+
 
 
 document.write('http://www.w3.org/TR/html4/loose.dtd";>
 
+