Hi @sahsanu ,
I am able to generate the certificate on my webserver for the domain: gamoly.com.
I edited my domain's 'A' record to point to my webserver's ip 104.154.207.47
curl -IkL https://gamoly.com
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Fri, 26 May 2017 11:04:48 GMT
Content-Type: text/html
Content-Length: 867
Last-Modified: Tue, 23 May 2017 11:41:22 GMT
Connection: keep-alive
ETag: "59241fe2-363"
Accept-Ranges: bytes
Webserver : nginx/1.6.2 listens for both http and https
Now, I have other machine (REST server) which has to be exposed to the world. Please let me know how to secure this machine.
I tried running the below command on this machine (104.155.175.183)
sudo certbot certonly --manual --preferred-challenges http -d gamoly.com
output:
murugan@gm-app-1:~$ sudo certbot certonly --manual --preferred-challenges http -d gamoly.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel):murugan@gamoly.com
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf. You must agree
in order to register with the ACME server at
https://acme-v01.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: A
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for gamoly.com
-------------------------------------------------------------------------------
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.
Are you OK with your IP being logged?
-------------------------------------------------------------------------------
(Y)es/(N)o: Y
-------------------------------------------------------------------------------
Make sure your web server displays the following content at
http://gamoly.com/.well-known/acme-challenge/ha9WrWnLYerW5PCQ-v5GTroUPEoIqfRGgKCFLGJihgg before continuing:
ha9WrWnLYerW5PCQ-v5GTroUPEoIqfRGgKCFLGJihgg.YrKfS30sE2WgXWd0GL-Xm2w-wdUKDumHV8UoWr-XYKM
If you don't have HTTP server configured, you can run the following
command on the target server (as root):
mkdir -p /tmp/certbot/public_html/.well-known/acme-challenge
cd /tmp/certbot/public_html
printf "%s" ha9WrWnLYerW5PCQ-v5GTroUPEoIqfRGgKCFLGJihgg.YrKfS30sE2WgXWd0GL-Xm2w-wdUKDumHV8UoWr-XYKM > .well-known/acme-challenge/ha9WrWnLYerW5PCQ-v5GTroUPEoIqfRGgKCFLGJihgg
# run only once per server:
$(command -v python2 || command -v python2.7 || command -v python2.6) -c \
"import BaseHTTPServer, SimpleHTTPServer; \
s = BaseHTTPServer.HTTPServer(('', 80), SimpleHTTPServer.SimpleHTTPRequestHandler); \
s.serve_forever()"
-------------------------------------------------------------------------------
Press Enter to Continue
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0000_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0000_csr-certbot.pem
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/gamoly.com/fullchain.pem. Your cert will
expire on 2017-08-24. To obtain a new or tweaked version of this
certificate in the future, simply run certbot again. To
non-interactively renew *all* of your certificates, run "certbot
renew"
- If you lose your account credentials, you can recover through
e-mails sent to murugan@gamoly.com.
- Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
But when I hit my REST server (104.155.175.183) with the below command,
wget --method GET --header 'content-type: application/json' --header 'authorization: Bearer token --output-document - https://104.155.175.183:443/path/to/resource
I get the below error
--2017-05-26 16:45:01-- https://104.155.175.183/path/to/resource
Connecting to 104.155.175.183:443... connected.
ERROR: certificate common name ‘gamoly.com’ doesn't match requested host name ‘104.155.175.183’.
To connect to 104.155.175.183 insecurely, use `--no-check-certificate'.
I also tried copy/pasting the certificate from my webserver onto the REST server (104.155.175.183) but it throws the same error
I am not sure if the above method is the correct way to obtain and install cert onto the machines other than my webserver or there exists a different way to do it. Please help me out.
Thanks,
Murugan