Join the community today
Become a Member

Letsencrypt Official acmetool.sh testing thread for Centmin Mod 123.09beta01

Discussion in 'Domains, DNS, Email & SSL Certificates' started by eva2000, Jul 26, 2016.

  1. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    did you create nginx vhost separately before running
    Code (Text):
    ./acmetool.sh acmeinstall
    ./acmetool.sh issue centmintest.com lived

    that could of been problem as you don't need to create it separately as the last command does that too

     
  2. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
  3. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    Yes first i create the domain from menu option 2 without self signed certificate option and then i was run:

    Code:
    ./acmetool.sh acmeinstall
    ./acmetool.sh issue centmintest.com lived
    I thought that the d at the end will just configure my existing vhost file to move from http to https :)
     
  4. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    It should. Just the assumption was /usr/local/nginx/conf/ssl/centmintest.com/ would of been created by acmetool.sh via /usr/bin/nv when it sets up self-signed ssl cert routine which is created regardless of you answering no if letsencrypt is detected. Should be fixed with Beta Branch - acmetool.sh 1.0.2 ensure nginx ssl directory exists | Centmin Mod Community
     
  5. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    ok i am on the way for test number 2 :)
     
  6. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    Code:
    [sslvhostsetup] create /usr/local/nginx/conf/conf.d/centmintest.com.ssl.conf
    
    backup & remove /usr/local/nginx/conf/conf.d/centmintest.com.conf
    create /usr/local/nginx/conf/conf.d/centmintest.com.ssl.conf
    Reloading nginx configuration (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    [FAILED]
    backup & remove /usr/local/nginx/conf/conf.d/centmintest.com.conf
    
    [sslvhostsetup] create /usr/local/nginx/conf/conf.d/centmintest.com.ssl.conf
    
    backup & remove /usr/local/nginx/conf/conf.d/centmintest.com.conf
    create /usr/local/nginx/conf/conf.d/centmintest.com.ssl.conf
    Reloading nginx configuration (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
    [FAILED]
     
    Last edited: Sep 23, 2016
  7. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    It is looking for:

    Code:
    /usr/local/nginx/conf/ssl/centmintest.com/centmintest.com.crt
    /usr/local/nginx/conf/ssl/centmintest.com/dhparam.pem
    But there is:

    Code:
    /usr/local/nginx/conf/ssl/centmintest.com/centmintest.com-acme.cer
    /usr/local/nginx/conf/ssl/centmintest.com/centmintest.com-acme.key
    /usr/local/nginx/conf/ssl/centmintest.com/centmintest.com-fullchain-acme.key
    Code:
    [root@server addons]# nginx -t
    nginx: [emerg] BIO_new_file("/usr/local/nginx/conf/ssl/centmintest.com/dhparam.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/usr/local/nginx/conf/ssl/centmintest.com/dhparam.pem', 'r') error:2006D080:BIO routines:BIO_new_file:no such file)
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
     
  8. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    After a few tests i found what the issue is :)

    If i use on a domain that is NOT exist this:

    Code:
    ./acmetool.sh issue domain.com lived
    it works! (but not if the domain exists)

    If i use from centminmod menu option 2 to create a vhost and select to create a self signed ssl and then run this:

    Code:
    ./acmetool.sh issue domain.com lived
    it works again!

    But if i create from Centminmod menu option 2 a vhost without to create the self signed ssl then it doesn't work and from the nginx error i see that the issue is that is missing:

    Code:
    /usr/local/nginx/conf/ssl/centmintest.com/centmintest.com.crt
    /usr/local/nginx/conf/ssl/centmintest.com/dhparam.pem
    and fails.... :( (don't know if it needs other files also from this folder)

    At the end i try to use one method that it works without any errors but when i browse i am getting :

    Code:
    ERR_TOO_MANY_REDIRECTS
    I thought that is related to my cookies but i just test it on another device from another ISP that never browse to that domain and got the same issue :(

    I have set all ssl related info on cloudflare off if that matters ....

    My centmintest.com.ssl.conf :

    Code:
    http://pastebin.com/fYG183S2
    You can test it online: https:centmintest.com

    When i click once it says ERR_TOO_MANY_REDIRECTS then on refresh is using http with the same error and then https again :(
     
    Last edited: Sep 23, 2016
  9. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Thanks @pamamolf for the info. Will check it out :)

    I think i know what's going on. If you created a non-selfsigned ssl cert nginx vhost with Centmin Mod centmin.sh menu options 2, 22 or /usr/bin/nv command, then /usr/local/nginx/conf/ssl/yourdomain.com directory and the self-signed ssl cert files don't exist. Then acmetool.sh currently detects if /usr/local/nginx/conf/conf.d/yourdomain.com.ssl.conf exists or not for HTTPS nginx vhost and if doesn't exist, creates it via the self-signed ssl cert creation routine. (So i should check more than just /usr/local/nginx/conf/conf.d/yourdomain.com.ssl.conf existence to trigger the self-signed ssl cert creation routine. I should also check for /usr/local/nginx/conf/ssl/yourdomain.com existence and the self-signed ssl certificates within it to determine if self-signed ssl cert creation routine should be triggered)

    Then when acmetool.sh successfully uses acme.sh client to get a letsencrypt ssl certificate, it auto replaces the self-signed ssl certificate with letencrypt ssl certificate. If acme.sh client fails verification of your domain and can not get letsencrypt ssl certificate, it falls back to and leaves self-signed ssl certificate.
     
    Last edited: Sep 23, 2016
  10. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    @pamamolf added fix for this issue where nginx vhost was created prior with no self-signed ssl cert setup. So update to latest 123.09beta01 :)

    example if you issue with newdomain.com previously created with self-signed ssl setup answer = no
    Code (Text):
    addons/acmetool.sh issue newdomain.com

    You'll see an extra segment of output at the beginning triggering the self-signed ssl cert check and generation.
    Code (Text):
    [self-signed ssl cert check] required by acmetool.sh
    
    /usr/local/nginx/conf/ssl/newdomain.com ~/tools/acme.sh
    ---------------------------------------------------------------
    Generating self signed SSL certificate...
    CSR file can also be used to be submitted for paid SSL certificates
    If using for paid SSL certificates be sure to keep both private key and CSR safe
    creating CSR File: newdomain.com.csr
    creating private key: newdomain.com.key
    creating self-signed SSL certificate: newdomain.com.crt
    openssl req -new -newkey rsa:2048 -sha256 -nodes -out newdomain.com.csr -keyout newdomain.com.key -subj "/C=/ST=/L=/O=newdomain.com/OU=newdomain.com/CN=newdomain.com"
    Generating a 2048 bit RSA private key
    ....................+++
    ............................................................................................................................+++
    writing new private key to 'newdomain.com.key'
    -----
    openssl x509 -req -days 36500 -sha256 -in newdomain.com.csr -signkey newdomain.com.key -out newdomain.com.crt
    Signature ok
    subject=/O=newdomain.com/OU=newdomain.com/CN=newdomain.com
    Getting Private key
    
    ---------------------------------------------------------------
    Generating dhparam.pem file - can take a few minutes...
    Generating DH parameters, 2048 bit long safe prime, generator 2
    This is going to take a long time
    .....+......+*
    dhparam file generation time: 66.134662728
     
  11. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    Any ideas about this also?

    Code:
    ERR_TOO_MANY_REDIRECTS
    I thought that is related to my cookies but i just test it on another device from another ISP that never browse to that domain and got the same issue :(

    I have set all ssl related info on cloudflare off if that matters ....

    My centmintest.com.ssl.conf :

    Code:
    http://pastebin.com/fYG183S2
    You can test it online: https:centmintest.com

    When i click once it says ERR_TOO_MANY_REDIRECTS then on refresh is using http with the same error and then https again :(
     
  12. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    your cloudflare config is redirecting https requests to http and then nginx is redirecting http to https LOL
    Code (Text):
    curl -I https://centmintest.com
    HTTP/1.1 301 Moved Permanently
    Date: Fri, 23 Sep 2016 10:49:07 GMT
    Connection: keep-alive
    Set-Cookie: __cfduid=d42c7711ee0c69e8990573a5c0e63bb681474627747; expires=Sat, 23-Sep-17 10:49:07 GMT; path=/; domain=.centmintest.com; HttpOnly
    Location: http://centmintest.com/
    Server: cloudflare-nginx
    CF-RAY: 2e6d6d9e2d3d3828-ATL

    Code (Text):
    curl -I http://centmintest.com
    HTTP/1.1 302 Moved Temporarily
    Date: Fri, 23 Sep 2016 10:49:55 GMT
    Content-Type: text/html
    Connection: keep-alive
    Set-Cookie: __cfduid=deee4af0a45d336c31b3daf0a23a8bdb21474627795; expires=Sat, 23-Sep-17 10:49:55 GMT; path=/; domain=.centmintest.com; HttpOnly
    Location: https://centmintest.com/
    X-Powered-By: centminmod
    Server: cloudflare-nginx
    CF-RAY: 2e6d6ec9f7443870-ATL
     
  13. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    Ok got it now :)

    Now i want to play with strict option on cloudflare and to check on online sites the certificate and if i will have an A for it :)

    Thanks !!!!
     
    Last edited: Sep 23, 2016
  14. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    there's no options for cloudflare to redirect https to http unless you have a page rule set i don't think.
     
  15. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    If ssl is disabled on Cloudflare that cause that issue !!!

    [​IMG]

    I just enable Full and it works...
     
  16. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Strange that doesn't happen for my cloudflare based domains. Might want to contact cloudflare support to ask. Could be you need to go into Cloudflare DNS only mode to use own HTTPS based sites.
     
  17. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    I am not sure that i use now the let's encrypt certificate and not the cloudflare one with that setting ?

    Need to check online which one is active.

    Any link to check it?
     
  18. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    check browser security console tab, if cloudflare is active with cache/protection you will use cloudflare's ssl certificates
     
  19. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    7:17 PM
    Nginx-1.29.x
    MariaDB 10.6.x
    Damn i am using cloudflare one :(

    So i will set again to OFF the ssl on crypto section and try to find what is causing this redirect from cloudflare :(

    Can you please share what you have enable on crypto section ?
     
  20. eva2000

    eva2000 Administrator Staff Member

    59,271
    12,508
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,140
    Local Time:
    2:17 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    save time, just ask cloudflare support :)