diff --git a/.circleci/@eaDir/config.yml@SynoResource b/.circleci/@eaDir/config.yml@SynoResource
new file mode 100755
index 0000000..718eb17
Binary files /dev/null and b/.circleci/@eaDir/config.yml@SynoResource differ
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 3f711f8..c0b0ccc 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -37,5 +37,8 @@ jobs:
key: v1-dependencies-{{ checksum "composer.json" }}
# run tests!
+ - run: cp ./example.env ./.env
+ - run: composer dump-autoload -o
- run: php lh create --a
- run: ./vendor/bin/phpunit
+ - run: cat cert/logs/log
diff --git a/.gitignore b/.gitignore
index 79e6142..3d7eb39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,13 @@
/vendor/
/deply/
/.readme
-/goundo.md.conf
-/issuer.conf
-/rootCA.key
-/rootCa.pem
-/rootCA.srl
-/server.csr
-/server.key
-/v3.ext
+/.env
+/cert/cnf/
+./cert/@eaDir
+/cert/config/
+/cert/csr/
+/cert/keys/
+/cert/logs/
+/cert/live/
+/@eaDir
+./@eaDir
diff --git a/.travis.yml b/.travis.yml
index 573b64e..1201dd6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,7 @@ addons:
php:
- 7.1
- 7.2
+ - 7.3
- nightly
env:
global:
@@ -19,9 +20,11 @@ matrix:
install:
- composer install --prefer-dist --no-suggest
-# before_script:
+before_script:
+ - cp ./example.env ./.env
# - composer self-update
# - composer install --no-interaction
script:
- - ./vendor/bin/phpunit
\ No newline at end of file
+ - ./vendor/bin/phpunit
+ - cat cert/logs/log
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
old mode 100644
new mode 100755
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
index e2941b9..c0cc4c5
--- a/README.md
+++ b/README.md
@@ -3,23 +3,26 @@
* Create a Certifcate Authority that can be use to issue certificate for domains.
[](https://travis-ci.org/madeny/lhttps) [](https://circleci.com/gh/madeny/lhttps)
+[](https://bettercodehub.com/)
---
-Sometimes you need https on your local machine to test some functionality of your application, like payment system but some of them require a valid https. Like stripe. And you can’t use localhost to request a certificate from issuer like Let’s Encrypt. So your option is to create a self signed certificate authority (CA). This tool make it easy.
+Sometimes you need https on your local machine to test some functionality of your application, like payment system, but some of them require a valid https. Like stripe. And you can’t use localhost to request a certificate from issuer like Let’s Encrypt, so your option is to create a self signed certificate authority (CA). This tool make it easy.
---
Just clone this repository by run this command:
-`git clone git@github.com:madeny/lhttps.git`
+```
+git clone git@github.com:madeny/lhttps.git`
from terminal and do the following:
+```
-* `cd lhttps`
-* `composer install` make sure "dom" and "mbstring" extensions are installed!
-* `php lh create domain.com`
+* ```cd lhttps ```
+* ```composer install ```
+* ```php lh create domain.com ```
-If you wish to add your rootCA.pem to your Mac OS trusted certificate, use the a flag `--a` right after domain.com like so: `php lh create domain.com --a`
+If you wish to add your rootCA.pem to your Mac OS trusted certificate, use the a flag ```--a``` right after domain.com like so: ```php lh create domain.com --a```
-Your `domain.com.ssl.key` and `domain.com.ssl.crt` will be in `cert/live` directory
+Your ```domain.com.ssl.key``` and ```domain.com.ssl.crt``` will be in ```cert/live``` directory
Just update your nginx config with
```
diff --git a/cert/cnf/openssl.cnf b/cert/cnf/openssl.cnf
deleted file mode 100644
index f0c9cc5..0000000
--- a/cert/cnf/openssl.cnf
+++ /dev/null
@@ -1,13 +0,0 @@
-[req]
-default_bits = 2048
-prompt = no
-default_md = sha256
-distinguished_name = dn
-[dn]
-C=LH
-ST=LC
-L=Local Citry
-O=LOCALHTTPS
-OU=localhttps
-emailAddress=local@https.local
-CN=com.local.https
\ No newline at end of file
diff --git a/cert/cnf/v3.ext b/cert/cnf/v3.ext
deleted file mode 100644
index 19f76c8..0000000
--- a/cert/cnf/v3.ext
+++ /dev/null
@@ -1,7 +0,0 @@
-authorityKeyIdentifier=keyid,issuer
-basicConstraints=CA:FALSE
-keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
-subjectAltName = @alt_names
-[alt_names]
-DNS.1 = madeny.me
-DNS.2 = www.madeny.me
\ No newline at end of file
diff --git a/cert/config/default.conf b/cert/config/default.conf
deleted file mode 100644
index 7759019..0000000
--- a/cert/config/default.conf
+++ /dev/null
@@ -1,81 +0,0 @@
-server {
-
- if ($host = goundo.md) {
- return 301 https://$host$request_uri;
- } # managed by EeasyCert
-
-
- if ($host = www.goundo.md) {
- return 301 https://$host$request_uri;
- } # managed by EasyCert
-
- listen 80;
- root /var/www/html/;
- index index.php index.html index.htm;
- server_name goundo.md www.goundo.md;
- charset utf-8;
-}
-server {
- # SSL configuration
- listen 443 ssl http2;
- #listen [::]:443 ssl http2;
- root /var/www/html;
- index index.php index.html index.htm;
- server_name goundo.md www.goundo.md;
-
- # for EasyCert Sertificates.
-
- ssl_certificate snippets/domain.com.ssl.crt; #
- ssl_certificate_key snippets/domain.com.ssl.key; #
-
-
-
- charset utf-8;
- gzip on;
- gzip_vary on;
- gzip_disable "msie6";
- gzip_comp_level 6;
- gzip_min_length 1100;
- gzip_buffers 16 8k;
- gzip_proxied any;
- gzip_types
- text/plain
- text/css
- text/js
- text/xml
- text/javascript
- application/javascript
- application/x-javascript
- application/json
- application/xml
- application/xml+rss;
- location / {
- try_files $uri $uri/ /index.php?$query_string;
- }
- location ~ \.php$ {
- try_files $uri /index.php =404;
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass unix:/run/php/php7.1-fpm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|svg|woff|woff2|ttf)$ {
- expires 1M;
- access_log off;
- add_header Cache-Control "public";
- }
- location ~* \.(?:css|js)$ {
- expires 7d;
- access_log off;
- add_header Cache-Control "public";
- }
- location ~ /.well-known {
- allow all;
- }
- location ~ /\.ht {
- deny all;
- }
-
-
-}
\ No newline at end of file
diff --git a/cert/csr/.csr b/cert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c/W2jEn0bC
-1cXCog==
------END CERTIFICATE REQUEST-----
diff --git a/cert/csr/madeny.me.csr b/cert/csr/madeny.me.csr
deleted file mode 100644
index 9faa4e5..0000000
--- a/cert/csr/madeny.me.csr
+++ /dev/null
@@ -1,18 +0,0 @@
------BEGIN CERTIFICATE REQUEST-----
-MIIC3DCCAcQCAQAwgZYxCzAJBgNVBAYTAkxIMQswCQYDVQQIDAJMQzEUMBIGA1UE
-BwwLTG9jYWwgQ2l0cnkxEzARBgNVBAoMCkxPQ0FMSFRUUFMxEzARBgNVBAsMCmxv
-Y2FsaHR0cHMxIDAeBgkqhkiG9w0BCQEWEWxvY2FsQGh0dHBzLmxvY2FsMRgwFgYD
-VQQDDA9jb20ubG9jYWwuaHR0cHMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
-AoIBAQDxtDf6+k9B388aECZQo/cArrB1vDd2TSVq/lXEIDSNgkr8zxMtxaalMAsH
-bsV1T9xFsfedSQNdHjmOr6XcRfsyijnO8EqENzyoMVgaALewvfguoPApOqRzD7i9
-lt3eF343zYhagZhMhBRqOi2HleDnC/o7R+8/gH1pKwhvsfyMn88Nvn3xx9J05XD5
-VUFZaKmLHYVBL7OsB7XHTcFPGw0kdUqZwtJJ2hXV+LQi6aOafx+YgIK3ZwXXuZKv
-aQ6zaUQ7e3yvjOO3r/mY12PudtHQqb9xsaLk0QuD8skg4hhDx2dduQCYUv6U1oif
-xn0aFYx/75McHCkEKDN0dWFFlZpfAgMBAAGgADANBgkqhkiG9w0BAQsFAAOCAQEA
-WrFlZ28IHcaqHNhLOtYxlLI8X68CKto2yoj2MTLRQQ6k2XcdIBitGuP4JtT/W+A/
-521AwrpJb6sNyNvjIBPm6lvXY3Gwk68+FWHgw4EtLKlO9VPL9AaVxZ69iMJyPXSv
-ztyjXRIZYjGfHZCV4FPrVQiqlTiHZEeq71UvyGjmIOK4JU4Y6AweHIAQTHpaEy+S
-i/O7wVNVW0hH7GVyTo3Brroyq5YFtVpd634zrtVe92SFB+mJZ4lOTar/Gj/H5OOI
-KdHnPpCKdOV9qIKC8a9b2947Oy5TecXKNG1DgIO4vkkiE7DKmw9WvVt0VhzA8wJO
-cJDr1c0sBX0bN/PYKFXj8A==
------END CERTIFICATE REQUEST-----
diff --git a/cert/csr/process b/cert/csr/process
deleted file mode 100644
index 746be89..0000000
--- a/cert/csr/process
+++ /dev/null
@@ -1,3 +0,0 @@
-Signature ok
-subject=/C=LH/ST=LC/L=Local Citry/O=LOCALHTTPS/OU=localhttps/emailAddress=local@https.local/CN=com.local.https
-Getting CA Private Key
diff --git a/cert/csr/root.pem b/cert/csr/root.pem
deleted file mode 100644
index 2bacbf7..0000000
--- a/cert/csr/root.pem
+++ /dev/null
@@ -1,22 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDqjCCApICCQDt6ECm4mieVjANBgkqhkiG9w0BAQsFADCBljELMAkGA1UEBhMC
-TEgxCzAJBgNVBAgMAkxDMRQwEgYDVQQHDAtMb2NhbCBDaXRyeTETMBEGA1UECgwK
-TE9DQUxIVFRQUzETMBEGA1UECwwKbG9jYWxodHRwczEgMB4GCSqGSIb3DQEJARYR
-bG9jYWxAaHR0cHMubG9jYWwxGDAWBgNVBAMMD2NvbS5sb2NhbC5odHRwczAeFw0x
-ODA0MDUyMDE1NTVaFw0yMTAxMjMyMDE1NTVaMIGWMQswCQYDVQQGEwJMSDELMAkG
-A1UECAwCTEMxFDASBgNVBAcMC0xvY2FsIENpdHJ5MRMwEQYDVQQKDApMT0NBTEhU
-VFBTMRMwEQYDVQQLDApsb2NhbGh0dHBzMSAwHgYJKoZIhvcNAQkBFhFsb2NhbEBo
-dHRwcy5sb2NhbDEYMBYGA1UEAwwPY29tLmxvY2FsLmh0dHBzMIIBIjANBgkqhkiG
-9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkyhPTEFecnxRu/dLVfIdK1OQK8rPkeLHQ09x
-TxRN6glVXD3xYsBH2cEvDRxQd2QK3UiCIV3rhfDvznzDJ/tc4IS1XO3moHxV4/m9
-Twp6X2lZR9PU24gFIIUh9dhTWTG4dlVhoE1IT1PytC6ReBFFXN2tKgJMCBOLM4Nn
-AAcNuYRCxyuKPi7fBKglWVonbyRXFunB+3IZ/6uwGqZDba+TtHiVrO+LB2nJZoFc
-tXSMo9GJok8jxe9hcDWEFvgVET2qE0aooz5HRuLduyJ4NcRUEkJMSA63pd08NJ5v
-u+GAmmtGtR1r7CK0v/zpRnTyyudrbOiigkh5phtrb9h5M7jYjQIDAQABMA0GCSqG
-SIb3DQEBCwUAA4IBAQBOgc7G1QdaS6T5nw3fpS4TzUeL3diu9tcs3h8BvVYEOkHH
-VfFlOWxXlrhqPz/MdE+/pcjbBtlHCM2oey2ZknWRpEKvbHbLNZGOtmTw0E20iI+c
-pKofYGU5462nFq5PZzfI/uD6crmaliZzxe784sC5crE3pxHP+lDSiqOW3BZJmBYp
-dXID9Y33hPNpUMNMqJXhsboc+OB8uPP/lG4SvaVcIWVkPQVXsRRUS/39dNwmqivt
-wUI6Dl/U8KeP4qRqIsafm2OMXvF2NqTx84UQxjC1o2PeqHP9ac6nUERMtohC3qmn
-UcFlraDZvK8Ge3sHQUHauePYm62LuxVb4ZSiJm/H
------END CERTIFICATE-----
diff --git a/cert/csr/root.srl b/cert/csr/root.srl
deleted file mode 100644
index 361d759..0000000
--- a/cert/csr/root.srl
+++ /dev/null
@@ -1 +0,0 @@
-CEAF7BF21BF1E095
diff --git a/cert/keys/root.key b/cert/keys/root.key
deleted file mode 100644
index 9748df2..0000000
--- a/cert/keys/root.key
+++ /dev/null
@@ -1,30 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,4D7B950AD144C803
-
-lcuR5nV0JDWFNKiC5LNnLV5LtBXPJtNeirgToLWgV5JTtPZY6VvdkqdjmbwKOrlV
-IGLhUWpshfEfkXisu1Cyn7xozXNf5HOT6Uq8MGQPjmN2eDauQl2MUjfhnUbpT/VO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NaiLgJWOCnfCeS7r9TNQRRH7LBmRrxqJ7n6BXNgj29avt0WHraY/I7aUUjXus
-iKk1a5caLHfs7msxLSb7e4BP6gLs4UvkItpzOZBWuiHXpNtHJMj0rFdjDOPU/N75
-c5JHwiFop5+N/nP+fLeGL4I15+wcr/9CAxRwFttqtXpQdg3X5OhoLVKTU+m57GI1
-SvDnByyx+358E6onCgMs8WH+hZZTxwnIHJTnAmBYRHlMywJPId0zFOORhLKsbEGv
-gxd9VxhmHPAFQLqSSa5pwLUXKRTXVG9yTUZx5Dl4EM7vW/jI7hw50OFRVCWEpsmh
-UVw6vOrjZ0RE9StoeJbb0cg0iw/gAgvL2iU0vDaM8KuTB7e2SjCFLX5jFXAeOPlk
-29jb1LYJnR+pQRchh/PKyyFiL54TsSCkk1fWawwOGpz4b1JkY9WrvQ==
------END RSA PRIVATE KEY-----
diff --git a/cert/live/madeny.me.ssl.crt b/cert/live/madeny.me.ssl.crt
deleted file mode 100644
index f150e7b..0000000
--- a/cert/live/madeny.me.ssl.crt
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIEqjCCA5KgAwIBAgIJAM6ve/Ib8eCVMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD
-VQQGEwJMSDELMAkGA1UECAwCTEMxFDASBgNVBAcMC0xvY2FsIENpdHJ5MRMwEQYD
-VQQKDApMT0NBTEhUVFBTMRMwEQYDVQQLDApsb2NhbGh0dHBzMSAwHgYJKoZIhvcN
-AQkBFhFsb2NhbEBodHRwcy5sb2NhbDEYMBYGA1UEAwwPY29tLmxvY2FsLmh0dHBz
-MB4XDTE4MDQwNTIxMjA0N1oXDTE5MDgxODIxMjA0N1owgZYxCzAJBgNVBAYTAkxI
-MQswCQYDVQQIDAJMQzEUMBIGA1UEBwwLTG9jYWwgQ2l0cnkxEzARBgNVBAoMCkxP
-Q0FMSFRUUFMxEzARBgNVBAsMCmxvY2FsaHR0cHMxIDAeBgkqhkiG9w0BCQEWEWxv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UnEna6yKdTAw9fYMbToTwtAQdXpR+FXRNURrEPhRMBjjVdJDRcPkhl3gvg
-5iDMFQBTfDfmjNhpeK0zzCbB7oLaziecSvsmbtuxXzFziLMLUE1LNv1ce9H4Hg==
------END CERTIFICATE-----
diff --git a/cert/live/madeny.me.ssl.key b/cert/live/madeny.me.ssl.key
deleted file mode 100644
index cf3dc6e..0000000
--- a/cert/live/madeny.me.ssl.key
+++ /dev/null
@@ -1,28 +0,0 @@
------BEGIN PRIVATE KEY-----
-MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDxtDf6+k9B388a
-ECZQo/cArrB1vDd2TSVq/lXEIDSNgkr8zxMtxaalMAsHbsV1T9xFsfedSQNdHjmO
-r6XcRfsyijnO8EqENzyoMVgaALewvfguoPApOqRzD7i9lt3eF343zYhagZhMhBRq
-Oi2HleDnC/o7R+8/gH1pKwhvsfyMn88Nvn3xx9J05XD5VUFZaKmLHYVBL7OsB7XH
-TcFPGw0kdUqZwtJJ2hXV+LQi6aOafx+YgIK3ZwXXuZKvaQ6zaUQ7e3yvjOO3r/mY
-12PudtHQqb9xsaLk0QuD8skg4hhDx2dduQCYUv6U1oifxn0aFYx/75McHCkEKDN0
-dWFFlZpfAgMBAAECggEBAOcjQKVx2XlVXee+qeVT51FvvK/aXe9ztuSqc7oqUhdB
-EhTQsbaD3Oj7GJDzDUEyLaM4nWJ8AAt8a+5XanVLNv0N0lpiz9/AMvFkvqufJAqQ
-oFV28jN7MOgXkMM9Es7gCIO0uUBTziDd7efn2sJeQcSxX4pxMAm6BjQcQuUNgEW4
-cbaE6YCwuG24awwhOyAjmTiJTdy1Jl/o2bWR6iPtsVu6vijcty7WZCDm1+lHC5o6
-BeTUt0YHN/cyIe61wmWG0ItE7lPj8+pqhCIqfv/wAro0zIQQupSgNcrBWJyHrgP7
-pIpLwUrQE9G0mrHqT05hKzBjOWPulhAEUK3BbzRkMoECgYEA+XQzta7BbOwEiJe8
-HCvxW+JjRJpGdqltWETSf5a5l5pfSNzekgc3le+oF1wJabhsk4djyCJax/wRsunk
-HkUT6RuR0H3BxAkiHWVD8Fz/s3ZMHnly2r+FxItAo2t6ropcNz3d4Oasr6Acoqbq
-fZvDT8QlPBeMwYIsxDQXmyvEoUUCgYEA+Av0IuNNRVIKkbNPAHEdZoKdVsh96TPz
-NdhP3IZqpxsxSQbUkLtbgr7cPhNIDpy05CvuJVSMJtvw+GhKPq55vAoPvG6hdcM2
-jN9nIp1dOgWy5B6e3GJbo5oH8jd2I/EQC/VO0ntEio2ww19AgsIosm8A31JNKGEh
-iMwWzzoWnVMCgYEAvZDDtv5deTOGYnLEfbgbC5NnknuWrpgkQx7RxCm7Uez7GfjW
-nqwjXqqn11CWyqNex2Hsvur0h+MTZB3/v80Iy22rCoB2nk2+gg4xadiSbEOqpsHu
-OTOwKOMVtNp5eWglmclG8qD5e+E1wZkMu3WCH/zTuu2+hlMxR8y6X64MF+0CgYEA
-i1ijySmqkiPZvipeWmAxZRJBc6xkV6sQmZIwozF8Hu5+zIiix8AJU7UHI3RPia3t
-TTWErsIFjhsHD3X/J6F6z/FTD8eSuwZ00cT7Oo3u/paO/epZ0nMLCiiRCDiyDNTy
-79TaeBI52iBpSghrxElw9XS4p7yjjeirHx+QPNBkPfMCgYAp+MA+3cDOx13HbPUa
-8i6Xzi6aW9o7c+qOSeu6VIzPm5e9oyfH/dgRmLK7gKcCs+dWv/5qBqgkO8nM7hdy
-9kHEMP8Y2KG1oDM86DGrglQQiJbKUXybjOZHAOBmaPU3Y+lCCSJlKppA9+2peFCJ
-mBoEsGuJYMsB5BJPqLGiG9K6Iw==
------END PRIVATE KEY-----
diff --git a/cert/logs/log b/cert/logs/log
deleted file mode 100644
index 86be59c..0000000
--- a/cert/logs/log
+++ /dev/null
@@ -1,12 +0,0 @@
-Signature ok
-subject=/C=LH/ST=LC/L=Local Citry/O=LOCALHTTPS/OU=localhttps/emailAddress=local@https.local/CN=com.local.https
-Getting CA Private Key
-Signature ok
-subject=/C=LH/ST=LC/L=Local Citry/O=LOCALHTTPS/OU=localhttps/emailAddress=local@https.local/CN=com.local.https
-Getting CA Private Key
-Signature ok
-subject=/C=LH/ST=LC/L=Local Citry/O=LOCALHTTPS/OU=localhttps/emailAddress=local@https.local/CN=com.local.https
-Getting CA Private Key
-Signature ok
-subject=/C=LH/ST=LC/L=Local Citry/O=LOCALHTTPS/OU=localhttps/emailAddress=local@https.local/CN=com.local.https
-Getting CA Private Key
diff --git a/cert/readme.md b/cert/readme.md
new file mode 100644
index 0000000..e69de29
diff --git a/composer.json b/composer.json
old mode 100644
new mode 100755
index af217f9..64fd19e
--- a/composer.json
+++ b/composer.json
@@ -11,15 +11,14 @@
}
],
"autoload": {
-
- "classmap": [
- "src/"
- ]
+ "psr-4": {
+ "Madeny\\lhttps\\": "src/"
+ }
},
"autoload-dev": {
"psr-4": {
- "madeny\\lhttps\\Test\\": "tests"
+ "Madeny\\lhttps\\Test\\": "tests"
}
},
@@ -27,6 +26,8 @@
"phpunit/phpunit": "^7"
},
"require": {
+ "ext-dom": "*",
+ "ext-mbstring": "*",
"symfony/console": "^4.0",
"symfony/dotenv": "^4.0"
},
diff --git a/composer.lock b/composer.lock
old mode 100644
new mode 100755
index 64e3fbf..de5ad2c
--- a/composer.lock
+++ b/composer.lock
@@ -1,10 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "526e174f687f51c029becab81a32bcd9",
+ "content-hash": "e9aad6842ca6edf7d0c9eb7a7967c3b2",
"packages": [
{
"name": "symfony/console",
@@ -1652,6 +1652,9 @@
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
- "platform": [],
+ "platform": {
+ "ext-dom": "*",
+ "ext-mbstring": "*"
+ },
"platform-dev": []
}
diff --git a/.env b/example.env
old mode 100644
new mode 100755
similarity index 100%
rename from .env
rename to example.env
diff --git a/lh b/lh
index 9d010f6..83308c6 100755
--- a/lh
+++ b/lh
@@ -1,10 +1,13 @@
#! /usr/bin/env php
Local https Version 1.0>");
$app->add(new CreatorCommand);
$app->run();
diff --git a/lhttps.svg b/lhttps.svg
old mode 100644
new mode 100755
diff --git a/phpunit.xml b/phpunit.xml
old mode 100644
new mode 100755
index c4c5ca9..3c268c2
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -9,28 +9,21 @@
processIsolation="false"
stopOnFailure="false">
-
-
./tests
-
-
-
+
+
+ src/
+
+ cert/logs/report.html
+
+
+
+
+
+
diff --git a/src/@eaDir/CertificateAuthorityCreator.php@SynoResource b/src/@eaDir/CertificateAuthorityCreator.php@SynoResource
new file mode 100644
index 0000000..718eb17
Binary files /dev/null and b/src/@eaDir/CertificateAuthorityCreator.php@SynoResource differ
diff --git a/src/@eaDir/CertificateKeyCreator.php@SynoResource b/src/@eaDir/CertificateKeyCreator.php@SynoResource
new file mode 100644
index 0000000..718eb17
Binary files /dev/null and b/src/@eaDir/CertificateKeyCreator.php@SynoResource differ
diff --git a/src/@eaDir/Config.php@SynoResource b/src/@eaDir/Config.php@SynoResource
new file mode 100644
index 0000000..718eb17
Binary files /dev/null and b/src/@eaDir/Config.php@SynoResource differ
diff --git a/src/@eaDir/CreateDomainCertificate.php@SynoResource b/src/@eaDir/CreateDomainCertificate.php@SynoResource
new file mode 100644
index 0000000..718eb17
Binary files /dev/null and b/src/@eaDir/CreateDomainCertificate.php@SynoResource differ
diff --git a/src/@eaDir/DomainProvider.php@SynoResource b/src/@eaDir/DomainProvider.php@SynoResource
new file mode 100644
index 0000000..718eb17
Binary files /dev/null and b/src/@eaDir/DomainProvider.php@SynoResource differ
diff --git a/src/@eaDir/Factory.php@SynoResource b/src/@eaDir/Factory.php@SynoResource
new file mode 100755
index 0000000..0145e69
Binary files /dev/null and b/src/@eaDir/Factory.php@SynoResource differ
diff --git a/src/@eaDir/Openssl.php@SynoResource b/src/@eaDir/Openssl.php@SynoResource
new file mode 100644
index 0000000..718eb17
Binary files /dev/null and b/src/@eaDir/Openssl.php@SynoResource differ
diff --git a/src/@eaDir/Path.php@SynoResource b/src/@eaDir/Path.php@SynoResource
new file mode 100644
index 0000000..718eb17
Binary files /dev/null and b/src/@eaDir/Path.php@SynoResource differ
diff --git a/src/@eaDir/TrustTheRootSSLCertificate.php@SynoResource b/src/@eaDir/TrustTheRootSSLCertificate.php@SynoResource
new file mode 100644
index 0000000..718eb17
Binary files /dev/null and b/src/@eaDir/TrustTheRootSSLCertificate.php@SynoResource differ
diff --git a/src/@eaDir/bash@SynoResource b/src/@eaDir/bash@SynoResource
new file mode 100644
index 0000000..d414abf
Binary files /dev/null and b/src/@eaDir/bash@SynoResource differ
diff --git a/src/CertificateAuthorityCreator.php b/src/CertificateAuthorityCreator.php
index 294f05b..ade96a5 100644
--- a/src/CertificateAuthorityCreator.php
+++ b/src/CertificateAuthorityCreator.php
@@ -2,22 +2,17 @@
namespace Madeny\lhttps;
class CertificateAuthorityCreator{
- protected $error;
+ public $errors;
- protected $output;
+ public $output;
public function __construct($path)
{
exec("openssl req -x509 -new -nodes -passin pass:none -key {$path}/keys/root.key -sha256 -days 1024 -out {$path}/csr/root.pem -config {$path}/cnf/openssl.cnf 2>>{$path}/logs/log", $output, $error);
- $this->error = $error;
+ $this->errors = $error;
$this->output = $output;
}
-
- public function getError()
- {
- return $this->error;
- }
}
diff --git a/src/CertificateKeyCreator.php b/src/CertificateKeyCreator.php
index 0362cd8..a79a47e 100644
--- a/src/CertificateKeyCreator.php
+++ b/src/CertificateKeyCreator.php
@@ -3,8 +3,8 @@
class CertificateKeyCreator{
- protected $output;
- protected $errors;
+ public $output;
+ public $errors;
public function __construct($path)
{
@@ -13,14 +13,4 @@ public function __construct($path)
$this->errors = $errors;
$this->output = $output;
}
-
- public function getError()
- {
- return $this->errors;
- }
-
- public function getOutput()
- {
- return $this->output;
- }
}
\ No newline at end of file
diff --git a/src/CertificateSigningRequest.php b/src/CertificateSigningRequest.php
index 505891b..dda3441 100644
--- a/src/CertificateSigningRequest.php
+++ b/src/CertificateSigningRequest.php
@@ -8,10 +8,9 @@ class CertificateSigningRequest{
function __construct($path, $domain)
{
- $test = "madeny";
+
exec("openssl x509 -req -in {$path}/csr/{$domain}.csr -CA {$path}/csr/root.pem -CAkey {$path}/keys/root.key -CAcreateserial -out {$path}/live/{$domain}.ssl.crt -days 500 -sha256 -extfile {$path}/cnf/v3.ext -passin pass:none 2>>{$path}/logs/log", $output, $error);
-
- // 2>/dev/null
+
$this->error = $error;
$this->output = $output;
diff --git a/src/Config.php b/src/Config.php
index 2510f13..300a74b 100644
--- a/src/Config.php
+++ b/src/Config.php
@@ -2,11 +2,39 @@
namespace Madeny\lhttps;
use Madeny\lhttps\Openssl;
+use Madeny\lhttps\Path;
class Config{
-public static function file($path, $domainOne, $domainTwo)
-{
- return new Openssl($path, $domainOne, $domainTwo);
-}
+ function __construct()
+ {
+
+ $folders = ['cnf', 'config', 'csr', 'keys', 'live', 'logs'];
+ $i = 0;
+
+ foreach ($folders as $key => $value) {
+
+ if (file_exists(Path::all()."/".$value)) {
+ echo "Path to your certificates >> ".Path::all()."/live"."\n";
+ exec("ls ".Path::all()."/live", $outpout, $error);
+ foreach ($outpout as $value) {
+ echo $value."\n";
+ }
+ echo "----------------------- \n";
+ return;
+ }else {
+ while ($i < 6) {
+
+ mkdir(Path::all()."/".$folders[$i]);
+ $i++;
+ }
+ }
+ }
+ }
+
+ public static function file($path, $domain)
+ {
+ return new Openssl($path, $domain);
+ }
}
+
diff --git a/src/CreateDomainCertificate.php b/src/CreateDomainCertificate.php
index 1810017..e13be18 100644
--- a/src/CreateDomainCertificate.php
+++ b/src/CreateDomainCertificate.php
@@ -7,9 +7,9 @@ class CreateDomainCertificate{
protected $output;
- function __construct($path, $domainOne)
+ function __construct($path, $domain)
{
- exec("openssl req -new -sha256 -nodes -out {$path}/csr/{$domainOne}.csr -newkey rsa:2048 -keyout {$path}/live/{$domainOne}.ssl.key -config {$path}/cnf/openssl.cnf 2>>{$path}/logs/log", $output, $error);
+ exec("openssl req -new -sha256 -nodes -out {$path}/csr/{$domain}.csr -newkey rsa:2048 -keyout {$path}/live/{$domain}.ssl.key -config {$path}/cnf/openssl.cnf 2>>{$path}/logs/log", $output, $error);
$this->error = $error;
@@ -20,5 +20,10 @@ public function getError()
{
return $this->error;
}
+
+ public function getOutput()
+ {
+ return $this->output;
+ }
}
diff --git a/src/Domain.php b/src/Domain.php
deleted file mode 100644
index 5090def..0000000
--- a/src/Domain.php
+++ /dev/null
@@ -1,31 +0,0 @@
-domainOne = trim(preg_replace('/\s\s+/', ' ', $this->domainOne));
-
- return $this->domainOne;
- }
-
- public function getDomainTwo()
- {
- $this->domainTwo = 'www.'.$this->domainOne;
-
- return $this->domainTwo;
- }
-
- public function setDomainOne($domainOne)
- {
- if (!$domainOne) {
- $this->domainOne = "localhost";
- }else{
- $this->domainOne = $domainOne;
- }
- }
-}
\ No newline at end of file
diff --git a/src/DomainProvider.php b/src/DomainProvider.php
new file mode 100644
index 0000000..f494d05
--- /dev/null
+++ b/src/DomainProvider.php
@@ -0,0 +1,20 @@
+domain = trim(preg_replace('/\s\s+/', ' ', $this->domain));
+
+ return $this->domain;
+ }
+
+ public function setdomain($domain)
+ {
+
+ !$domain ? $this->domain = "localhost" : $this->domain = $domain;
+ }
+}
\ No newline at end of file
diff --git a/src/Maker.php b/src/Factory.php
similarity index 80%
rename from src/Maker.php
rename to src/Factory.php
index 9c71f87..1cfeb8d 100644
--- a/src/Maker.php
+++ b/src/Factory.php
@@ -5,7 +5,7 @@
use Madeny\lhttps\CreateDomainCertificate;
use Madeny\lhttps\CertificateSigningRequest;
use Madeny\lhttps\TrustTheRootSSLCertificate;
-class Maker
+class Factory
{
// Generate a RSA-2048 key and save it to a file rootCA.key. This file will be used as the key to generate the Root SSL certificate. You
public static function keygen($path)
@@ -20,9 +20,9 @@ public static function create($path)
}
- public static function domain($path, $domainOne, $domainTwo)
+ public static function domain($path, $domain)
{
- return new CreateDomainCertificate($path, $domainOne, $domainTwo);
+ return new CreateDomainCertificate($path, $domain);
}
@@ -37,11 +37,6 @@ public static function trust($path, $OS, $option)
return new TrustTheRootSSLCertificate($path, $OS, $option);
}
- public static function deply($file, $path)
- {
- exec("sudo cp {$file} {$path}");
- }
-
}
diff --git a/src/Openssl.php b/src/Openssl.php
index 2567f3a..aabb1d6 100644
--- a/src/Openssl.php
+++ b/src/Openssl.php
@@ -4,7 +4,7 @@
class Openssl
{
- public function __construct($path, $domainOne, $domainTwo)
+ public function __construct($path, $domain)
{
$v3 = [
@@ -13,8 +13,7 @@ public function __construct($path, $domainOne, $domainTwo)
'keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment',
'subjectAltName = @alt_names',
"[alt_names]",
- "DNS.1 = {$domainOne}",
- "DNS.2 = {$domainTwo}"
+ "DNS.1 = {$domain}"
];
$str = implode("\n", $v3);
diff --git a/src/Path.php b/src/Path.php
index 1d1dc14..16f1a17 100644
--- a/src/Path.php
+++ b/src/Path.php
@@ -5,10 +5,11 @@
class Path{
-
+// need refactory.
public static function all()
{
- return realpath(__DIR__.'/../cert');
+ $path = realpath(__DIR__.'/../cert');
+ return $path;
}
}
\ No newline at end of file
diff --git a/src/TrustTheRootSSLCertificate.php b/src/TrustTheRootSSLCertificate.php
index 79af85e..81bf05f 100644
--- a/src/TrustTheRootSSLCertificate.php
+++ b/src/TrustTheRootSSLCertificate.php
@@ -10,14 +10,8 @@ class TrustTheRootSSLCertificate{
function __construct($path, $checker, $option)
{
- if (strpos($checker, "Darwin") !== false) {
exec("sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain {$path}/csr/root.pem 2>>{$path}/logs/log", $output, $error);
$this->error = $error;
-
- }else{
- return $this->error = 2;
- }
-
}
public function getError()
diff --git a/src/bash/@eaDir/script.sh@SynoResource b/src/bash/@eaDir/script.sh@SynoResource
new file mode 100755
index 0000000..eac236d
Binary files /dev/null and b/src/bash/@eaDir/script.sh@SynoResource differ
diff --git a/src/bash/script.sh b/src/bash/script.sh
new file mode 100755
index 0000000..3321dc6
--- /dev/null
+++ b/src/bash/script.sh
@@ -0,0 +1,14 @@
+# !/usr/bin/env bash
+# Generate the private key.
+openssl genrsa -des3 -passout pass:none -out ../../cert/keys/root.key 2048 2>> ../../cert/logs/log.key;
+
+# Create root CA from private key.
+openssl req -x509 -new -nodes -passin pass:none -key ../../cert/keys/root.key -sha256 -days 1024 -out ../../cert/csr/root.pem -config ../../cert/cnf/openssl.cnf 2>> ../../cert/logs/log.CA;
+
+# Create domain certificate
+openssl req -new -sha256 -nodes -out ../../cert/csr/byrun.csr -newkey rsa:2048 -keyout ../../cert/live/byrun.ssl.key -config ../../cert/cnf/openssl.cnf 2>> ../../cert/logs/log.domain
+
+# Certificate sign request
+openssl x509 -req -in ../../cert/csr/byrun.csr -CA ../../cert/csr/root.pem -CAkey ../../cert/keys/root.key -CAcreateserial -out ../../cert/live/byrun.ssl.crt -days 500 -sha256 -extfile ../../cert/cnf/v3.ext -passin pass:none 2>>../../cert/logs/log.sign
+
+
diff --git a/src/command/@eaDir/CreatorCommand.php@SynoResource b/src/command/@eaDir/CreatorCommand.php@SynoResource
new file mode 100755
index 0000000..718eb17
Binary files /dev/null and b/src/command/@eaDir/CreatorCommand.php@SynoResource differ
diff --git a/src/command/CreatorCommand.php b/src/command/CreatorCommand.php
index adbdb24..3cba6a6 100644
--- a/src/command/CreatorCommand.php
+++ b/src/command/CreatorCommand.php
@@ -7,9 +7,9 @@
use Symfony\Component\Console\Input\InputOption;
use Madeny\lhttps\Config;
-use Madeny\lhttps\Maker;
+use Madeny\lhttps\Factory;
use Madeny\lhttps\Path;
-use Madeny\lhttps\Domain;
+use Madeny\lhttps\DomainProvider;
class CreatorCommand extends Command
{
@@ -26,7 +26,8 @@ protected function configure()
'a',
null,
InputOption::VALUE_NONE,
- 'This will add your root certificate on your OS trusted list?'
+ // 'This will add your root certificate on your OS trusted list?'
+ 'Config your certificate for trust policy.'
);
@@ -39,26 +40,28 @@ protected function execute(InputInterface $input, OutputInterface $output)
// Instantiating dependencies
$path = Path::all();
- $domain = new Domain();
+ (new Config);
+
+ $domain = new DomainProvider();
$domainName = $input->getArgument('domainName');
- $domain->setDomainOne($domainName);
+ $domain->setdomain($domainName);
- Config::file($path, $domain->getDomainOne(), $domain->getDomainTwo());
+ Config::file($path, $domain->getdomain());
// generate a root certificate key.
- Maker::keygen($path);
+ Factory::keygen($path);
// Create a root certificate authority.
- Maker::create($path);
+ Factory::create($path);
// Create cert key for a domain.
- Maker::domain($path, $domain->getDomainOne(), $domain->getDomainTwo());
+ Factory::domain($path, $domain->getdomain());
// Request a certificate sign from root certificate authority.
- Maker::request($path, $domainName);
+ Factory::request($path, $domainName);
$checker = exec("uname -a");
@@ -67,16 +70,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!$option == true) {
exit();
}else{
- $trust = Maker::trust($path, $checker, $option);
+ $trust = Factory::trust($path, $checker, $option);
}
// Disply error messages.
if ( $trust->getError() == 2) {
- $output->writeln('Sorry this host not support!');
+ $output->writeln('Sorry this host is not support!');
}elseif ($trust->getError() == 1) {
- $output->writeln('Fail to add your certificate to trust list you can do it manually');
+ $output->writeln('Fail to config your certificate for trust policy. see help for more information');
}elseif ($trust->getError() == 0) {
- $output->writeln('Your certificate is added to your trust list');
+ $output->writeln('Your certificate is configured');
}
}
diff --git a/tests/@eaDir/CertificateAuthorityCreatorTest.php@SynoResource b/tests/@eaDir/CertificateAuthorityCreatorTest.php@SynoResource
new file mode 100755
index 0000000..718eb17
Binary files /dev/null and b/tests/@eaDir/CertificateAuthorityCreatorTest.php@SynoResource differ
diff --git a/tests/@eaDir/CertificateKeyCreatorTest.php@SynoResource b/tests/@eaDir/CertificateKeyCreatorTest.php@SynoResource
new file mode 100755
index 0000000..718eb17
Binary files /dev/null and b/tests/@eaDir/CertificateKeyCreatorTest.php@SynoResource differ
diff --git a/tests/@eaDir/CreateDomainCertificateTest.php@SynoResource b/tests/@eaDir/CreateDomainCertificateTest.php@SynoResource
new file mode 100755
index 0000000..718eb17
Binary files /dev/null and b/tests/@eaDir/CreateDomainCertificateTest.php@SynoResource differ
diff --git a/tests/@eaDir/CustomTestCase.php@SynoResource b/tests/@eaDir/CustomTestCase.php@SynoResource
new file mode 100755
index 0000000..718eb17
Binary files /dev/null and b/tests/@eaDir/CustomTestCase.php@SynoResource differ
diff --git a/tests/@eaDir/FactoryTest.php@SynoResource b/tests/@eaDir/FactoryTest.php@SynoResource
new file mode 100755
index 0000000..718eb17
Binary files /dev/null and b/tests/@eaDir/FactoryTest.php@SynoResource differ
diff --git a/tests/CertificateAuthorityCreatorTest.php b/tests/CertificateAuthorityCreatorTest.php
new file mode 100644
index 0000000..795eb07
--- /dev/null
+++ b/tests/CertificateAuthorityCreatorTest.php
@@ -0,0 +1,34 @@
+path));
+ $certificateAuthority = new CertificateAuthorityCreator($this->path);
+
+
+ $this->assertEquals(0, $certificateAuthority->errors);
+ }
+
+ /** @test */
+ public function it_can_return_an_error()
+ {
+ $certificateAuthority = new CertificateAuthorityCreator("fake/path");
+
+ $this->assertEquals(2, $certificateAuthority->errors);
+ }
+
+ /** @test */
+ public function it_can_return_array_of_output()
+ {
+ $certificateAuthority = new CertificateAuthorityCreator($this->path);
+
+ $this->assertEquals(0, count($certificateAuthority->output));
+ }
+
+}
\ No newline at end of file
diff --git a/tests/CertificateKeyCreatorTest.php b/tests/CertificateKeyCreatorTest.php
new file mode 100644
index 0000000..3fec0cc
--- /dev/null
+++ b/tests/CertificateKeyCreatorTest.php
@@ -0,0 +1,33 @@
+path);
+
+ $this->assertEquals(0, $rsa->errors);
+ }
+
+ /** @test */
+ public function it_can_generate_an_error()
+ {
+ $rsa = new CertificateKeyCreator("fake/path");
+
+ $this->assertEquals(2, $rsa->errors);
+ }
+
+ /** @test */
+ public function it_can_ouput_logs()
+ {
+ $rsa = new CertificateKeyCreator($this->path);
+
+ $output = count($rsa->output);
+
+ $this->assertEquals(0, $output);
+ }
+
+}
\ No newline at end of file
diff --git a/tests/CreateDomainCertificateTest.php b/tests/CreateDomainCertificateTest.php
new file mode 100644
index 0000000..2e6b2cb
--- /dev/null
+++ b/tests/CreateDomainCertificateTest.php
@@ -0,0 +1,31 @@
+path, $this->domain->getdomain());
+
+ $this->assertEquals(0, $domainCertificate->getError());
+ }
+
+ /** @test */
+ public function it_can_report_an_error()
+ {
+ $domainCertificate = new CreateDomainCertificate("fake/path", "fake_domain");
+
+ $this->assertEquals(2, $domainCertificate->getError());
+ }
+ /** @test */
+ public function it_can_return_array_of_output()
+ {
+ $domainCertificate = new CreateDomainCertificate($this->path, $this->domain->getdomain());
+
+ $this->assertEquals(0, count($domainCertificate->getOutput()));
+ }
+}
\ No newline at end of file
diff --git a/tests/CreateTest.php b/tests/CreateTest.php
new file mode 100644
index 0000000..adf80a6
--- /dev/null
+++ b/tests/CreateTest.php
@@ -0,0 +1,17 @@
+assertEquals(0, $error);
+
+ }
+
+}
diff --git a/tests/CreateTest.php.save b/tests/CreateTest.php.save
new file mode 100644
index 0000000..be08e28
--- /dev/null
+++ b/tests/CreateTest.php.save
@@ -0,0 +1,20 @@
+assertEquals(1, $error());
+
+
+ }
+}
diff --git a/tests/CustomTestCase.php b/tests/CustomTestCase.php
new file mode 100644
index 0000000..ee3d4f8
--- /dev/null
+++ b/tests/CustomTestCase.php
@@ -0,0 +1,33 @@
+path = Path::all();
+
+ $this->domain = new DomainProvider;
+
+ $this->domain->setdomain('example.com');
+
+ Config::file($this->path, $this->domain->getdomain());
+ $this->factory = new Factory();
+ }
+
+ public function tearDown()
+ {
+ unset($this->path, $this->domain);
+ }
+}
\ No newline at end of file
diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php
new file mode 100644
index 0000000..2f8aa4f
--- /dev/null
+++ b/tests/FactoryTest.php
@@ -0,0 +1,104 @@
+path.'/keys/root.key');
+
+ if ($rootkey) {
+ echo "\n You already have a Root Key I'm using that! \n";
+ }else{
+ $keygen = Factory::keygen($this->path);
+
+ if ($keygen->getError() == 0) {
+ echo "\n Key created with success \n";
+ }else{
+ echo "Something not right";
+ }
+
+ $rootkey = true;
+ }
+
+ $this->assertEquals($rootkey, true);
+ $this->assertEquals($this->factory->keygen($this->path)->errors, 0);
+ }
+
+ /** @test */
+ public function a_user_can_create_root_certificate_authority()
+ {
+
+ if (file_exists($this->path.'/csr/root.pem')) {
+ echo "\n You already have a Root Certificate we can use that! \n";
+ }else{
+ $ca = Factory::create($this->path);
+
+ if ($ca->getError() == 0) {
+ echo "\n Certificate create success \n";
+ }else{
+ echo "\n Sorry something is wrong \n";
+ }
+ }
+
+ $rootCA = file_exists($this->path.'/csr/root.pem');
+
+ $this->assertEquals($rootCA, true);
+ $this->assertEquals($this->factory->create($this->path)->errors, 0);
+ }
+
+ /** @test */
+ public function a_user_can_create_certificate_key_for_domain()
+ {
+ $domainkey = file_exists($this->path.'/live/'.$this->domain->getdomain().'.ssl.key');
+ $domaincsr = file_exists($this->path.'/csr/'.$this->domain->getdomain().'.csr');
+
+ if ($domainkey && $domaincsr) {
+ echo "\n You already have a key for this domain we can sign this \n";
+
+ }else{
+ Factory::domain($this->path, $this->domain->getdomain());
+
+ $domainkey = true;
+ $domaincsr = true;
+ }
+
+ $this->assertEquals($domainkey, true);
+ $this->assertEquals($domaincsr, true);
+
+ $this->assertEquals($this->factory->domain($this->path, $this->domain->getdomain() )->getError(), 0);
+
+ }
+
+
+ /** @test */
+ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority()
+ {
+ $request = Factory::request($this->path, $this->domain->getdomain());
+
+ $log = file_get_contents(realpath($this->path.'/logs/log'));
+
+ if (strpos($log, "values mismatch") == true){
+
+ echo "\n Please delete your your CA and CAkey and make new one \n";
+
+ $request->setError(0);
+ }
+
+ $this->assertEquals($request->getError(), 0);
+ $this->assertEquals($this->factory->request($this->path, $this->domain->getdomain())->getError(), 0);
+ }
+
+ /** @test */
+ public function a_user_can_Trust_the_root_SSL_certificate()
+ {
+ $os = exec("uname -a");
+
+ $trusted = Factory::trust($this->path, $os, $option = null);
+
+ $this->assertEquals($trusted->getError(), 1);
+ }
+
+}
\ No newline at end of file
diff --git a/tests/MakerTest.php b/tests/MakerTest.php
deleted file mode 100644
index d5dd74e..0000000
--- a/tests/MakerTest.php
+++ /dev/null
@@ -1,119 +0,0 @@
-path = Path::all();
-
- $this->domain = new domain;
- $this->domain->setDomainOne('madeny.me');
-
- Config::file($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo());
-
-
- }
-
- /** @test */
- public function a_user_can_generate_root_certificate_key()
- {
- $rootkey = file_exists($this->path.'/keys/root.key');
-
- if ($rootkey) {
- echo "\n You already have a Root Key I'm using that! \n";
- }else{
- $keygen = Maker::keygen($this->path);
-
- if ($keygen->getError() == 0) {
- echo "\n Key created with success \n";
- }else{
- echo "Something not right";
- }
-
- $rootkey = true;
- }
-
- $this->assertEquals($rootkey, true);
- }
-
- /** @test */
- public function a_user_can_create_root_certificate_authority()
- {
-
- if (file_exists($this->path.'/csr/root.pem')) {
- echo "\n You already have a Root Certificate we can use that!";
- }else{
- $ca = Maker::create($this->path);
-
- if ($ca->getError() == 0) {
- echo "\n Certificate create success \n";
- }else{
- echo "\n Sorry something is wrong \n";
- }
- }
-
- $rootCA = file_exists($this->path.'/csr/root.pem');
-
- $this->assertEquals($rootCA, true);
- }
-
- /** @test */
- public function a_user_can_create_certificate_key_for_domain()
- {
- $domainkey = file_exists($this->path.'/live/'.$this->domain->getDomainOne().'.ssl.key');
- $domaincsr = file_exists($this->path.'/csr/'.$this->domain->getDomainOne().'.csr');
-
- if ($domainkey) {
- echo "\n You already have a key for this domain we can sign this \n";
- }else{
- Maker::domain($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo());
-
- $domainkey = true;
- $domaincsr = true;
- }
-
- $this->assertEquals($domainkey, true);
- $this->assertEquals($domaincsr, true);
- }
-
-
- /** @test */
- public function a_user_can_sign_a_domain_cert_with_root_certificate_authority()
- {
- $request = Maker::request($this->path, $this->domain->getDomainOne());
-
- $log = file_get_contents(realpath($this->path.'/logs/log'));
-
- // die(var_dump(exec("cat {$process}")));
- if (strpos($log, "values mismatch") == true){
-
- echo "\n Please delete your your CA and CAkey and make new one \n";
-
- $request->setError(0);
- }
-
- $this->assertEquals($request->getError(), 0);
-
-
- }
-
- /** @test */
- public function a_user_can_Trust_the_root_SSL_certificate()
- {
- $os = exec("uname -a");
-
- $trusted = Maker::trust($this->path, $os, $option = null);
-
- $this->assertEquals($trusted->getError(), 2);
- }
-
-
-
-}
\ No newline at end of file
diff --git a/tests/TrustTheRootSSLCertificateTest.php b/tests/TrustTheRootSSLCertificateTest.php
new file mode 100644
index 0000000..b952400
--- /dev/null
+++ b/tests/TrustTheRootSSLCertificateTest.php
@@ -0,0 +1,18 @@
+path, $cheker, $option);
+
+ $this->assertEquals(1, $trusted->getError());
+ }
+}
\ No newline at end of file
diff --git a/ubuntu.png b/ubuntu.png
deleted file mode 100644
index 428fdb1..0000000
Binary files a/ubuntu.png and /dev/null differ