]> WPIA git - gigi.git/commitdiff
upd: enforce serverAuth EKU for SSL-pings
authorFelix Dörre <felix@dogcraft.de>
Sun, 27 Nov 2016 15:10:34 +0000 (16:10 +0100)
committerFelix Dörre <felix@dogcraft.de>
Mon, 28 Nov 2016 12:35:09 +0000 (13:35 +0100)
Change-Id: Ia98447b476eb1e6b60c7471208c7cf965e482aea

src/org/cacert/gigi/pages/account/domain/PingConfigForm.java
src/org/cacert/gigi/pages/account/domain/PingConfigForm.templ
src/org/cacert/gigi/ping/SSLPinger.java

index 6d23c3a0a14ea4fbe0732cf9069bfc3cb2bece3d..b4c5ac8a10c5e3abbdf886e7740211d829caf00e 100644 (file)
@@ -17,7 +17,6 @@ import org.cacert.gigi.output.template.Form;
 import org.cacert.gigi.output.template.IterableDataset;
 import org.cacert.gigi.output.template.Template;
 import org.cacert.gigi.ping.SSLPinger;
-import org.cacert.gigi.util.HTMLEncoder;
 import org.cacert.gigi.util.RandomToken;
 
 public class PingConfigForm extends Form {
@@ -154,7 +153,6 @@ public class PingConfigForm extends Form {
     protected void outputEmbeddableContent(PrintWriter out, Language l, Map<String, Object> vars) {
         vars.put("tokenName", tokenName);
         vars.put("tokenValue", tokenValue);
-        vars.put("openSSLHelp", "<code>" + HTMLEncoder.encodeHTML("-subj \"/CN=<domain>/OU=" + tokenValue + "\"") + "</code>");
         vars.put("authEmails", new IterableDataset() {
 
             int i = 0;
index 7d2eb5dc8412622dc1790c4bbaa4800694a42318..ff7c824b08459af219f4c050cc13f7924a39c431 100644 (file)
   <div class="panel-heading"><input type="checkbox" name="SSLType" value="y"<?=$!ssl?>> <?=_Verify by searching for installed certificate.?></div>
   <div class="panel-body">
     <?=_Please list up to four services using your certificate. You need to have one of them up and using a valid SomeCA certificate or a specific self-signed certificate in order to pass this test?>:
-    <?=_The self-signed certificate needs to contain your domain as CN and ${tokenValue} as organization unit. With $!{openSSLHelp} OpenSSL command line utilities can generate such a certificate.?>:
+    <?=_The self-signed certificate needs to contain your domain as CN and ${tokenValue} as organization unit.?> <?=_You can use these commands to create such a certificate:?>
+    <code>
+openssl req -newkey rsa:4096 -subj "/CN=<span class='exampleDomain'>example.org</span>/OU=<?=$tokenValue?>" -nodes -out myCSR -keyout myKey<br>
+openssl x509 -req -in myCSR -signkey myKey -out myCert -extfile &lt;(printf 'extendedKeyUsage = serverAuth\n')
+    </code>
     <table>
     <? foreach($ssl-services){ ?>
     <tr><td><select name='ssl-type-<?=$i?>'>
index 312c88709df9882c349f2bbcdccce4fbbec616fe..7db5a6b16786a066cb4f3427990a2477b111c7ed 100644 (file)
@@ -180,8 +180,8 @@ public class SSLPinger extends DomainPinger {
                             @Override
                             public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws java.security.cert.CertificateException {
                                 java.security.cert.X509Certificate c = chain[0];
-                                if (c.getExtendedKeyUsage() != null && !c.getExtendedKeyUsage().contains(OID_EKU_serverAuth)) {
-                                    throw new java.security.cert.CertificateException("Illegal EKU");
+                                if (c.getExtendedKeyUsage() == null || !c.getExtendedKeyUsage().contains(OID_EKU_serverAuth)) {
+                                    throw new java.security.cert.CertificateException("Extended Key Usage for SSL Server Authentication missing");
                                 }
                             }