From fb8bfa813847df962d02086a0b93fa60239de576 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 7 Nov 2015 20:03:16 +0200
Subject: [PATCH] - Complete test case! - Found first bug (and fixed).

---
 Makefile   | 12 ++++++++++++
 README.rst |  1 -
 ssl-ca     |  2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 9f234f1..1d08139 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,18 @@ clean:
 test: clean
 	./ssl-ca init
 	./ssl-ca gen www
+	openssl verify -CAfile CA.crt certs/www
+	test "$$(openssl x509 -in certs/www -issuer -noout)" == "issuer= /CN=*.*.ssl-ca"
+	test "$$(openssl x509 -in certs/www -subject -noout)" == "subject= /CN=*.*.www.ssl-ca"
 	openssl genrsa -out keys/smtp
 	./ssl-ca sign
+	openssl verify -CAfile CA.crt certs/smtp
+	test "$$(openssl x509 -in certs/smtp -issuer -noout)" == "issuer= /CN=*.*.ssl-ca"
+	test "$$(openssl x509 -in certs/smtp -subject -noout)" == "subject= /CN=*.*.smtp.ssl-ca"
 	./ssl-ca resign
+	openssl verify -CAfile CA.crt certs/www
+	openssl verify -CAfile CA.crt certs/smtp
+	test "$$(openssl x509 -in certs/www -issuer -noout)" == "issuer= /CN=*.*.ssl-ca"
+	test "$$(openssl x509 -in certs/www -subject -noout)" == "subject= /CN=*.*.www.ssl-ca"
+	test "$$(openssl x509 -in certs/smtp -issuer -noout)" == "issuer= /CN=*.*.ssl-ca"
+	test "$$(openssl x509 -in certs/smtp -subject -noout)" == "subject= /CN=*.*.smtp.ssl-ca"
diff --git a/README.rst b/README.rst
index 0838170..ecc5131 100644
--- a/README.rst
+++ b/README.rst
@@ -81,4 +81,3 @@ TODO
 ----
 
 - Add checks and failure messages to each action.
-- Verify that the fqdn is correct.
diff --git a/ssl-ca b/ssl-ca
index 378143d..464a466 100755
--- a/ssl-ca
+++ b/ssl-ca
@@ -53,7 +53,7 @@ init () {
 
 sign_key () {
     csr="$(mktemp -t ssl-ca)"
-    export domain="$1.$domain"
+    export domain="$1.$(basename $PWD)"
     openssl req \
         -key keys/$1 \
         -new \
-- 
GitLab