From 5cefe70cd9cf7c3aaacc2f8d735608b2db1b5475 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Mon, 16 Apr 2018 22:36:53 +0200 Subject: [PATCH 01/46] Update readme --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e2941b9..26ea5c8 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,25 @@ [![Build Status](https://travis-ci.org/madeny/lhttps.svg?branch=master)](https://travis-ci.org/madeny/lhttps)  [![CircleCI](https://circleci.com/gh/madeny/lhttps.svg?style=svg)](https://circleci.com/gh/madeny/lhttps) --- -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``` make sure "dom" and "mbstring" extensions are installed! +* ```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 ``` From 7c3a34adcd81650b9ad33e1a3e85476388de385b Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Mon, 16 Apr 2018 22:40:06 +0200 Subject: [PATCH 02/46] ##8 quick changes and updates... --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 26ea5c8..2cae51e 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,11 @@ Just clone this repository by run this command: ``` 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 ``` make sure "dom" and "mbstring" extensions are installed! +* ```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``` From 5734e6760649c669a7c91801026f1055677c9123 Mon Sep 17 00:00:00 2001 From: Craig Duncan Date: Wed, 25 Apr 2018 22:23:10 +0100 Subject: [PATCH 03/46] Have composer handle the extension requirements --- README.md | 2 +- composer.json | 2 ++ composer.lock | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2cae51e..530c41c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ from terminal and do the following: ``` * ```cd lhttps ``` -* ```composer install ``` make sure "dom" and "mbstring" extensions are installed! +* ```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``` diff --git a/composer.json b/composer.json index af217f9..e160d08 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,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 index 64e3fbf..de5ad2c 100644 --- 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": [] } From 4e6e5ed30f283db2009201f8dd6e3b868d392bf9 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:12:26 +0200 Subject: [PATCH 04/46] Add a cleanup method for dumy files --- cert/cnf/openssl.cnf | 13 --- cert/cnf/v3.ext | 7 -- cert/config/default.conf | 81 ---------------- cert/csr/.csr | 18 ---- cert/csr/madeny.me.csr | 18 ---- cert/csr/process | 3 - cert/csr/root.pem | 22 ----- cert/csr/root.srl | 1 - cert/keys/root.key | 30 ------ cert/live/madeny.me.ssl.crt | 27 ------ cert/live/madeny.me.ssl.key | 28 ------ cert/logs/log | 46 +++++++++ src/{Domain.php => DomainProvider.php} | 2 +- src/TestCleaner.php | 21 +++++ src/command/CreatorCommand.php | 4 +- tests/MakerTest.php | 123 +++++++++++++------------ 16 files changed, 136 insertions(+), 308 deletions(-) delete mode 100644 cert/cnf/openssl.cnf delete mode 100644 cert/cnf/v3.ext delete mode 100644 cert/config/default.conf delete mode 100644 cert/csr/.csr delete mode 100644 cert/csr/madeny.me.csr delete mode 100644 cert/csr/process delete mode 100644 cert/csr/root.pem delete mode 100644 cert/csr/root.srl delete mode 100644 cert/keys/root.key delete mode 100644 cert/live/madeny.me.ssl.crt delete mode 100644 cert/live/madeny.me.ssl.key rename src/{Domain.php => DomainProvider.php} (95%) create mode 100644 src/TestCleaner.php 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/csr/.csr deleted file mode 100644 index 46ea5f7..0000000 --- a/cert/csr/.csr +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIC0DCCAbgCAQAwgYoxCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJOWTERMA8GA1UE -BwwITmV3IFlvcmsxEDAOBgNVBAoMB0BtYWRlbnkxEzARBgNVBAsMCm1hZGVueSBp -bmMxGzAZBgkqhkiG9w0BCQEWDG1lQG1hZGVueS5tZTEXMBUGA1UEAwwOY29tLm1h -ZGVueS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDWaSA0m2br -0SREhaDVHDIMciS+ODPdS0RnV4LoePTRLFxzo7/OH+6xDePX+wGilwLO8kNnFywL -BNChxqLyc4K7u0povm04TKqsbYR8GCDkQ9iv9lxRCuEJ1MIquI5LaVbnd4iszUrM -ZBaM6iYLTJQgmLhdW78dfqDvr3j3pwtMlhxepcOOW8fyiEL7peK72QOD0bdNoMeV -/j4OzabUAmm3/0Z3ym+dFNkIjzACiWevMDXdKHjDPH6b9fZH4891SocXCNuXBP7z -H6Wmdm218CXfdvCjtcCQiCSy5nquKh0Ecys5TrOcPmpmefv0Jp9dEQ1sfaMxVlQL -XoM2+um4F7QzAgMBAAGgADANBgkqhkiG9w0BAQsFAAOCAQEAsVNwmhtNREzwMwZm -KzoSSo58iN/QUn6vKvhAFm6/XX+bV6ZR2h6m/yvHnQ193pntfEasPdLH+6gdGn67 -JipemCZEF2Pj1Qka8IubthH4KvzJbbDmmVWwv+xJHE3j+WZ6Uh7jhqYtsK/FIhcS -ehxHpYhpscDyIlWzoU7OGXp+mJtOeID8kEuqOZZBaXtYCHsPlNta7Gvr5YxNp+Z4 -JVcNsMa5qsJQEihY5VFIgXDeG6uux5sdWBR2O04UcqaPu23Cn0L016qNw8WrOhL9 -7Dz6yKsIHgKs9Id1uJOO0fPoprkvKOkN3bmYz0K6eumkdAamfU5p8tc/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 - -lcuR5nV0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ymOxVJ4PxyHp0ZPEFpjiReprdXV23ikqrRa0lAKu -Owdz5FuZXGy87RmqjajLT4jprQdo9xqqWEiMzw3FfDF0LU/TzFEN1eRmCjJ9RIeV -NgKNaiLgJWOCnfCeS7r9TNQRRH7LBmRrxqJ7n6BXNgj29avt0WHraY/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 -MQswCQYDVQQIDAJMQzEUMBIGA1UEBwwLTG9jYW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GgDSw9Y -07kiFkFRD4HKz7YuAPSKXkTfv5CWyM12t/Ztohk/lW/B/SMsZNjSYrk5ROu5sOAM -jRyVBgUnEna6yKdTAw9fYMbToTwtAQdXpR+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 index 86be59c..3b7d37e 100644 --- a/cert/logs/log +++ b/cert/logs/log @@ -1,12 +1,58 @@ +/Volumes/HD/Projects/madeny/lhttps/cert/csr/example.com.csr: No such file or directory +/Volumes/HD/Projects/madeny/lhttps/cert/csr/example.com.csr: No such file or directory +/Volumes/HD/Projects/madeny/lhttps/cert/csr/example.com.csr: No such file or directory +Generating a 2048 bit RSA private key +.................+++ +....................................+++ +writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 +Generating a 2048 bit RSA private key +.....................+++ +....................................................................................+++ +writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 +Generating a 2048 bit RSA private key +........................+++ +..............................+++ +writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 +Generating a 2048 bit RSA private key +.........................+++ +.+++ +writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 +Generating a 2048 bit RSA private key +..................................................................................................................................................+++ +..............+++ +writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 +Generating RSA private key, 2048 bit long modulus +.......................................................+++ +...............................................................+++ +e is 65537 (0x10001) +Generating a 2048 bit RSA private key +................+++ +.......................+++ +writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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/src/Domain.php b/src/DomainProvider.php similarity index 95% rename from src/Domain.php rename to src/DomainProvider.php index 5090def..4d61dca 100644 --- a/src/Domain.php +++ b/src/DomainProvider.php @@ -1,6 +1,6 @@ error = $error; + + } + + public function getError() + { + return $this->error; + } +} \ No newline at end of file diff --git a/src/command/CreatorCommand.php b/src/command/CreatorCommand.php index adbdb24..617c923 100644 --- a/src/command/CreatorCommand.php +++ b/src/command/CreatorCommand.php @@ -9,7 +9,7 @@ use Madeny\lhttps\Config; use Madeny\lhttps\Maker; use Madeny\lhttps\Path; -use Madeny\lhttps\Domain; +use Madeny\lhttps\DomainProvider; class CreatorCommand extends Command { @@ -39,7 +39,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // Instantiating dependencies $path = Path::all(); - $domain = new Domain(); + $domain = new DomainProvider(); $domainName = $input->getArgument('domainName'); diff --git a/tests/MakerTest.php b/tests/MakerTest.php index d5dd74e..0ea1f47 100644 --- a/tests/MakerTest.php +++ b/tests/MakerTest.php @@ -1,10 +1,11 @@ path = Path::all(); - - $this->domain = new domain; - $this->domain->setDomainOne('madeny.me'); - + $this->domain = new DomainProvider; + $this->domain->setDomainOne('example.com'); Config::file($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo()); + } - + public function tearDown() + { + + unset($this->path, $this->domain); } - /** @test */ + /** @test */ public function a_user_can_generate_root_certificate_key() - { - $rootkey = file_exists($this->path.'/keys/root.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 ($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"; - } + if ($keygen->getError() == 0) { + echo "\n Key created with success \n"; + }else{ + echo "Something not right"; + } - $rootkey = true; - } + $rootkey = true; + } - $this->assertEquals($rootkey, true); - } + $this->assertEquals($rootkey, true); + } - /** @test */ + /** @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{ @@ -64,56 +67,62 @@ public function a_user_can_create_root_certificate_authority() $this->assertEquals($rootCA, true); } - /** @test */ + /** @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'); + { + $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()); + 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; - } + $domainkey = true; + $domaincsr = true; + } - $this->assertEquals($domainkey, true); - $this->assertEquals($domaincsr, true); - } + $this->assertEquals($domainkey, true); + $this->assertEquals($domaincsr, true); + } - /** @test */ + /** @test */ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() - { - $request = Maker::request($this->path, $this->domain->getDomainOne()); + { + $request = Maker::request($this->path, $this->domain->getDomainOne()); - $log = file_get_contents(realpath($this->path.'/logs/log')); + $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"; + if (strpos($log, "values mismatch") == true){ + + echo "\n Please delete your your CA and CAkey and make new one \n"; - $request->setError(0); - } + $request->setError(0); + } - $this->assertEquals($request->getError(), 0); + $this->assertEquals($request->getError(), 0); - } + } - /** @test */ - public function a_user_can_Trust_the_root_SSL_certificate() - { - $os = exec("uname -a"); +// /** @test */ +// public function a_user_can_Trust_the_root_SSL_certificate() +// { +// $os = exec("uname -a"); - $trusted = Maker::trust($this->path, $os, $option = null); +// $trusted = Maker::trust($this->path, $os, $option = null); - $this->assertEquals($trusted->getError(), 2); +// $this->assertEquals($trusted->getError(), 2); +// } + /** @test */ + public function clearUp() + { + $stats = (new TestCleaner($this->path))->getError(); + + $this->assertEquals(0, $stats); } - + } \ No newline at end of file From 73a1411cd98c9605449729c13c3d06ee6497d66e Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:17:41 +0200 Subject: [PATCH 05/46] Add a cleanup method for dumy files + fix failing --- cert/cnf/openssl.cnf | 13 +++++++++++++ cert/cnf/v3.ext | 7 +++++++ cert/csr/example.com.csr | 18 ++++++++++++++++++ cert/csr/root.pem | 22 ++++++++++++++++++++++ cert/csr/root.srl | 1 + cert/keys/root.key | 30 ++++++++++++++++++++++++++++++ cert/live/example.com.ssl.crt | 28 ++++++++++++++++++++++++++++ cert/live/example.com.ssl.key | 28 ++++++++++++++++++++++++++++ cert/logs/log | 24 ++++++++++++++++++++++++ tests/MakerTest.php | 10 +++++----- 10 files changed, 176 insertions(+), 5 deletions(-) create mode 100644 cert/cnf/openssl.cnf create mode 100644 cert/cnf/v3.ext create mode 100644 cert/csr/example.com.csr create mode 100644 cert/csr/root.pem create mode 100644 cert/csr/root.srl create mode 100644 cert/keys/root.key create mode 100644 cert/live/example.com.ssl.crt create mode 100644 cert/live/example.com.ssl.key diff --git a/cert/cnf/openssl.cnf b/cert/cnf/openssl.cnf new file mode 100644 index 0000000..f0c9cc5 --- /dev/null +++ b/cert/cnf/openssl.cnf @@ -0,0 +1,13 @@ +[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 new file mode 100644 index 0000000..21be49e --- /dev/null +++ b/cert/cnf/v3.ext @@ -0,0 +1,7 @@ +authorityKeyIdentifier=keyid,issuer +basicConstraints=CA:FALSE +keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment +subjectAltName = @alt_names +[alt_names] +DNS.1 = example.com +DNS.2 = www.example.com \ No newline at end of file diff --git a/cert/csr/example.com.csr b/cert/csr/example.com.csr new file mode 100644 index 0000000..d6de5a9 --- /dev/null +++ b/cert/csr/example.com.csr @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIC3DCCAcQCAQAwgZYxCzAJBgNVBAYTAkxIMQswCQYDVQQIDAJMQzEUMBIGA1UE +BwwLTG9jYWwgQ2l0cnkxEzARBgNVBAoMCkxPQ0FMSFRUUFMxEzARBgNVBAsMCmxv +Y2FsaHR0cHMxIDAeBgkqhkiG9w0BCQEWEWxvY2FsQGh0dHBzLmxvY2FsMRgwFgYD +VQQDDA9jb20ubG9jYWwuaHR0cHMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK +AoIBAQDAJnM/wnnaJVEV4W0lBSPjE5I5A1tctTrR1N1+5BA21HV+aJCvjU6S+Xa+ +ECrve0ZyVJN3mmdpKJj6aZvnAZFixRGpL0FxgepHbxSwdH66T2BqbWYqVqijAB0S +//5J8qVLo4Hd5n15HRCK9xKQxhwDfEssXo17b5tzXK4n/sjtaMmew5li9RC56n3A +2OIbf7RInAiTXhU46rQsyAoSEA4WYf139ZqDAyEoBjil58VIRH2/l3FA5Oqirmzm +laWaDexCSOIrTWAEq01n1hrgU151sVSMHICjtnm3HhnLpwfcjDKOr/zegJRb+963 +HNWLu1trKFdwXYhpamurQm/UV5tFAgMBAAGgADANBgkqhkiG9w0BAQsFAAOCAQEA +bx3HGMgEpH7V/qOd/VXnPFv9TxnGKLdXi3tLR0avQxPL9B/DIpUevIbeVARmGJMx +kZ9xOm4OsRqN11QdJMmQSEaTs3jwrUZKTZrIvawvtijVpQsBVITbd5+CGnlJoBUt +hPWqFuQvmJvL3Z1GgPzTDQzL3q4wCXEcGrWbHRptMIfVyrSukDtht1TFr5Lexl1/ +6mjzsvc5StM2TwMp1KpnsmJlCO8on8slBT1gT4vtNsYTq24/Ezm9Ko4XEo8Zq1Us +odSt8lKKsWh/ZMXHJO+dXFVFLB4m4NkkdE18CIRU3X4QaWDaDWxpX18Td2y5H96N +JrKaURhpQLz4e+yWIULAgA== +-----END CERTIFICATE REQUEST----- diff --git a/cert/csr/root.pem b/cert/csr/root.pem new file mode 100644 index 0000000..76311d3 --- /dev/null +++ b/cert/csr/root.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDqjCCApICCQConToiUzVkLzANBgkqhkiG9w0BAQsFADCBljELMAkGA1UEBhMC +TEgxCzAJBgNVBAgMAkxDMRQwEgYDVQQHDAtMb2NhbCBDaXRyeTETMBEGA1UECgwK +TE9DQUxIVFRQUzETMBEGA1UECwwKbG9jYWxodHRwczEgMB4GCSqGSIb3DQEJARYR +bG9jYWxAaHR0cHMubG9jYWwxGDAWBgNVBAMMD2NvbS5sb2NhbC5odHRwczAeFw0x +ODA0MjkwNTE3MjJaFw0yMTAyMTYwNTE3MjJaMIGWMQswCQYDVQQGEwJMSDELMAkG +A1UECAwCTEMxFDASBgNVBAcMC0xvY2FsIENpdHJ5MRMwEQYDVQQKDApMT0NBTEhU +VFBTMRMwEQYDVQQLDApsb2NhbGh0dHBzMSAwHgYJKoZIhvcNAQkBFhFsb2NhbEBo +dHRwcy5sb2NhbDEYMBYGA1UEAwwPY29tLmxvY2FsLmh0dHBzMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy67i3fFyEKArxUeywzPE8LSS/uogJhRcFuJM +I8acDe/5PXoNHgZtSlvdvjle5Ef3bwu37JU/TvNiLcZauYtrpKusMZfW/mfCat/g +4ypIi+7b1ig27iSi0z8cLF6OOKpHy/MRZvD6E1wti5RZxqAaAIyaZ7oNTjUQU9u0 +c2022yUQacsvhh75syl+SlBhiu5NnrH9kz/o4iUn5ZDOU2HZIZF0EkwyRZ2hwrWz +UsEe/vHQ029otBmU2XJ0yAzolIYJIg5A/BdecfAat3gJoSSDve2GxwvdNjzKLJzz +fPezrrKVNxVxjcbUV7jotrRHOSjann4h3QJVH9PJY6gCfUR8YwIDAQABMA0GCSqG +SIb3DQEBCwUAA4IBAQBifwDCnniW3RdBtABw/J6lDq9enbRyNpaHJVYN0lN2VGmS +A9D37o4lpCfCVuqIbIHn2kvmBTGeXN6f3+NEY/EQDp+QkarcOfjbUNDJ571d0wk8 +0MwG1Pcw299dgiRWXHIShtTYLQ+Q26507i5Cs8tSaNeVtLPuoeoOXZEUmWCnhhTd +Y/RIumsR/Ji1K1tAa9nYd5vFKIzHkg8fXJQV5MK1b+k7vwIFkjRhFnhhVMZ2CLQO +OmIl+xwlOrzBCwZtlj5jmGYVlH1nVnKdUSkZO6N1DFuaTplfSnaNlwnkPX22JPwj +jJ1xKu2ekDmrP5I837KtmvjgZFjh9Yd2fDsnwD5o +-----END CERTIFICATE----- diff --git a/cert/csr/root.srl b/cert/csr/root.srl new file mode 100644 index 0000000..6431460 --- /dev/null +++ b/cert/csr/root.srl @@ -0,0 +1 @@ +E9177AD8D3932B35 diff --git a/cert/keys/root.key b/cert/keys/root.key new file mode 100644 index 0000000..76149a1 --- /dev/null +++ b/cert/keys/root.key @@ -0,0 +1,30 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-EDE3-CBC,0D87B280D4AC9025 + +pz8O2cvyKwwXaecNLTIILrh4/CfTX3fclRMv5RXZIQ8K7UueONx2qY0zUrBqkDGO +w9ja5wWX5TiCF7BO2IABxyCdM5+lr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6hbp +lN6Ff90pslJv7acjf2r4Spb+G6Q3yC0cpPJ5Z8owqE9ssNr0AGe0Tr8HUPl8CB7N +O46i9pzZhgYJ5yltfoa3i6OLT879+bozNooCgHlx+TDbHclbeZoW524qF9qL4Eco +dnpguCyUVQwBfd1KCEyYLzvfSJdG0x94M5HYzYUmvYCgAws47M+sRCmG0J5HrEvO +h81ObVsO0Vb5j5CHE8FBbF45DC/vlVXrR57gSIp/6Ts7Fzg3q7Amr9dbNuAPdaaD +WBkkhPPXg9tlqRmbSF1ezDVuShP7w2yBYoknlMFPIXymaiEwlRZ1qVkjhDALx6zL +ObXrFiR7SXOeVGux6VS+QmbiCdGPsLJbtMteswT2/IivnfOUiEReEaIatAa10fT0 +h87QZ97cPWj7ZHVgZhRBIxJ2QHQ9d1GIDM5Gn3ziJQHUYmGBbQ5AFzpJsNjVufBe +-----END RSA PRIVATE KEY----- diff --git a/cert/live/example.com.ssl.crt b/cert/live/example.com.ssl.crt new file mode 100644 index 0000000..c5cc2dc --- /dev/null +++ b/cert/live/example.com.ssl.crt @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIErjCCA5agAwIBAgIJAOkXetjTkys1MA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD +VQQGEwJMSDELMAkGA1UECAwCTEMxFDASBgNVBAcMC0xvY2FsIENpdHJ5MRMwEQYD +VQQKDApMT0NBTEhUVFBTMRMwEQYDVQQLDApsb2NhbGh0dHBzMSAwHgYJKoZIhvcN +AQkBFhFsb2NhbEBodHRwcy5sb2NhbDEYMBYGA1UEAwwPY29tLmxvY2FsLmh0dHBz +MB4XDTE4MDQyOTA1MTcyNFoXDTE5MDkxMTA1MTcyNFowgZYxCzAJBgNVBAYTAkxI +MQswCQYDVQQIDAJMQzEUMBIGA1UEBwwLTG9jYWwgQ2l0cnkxEzARBgNVBAoMCkxP +Q0FMSFRUUFMxEzARBgNVBAsMCmxvY2FsaHR0cHMxIDAeBgkqhkiG9w0BCQEWEWxv +Y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h7c2m5KC8VlgD1NitUpU3CH +GrLndqUBNmSxUsjDOs6mCrp0bsz+6oIluCuU9eYnSINdkTVghy2EdgvNrb873QiR +cgs= +-----END CERTIFICATE----- diff --git a/cert/live/example.com.ssl.key b/cert/live/example.com.ssl.key new file mode 100644 index 0000000..0b19914 --- /dev/null +++ b/cert/live/example.com.ssl.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDAJnM/wnnaJVEV +4W0lBSPjE5I5A1tctTrR1N1+5BA21HV+aJCvjU6S+Xa+ECrve0ZyVJN3mmdpKJj6 +aZvnAZFixRGpL0FxgepHbxSwdH66T2BqbWYqVqijAB0S//5J8qVLo4Hd5n15HRCK +9xKQxhwDfEssXo17b5tzXK4n/sjtaMmew5li9RC56n3A2OIbf7RInAiTXhU46rQs +yAoSEA4WYf139ZqDAyEoBjil58VIRH2/l3FA5OqirmzmlaWaDexCSOIrTWAEq01n +1hrgU151sVSMHICjtnm3HhnLpwfcjDKOr/zegJRb+963HNWLu1trKFdwXYhpamur +Qm/UV5tFAgMBAAECggEARAwZ2mWb04ZNnesURPz6BYvDx88Jht5jczXoLuzDVTeO +WHLdcl4fimswAwUkv2SvwQN0qfGTV6lZ66yE2p0yiIDzzS+ABJuWhS+wawEGdCJy +KZ6OhMXluLvsj/L6ceOtaAkCj7v1iXOijSQMfhq6hv14fcEKZ8FRktwqjN1s+K37 +P4x9wFI8loiX6+bVa9XYWMsyZBDGAOELmk5mFC0EVGHznilDIzB4Q0Q2tTdrkevy +75qvsCnB61ECQSToHRk3bCO3iyKj9XKQnVqI8ylCZmoPFVxqFcGsHSS/9olAvvdr +nQjjKFCCSSPcOAIySPE5/2zvrqmBogZJG2MmXI+WDQKBgQDi6lOFa4eEFeSbDvdZ +qnt+Uld9zstan+7W7WTNHgSKj4z93sJTIGJkJvv1K/9puaC3H9qyTHnhaEUoH1ZO +YcJR6bKwK0pE/5qHM8dzZSIOlyprqnRlYTiR7W9fhXp7ME1eKFI/AofdE8T1ywpM +X8+wb1q2AbM52OcTfWmaYfKZ1wKBgQDYx2P8Tw1P1W+xeP1p7K8k0zUvnIJ4OL6p +0ifQa7i80CszEGqDyu8PDLRtQ9Bp1mhV7u1iybzCBwLhSMBTN0QQRBohjj6cygau +UBVVzlBd6g88zj/BfnoL2PuhCKrPI2+cITkspPe0oK+nTg9mZyAElfZMOnffoL1I +324yUDZoQwKBgElo6ZBWU0cmFgkb9GWrw7wAQ5HN3vf4mboqntvFBE8XVdOjx1ZB +OdOQ0R5mF4FKrnXP9l6MYznLE+SBDtjYw5bgdhCMUMC1uHZZCAOLClOSEAU45eMO +atC68bcDZbaIz97QSJtd5DpfdO7XuwMuU/COddhAAI2MYGVrw0hQu72NAoGAFnWi +EFQIZwsQBW0ppD3Xb5NKYWJvyhDnACU75sYiX72ZnDLJNlpiJkcEsoViJHUIXk7g +3WlVWyzqyXiGJJkHPkAwDOX16ryrsIevjjJP9Ur4xS4BQQTflDao62hAejGLsLto +dw2odFhpmoXl5pAsqwz2dbNhFBRNSC2N9zyERo0CgYB9rpcvcToypgqNWv7XVOHq +wTqlz01Gevz2F2M99uKmZ2dm5m22DQZvjGD89TomOIQ2tBsFUhSdQ+5OhWIHtcL/ +N52lPbtKFMma2foS6CC5CW4df5jhVK4GNTRvSmPgu28FXzLphrr4kWVUG8UCWlvd +I7DNP60XpW+feNEPX8JLyw== +-----END PRIVATE KEY----- diff --git a/cert/logs/log b/cert/logs/log index 3b7d37e..7e540fd 100644 --- a/cert/logs/log +++ b/cert/logs/log @@ -56,3 +56,27 @@ writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example 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 +Generating RSA private key, 2048 bit long modulus +...........................+++ +.........+++ +e is 65537 (0x10001) +Generating a 2048 bit RSA private key +...............................+++ +.......................................................+++ +writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 +Generating RSA private key, 2048 bit long modulus +..+++ +.........................................................................................................+++ +e is 65537 (0x10001) +Generating a 2048 bit RSA private key +.......+++ +.................................+++ +writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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/tests/MakerTest.php b/tests/MakerTest.php index 0ea1f47..f8cc610 100644 --- a/tests/MakerTest.php +++ b/tests/MakerTest.php @@ -116,12 +116,12 @@ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() // $this->assertEquals($trusted->getError(), 2); // } /** @test */ - public function clearUp() - { - $stats = (new TestCleaner($this->path))->getError(); + // public function clearUp() + // { + // $stats = (new TestCleaner($this->path))->getError(); - $this->assertEquals(0, $stats); - } + // $this->assertEquals(0, $stats); + // } From 3afa57e5982b74b84a521b8bdbf0000b6308f86b Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:21:28 +0200 Subject: [PATCH 06/46] ##4 quick changes and updates... --- .circleci/config.yml | 1 + tests/MakerTest.php | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3f711f8..a84e85d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,3 +39,4 @@ jobs: # run tests! - run: php lh create --a - run: ./vendor/bin/phpunit + - run: cat cert/logs/log diff --git a/tests/MakerTest.php b/tests/MakerTest.php index f8cc610..0ea1f47 100644 --- a/tests/MakerTest.php +++ b/tests/MakerTest.php @@ -116,12 +116,12 @@ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() // $this->assertEquals($trusted->getError(), 2); // } /** @test */ - // public function clearUp() - // { - // $stats = (new TestCleaner($this->path))->getError(); + public function clearUp() + { + $stats = (new TestCleaner($this->path))->getError(); - // $this->assertEquals(0, $stats); - // } + $this->assertEquals(0, $stats); + } From 4db7406d611fe6d01e384504e0f3c83ea515421b Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:23:34 +0200 Subject: [PATCH 07/46] ##4 quick changes and updates... --- cert/logs/log | 82 --------------------------------------------------- 1 file changed, 82 deletions(-) diff --git a/cert/logs/log b/cert/logs/log index 7e540fd..e69de29 100644 --- a/cert/logs/log +++ b/cert/logs/log @@ -1,82 +0,0 @@ -/Volumes/HD/Projects/madeny/lhttps/cert/csr/example.com.csr: No such file or directory -/Volumes/HD/Projects/madeny/lhttps/cert/csr/example.com.csr: No such file or directory -/Volumes/HD/Projects/madeny/lhttps/cert/csr/example.com.csr: No such file or directory -Generating a 2048 bit RSA private key -.................+++ -....................................+++ -writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 -Generating a 2048 bit RSA private key -.....................+++ -....................................................................................+++ -writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 -Generating a 2048 bit RSA private key -........................+++ -..............................+++ -writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 -Generating a 2048 bit RSA private key -.........................+++ -.+++ -writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 -Generating a 2048 bit RSA private key -..................................................................................................................................................+++ -..............+++ -writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 -Generating RSA private key, 2048 bit long modulus -.......................................................+++ -...............................................................+++ -e is 65537 (0x10001) -Generating a 2048 bit RSA private key -................+++ -.......................+++ -writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 -Generating RSA private key, 2048 bit long modulus -...........................+++ -.........+++ -e is 65537 (0x10001) -Generating a 2048 bit RSA private key -...............................+++ -.......................................................+++ -writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 -Generating RSA private key, 2048 bit long modulus -..+++ -.........................................................................................................+++ -e is 65537 (0x10001) -Generating a 2048 bit RSA private key -.......+++ -.................................+++ -writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 From 19cef3953ad3abce78ffdbdc09cb5da61e772d65 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:29:42 +0200 Subject: [PATCH 08/46] ##4 quick changes and updates... --- cert/cnf/openssl.cnf | 13 ------------- cert/cnf/v3.ext | 7 ------- cert/csr/example.com.csr | 18 ------------------ cert/csr/root.pem | 22 ---------------------- cert/csr/root.srl | 1 - cert/keys/root.key | 30 ------------------------------ cert/live/example.com.ssl.crt | 28 ---------------------------- cert/live/example.com.ssl.key | 28 ---------------------------- cert/logs/log | 3 +++ 9 files changed, 3 insertions(+), 147 deletions(-) delete mode 100644 cert/cnf/openssl.cnf delete mode 100644 cert/cnf/v3.ext delete mode 100644 cert/csr/example.com.csr delete mode 100644 cert/csr/root.pem delete mode 100644 cert/csr/root.srl delete mode 100644 cert/keys/root.key delete mode 100644 cert/live/example.com.ssl.crt delete mode 100644 cert/live/example.com.ssl.key 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 21be49e..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 = example.com -DNS.2 = www.example.com \ No newline at end of file diff --git a/cert/csr/example.com.csr b/cert/csr/example.com.csr deleted file mode 100644 index d6de5a9..0000000 --- a/cert/csr/example.com.csr +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIC3DCCAcQCAQAwgZYxCzAJBgNVBAYTAkxIMQswCQYDVQQIDAJMQzEUMBIGA1UE -BwwLTG9jYWwgQ2l0cnkxEzARBgNVBAoMCkxPQ0FMSFRUUFMxEzARBgNVBAsMCmxv -Y2FsaHR0cHMxIDAeBgkqhkiG9w0BCQEWEWxvY2FsQGh0dHBzLmxvY2FsMRgwFgYD -VQQDDA9jb20ubG9jYWwuaHR0cHMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK -AoIBAQDAJnM/wnnaJVEV4W0lBSPjE5I5A1tctTrR1N1+5BA21HV+aJCvjU6S+Xa+ -ECrve0ZyVJN3mmdpKJj6aZvnAZFixRGpL0FxgepHbxSwdH66T2BqbWYqVqijAB0S -//5J8qVLo4Hd5n15HRCK9xKQxhwDfEssXo17b5tzXK4n/sjtaMmew5li9RC56n3A -2OIbf7RInAiTXhU46rQsyAoSEA4WYf139ZqDAyEoBjil58VIRH2/l3FA5Oqirmzm -laWaDexCSOIrTWAEq01n1hrgU151sVSMHICjtnm3HhnLpwfcjDKOr/zegJRb+963 -HNWLu1trKFdwXYhpamurQm/UV5tFAgMBAAGgADANBgkqhkiG9w0BAQsFAAOCAQEA -bx3HGMgEpH7V/qOd/VXnPFv9TxnGKLdXi3tLR0avQxPL9B/DIpUevIbeVARmGJMx -kZ9xOm4OsRqN11QdJMmQSEaTs3jwrUZKTZrIvawvtijVpQsBVITbd5+CGnlJoBUt -hPWqFuQvmJvL3Z1GgPzTDQzL3q4wCXEcGrWbHRptMIfVyrSukDtht1TFr5Lexl1/ -6mjzsvc5StM2TwMp1KpnsmJlCO8on8slBT1gT4vtNsYTq24/Ezm9Ko4XEo8Zq1Us -odSt8lKKsWh/ZMXHJO+dXFVFLB4m4NkkdE18CIRU3X4QaWDaDWxpX18Td2y5H96N -JrKaURhpQLz4e+yWIULAgA== ------END CERTIFICATE REQUEST----- diff --git a/cert/csr/root.pem b/cert/csr/root.pem deleted file mode 100644 index 76311d3..0000000 --- a/cert/csr/root.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDqjCCAp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eoOXZEUmWCnhhTd -Y/RIumsR/Ji1K1tAa9nYd5vFKIzHkg8fXJQV5MK1b+k7vwIFkjRhFnhhVMZ2CLQO -OmIl+xwlOrzBCwZtlj5jmGYVlH1nVnKdUSkZO6N1DFuaTplfSnaNlwnkPX22JPwj -jJ1xKu2ekDmrP5I837KtmvjgZFjh9Yd2fDsnwD5o ------END CERTIFICATE----- diff --git a/cert/csr/root.srl b/cert/csr/root.srl deleted file mode 100644 index 6431460..0000000 --- a/cert/csr/root.srl +++ /dev/null @@ -1 +0,0 @@ -E9177AD8D3932B35 diff --git a/cert/keys/root.key b/cert/keys/root.key deleted file mode 100644 index 76149a1..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,0D87B280D4AC9025 - -pz8O2cvyKwwXaecNLTIILrh4/CfTX3fclRMv5RXZIQ8K7UueONx2qY0zUrBqkDGO -w9ja5wWX5TiCF7BO2IABxyCdM5+lrMGuqiWQLS9t0L8RwI+6yx7NKczblc3kBcSG -UmWQW9pRPU3IFbZigKqBXPD0vmTDVovPPjFMAe0s+bOn+gR2Gzs8WH3piVVbhul9 -RbL0P4984EHc7zRm0AxwiN1aV0LvZ+ND0yceSIk2M/L/+oPSm6btvU4pltqbaljX -cWB+VlHsLH8izB2B44zZZYW736rXlm8ZXERQ5gEMvNpxQMwnGsXjq4/FTT1kKfTt -82CU6vIblYvfNNAleyFDEPXpiQ8wJZsZ0Dfb5IZcyuAObiox+ZlOo81X97rKHLkk -LAQC+kHqPIkW7OToqSHmn3Ju9b+BW5Bj07/aOmjelqbOA+deGACLgt89E8Q1ttxi -WBZOk1m0cY1Kzcsxu0W71QvtesT8P6nJbveXJ0S3sA+CSdN1dy9RO+eCmSGmmpJz -14VtoZmXwgOo85S+WgM03O+JGtwfGb2q3Zcx7QVgmTUWpOrsFODbryYiwciWVAIt -sQeqW79RUiSr9dg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/cert/live/example.com.ssl.crt deleted file mode 100644 index c5cc2dc..0000000 --- a/cert/live/example.com.ssl.crt +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIErjCCA5agAwIBAgIJAOkXetjTkys1MA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD -VQQGEwJMSDELMAkGA1UECAwCTEMxFDASBgNVBAcMC0xvY2FsIENpdHJ5MRMwEQYD -VQQKDApMT0NBTEhUVFBTMRMwEQYDVQQLDApsb2NhbGh0dHBzMSAwHgYJKoZIhvcN -AQkBFhFsb2NhbEBodHRwcy5sb2NhbDEYMBYGA1UEAwwPY29tLmxvY2FsLmh0dHBz -MB4XDTE4MDQyOTA1MTcyNFoXDTE5MDkxMTA1MTcyNFowgZYxCzAJBgNVBAYTAkxI -MQswCQYDVQQIDAJMQzEUMBIGA1UEBwwLTG9jYWwgQ2l0cnkxEzARBgNVBAoMCkxP -Q0FMSFRUUFMxEzARBgNVBAsMCmxvY2FsaHR0cHMxIDAeBgkqhkiG9w0BCQEWEWxv -Y2FsQGh0dHBzLmxvY2FsMRgwFgYDVQQDDA9jb20ubG9jYWwuaHR0cHMwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDAJnM/wnnaJVEV4W0lBSPjE5I5A1tc -tTrR1N1+5BA21HV+aJCvjU6S+Xa+ECrve0ZyVJN3mmdpKJj6aZvnAZFixRGpL0Fx -gepHbxSwdH66T2BqbWYqVqijAB0S//5J8qVLo4Hd5n15HRCK9xKQxhwDfEssXo17 -b5tzXK4n/sjtaMmew5li9RC56n3A2OIbf7RInAiTXhU46rQsyAoSEA4WYf139ZqD -AyEoBjil58VIRH2/l3FA5OqirmzmlaWaDexCSOIrTWAEq01n1hrgU151sVSMHICj -tnm3HhnLpwfcjDKOr/zegJRb+963HNWLu1trKFdwXYhpamurQm/UV5tFAgMBAAGj -gfwwgfkwgbUGA1UdIwSBrTCBqqGBnKSBmTCBljELMAkGA1UEBhMCTEgxCzAJBgNV -BAgMAkxDMRQwEgYDVQQHDAtMb2NhbCBDaXRyeTETMBEGA1UECgwKTE9DQUxIVFRQ -UzETMBEGA1UECwwKbG9jYWxodHRwczEgMB4GCSqGSIb3DQEJARYRbG9jYWxAaHR0 -cHMubG9jYWwxGDAWBgNVBAMMD2NvbS5sb2NhbC5odHRwc4IJAKidOiJTNWQvMAkG -A1UdEwQCMAAwCwYDVR0PBAQDAgTwMCcGA1UdEQQgMB6CC2V4YW1wbGUuY29tgg93 -d3cuZXhhbXBsZS5jb20wDQYJKoZIhvcNAQELBQADggEBAIMqVEi76xz78RKLCDDt -BrD4aqf5Iq31wFgnIbAncOJiZNAg77sFFzc3yHHugxOM2R6lQCkMwjGzRy0aZlxN -wU1AmhTgOutfxuZFyR/o/xri5mVPMyWkFwcq7y5bxNbK0SuBVt5jd28usYq+/7Ph -+ageorTMeXWzrFiatyFCDtqPXr2B2SKCFRqbvYCU2CQB28C3/8HweGJQoH0F+rvP -wt0o8oGv0kxEBu5Be5A2MiuxnuqfKjMFCfiPRoKSNh7c2m5KC8VlgD1NitUpU3CH -GrLndqUBNmSxUsjDOs6mCrp0bsz+6oIluCuU9eYnSINdkTVghy2EdgvNrb873QiR -cgs= ------END CERTIFICATE----- diff --git a/cert/live/example.com.ssl.key b/cert/live/example.com.ssl.key deleted file mode 100644 index 0b19914..0000000 --- a/cert/live/example.com.ssl.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDAJnM/wnnaJVEV -4W0lBSPjE5I5A1tctTrR1N1+5BA21HV+aJCvjU6S+Xa+ECrve0ZyVJN3mmdpKJj6 -aZvnAZFixRGpL0FxgepHbxSwdH66T2BqbWYqVqijAB0S//5J8qVLo4Hd5n15HRCK -9xKQxhwDfEssXo17b5tzXK4n/sjtaMmew5li9RC56n3A2OIbf7RInAiTXhU46rQs -yAoSEA4WYf139ZqDAyEoB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k7g -3WlVWyzqyXiGJJkHPkAwDOX16ryrsIevjjJP9Ur4xS4BQQTflDao62hAejGLsLto -dw2odFhpmoXl5pAsqwz2dbNhFBRNSC2N9zyERo0CgYB9rpcvcToypgqNWv7XVOHq -wTqlz01Gevz2F2M99uKmZ2dm5m22DQZvjGD89TomOIQ2tBsFUhSdQ+5OhWIHtcL/ -N52lPbtKFMma2foS6CC5CW4df5jhVK4GNTRvSmPgu28FXzLphrr4kWVUG8UCWlvd -I7DNP60XpW+feNEPX8JLyw== ------END PRIVATE KEY----- diff --git a/cert/logs/log b/cert/logs/log index e69de29..746be89 100644 --- a/cert/logs/log +++ b/cert/logs/log @@ -0,0 +1,3 @@ +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 From b7485fb0362f4f8b783b5f3eea1adce9206e47fa Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:37:13 +0200 Subject: [PATCH 09/46] ##4 quick changes and updates... --- src/TestCleaner.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TestCleaner.php b/src/TestCleaner.php index 1f66972..e435788 100644 --- a/src/TestCleaner.php +++ b/src/TestCleaner.php @@ -8,7 +8,7 @@ class TestCleaner protected $error; function __construct($path) { - exec("rm {$path}/cnf/* ; rm {$path}/live/*; rm {$path}/keys/*; rm {$path}/csr/*", $output, $error); + exec("rm {$path}/live/*; rm {$path}/keys/*; rm {$path}/csr/*", $output, $error); $this->error = $error; From 97a5ad632ebc10b9e5a0b28b419464f1b30af702 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:39:39 +0200 Subject: [PATCH 10/46] ##4 quick changes and updates... --- cert/cnf/openssl.cnf | 13 +++++++++++++ cert/cnf/v3.ext | 7 +++++++ cert/logs/log | 12 ++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 cert/cnf/openssl.cnf create mode 100644 cert/cnf/v3.ext diff --git a/cert/cnf/openssl.cnf b/cert/cnf/openssl.cnf new file mode 100644 index 0000000..f0c9cc5 --- /dev/null +++ b/cert/cnf/openssl.cnf @@ -0,0 +1,13 @@ +[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 new file mode 100644 index 0000000..21be49e --- /dev/null +++ b/cert/cnf/v3.ext @@ -0,0 +1,7 @@ +authorityKeyIdentifier=keyid,issuer +basicConstraints=CA:FALSE +keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment +subjectAltName = @alt_names +[alt_names] +DNS.1 = example.com +DNS.2 = www.example.com \ No newline at end of file diff --git a/cert/logs/log b/cert/logs/log index 746be89..76252f2 100644 --- a/cert/logs/log +++ b/cert/logs/log @@ -1,3 +1,15 @@ 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 +Generating RSA private key, 2048 bit long modulus +....................+++ +............+++ +e is 65537 (0x10001) +Generating a 2048 bit RSA private key +...+++ +.............................................................+++ +writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 From baaa4bcee7d0521d26537ea66afcf089b80e8b59 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:41:01 +0200 Subject: [PATCH 11/46] ##4 quick changes and updates... --- tests/MakerTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/MakerTest.php b/tests/MakerTest.php index 0ea1f47..f8cc610 100644 --- a/tests/MakerTest.php +++ b/tests/MakerTest.php @@ -116,12 +116,12 @@ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() // $this->assertEquals($trusted->getError(), 2); // } /** @test */ - public function clearUp() - { - $stats = (new TestCleaner($this->path))->getError(); + // public function clearUp() + // { + // $stats = (new TestCleaner($this->path))->getError(); - $this->assertEquals(0, $stats); - } + // $this->assertEquals(0, $stats); + // } From da6d26c6875fb85c8cf7493260acaf4797ddeb1e Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:45:53 +0200 Subject: [PATCH 12/46] ##4 quick changes and updates... --- .gitignore | 13 +++++-------- cert/cnf/openssl.cnf | 13 ------------- cert/cnf/v3.ext | 7 ------- cert/logs/log | 15 --------------- 4 files changed, 5 insertions(+), 43 deletions(-) delete mode 100644 cert/cnf/openssl.cnf delete mode 100644 cert/cnf/v3.ext delete mode 100644 cert/logs/log diff --git a/.gitignore b/.gitignore index 79e6142..084ddb2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,8 @@ /vendor/ /deply/ /.readme -/goundo.md.conf -/issuer.conf -/rootCA.key -/rootCa.pem -/rootCA.srl -/server.csr -/server.key -/v3.ext +/cert/cnf/ +/cert/config/ +/cert/csr/ +/cert/keys/ +/cert/logs/ 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 21be49e..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 = example.com -DNS.2 = www.example.com \ No newline at end of file diff --git a/cert/logs/log b/cert/logs/log deleted file mode 100644 index 76252f2..0000000 --- a/cert/logs/log +++ /dev/null @@ -1,15 +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 -Generating RSA private key, 2048 bit long modulus -....................+++ -............+++ -e is 65537 (0x10001) -Generating a 2048 bit RSA private key -...+++ -.............................................................+++ -writing new private key to '/Volumes/HD/Projects/madeny/lhttps/cert/live/example.com.ssl.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 From 00e8ef8716245c801097de61ffc0abfa44464eb7 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Sun, 29 Apr 2018 07:47:41 +0200 Subject: [PATCH 13/46] ##4 quick changes and updates... --- cert/live/example.com.ssl.crt | 28 ++++++++++++++++++++++++++++ cert/live/example.com.ssl.key | 28 ++++++++++++++++++++++++++++ src/TestCleaner.php | 21 --------------------- 3 files changed, 56 insertions(+), 21 deletions(-) create mode 100644 cert/live/example.com.ssl.crt create mode 100644 cert/live/example.com.ssl.key delete mode 100644 src/TestCleaner.php diff --git a/cert/live/example.com.ssl.crt b/cert/live/example.com.ssl.crt new file mode 100644 index 0000000..c4af753 --- /dev/null +++ b/cert/live/example.com.ssl.crt @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIErjCCA5agAwIBAgIJAMvDJeM0cg1IMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD +VQQGEwJMSDELMAkGA1UECAwCTEMxFDASBgNVBAcMC0xvY2FsIENpdHJ5MRMwEQYD +VQQKDApMT0NBTEhUVFBTMRMwEQYDVQQLDApsb2NhbGh0dHBzMSAwHgYJKoZIhvcN +AQkBFhFsb2NhbEBodHRw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BAFa4HM6HD1KNmwhQFx60 +FDTmW2AI8XYvrJZ5pvOJ8jkm+BLy18Prf5g5cuigJmk4Mz92Qkm5RUiG/U3A6Wwx +KSpxzitPRHeAAl/u1HSKI2t672+G73/FXM75lkKoWrhpb7SVJ6un9V+fR7V+y0w2 +So8ywV3V+GfxiRoDTkQ7V1rq3NU00gptcg/ULRaFyPoiTntUVaNzv2uZknFwXHFj +QuQWOtVmQLh2+4VKwq8ZHNRRh3KuQ75TVF1Ol4oIR6oUFifuq6/ORYelWY6yGoyU +wIeViJ3YkzB+osUxZ8Fz9dKWYBWfNFIIMdXbqZZqgcw47nfaGBHtS5r0c5DtuUKb +Duw= +-----END CERTIFICATE----- diff --git a/cert/live/example.com.ssl.key b/cert/live/example.com.ssl.key new file mode 100644 index 0000000..302b01c --- /dev/null +++ b/cert/live/example.com.ssl.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC65N0XIaHxwImW +It/CdPf7iRMWTl6+tIwmy30BuEJfnctj8P5Xekn/e7Kw42KiRKuwKxuNLQB09LSh +hmwwe2tri5rKg+htt8QyfXYkcFOXzXIAD8MbagTujh9yZ4fwLApNF52hxBTQKbci +FO9Q0EfvCd92A27LFv5Evn1y6LWmt0QHae/nMpjXPXaEYwtfSjPGLpma6/pZBFJh +S5rlI01HCPt5zvToHIgI9sn/kzivgvucyRQVeraUqp0QNZuN/1/19v4B+iINan+O +zhWzdKVm5cS1s8T8HwIIEGTECE/Z4Y3e3DpDVnG9r6QBLXRYPxWNLUMyxr8kDIdx +iYB+jAqlAgMBAAECggEBAKjx+DZPzeAG55kTn2heakk0iU+Ruq3z8fmj2zXxxfY/ +YzvN/20+e6P6wvaKJoB/SSBwZ3CALLiM+LhHFofhGaLXSS8mfLap9y6ZIXIhJD/G +lPYfSYT/msO3MBAwLL9cYFd+MJ2p7hKakxS5DfjkvxIDv8AjrETkXSfxdt+oI4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n +-----END PRIVATE KEY----- diff --git a/src/TestCleaner.php b/src/TestCleaner.php deleted file mode 100644 index e435788..0000000 --- a/src/TestCleaner.php +++ /dev/null @@ -1,21 +0,0 @@ -error = $error; - - } - - public function getError() - { - return $this->error; - } -} \ No newline at end of file From edb2575fb3796971d6565c12a8430ac662240d31 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Mon, 30 Apr 2018 01:55:34 +0200 Subject: [PATCH 14/46] Auto updates --- cert/live/example.com.ssl.crt | 28 ---------------------------- cert/live/example.com.ssl.key | 28 ---------------------------- src/Config.php | 13 +++++++++++++ tests/MakerTest.php | 1 + 4 files changed, 14 insertions(+), 56 deletions(-) delete mode 100644 cert/live/example.com.ssl.crt delete mode 100644 cert/live/example.com.ssl.key diff --git a/cert/live/example.com.ssl.crt b/cert/live/example.com.ssl.crt deleted file mode 100644 index c4af753..0000000 --- a/cert/live/example.com.ssl.crt +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIErjCCA5agAwIBAgIJAMvDJeM0cg1IMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD -VQQGEwJMSDELMAkGA1UECAwCTEMxFDASBgNVBAcMC0xvY2FsIENpdHJ5MRMwEQYD -VQQKDApMT0NBTEhUVFBTMRMwEQYDVQQLDApsb2NhbGh0dHBzMSAwHgYJKoZIhvcN -AQkBFhFsb2NhbEBodHRwcy5sb2NhbDEYMBYGA1UEAwwPY29tLmxvY2FsLmh0dHBz -MB4XDTE4MDQyOTA1NDczN1oXDTE5MDkxMTA1NDczN1owgZYxCzAJBgNVBAYTAkxI -MQswCQYDVQQIDAJMQzEUMBIGA1UEBwwLTG9jYWwgQ2l0cnkxEzARBgNVBAoMCkxP -Q0FMSFRUUFMxEzARBgNVBAsMCmxvY2FsaHR0cHMxIDAeBgkqhkiG9w0BCQEWEWxv -Y2FsQGh0dHBzLmxvY2FsMRgwFgYDVQQDDA9jb20ubG9jYWwuaHR0cHMwggEiMA0G -CSqGSI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NFIIMdXbqZZqgcw47nfaGBHtS5r0c5DtuUKb -Duw= ------END CERTIFICATE----- diff --git a/cert/live/example.com.ssl.key b/cert/live/example.com.ssl.key deleted file mode 100644 index 302b01c..0000000 --- a/cert/live/example.com.ssl.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC65N0XIaHxwImW -It/CdPf7iRMWTl6+tIwmy30BuEJfnctj8P5Xekn/e7Kw42KiRKuwKxuNLQB09LSh -hmwwe2tri5rKg+htt8QyfXYkcFOXzXIAD8MbagTujh9yZ4fwLApNF52hxBTQKbci -FO9Q0EfvCd92A27LFv5Evn1y6LWmt0QHae/nMpjXPXaEYwtfSjPGLpma6/pZBFJh -S5rlI01HCPt5zvToHIgI9sn/kzivgvucyRQVeraUqp0QNZuN/1/19v4B+iINan+O -zhWzdKVm5cS1s8T8HwIIEGTECE/Z4Y3e3DpDVnG9r6QBLXRYPxWNLUMyxr8kDIdx -iYB+jAqlAgMBAAECggEBAKjx+DZPzeAG55kTn2heakk0iU+Ruq3z8fmj2zXxxfY/ -YzvN/20+e6P6wvaKJoB/SSBwZ3CALLiM+LhHFofhGaLXSS8mfLap9y6ZIXIhJD/G -lPYfSYT/msO3MBAwLL9cYFd+MJ2p7hKakxS5DfjkvxIDv8AjrETkXSfxdt+oI4U2 -+bk/Q84KJjEGFPkhHX4lvuImHayjsusyUsOUuoan7Txt7Br+s7SgrfU8wvAeLlPm -CabT4ioAGLWAP6f62G16iqZV9YYM/+IB+IhzrdqPTseINQ/r/1SdcEN2XjpnxJEh -Qm2FnX95I2MBKrbHjVxmqvpLInGBlumv3A1c6Zy2W0UCgYEA9TZawekSR0phH1B4 -WB+HeHPctRG9p2CUTZBxy8misTYJ/KI4NKrpXlhlU1/Hpjn6QkoBzmGQEz2zYZVH -ctTVq923on1n+mxU9s7ASOqVjGyk6Jc1MWYvEtUpknF3BloY/3v2JsHx/+QwsUlG -S1uhxKYaQhqJinzJnvpKcTLA73sCgYEAwx22fc284OD/UPq4oL+6K9vQ0dW3V5g2 -XaAQACNlLeECNUfiZQNZuPsIN6pAgF/mkJIiISrs2gwzZlzW+EbuuABowUtxTRXS -Uw7CUgpT/ik1GW1zbT/zcrFkmp59o4gQRcLXgmdqOzzilTm10fikqit7gTBrmJsD -BCImPSz7xF8CgYBRkgBE6yx6bKK8UP+HiQ1+o0QzM7CcQkNzPe6s9Ola+/f8g1Yh -Jw20pcEnKAB5KmY2sPnC1q+fxvGqL4dyCpz9rCbPNdpl8q2c4JAUcXzIFsgQ22QF -h9F2+VP39Ci9AzG3o1vx7qh7EESmZRKuNNAuY3busHc6i2JisS4cU97ciwKBgGhr -QVvIPBnZL6ol06LrmHWaWQHDLzBonEe0vntkdeR8s5LSGp3WkjDF35ryuTw6loiu -PCel8kWrG+LfMoiCZYUBaw5vEn6ffATJNEN1lYfCg9FM2uYPwHiT6PQ6d6CJ07OR -14XJVHfJWLVlwiFRwMX1KU51HE/6PT38DJzWsxJfAoGBAO64U6mOj+tajyPjlZTk -LrwS8GBN0l1X0zMZ03MpNInhjAs3xK7N1zWne0XRS80ab6s2pVBmZZaQ1ieJ5kVI -YgG3Uq5KH8EBRQvht3TIOHmEOPgeQjz9o81GxNmlbcIdA1Ky/xQ8rF5ZAtXPFEBh -eYRsOETyWPEE+h8FXM6OB2hn ------END PRIVATE KEY----- diff --git a/src/Config.php b/src/Config.php index 2510f13..e73d399 100644 --- a/src/Config.php +++ b/src/Config.php @@ -2,9 +2,22 @@ namespace Madeny\lhttps; use Madeny\lhttps\Openssl; +use Madeny\lhttps\Path; class Config{ +function __construct() +{ + +$folders = ["madeny", "goundo"]; +for($i=0;$i<=$folders[0];$i++) +{ +mkdir(Path::all().folders[$i]); + +die(); +} +} + public static function file($path, $domainOne, $domainTwo) { return new Openssl($path, $domainOne, $domainTwo); diff --git a/tests/MakerTest.php b/tests/MakerTest.php index f8cc610..1b905a8 100644 --- a/tests/MakerTest.php +++ b/tests/MakerTest.php @@ -15,6 +15,7 @@ public function setUp() $this->path = Path::all(); $this->domain = new DomainProvider; $this->domain->setDomainOne('example.com'); + (new Config); Config::file($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo()); } From 242f08392e0dacbe6302f67559888377c9676065 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Mon, 30 Apr 2018 02:26:33 +0200 Subject: [PATCH 15/46] ##4 quick changes and updates... --- cert/live/example.com.ssl.crt | 28 ++++++++++++++++++++++++++++ cert/live/example.com.ssl.key | 28 ++++++++++++++++++++++++++++ src/Config.php | 23 +++++++++++++++++------ 3 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 cert/live/example.com.ssl.crt create mode 100644 cert/live/example.com.ssl.key diff --git a/cert/live/example.com.ssl.crt b/cert/live/example.com.ssl.crt new file mode 100644 index 0000000..2f06744 --- /dev/null +++ b/cert/live/example.com.ssl.crt @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIErjCCA5agAwIBAgIJANfS38bMJBQWMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD +VQQGEwJMSDELMAkGA1UECAwCTEMxFDASBgNVBAcMC0xvY2FsIENpdHJ5MRMwEQYD +VQQKDApMT0NBTEhUVFBTMRMwEQYDVQQLDApsb2NhbGh0dHBzMSAwHgYJKoZIhvcN +AQkBFhFsb2NhbEBodHRwcy5sb2NhbDEYMBYGA1UEAwwPY29tLmxvY2FsLmh0dHBz +MB4XDTE4MDQzMDAwMjYyOVoXDTE5MDkxMjAwMjYyOVowgZYxCzAJBgNVBAYTAkxI +MQswCQYDVQQIDAJMQzEUMBIGA1UEBwwLTG9jYWwgQ2l0cnkxEzARBgNVBAoMCkxP +Q0FMSFRUUFMxEzARBgNVBAsMCmxvY2FsaHR0cHMxIDAeBgkqhkiG9w0BCQEWEWxv +Y2FsQGh0dHBzLmxvY2FsMRgwFgYDVQQDDA9jb20ubG9jYWwuaHR0cHMwggEiMA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7omzH/pyN8/wxVGtGiO2DE1Uq0nqhzMT +/hc= +-----END CERTIFICATE----- diff --git a/cert/live/example.com.ssl.key b/cert/live/example.com.ssl.key new file mode 100644 index 0000000..ae2181d --- /dev/null +++ b/cert/live/example.com.ssl.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDw5v0XTY0AsIHP +J+CoFCKOF94I3M+9q2CDJBrGPYuNQ0qpD7f0kxNbp/TuYDxEh6szlFUVD+l6up21 +5n5koXrofhgRhkBXHO9n9CqVCpDv/yWGlPcIJhuT8+wPhU9pvPL7n2eBJGdDvU2Q +S6AWnamjfOQIfyzt7KMg5e6TediVVSdiGPW3H7ASlpSP+TwCH/w7J/Y51ETbrHiz +dudoPM6xSzD+hCekaoaIoTzkOTM+VNnl8sLQ8OSC8LAPhic3UBKdafkbNmfhwJbP +EHp5LLzC3zj9z8dzSKUfIUt5T2eTc980o8mAf5tNqVKhZCMsGjmc2hTpEDahdznX +Z+2dDpe3AgMBAAECggEBANuaxndaw8IwJXWRtbOi/0knKspLeLk/pDCIVjwHWNMC +1+m8IYa8GHaCar5vTiFux7uyaclUgxPVUPXEU84qgp+0av52sup2vyu1oqfRRQTz +Q+MmovdzvconHzea4CTVEXAeBT3t0JEo3a8/sYVMXpthu4KfZHbUNHVGBjG8bprZ +i7/59CANZvEAxfFwJNKewYoD9uA0lIUeADjjUQ3w3yzHDu2o5Z6WPSJCF5htGJkq +vrQhzWchkLVHNsMR7bsQX4NpPWONac5PcduN4F36YT89XwHIYVz09nQwVmkx3UBY +98a0rSaZD1jND3prNtJKHHWY7610Gedhs3JdrJo1OIkCgYEA/Ohfh42qfQoyvJlp +id9GTSmFI8QOwFpDoL+RsVEXRBKzK3x5jsEz1IHz7QSAyGWZ5q/Hmo173wEdBRJt +IcGdvWTZvo+N5k8mNZaGQaYcHN+hHj8XUWYc9gKcYyuBIZ3u2h+s5Chvm06hPscT +PKOlc7SA9TQ75fmY3aePpzgQRD0CgYEA89kJjjSO26sEL146e5jvOD3w5DDT8TEr +mKelOBLCVHQ9XDzt1b/6gUKqlCuuqQeaRv4rdY+wEd2lhtJmGeQJE43OblBTC02Q +5XPLWa/aCn8PeUwwWMmf3K6US/INv+oEhj8mBe0WB3yt8fpHgJ/fwzatN1l03nU2 +eC0mJq1ipwMCgYA10FgrZsiFLLtZCCe9z4WM+625y4j8Avjq5nhgy4lw0a3QLf9L +ke6uZCx8HX4tpfjWbkbBqyNVc04yexY/nYwr9Z6jfrZJ8EOIGYxdwbOvrSICZphW +mKzG6A1QyLwEZC+juCO4tKXy3QtQaVm9iHC3KwxZoJCyQab2WyYlBbfoXQKBgADX +RMMqxztWsaMALi9y7ZBCFmyTBogUZVQXb+hrmCP2aqfAxgkwqkp70l7Eb8vBbPTF +t5ymLDNDkmiOnS+Fq8pXeNjEiiTF1bQU3CSpCJV0rrb6XkhQGa8HIxfH8+gvhGh6 +G0V19dd8xJTLCigVZQ4lSB+ivVZvDQsJDNKhUm/FAoGAI6x7a7YUpbyaXzkj7uZP ++m3x2SeyD+7BvoVNtK+EjYIib549Bm8VLc+di5EzFojVlyFZ87SkLGlcJyEbDDsL +SLgclzDv/BvnUotCnnYxdJBMN/rvUm+RimpA6qpUkhnb49jmdWYOIEYdz+MA+Axp +HAeA/1NuvlQJyzJWH1uzRFY= +-----END PRIVATE KEY----- diff --git a/src/Config.php b/src/Config.php index e73d399..fa377a6 100644 --- a/src/Config.php +++ b/src/Config.php @@ -9,13 +9,24 @@ class Config{ function __construct() { -$folders = ["madeny", "goundo"]; -for($i=0;$i<=$folders[0];$i++) -{ -mkdir(Path::all().folders[$i]); +$folders = ['cnf', 'config', 'csr', 'keys', 'live', 'logs']; +$i = 0; -die(); -} +foreach ($folders as $key => $value) { + + if (Path::all()."/".$value) { + echo "Folder already exist"; + return; + }else{ + while ($i < 6) { + + mkdir(Path::all()."/".$folders[$i]); + $i++; +} + } +} + +// die(); } public static function file($path, $domainOne, $domainTwo) From 0f929328271a91d12e121cbe84ce36e263878dcb Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Mon, 30 Apr 2018 02:32:10 +0200 Subject: [PATCH 16/46] ##4 quick changes and updates... --- .gitignore | 1 + cert/live/example.com.ssl.crt | 28 ---------------------------- cert/live/example.com.ssl.key | 28 ---------------------------- ubuntu.png | Bin 492 -> 0 bytes 4 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 cert/live/example.com.ssl.crt delete mode 100644 cert/live/example.com.ssl.key delete mode 100644 ubuntu.png diff --git a/.gitignore b/.gitignore index 084ddb2..468a737 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /cert/csr/ /cert/keys/ /cert/logs/ +/cert/live/ diff --git a/cert/live/example.com.ssl.crt b/cert/live/example.com.ssl.crt deleted file mode 100644 index 2f06744..0000000 --- a/cert/live/example.com.ssl.crt +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIErjCCA5agAwIBAgIJANfS38bMJBQWMA0GCSqGSIb3DQEBCwUAMIGWMQswCQYD -VQQGEwJMSDELMAkGA1UECAwCTEMxFDASBgNVBAcMC0xvY2FsIENpdHJ5MRMwEQYD -VQQKDApMT0NBTEhUVFBTMRMwEQYDVQQLDApsb2NhbGh0dHBzMSAwHgYJKoZIhvcN -AQkBFhFsb2NhbEBodHRwcy5sb2NhbDEYMBYGA1UEAwwPY29tLmxvY2FsLmh0dHBz -MB4XDTE4MDQzMDAwMjYyOVoXDTE5MDkxMjAwMjYyOVowgZYxCzAJBgNVBAYTAkxI -MQswCQYDVQQIDAJMQzEUMBIGA1UEBwwLTG9jYWwgQ2l0cnkxEzARBgNVBAoMCkxP -Q0FMSFRUUFMxEzARBgNVBAsMCmxvY2FsaHR0cHMxIDAeBgkqhkiG9w0BCQEWEWxv -Y2FsQGh0dHBzLmxvY2FsMRgwFgYDVQQDDA9jb20ubG9jYWwuaHR0cHMwggEiMA0G -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H/pyN8/wxVGtGiO2DE1Uq0nqhzMT -/hc= ------END CERTIFICATE----- diff --git a/cert/live/example.com.ssl.key b/cert/live/example.com.ssl.key deleted file mode 100644 index ae2181d..0000000 --- a/cert/live/example.com.ssl.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDw5v0XTY0AsIHP -J+CoFCKOF94I3M+9q2CDJBrGPYuNQ0qpD7f0kxNbp/TuYDxEh6szlFUVD+l6up21 -5n5koXrofhgRhkBXHO9n9CqVCpDv/yWGlPcIJhuT8+wPhU9pvPL7n2eBJGdDvU2Q -S6AWnamjfOQIfyzt7KMg5e6TediVVSdiGPW3H7ASlpSP+TwCH/w7J/Y51ETbrHiz -dudoPM6xSzD+hCekaoaIoTzkOTM+VNnl8sLQ8OSC8LAPhic3UBKdafkbNmfhwJbP -EHp5LLzC3zj9z8dzSKUfIUt5T2eTc980o8mAf5tNqVKhZCMsGjmc2hTpEDahdznX -Z+2dDpe3AgMBAAECggEBANuaxndaw8IwJXWRtbOi/0knKspLeLk/pDCIVjwHWNMC -1+m8IYa8GHaCar5vTiFux7uyaclUgxPVUPXEU84qgp+0av52sup2vyu1oqfRRQTz -Q+MmovdzvconHzea4CTVEXAeBT3t0JEo3a8/sYVMXpthu4KfZHbUNHVGBjG8bprZ -i7/59CANZvEAxfFwJNKewYoD9uA0lIUeADjjUQ3w3yzHDu2o5Z6WPSJCF5htGJkq -vrQhzWchkLVHNsMR7bsQX4NpPWONac5PcduN4F36YT89XwHIYVz09nQwVmkx3UBY -98a0rSaZD1jND3prNtJKHHWY7610Gedhs3JdrJo1OIkCgYEA/Ohfh42qfQoyvJlp -id9GTSmFI8QOwFpDoL+RsVEXRBKzK3x5jsEz1IHz7QSAyGWZ5q/Hmo173wEdBRJt -IcGdvWTZvo+N5k8mNZaGQaYcHN+hHj8XUWYc9gKcYyuBIZ3u2h+s5Chvm06hPscT -PKOlc7SA9TQ75fmY3aePpzgQRD0CgYEA89kJjjSO26sEL146e5jvOD3w5DDT8TEr -mKelOBLCVHQ9XDzt1b/6gUKqlCuuqQeaRv4rdY+wEd2lhtJmGeQJE43OblBTC02Q -5XPLWa/aCn8PeUwwWMmf3K6US/INv+oEhj8mBe0WB3yt8fpHgJ/fwzatN1l03nU2 -eC0mJq1ipwMCgYA10FgrZsiFLLtZCCe9z4WM+625y4j8Avjq5nhgy4lw0a3QLf9L -ke6uZCx8HX4tpfjWbkbBqyNVc04yexY/nYwr9Z6jfrZJ8EOIGYxdwbOvrSICZphW -mKzG6A1QyLwEZC+juCO4tKXy3QtQaVm9iHC3KwxZoJCyQab2WyYlBbfoXQKBgADX -RMMqxztWsaMALi9y7ZBCFmyTBogUZVQXb+hrmCP2aqfAxgkwqkp70l7Eb8vBbPTF -t5ymLDNDkmiOnS+Fq8pXeNjEiiTF1bQU3CSpCJV0rrb6XkhQGa8HIxfH8+gvhGh6 -G0V19dd8xJTLCigVZQ4lSB+ivVZvDQsJDNKhUm/FAoGAI6x7a7YUpbyaXzkj7uZP -+m3x2SeyD+7BvoVNtK+EjYIib549Bm8VLc+di5EzFojVlyFZ87SkLGlcJyEbDDsL -SLgclzDv/BvnUotCnnYxdJBMN/rvUm+RimpA6qpUkhnb49jmdWYOIEYdz+MA+Axp -HAeA/1NuvlQJyzJWH1uzRFY= ------END PRIVATE KEY----- diff --git a/ubuntu.png b/ubuntu.png deleted file mode 100644 index 428fdb1a6ea555c7c6af685abf542a5af4840b74..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 492 zcmVPx$rb$FWR5%gUR544#Koo95ByrHTiXftclXMaX!9~%7z zE{cCZP(*Pk;^L}K4uUuXOI zsNAqB1OL^9LSZkJO1&wHGAFMqG9cFw?*KbOyjCg|G6+OYYzILQY>@ytFN+EP(*fuZ!Af^!4)oPXI;fM@u+g<~5hJ8-<*63T`F>eA}5HQ+8 zUDx$&sZ?r(Td*u^2H=$_CIRYcQQX4-DI1+mCquOserTG5Ol=Q3@~-RN5t$Ehbx(`*-VNe%2e)xT zaUCXy_}Q(a8CP)ftNgzy=|{2uop$8}^t08DNS! Date: Mon, 30 Apr 2018 02:37:37 +0200 Subject: [PATCH 17/46] ##7 quick changes and updates... --- src/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Config.php b/src/Config.php index fa377a6..c493344 100644 --- a/src/Config.php +++ b/src/Config.php @@ -14,7 +14,7 @@ function __construct() foreach ($folders as $key => $value) { - if (Path::all()."/".$value) { + if (file_exists(Path::all()."/".$value)) { echo "Folder already exist"; return; }else{ From 7d082bb4e4f9ba181bdf1d6b1f76fc216a36b462 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Mon, 30 Apr 2018 02:41:53 +0200 Subject: [PATCH 18/46] ##7 quick changes and updates... --- cert/readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 cert/readme.md diff --git a/cert/readme.md b/cert/readme.md new file mode 100644 index 0000000..8a7dbd0 --- /dev/null +++ b/cert/readme.md @@ -0,0 +1 @@ +# Output file here \ No newline at end of file From ee7d59984c2305649dbd6062962d22ef05cd4fa3 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Mon, 30 Apr 2018 02:45:26 +0200 Subject: [PATCH 19/46] ##7 quick changes and updates... --- .travis.yml | 3 ++- src/command/CreatorCommand.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 573b64e..57f21fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,4 +24,5 @@ install: # - 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/src/command/CreatorCommand.php b/src/command/CreatorCommand.php index 617c923..e34c8c4 100644 --- a/src/command/CreatorCommand.php +++ b/src/command/CreatorCommand.php @@ -39,6 +39,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // Instantiating dependencies $path = Path::all(); + (new Config); $domain = new DomainProvider(); $domainName = $input->getArgument('domainName'); From 5cc24b2d3330516a89a4024b56235f60fe270b3f Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Mon, 30 Apr 2018 02:53:15 +0200 Subject: [PATCH 20/46] Add some refactoring php --- src/Config.php | 2 +- tests/MakerTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Config.php b/src/Config.php index c493344..c483e63 100644 --- a/src/Config.php +++ b/src/Config.php @@ -15,7 +15,7 @@ function __construct() foreach ($folders as $key => $value) { if (file_exists(Path::all()."/".$value)) { - echo "Folder already exist"; + echo "\n ... managing outputs folders \n"; return; }else{ while ($i < 6) { diff --git a/tests/MakerTest.php b/tests/MakerTest.php index 1b905a8..5426a7b 100644 --- a/tests/MakerTest.php +++ b/tests/MakerTest.php @@ -52,7 +52,7 @@ 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!"; + echo "\n You already have a Root Certificate we can use that! \n"; }else{ $ca = Maker::create($this->path); @@ -76,6 +76,7 @@ public function a_user_can_create_certificate_key_for_domain() 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()); From 0872115eeff55246a130a6a178df6cc9c7ca996c Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Tue, 1 May 2018 19:39:00 +0200 Subject: [PATCH 21/46] Rebuild the factory class from Maker --- src/CertificateSigningRequest.php | 5 +-- src/Config.php | 48 ++++++++++++------------ src/{Maker.php => Factory.php} | 2 +- src/command/CreatorCommand.php | 12 +++--- tests/{MakerTest.php => FactoryTest.php} | 34 +++++++---------- 5 files changed, 45 insertions(+), 56 deletions(-) rename src/{Maker.php => Factory.php} (98%) rename tests/{MakerTest.php => FactoryTest.php} (76%) 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 c483e63..74888ff 100644 --- a/src/Config.php +++ b/src/Config.php @@ -6,31 +6,29 @@ class Config{ -function __construct() -{ - -$folders = ['cnf', 'config', 'csr', 'keys', 'live', 'logs']; -$i = 0; - -foreach ($folders as $key => $value) { - - if (file_exists(Path::all()."/".$value)) { - echo "\n ... managing outputs folders \n"; - return; - }else{ - while ($i < 6) { - - mkdir(Path::all()."/".$folders[$i]); - $i++; -} + function __construct() + { + + $folders = ['cnf', 'config', 'csr', 'keys', 'live', 'logs']; + $i = 0; + + foreach ($folders as $key => $value) { + + if (file_exists(Path::all()."/".$value)) { + echo "\n ... checking output folders \n"; + return; + }else { + while ($i < 6) { + + mkdir(Path::all()."/".$folders[$i]); + $i++; + } + } + } } -} -// die(); -} - -public static function file($path, $domainOne, $domainTwo) -{ - return new Openssl($path, $domainOne, $domainTwo); -} + public static function file($path, $domainOne, $domainTwo) + { + return new Openssl($path, $domainOne, $domainTwo); + } } diff --git a/src/Maker.php b/src/Factory.php similarity index 98% rename from src/Maker.php rename to src/Factory.php index 9c71f87..f570f16 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) diff --git a/src/command/CreatorCommand.php b/src/command/CreatorCommand.php index e34c8c4..be9fbbe 100644 --- a/src/command/CreatorCommand.php +++ b/src/command/CreatorCommand.php @@ -7,7 +7,7 @@ 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\DomainProvider; @@ -49,17 +49,17 @@ protected function execute(InputInterface $input, OutputInterface $output) Config::file($path, $domain->getDomainOne(), $domain->getDomainTwo()); // 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->getDomainOne(), $domain->getDomainTwo()); // Request a certificate sign from root certificate authority. - Maker::request($path, $domainName); + Factory::request($path, $domainName); $checker = exec("uname -a"); @@ -68,7 +68,7 @@ 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. diff --git a/tests/MakerTest.php b/tests/FactoryTest.php similarity index 76% rename from tests/MakerTest.php rename to tests/FactoryTest.php index 5426a7b..a5f4d36 100644 --- a/tests/MakerTest.php +++ b/tests/FactoryTest.php @@ -3,12 +3,12 @@ use PHPUnit\Framework\TestCase; use Madeny\lhttps\DomainProvider; use Madeny\lhttps\Path; -use Madeny\lhttps\Maker; +use Madeny\lhttps\Factory; use Madeny\lhttps\Config; use Madeny\lhttps\TestCleaner; use Symfony\Component\Dotenv\Dotenv; -class MakerTest extends TestCase +class FactoryTest extends TestCase { public function setUp() { @@ -33,7 +33,7 @@ public function a_user_can_generate_root_certificate_key() if ($rootkey) { echo "\n You already have a Root Key I'm using that! \n"; }else{ - $keygen = Maker::keygen($this->path); + $keygen = Factory::keygen($this->path); if ($keygen->getError() == 0) { echo "\n Key created with success \n"; @@ -54,7 +54,7 @@ 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 = Maker::create($this->path); + $ca = Factory::create($this->path); if ($ca->getError() == 0) { echo "\n Certificate create success \n"; @@ -74,11 +74,11 @@ 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) { + if ($domainkey && $domaincsr) { 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()); + Factory::domain($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo()); $domainkey = true; $domaincsr = true; @@ -92,7 +92,7 @@ public function a_user_can_create_certificate_key_for_domain() /** @test */ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() { - $request = Maker::request($this->path, $this->domain->getDomainOne()); + $request = Factory::request($this->path, $this->domain->getDomainOne()); $log = file_get_contents(realpath($this->path.'/logs/log')); @@ -109,22 +109,14 @@ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() } // /** @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); -// } - /** @test */ - // public function clearUp() - // { - // $stats = (new TestCleaner($this->path))->getError(); +public function a_user_can_Trust_the_root_SSL_certificate() + { + $os = exec("uname -a"); - // $this->assertEquals(0, $stats); - // } + $trusted = Factory::trust($this->path, $os, $option = null); + $this->assertEquals($trusted->getError(), 2); + } } \ No newline at end of file From 641a21cbfdbc87b4c07c514f0878789135596511 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Tue, 1 May 2018 20:22:51 +0200 Subject: [PATCH 22/46] Updates and bug --- tests/CustomTestCase.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/CustomTestCase.php diff --git a/tests/CustomTestCase.php b/tests/CustomTestCase.php new file mode 100644 index 0000000..cd2858c --- /dev/null +++ b/tests/CustomTestCase.php @@ -0,0 +1,31 @@ +path = Path::all(); + + $this->domain = new DomainProvider; + + $this->domain->setDomainOne('example.com'); + + Config::file($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo()); + } + + public function tearDown() + { + unset($this->path, $this->domain); + } +} \ No newline at end of file From 426679a81ba20d9f714ff2a42d4aa4e66e2884af Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Tue, 1 May 2018 20:25:12 +0200 Subject: [PATCH 23/46] Clean FactoryTest clase --- composer.json | 9 ++++----- tests/FactoryTest.php | 45 +++++++++++-------------------------------- 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/composer.json b/composer.json index e160d08..64fd19e 100644 --- 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" } }, diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php index a5f4d36..e718da3 100644 --- a/tests/FactoryTest.php +++ b/tests/FactoryTest.php @@ -1,30 +1,10 @@ path = Path::all(); - $this->domain = new DomainProvider; - $this->domain->setDomainOne('example.com'); - (new Config); - Config::file($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo()); - } - - public function tearDown() - { - - unset($this->path, $this->domain); - } - /** @test */ public function a_user_can_generate_root_certificate_key() { @@ -68,7 +48,7 @@ public function a_user_can_create_root_certificate_authority() $this->assertEquals($rootCA, true); } - /** @test */ + /** @test */ public function a_user_can_create_certificate_key_for_domain() { $domainkey = file_exists($this->path.'/live/'.$this->domain->getDomainOne().'.ssl.key'); @@ -89,7 +69,7 @@ public function a_user_can_create_certificate_key_for_domain() } - /** @test */ + /** @test */ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() { $request = Factory::request($this->path, $this->domain->getDomainOne()); @@ -104,19 +84,16 @@ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() } $this->assertEquals($request->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); + /** @test */ + public function a_user_can_Trust_the_root_SSL_certificate() + { + $os = exec("uname -a"); - $this->assertEquals($trusted->getError(), 2); - } + $trusted = Factory::trust($this->path, $os, $option = null); + $this->assertEquals($trusted->getError(), 2); + } } \ No newline at end of file From 4b6b50b3a37a47e5ab13f20f70a38d2ddb1db579 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Tue, 1 May 2018 22:24:48 +0200 Subject: [PATCH 24/46] More unit testing added --- phpunit.xml | 29 ++++++++------------ src/CertificateAuthorityCreator.php | 5 ++++ src/CreateDomainCertificate.php | 5 ++++ src/TrustTheRootSSLCertificate.php | 2 +- tests/CertificateAuthorityCreatorTest.php | 32 ++++++++++++++++++++++ tests/CertificateKeyCreatorTest.php | 33 +++++++++++++++++++++++ tests/CreateDomainCertificateTest.php | 24 +++++++++++++++++ tests/FactoryTest.php | 2 +- 8 files changed, 112 insertions(+), 20 deletions(-) create mode 100644 tests/CertificateAuthorityCreatorTest.php create mode 100644 tests/CertificateKeyCreatorTest.php create mode 100644 tests/CreateDomainCertificateTest.php diff --git a/phpunit.xml b/phpunit.xml index c4c5ca9..3c268c2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -9,28 +9,21 @@ processIsolation="false" stopOnFailure="false"> - - ./tests - - - + + + src/ + + cert/logs/report.html + + + + + + diff --git a/src/CertificateAuthorityCreator.php b/src/CertificateAuthorityCreator.php index 294f05b..59c12b4 100644 --- a/src/CertificateAuthorityCreator.php +++ b/src/CertificateAuthorityCreator.php @@ -19,5 +19,10 @@ public function getError() { return $this->error; } + + public function getOutput() + { + return $this->output; + } } diff --git a/src/CreateDomainCertificate.php b/src/CreateDomainCertificate.php index 1810017..a64b2c3 100644 --- a/src/CreateDomainCertificate.php +++ b/src/CreateDomainCertificate.php @@ -20,5 +20,10 @@ public function getError() { return $this->error; } + + public function getOutput() + { + return $this->output; + } } diff --git a/src/TrustTheRootSSLCertificate.php b/src/TrustTheRootSSLCertificate.php index 79af85e..6574383 100644 --- a/src/TrustTheRootSSLCertificate.php +++ b/src/TrustTheRootSSLCertificate.php @@ -15,7 +15,7 @@ function __construct($path, $checker, $option) $this->error = $error; }else{ - return $this->error = 2; + return $this->error = 1; } } diff --git a/tests/CertificateAuthorityCreatorTest.php b/tests/CertificateAuthorityCreatorTest.php new file mode 100644 index 0000000..c07df6f --- /dev/null +++ b/tests/CertificateAuthorityCreatorTest.php @@ -0,0 +1,32 @@ +path); + + + $this->assertEquals(0, $certificateAuthority->getError()); + } + + /** @test */ + public function it_can_return_an_error() + { + $certificateAuthority = new CertificateAuthorityCreator("fake/path"); + + $this->assertEquals(1, $certificateAuthority->getError()); + } + + /** @test */ + public function it_can_return_array_of_output() + { + $certificateAuthority = new CertificateAuthorityCreator($this->path); + + $this->assertEquals(0, count($certificateAuthority->getOutput())); + } + +} \ No newline at end of file diff --git a/tests/CertificateKeyCreatorTest.php b/tests/CertificateKeyCreatorTest.php new file mode 100644 index 0000000..147ff7f --- /dev/null +++ b/tests/CertificateKeyCreatorTest.php @@ -0,0 +1,33 @@ +path); + + $this->assertEquals(0, $rsa->getError()); + } + + /** @test */ + public function it_can_generate_an_error() + { + $rsa = new CertificateKeyCreator("fake/path"); + + $this->assertEquals(1, $rsa->getError()); + } + + /** @test */ + public function it_can_ouput_logs() + { + $rsa = new CertificateKeyCreator($this->path); + + $output = count($rsa->getOutput()); + + $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..032a480 --- /dev/null +++ b/tests/CreateDomainCertificateTest.php @@ -0,0 +1,24 @@ +path, $this->domain->getDomainOne()); + + $this->assertEquals(0, $domainCertificate->getError()); + } + + /** @test */ + public function it_can_report_an_error() + { + $domainCertificate = new CreateDomainCertificate("fake/path", "fake_domain"); + + $this->assertEquals(1, $domainCertificate->getError()); + } +} \ No newline at end of file diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php index e718da3..1096415 100644 --- a/tests/FactoryTest.php +++ b/tests/FactoryTest.php @@ -93,7 +93,7 @@ public function a_user_can_Trust_the_root_SSL_certificate() $trusted = Factory::trust($this->path, $os, $option = null); - $this->assertEquals($trusted->getError(), 2); + $this->assertEquals($trusted->getError(), 1); } } \ No newline at end of file From f24ac3940fc2a815916348a7c9830870fec13147 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Tue, 1 May 2018 22:33:34 +0200 Subject: [PATCH 25/46] Updates and bug --- tests/CertificateAuthorityCreatorTest.php | 2 +- tests/CertificateKeyCreatorTest.php | 2 +- tests/CreateDomainCertificateTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/CertificateAuthorityCreatorTest.php b/tests/CertificateAuthorityCreatorTest.php index c07df6f..18aa750 100644 --- a/tests/CertificateAuthorityCreatorTest.php +++ b/tests/CertificateAuthorityCreatorTest.php @@ -18,7 +18,7 @@ public function it_can_return_an_error() { $certificateAuthority = new CertificateAuthorityCreator("fake/path"); - $this->assertEquals(1, $certificateAuthority->getError()); + $this->assertEquals(2, $certificateAuthority->getError()); } /** @test */ diff --git a/tests/CertificateKeyCreatorTest.php b/tests/CertificateKeyCreatorTest.php index 147ff7f..dc278d8 100644 --- a/tests/CertificateKeyCreatorTest.php +++ b/tests/CertificateKeyCreatorTest.php @@ -17,7 +17,7 @@ public function it_can_generate_an_error() { $rsa = new CertificateKeyCreator("fake/path"); - $this->assertEquals(1, $rsa->getError()); + $this->assertEquals(2, $rsa->getError()); } /** @test */ diff --git a/tests/CreateDomainCertificateTest.php b/tests/CreateDomainCertificateTest.php index 032a480..fb8c6b5 100644 --- a/tests/CreateDomainCertificateTest.php +++ b/tests/CreateDomainCertificateTest.php @@ -19,6 +19,6 @@ public function it_can_report_an_error() { $domainCertificate = new CreateDomainCertificate("fake/path", "fake_domain"); - $this->assertEquals(1, $domainCertificate->getError()); + $this->assertEquals(2, $domainCertificate->getError()); } } \ No newline at end of file From 3b33725795107cbb0d72e9824f3476d3ddcc3700 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Tue, 1 May 2018 22:48:32 +0200 Subject: [PATCH 26/46] =?UTF-8?q?=EF=A3=BF12=20quick=20changes=20and=20upd?= =?UTF-8?q?ates...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .circleci/config.yml | 1 + lh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a84e85d..c739144 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,6 +37,7 @@ jobs: key: v1-dependencies-{{ checksum "composer.json" }} # run tests! + - run: composer dump-autoload -o - run: php lh create --a - run: ./vendor/bin/phpunit - run: cat cert/logs/log diff --git a/lh b/lh index 9d010f6..f855e78 100755 --- a/lh +++ b/lh @@ -5,6 +5,8 @@ require __DIR__ . '/vendor/autoload.php'; use Symfony\Component\Console\Application; use Madeny\lhttps\CreatorCommand; +die(var_dump(new CreatorCommand)); + $app = new Application("Local https Version 1.0"); $app->add(new CreatorCommand); $app->run(); From edd8161a6df18e3ee8a7f15c7334abf9c8909cb7 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Tue, 1 May 2018 23:10:12 +0200 Subject: [PATCH 27/46] =?UTF-8?q?=EF=A3=BF12=20quick=20changes=20and=20upd?= =?UTF-8?q?ates...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cert/readme.md | 2 +- tests/CertificateAuthorityCreatorTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cert/readme.md b/cert/readme.md index 8a7dbd0..126c402 100644 --- a/cert/readme.md +++ b/cert/readme.md @@ -1 +1 @@ -# Output file here \ No newline at end of file +# Output files here \ No newline at end of file diff --git a/tests/CertificateAuthorityCreatorTest.php b/tests/CertificateAuthorityCreatorTest.php index 18aa750..91103cb 100644 --- a/tests/CertificateAuthorityCreatorTest.php +++ b/tests/CertificateAuthorityCreatorTest.php @@ -1,12 +1,14 @@ path)); $certificateAuthority = new CertificateAuthorityCreator($this->path); From a5f9bc15c6339c687b680fd2ec54a7f201864d38 Mon Sep 17 00:00:00 2001 From: Madeny Diawara Date: Wed, 2 May 2018 00:19:51 +0200 Subject: [PATCH 28/46] Updates and bug --- src/Factory.php | 8 ++++---- src/TrustTheRootSSLCertificate.php | 8 ++++---- tests/CreateDomainCertificateTest.php | 7 +++++++ tests/CustomTestCase.php | 2 ++ tests/FactoryTest.php | 7 ++++++- tests/TrustTheRootSSLCertificateTest.php | 18 ++++++++++++++++++ 6 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 tests/TrustTheRootSSLCertificateTest.php diff --git a/src/Factory.php b/src/Factory.php index f570f16..329abad 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -37,10 +37,10 @@ public static function trust($path, $OS, $option) return new TrustTheRootSSLCertificate($path, $OS, $option); } - public static function deply($file, $path) - { - exec("sudo cp {$file} {$path}"); - } + // public static function deply($file, $path) + // { + // exec("sudo cp {$file} {$path}"); + // } } diff --git a/src/TrustTheRootSSLCertificate.php b/src/TrustTheRootSSLCertificate.php index 6574383..01ba4e9 100644 --- a/src/TrustTheRootSSLCertificate.php +++ b/src/TrustTheRootSSLCertificate.php @@ -10,13 +10,13 @@ class TrustTheRootSSLCertificate{ function __construct($path, $checker, $option) { - if (strpos($checker, "Darwin") !== false) { + // 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 = 1; - } + // }else{ + // return $this->error = 1; + // } } diff --git a/tests/CreateDomainCertificateTest.php b/tests/CreateDomainCertificateTest.php index fb8c6b5..5cd2a40 100644 --- a/tests/CreateDomainCertificateTest.php +++ b/tests/CreateDomainCertificateTest.php @@ -21,4 +21,11 @@ public function it_can_report_an_error() $this->assertEquals(2, $domainCertificate->getError()); } + /** @test */ + public function it_can_return_array_of_output() + { + $domainCertificate = new CreateDomainCertificate($this->path, $this->domain->getDomainOne()); + + $this->assertEquals(0, count($domainCertificate->getOutput())); + } } \ No newline at end of file diff --git a/tests/CustomTestCase.php b/tests/CustomTestCase.php index cd2858c..99815d4 100644 --- a/tests/CustomTestCase.php +++ b/tests/CustomTestCase.php @@ -4,6 +4,7 @@ use Madeny\lhttps\DomainProvider; use Madeny\lhttps\Path; use Madeny\lhttps\Config; +use Madeny\lhttps\Factory; use Symfony\Component\Dotenv\Dotenv; class CustomTestCase extends TestCase { @@ -22,6 +23,7 @@ public function setUp() $this->domain->setDomainOne('example.com'); Config::file($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo()); + $this->factory = new Factory(); } public function tearDown() diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php index 1096415..b9ead40 100644 --- a/tests/FactoryTest.php +++ b/tests/FactoryTest.php @@ -2,7 +2,6 @@ declare(strict_types=1); use Madeny\lhttps\Test\CustomTestCase; use Madeny\lhttps\Factory; - class FactoryTest extends CustomTestCase { /** @test */ @@ -25,6 +24,7 @@ public function a_user_can_generate_root_certificate_key() } $this->assertEquals($rootkey, true); + $this->assertEquals($this->factory->keygen($this->path)->getError(), 0); } /** @test */ @@ -46,6 +46,7 @@ public function a_user_can_create_root_certificate_authority() $rootCA = file_exists($this->path.'/csr/root.pem'); $this->assertEquals($rootCA, true); + $this->assertEquals($this->factory->create($this->path)->getError(), 0); } /** @test */ @@ -66,6 +67,9 @@ public function a_user_can_create_certificate_key_for_domain() $this->assertEquals($domainkey, true); $this->assertEquals($domaincsr, true); + + $this->assertEquals($this->factory->domain($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo() )->getError(), 0); + } @@ -84,6 +88,7 @@ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() } $this->assertEquals($request->getError(), 0); + $this->assertEquals($this->factory->request($this->path, $this->domain->getDomainOne())->getError(), 0); } /** @test */ 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 From 02bb4bb8a42c52d4879857a4f6d0180522edf568 Mon Sep 17 00:00:00 2001 From: madeny Date: Thu, 31 Jan 2019 23:11:24 +0100 Subject: [PATCH 29/46] =?UTF-8?q?=EF=A3=BF=208=20quick=20fix|updates...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lh | 1 + 1 file changed, 1 insertion(+) diff --git a/lh b/lh index f855e78..f1be045 100755 --- a/lh +++ b/lh @@ -1,6 +1,7 @@ #! /usr/bin/env php Date: Fri, 1 Feb 2019 00:04:54 +0100 Subject: [PATCH 30/46] =?UTF-8?q?=EF=A3=BF=208=20quick=20fix|updates...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lh | 2 +- tests/.CreateTest.php.swp | Bin 0 -> 1024 bytes tests/CreateTest.php | 20 ++++++++++++++++++++ tests/CreateTest.php.save | 20 ++++++++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/.CreateTest.php.swp create mode 100644 tests/CreateTest.php create mode 100644 tests/CreateTest.php.save diff --git a/lh b/lh index f1be045..83308c6 100755 --- a/lh +++ b/lh @@ -6,7 +6,7 @@ require __DIR__ . '/src/command/CreatorCommand.php'; use Symfony\Component\Console\Application; use Madeny\lhttps\CreatorCommand; -die(var_dump(new CreatorCommand)); +#die(var_dump(new CreatorCommand)); $app = new Application("Local https Version 1.0"); $app->add(new CreatorCommand); diff --git a/tests/.CreateTest.php.swp b/tests/.CreateTest.php.swp new file mode 100644 index 0000000000000000000000000000000000000000..b58f8d0d487d45f52f4033f1ba84bce89f668f34 GIT binary patch literal 1024 zcmYc?$V<%2S1{5u)iY*50&_wc7;+O+Qu8X21aUB(a!Lz|GV@AsNW+EoGxBp&^&zI} u=VX+W6cp>1q!yPH>pK^vCYGdz0NHv483k|+qm0oI7!3hxh5#^EqXGbrsTsEb literal 0 HcmV?d00001 diff --git a/tests/CreateTest.php b/tests/CreateTest.php new file mode 100644 index 0000000..1559338 --- /dev/null +++ b/tests/CreateTest.php @@ -0,0 +1,20 @@ +assertEquals(1, $error()); + + + } +} \ No newline at end of file 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()); + + + } +} From 141a750b02a49b2052b0bbbcc8bbaa740247e435 Mon Sep 17 00:00:00 2001 From: madeny Date: Fri, 1 Feb 2019 00:16:20 +0100 Subject: [PATCH 31/46] =?UTF-8?q?=EF=A3=BF=208=20quick=20fix|updates...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lh | 2 +- tests/CreateTest.php | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/CreateTest.php diff --git a/lh b/lh index f1be045..83308c6 100755 --- a/lh +++ b/lh @@ -6,7 +6,7 @@ require __DIR__ . '/src/command/CreatorCommand.php'; use Symfony\Component\Console\Application; use Madeny\lhttps\CreatorCommand; -die(var_dump(new CreatorCommand)); +#die(var_dump(new CreatorCommand)); $app = new Application("Local https Version 1.0"); $app->add(new CreatorCommand); 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); + + } + +} From a63de9aef2b69b0ac1be732e347bea9bf2092c5d Mon Sep 17 00:00:00 2001 From: madeny Date: Fri, 1 Feb 2019 00:20:56 +0100 Subject: [PATCH 32/46] =?UTF-8?q?=EF=A3=BF=2013=20quick=20fix|updates...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/.CreateTest.php.swp | Bin 1024 -> 0 bytes tests/CreateTest.php | 15 --------------- 2 files changed, 15 deletions(-) delete mode 100644 tests/.CreateTest.php.swp diff --git a/tests/.CreateTest.php.swp b/tests/.CreateTest.php.swp deleted file mode 100644 index b58f8d0d487d45f52f4033f1ba84bce89f668f34..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 zcmYc?$V<%2S1{5u)iY*50&_wc7;+O+Qu8X21aUB(a!Lz|GV@AsNW+EoGxBp&^&zI} u=VX+W6cp>1q!yPH>pK^vCYGdz0NHv483k|+qm0oI7!3hxh5#^EqXGbrsTsEb diff --git a/tests/CreateTest.php b/tests/CreateTest.php index 40e6bce..adf80a6 100644 --- a/tests/CreateTest.php +++ b/tests/CreateTest.php @@ -6,7 +6,6 @@ class CreateTest extends TestCase { /** @test */ -<<<<<<< HEAD public function single_create_command () { exec("php lh create test.dev", $output, $error); @@ -16,17 +15,3 @@ public function single_create_command () { } } -======= - public function create_test() { - - exec("php lh create test.dev", $output, $error); - - - var_dump($error); - - $this->assertEquals(1, $error()); - - - } -} ->>>>>>> 8551acea69fff97acb96d2b8be229c5c4e054f11 From f1920151d79150b7d27dd41c0374fb3677822059 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 01:40:56 +0000 Subject: [PATCH 33/46] clean some --- src/@eaDir/Factory.php@SynoResource | Bin 0 -> 741 bytes src/Factory.php | 5 ----- 2 files changed, 5 deletions(-) create mode 100755 src/@eaDir/Factory.php@SynoResource diff --git a/src/@eaDir/Factory.php@SynoResource b/src/@eaDir/Factory.php@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..0145e69136ffae14be01d9b95f30ce87ae2f5eca GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3!4z0(ql>#(n_+Jj4=3 literal 0 HcmV?d00001 diff --git a/src/Factory.php b/src/Factory.php index 329abad..9985844 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -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}"); - // } - } From c0671c8721f254bebd34905f85b68d0e4eb07a85 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 01:44:14 +0000 Subject: [PATCH 34/46] add Compliance badge --- @eaDir/README.md@SynoResource | Bin 0 -> 741 bytes README.md | 1 + 2 files changed, 1 insertion(+) create mode 100755 @eaDir/README.md@SynoResource diff --git a/@eaDir/README.md@SynoResource b/@eaDir/README.md@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..0145e69136ffae14be01d9b95f30ce87ae2f5eca GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3!4z0(ql>#(n_+Jj4=3 literal 0 HcmV?d00001 diff --git a/README.md b/README.md index 530c41c..c0cc4c5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ * Create a Certifcate Authority that can be use to issue certificate for domains. [![Build Status](https://travis-ci.org/madeny/lhttps.svg?branch=master)](https://travis-ci.org/madeny/lhttps)  [![CircleCI](https://circleci.com/gh/madeny/lhttps.svg?style=svg)](https://circleci.com/gh/madeny/lhttps) +[![BCH compliance](https://bettercodehub.com/edge/badge/madeny/lhttps?branch=master)](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. From db6bb96fc02d6f8ada6a43c86a0b2f3e1c47cfb6 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 02:44:31 +0000 Subject: [PATCH 35/46] some refactory --- cert/readme.md | 1 - src/@eaDir/Config.php@SynoResource | Bin 0 -> 741 bytes .../CreateDomainCertificate.php@SynoResource | Bin 0 -> 741 bytes src/@eaDir/DomainProvider.php@SynoResource | Bin 0 -> 741 bytes src/@eaDir/Openssl.php@SynoResource | Bin 0 -> 741 bytes src/Config.php | 4 +-- src/CreateDomainCertificate.php | 4 +-- src/DomainProvider.php | 23 +++++------------- src/Factory.php | 4 +-- src/Openssl.php | 5 ++-- .../@eaDir/CreatorCommand.php@SynoResource | Bin 0 -> 741 bytes src/command/CreatorCommand.php | 7 +++--- ...eateDomainCertificateTest.php@SynoResource | Bin 0 -> 741 bytes tests/@eaDir/CustomTestCase.php@SynoResource | Bin 0 -> 741 bytes tests/@eaDir/FactoryTest.php@SynoResource | Bin 0 -> 741 bytes tests/CreateDomainCertificateTest.php | 4 +-- tests/CustomTestCase.php | 4 +-- tests/FactoryTest.php | 12 ++++----- 18 files changed, 28 insertions(+), 40 deletions(-) delete mode 100644 cert/readme.md create mode 100644 src/@eaDir/Config.php@SynoResource create mode 100644 src/@eaDir/CreateDomainCertificate.php@SynoResource create mode 100644 src/@eaDir/DomainProvider.php@SynoResource create mode 100644 src/@eaDir/Openssl.php@SynoResource create mode 100755 src/command/@eaDir/CreatorCommand.php@SynoResource create mode 100755 tests/@eaDir/CreateDomainCertificateTest.php@SynoResource create mode 100755 tests/@eaDir/CustomTestCase.php@SynoResource create mode 100755 tests/@eaDir/FactoryTest.php@SynoResource diff --git a/cert/readme.md b/cert/readme.md deleted file mode 100644 index 126c402..0000000 --- a/cert/readme.md +++ /dev/null @@ -1 +0,0 @@ -# Output files here \ No newline at end of file diff --git a/src/@eaDir/Config.php@SynoResource b/src/@eaDir/Config.php@SynoResource new file mode 100644 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/src/@eaDir/CreateDomainCertificate.php@SynoResource b/src/@eaDir/CreateDomainCertificate.php@SynoResource new file mode 100644 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/src/@eaDir/DomainProvider.php@SynoResource b/src/@eaDir/DomainProvider.php@SynoResource new file mode 100644 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/src/@eaDir/Openssl.php@SynoResource b/src/@eaDir/Openssl.php@SynoResource new file mode 100644 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/src/Config.php b/src/Config.php index 74888ff..41c266d 100644 --- a/src/Config.php +++ b/src/Config.php @@ -27,8 +27,8 @@ function __construct() } } - public static function file($path, $domainOne, $domainTwo) + public static function file($path, $domain) { - return new Openssl($path, $domainOne, $domainTwo); + return new Openssl($path, $domain); } } diff --git a/src/CreateDomainCertificate.php b/src/CreateDomainCertificate.php index a64b2c3..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; diff --git a/src/DomainProvider.php b/src/DomainProvider.php index 4d61dca..f494d05 100644 --- a/src/DomainProvider.php +++ b/src/DomainProvider.php @@ -3,29 +3,18 @@ class DomainProvider { - protected $domainOne; - protected $domainTwo; + protected $domain; - public function getDomainOne() + public function getdomain() { - $this->domainOne = trim(preg_replace('/\s\s+/', ' ', $this->domainOne)); + $this->domain = trim(preg_replace('/\s\s+/', ' ', $this->domain)); - return $this->domainOne; + return $this->domain; } - public function getDomainTwo() + public function setdomain($domain) { - $this->domainTwo = 'www.'.$this->domainOne; - - return $this->domainTwo; - } - public function setDomainOne($domainOne) - { - if (!$domainOne) { - $this->domainOne = "localhost"; - }else{ - $this->domainOne = $domainOne; - } + !$domain ? $this->domain = "localhost" : $this->domain = $domain; } } \ No newline at end of file diff --git a/src/Factory.php b/src/Factory.php index 9985844..1cfeb8d 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -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); } 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/command/@eaDir/CreatorCommand.php@SynoResource b/src/command/@eaDir/CreatorCommand.php@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/src/command/CreatorCommand.php b/src/command/CreatorCommand.php index be9fbbe..5b2b5c3 100644 --- a/src/command/CreatorCommand.php +++ b/src/command/CreatorCommand.php @@ -40,13 +40,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $path = Path::all(); (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. Factory::keygen($path); @@ -55,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output) Factory::create($path); // Create cert key for a domain. - Factory::domain($path, $domain->getDomainOne(), $domain->getDomainTwo()); + Factory::domain($path, $domain->getdomain()); // Request a certificate sign from root certificate authority. diff --git a/tests/@eaDir/CreateDomainCertificateTest.php@SynoResource b/tests/@eaDir/CreateDomainCertificateTest.php@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/tests/@eaDir/CustomTestCase.php@SynoResource b/tests/@eaDir/CustomTestCase.php@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/tests/@eaDir/FactoryTest.php@SynoResource b/tests/@eaDir/FactoryTest.php@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/tests/CreateDomainCertificateTest.php b/tests/CreateDomainCertificateTest.php index 5cd2a40..2e6b2cb 100644 --- a/tests/CreateDomainCertificateTest.php +++ b/tests/CreateDomainCertificateTest.php @@ -9,7 +9,7 @@ class CreateDomainCertificateTest extends CustomTestCase{ public function it_can_create_domain_certificate() { $domainCertificate = - new CreateDomainCertificate($this->path, $this->domain->getDomainOne()); + new CreateDomainCertificate($this->path, $this->domain->getdomain()); $this->assertEquals(0, $domainCertificate->getError()); } @@ -24,7 +24,7 @@ public function it_can_report_an_error() /** @test */ public function it_can_return_array_of_output() { - $domainCertificate = new CreateDomainCertificate($this->path, $this->domain->getDomainOne()); + $domainCertificate = new CreateDomainCertificate($this->path, $this->domain->getdomain()); $this->assertEquals(0, count($domainCertificate->getOutput())); } diff --git a/tests/CustomTestCase.php b/tests/CustomTestCase.php index 99815d4..ee3d4f8 100644 --- a/tests/CustomTestCase.php +++ b/tests/CustomTestCase.php @@ -20,9 +20,9 @@ public function setUp() $this->domain = new DomainProvider; - $this->domain->setDomainOne('example.com'); + $this->domain->setdomain('example.com'); - Config::file($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo()); + Config::file($this->path, $this->domain->getdomain()); $this->factory = new Factory(); } diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php index b9ead40..3213ebb 100644 --- a/tests/FactoryTest.php +++ b/tests/FactoryTest.php @@ -52,14 +52,14 @@ public function a_user_can_create_root_certificate_authority() /** @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'); + $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->getDomainOne(), $this->domain->getDomainTwo()); + Factory::domain($this->path, $this->domain->getdomain()); $domainkey = true; $domaincsr = true; @@ -68,7 +68,7 @@ public function a_user_can_create_certificate_key_for_domain() $this->assertEquals($domainkey, true); $this->assertEquals($domaincsr, true); - $this->assertEquals($this->factory->domain($this->path, $this->domain->getDomainOne(), $this->domain->getDomainTwo() )->getError(), 0); + $this->assertEquals($this->factory->domain($this->path, $this->domain->getdomain() )->getError(), 0); } @@ -76,7 +76,7 @@ public function a_user_can_create_certificate_key_for_domain() /** @test */ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() { - $request = Factory::request($this->path, $this->domain->getDomainOne()); + $request = Factory::request($this->path, $this->domain->getdomain()); $log = file_get_contents(realpath($this->path.'/logs/log')); @@ -88,7 +88,7 @@ public function a_user_can_sign_a_domain_cert_with_root_certificate_authority() } $this->assertEquals($request->getError(), 0); - $this->assertEquals($this->factory->request($this->path, $this->domain->getDomainOne())->getError(), 0); + $this->assertEquals($this->factory->request($this->path, $this->domain->getdomain())->getError(), 0); } /** @test */ From 07f2141a7b0917aa5423d6700f599813dc638bab Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 02:47:48 +0000 Subject: [PATCH 36/46] Guideline explanation --- .gitignore | 3 +++ example.env | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 example.env diff --git a/.gitignore b/.gitignore index 468a737..aba229f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ /vendor/ /deply/ /.readme +/.env /cert/cnf/ /cert/config/ /cert/csr/ /cert/keys/ /cert/logs/ /cert/live/ +/@eaDir +./@eaDir diff --git a/example.env b/example.env new file mode 100644 index 0000000..da16dbf --- /dev/null +++ b/example.env @@ -0,0 +1,16 @@ +# .env +#Subject information +R="[req]" +D="default_bits = 2048" +P="prompt = no" +DM="default_md = sha256" +DN="distinguished_name = dn" +D2="[dn]" +COUNTRY=C=LH +STATE="ST=LC" +LOCALITY=L="Local Citry" +ORGANIZATION=O=LOCALHTTPS +ORGANIZATION_UNIT=OU="localhttps" +EMAILADDRESS=emailAddress=local@https.local +COMMONNAME=CN=com.local.https + From 2ebf74cfcc57ab3df289fffbd24b287a578024a6 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 02:48:31 +0000 Subject: [PATCH 37/46] Guideline explanation --- .env | 16 ---------------- @eaDir/README.md@SynoResource | Bin 741 -> 0 bytes 2 files changed, 16 deletions(-) delete mode 100644 .env delete mode 100755 @eaDir/README.md@SynoResource diff --git a/.env b/.env deleted file mode 100644 index da16dbf..0000000 --- a/.env +++ /dev/null @@ -1,16 +0,0 @@ -# .env -#Subject information -R="[req]" -D="default_bits = 2048" -P="prompt = no" -DM="default_md = sha256" -DN="distinguished_name = dn" -D2="[dn]" -COUNTRY=C=LH -STATE="ST=LC" -LOCALITY=L="Local Citry" -ORGANIZATION=O=LOCALHTTPS -ORGANIZATION_UNIT=OU="localhttps" -EMAILADDRESS=emailAddress=local@https.local -COMMONNAME=CN=com.local.https - diff --git a/@eaDir/README.md@SynoResource b/@eaDir/README.md@SynoResource deleted file mode 100755 index 0145e69136ffae14be01d9b95f30ce87ae2f5eca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3!4z0(ql>#(n_+Jj4=3 From 135474042133818727d7b602080a964608b5b13d Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 02:57:30 +0000 Subject: [PATCH 38/46] fix ci issue --- .circleci/@eaDir/config.yml@SynoResource | Bin 0 -> 741 bytes .circleci/config.yml | 1 + .travis.yml | 3 ++- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100755 .circleci/@eaDir/config.yml@SynoResource diff --git a/.circleci/@eaDir/config.yml@SynoResource b/.circleci/@eaDir/config.yml@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/.circleci/config.yml b/.circleci/config.yml index c739144..c0b0ccc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,6 +37,7 @@ 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 diff --git a/.travis.yml b/.travis.yml index 57f21fa..c79578d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,8 @@ matrix: install: - composer install --prefer-dist --no-suggest -# before_script: +before_script: + - cp ./example.env ./.env # - composer self-update # - composer install --no-interaction From 85d21dd6ae1340780ca094bb1359f3665ac995a4 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 03:04:16 +0000 Subject: [PATCH 39/46] Fix cert folder issue --- cert/@eaDir/README.md@SynoResource | Bin 0 -> 741 bytes cert/README.md | 1 + 2 files changed, 1 insertion(+) create mode 100755 cert/@eaDir/README.md@SynoResource create mode 100644 cert/README.md diff --git a/cert/@eaDir/README.md@SynoResource b/cert/@eaDir/README.md@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..bb647c06615e86f531857ce2bf8170f553d57645 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3s{VfV|NFB4`Kz3{(-y literal 0 HcmV?d00001 diff --git a/cert/README.md b/cert/README.md new file mode 100644 index 0000000..cd527f8 --- /dev/null +++ b/cert/README.md @@ -0,0 +1 @@ +# This is where certificate reside. \ No newline at end of file From f58f5bb0c947a21928c7667501f347adb984e157 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 03:06:45 +0000 Subject: [PATCH 40/46] Fix cert folder issues --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index aba229f..3d7eb39 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /.readme /.env /cert/cnf/ +./cert/@eaDir /cert/config/ /cert/csr/ /cert/keys/ From ef08d18713f51bb547dfde869a24cb5de84588dd Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 03:31:56 +0000 Subject: [PATCH 41/46] Fix lines occurring --- ...CertificateAuthorityCreator.php@SynoResource | Bin 0 -> 741 bytes .../CertificateKeyCreator.php@SynoResource | Bin 0 -> 741 bytes src/CertificateAuthorityCreator.php | 16 +++------------- src/CertificateKeyCreator.php | 14 ++------------ ...ificateAuthorityCreatorTest.php@SynoResource | Bin 0 -> 741 bytes .../CertificateKeyCreatorTest.php@SynoResource | Bin 0 -> 741 bytes tests/CertificateAuthorityCreatorTest.php | 6 +++--- tests/CertificateKeyCreatorTest.php | 6 +++--- tests/FactoryTest.php | 4 ++-- 9 files changed, 13 insertions(+), 33 deletions(-) create mode 100644 src/@eaDir/CertificateAuthorityCreator.php@SynoResource create mode 100644 src/@eaDir/CertificateKeyCreator.php@SynoResource create mode 100755 tests/@eaDir/CertificateAuthorityCreatorTest.php@SynoResource create mode 100755 tests/@eaDir/CertificateKeyCreatorTest.php@SynoResource diff --git a/src/@eaDir/CertificateAuthorityCreator.php@SynoResource b/src/@eaDir/CertificateAuthorityCreator.php@SynoResource new file mode 100644 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/src/@eaDir/CertificateKeyCreator.php@SynoResource b/src/@eaDir/CertificateKeyCreator.php@SynoResource new file mode 100644 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/src/CertificateAuthorityCreator.php b/src/CertificateAuthorityCreator.php index 59c12b4..ade96a5 100644 --- a/src/CertificateAuthorityCreator.php +++ b/src/CertificateAuthorityCreator.php @@ -2,27 +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; - } - - public function getOutput() - { - return $this->output; - } } 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/tests/@eaDir/CertificateAuthorityCreatorTest.php@SynoResource b/tests/@eaDir/CertificateAuthorityCreatorTest.php@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/tests/@eaDir/CertificateKeyCreatorTest.php@SynoResource b/tests/@eaDir/CertificateKeyCreatorTest.php@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/tests/CertificateAuthorityCreatorTest.php b/tests/CertificateAuthorityCreatorTest.php index 91103cb..795eb07 100644 --- a/tests/CertificateAuthorityCreatorTest.php +++ b/tests/CertificateAuthorityCreatorTest.php @@ -12,7 +12,7 @@ public function it_can_create_certificate_authority() $certificateAuthority = new CertificateAuthorityCreator($this->path); - $this->assertEquals(0, $certificateAuthority->getError()); + $this->assertEquals(0, $certificateAuthority->errors); } /** @test */ @@ -20,7 +20,7 @@ public function it_can_return_an_error() { $certificateAuthority = new CertificateAuthorityCreator("fake/path"); - $this->assertEquals(2, $certificateAuthority->getError()); + $this->assertEquals(2, $certificateAuthority->errors); } /** @test */ @@ -28,7 +28,7 @@ public function it_can_return_array_of_output() { $certificateAuthority = new CertificateAuthorityCreator($this->path); - $this->assertEquals(0, count($certificateAuthority->getOutput())); + $this->assertEquals(0, count($certificateAuthority->output)); } } \ No newline at end of file diff --git a/tests/CertificateKeyCreatorTest.php b/tests/CertificateKeyCreatorTest.php index dc278d8..3fec0cc 100644 --- a/tests/CertificateKeyCreatorTest.php +++ b/tests/CertificateKeyCreatorTest.php @@ -9,7 +9,7 @@ public function it_can_generate_a_RSA_2048_key() { $rsa = new CertificateKeyCreator($this->path); - $this->assertEquals(0, $rsa->getError()); + $this->assertEquals(0, $rsa->errors); } /** @test */ @@ -17,7 +17,7 @@ public function it_can_generate_an_error() { $rsa = new CertificateKeyCreator("fake/path"); - $this->assertEquals(2, $rsa->getError()); + $this->assertEquals(2, $rsa->errors); } /** @test */ @@ -25,7 +25,7 @@ public function it_can_ouput_logs() { $rsa = new CertificateKeyCreator($this->path); - $output = count($rsa->getOutput()); + $output = count($rsa->output); $this->assertEquals(0, $output); } diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php index 3213ebb..2f8aa4f 100644 --- a/tests/FactoryTest.php +++ b/tests/FactoryTest.php @@ -24,7 +24,7 @@ public function a_user_can_generate_root_certificate_key() } $this->assertEquals($rootkey, true); - $this->assertEquals($this->factory->keygen($this->path)->getError(), 0); + $this->assertEquals($this->factory->keygen($this->path)->errors, 0); } /** @test */ @@ -46,7 +46,7 @@ public function a_user_can_create_root_certificate_authority() $rootCA = file_exists($this->path.'/csr/root.pem'); $this->assertEquals($rootCA, true); - $this->assertEquals($this->factory->create($this->path)->getError(), 0); + $this->assertEquals($this->factory->create($this->path)->errors, 0); } /** @test */ From 6c380e076557ccbe9eff532ed8073020677d7dd1 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 03:36:29 +0000 Subject: [PATCH 42/46] Fix lines occurring --- .../TrustTheRootSSLCertificate.php@SynoResource | Bin 0 -> 741 bytes src/TrustTheRootSSLCertificate.php | 6 ------ 2 files changed, 6 deletions(-) create mode 100644 src/@eaDir/TrustTheRootSSLCertificate.php@SynoResource diff --git a/src/@eaDir/TrustTheRootSSLCertificate.php@SynoResource b/src/@eaDir/TrustTheRootSSLCertificate.php@SynoResource new file mode 100644 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/src/TrustTheRootSSLCertificate.php b/src/TrustTheRootSSLCertificate.php index 01ba4e9..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 = 1; - // } - } public function getError() From 740e40defe3582744a40485f186ed906c60b8070 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 03:44:00 +0000 Subject: [PATCH 43/46] Fist test on php 7.3 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index c79578d..1201dd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ addons: php: - 7.1 - 7.2 + - 7.3 - nightly env: global: From 8120fa0ce6aafe47675a0505196366282bfd5b61 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 15:48:05 +0000 Subject: [PATCH 44/46] =?UTF-8?q?=EF=A3=BF=2010=20quick=20fix|updates...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 0 README.md | 0 cert/@eaDir/README.md@SynoResource | Bin 741 -> 0 bytes cert/README.md | 1 - composer.json | 0 composer.lock | 0 example.env | 0 lhttps.svg | 0 phpunit.xml | 0 src/Config.php | 8 +++++++- src/Path.php | 5 +++-- src/command/CreatorCommand.php | 9 +++++---- 12 files changed, 15 insertions(+), 8 deletions(-) mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md delete mode 100755 cert/@eaDir/README.md@SynoResource delete mode 100644 cert/README.md mode change 100644 => 100755 composer.json mode change 100644 => 100755 composer.lock mode change 100644 => 100755 example.env mode change 100644 => 100755 lhttps.svg mode change 100644 => 100755 phpunit.xml 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 diff --git a/cert/@eaDir/README.md@SynoResource b/cert/@eaDir/README.md@SynoResource deleted file mode 100755 index bb647c06615e86f531857ce2bf8170f553d57645..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3s{VfV|NFB4`Kz3{(-y diff --git a/cert/README.md b/cert/README.md deleted file mode 100644 index cd527f8..0000000 --- a/cert/README.md +++ /dev/null @@ -1 +0,0 @@ -# This is where certificate reside. \ No newline at end of file diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 diff --git a/composer.lock b/composer.lock old mode 100644 new mode 100755 diff --git a/example.env b/example.env old mode 100644 new mode 100755 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 diff --git a/src/Config.php b/src/Config.php index 41c266d..300a74b 100644 --- a/src/Config.php +++ b/src/Config.php @@ -15,7 +15,12 @@ function __construct() foreach ($folders as $key => $value) { if (file_exists(Path::all()."/".$value)) { - echo "\n ... checking output folders \n"; + 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) { @@ -32,3 +37,4 @@ public static function file($path, $domain) return new Openssl($path, $domain); } } + 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/command/CreatorCommand.php b/src/command/CreatorCommand.php index 5b2b5c3..3cba6a6 100644 --- a/src/command/CreatorCommand.php +++ b/src/command/CreatorCommand.php @@ -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.' ); @@ -74,11 +75,11 @@ protected function execute(InputInterface $input, OutputInterface $output) // 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'); } } From 5fac6f887dc44aa6bada890bf5268a70451ba439 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 15:48:33 +0000 Subject: [PATCH 45/46] =?UTF-8?q?=EF=A3=BF=2010=20quick=20fix|updates...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@eaDir/Path.php@SynoResource | Bin 0 -> 741 bytes src/@eaDir/bash@SynoResource | Bin 0 -> 741 bytes src/bash/@eaDir/script.sh@SynoResource | Bin 0 -> 741 bytes src/bash/script.sh | 14 ++++++++++++++ 4 files changed, 14 insertions(+) create mode 100644 src/@eaDir/Path.php@SynoResource create mode 100644 src/@eaDir/bash@SynoResource create mode 100755 src/bash/@eaDir/script.sh@SynoResource create mode 100755 src/bash/script.sh diff --git a/src/@eaDir/Path.php@SynoResource b/src/@eaDir/Path.php@SynoResource new file mode 100644 index 0000000000000000000000000000000000000000..718eb175901ad5be5eec863526e39a7117fa6e57 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3uA50C}T<#(n_+Dyk9} literal 0 HcmV?d00001 diff --git a/src/@eaDir/bash@SynoResource b/src/@eaDir/bash@SynoResource new file mode 100644 index 0000000000000000000000000000000000000000..d414abf2cd3ff8a80cda4b187d5273218ea39ef2 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3slN1$m=^#(n_+IKdJ* literal 0 HcmV?d00001 diff --git a/src/bash/@eaDir/script.sh@SynoResource b/src/bash/@eaDir/script.sh@SynoResource new file mode 100755 index 0000000000000000000000000000000000000000..eac236da595935442d61e337905be40ea446bcb4 GIT binary patch literal 741 zcmZQz6=P>$V!#BvKp|!z-UgLoVPIg~3T1OJFfi2u*#bb!31s&IX$2tW2C@$VX`nm< zP(Kq)Js*(05hw;UgMlB&UJGJ3xVVM^*(ZT)h6YbRe<1rJm>nGH2V~!bu*2$r?1vyW b5CGlD^c2DzC5J%>s3sll19_u?#(n_+Uj`DI literal 0 HcmV?d00001 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 + + From 7f9c0101ea8ad9f4a894d71b643018dd2573c986 Mon Sep 17 00:00:00 2001 From: madeny Date: Sat, 16 Nov 2019 15:49:25 +0000 Subject: [PATCH 46/46] =?UTF-8?q?=EF=A3=BF=2010=20quick=20fix|updates...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cert/readme.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 cert/readme.md diff --git a/cert/readme.md b/cert/readme.md new file mode 100644 index 0000000..e69de29