LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-13-2016, 04:17 AM   #1
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Rep: Reputation: 103Reputation: 103
installing certificate with Let's Encrypt


I am running Centos 7 and Apache 2.4.6. I'm trying to install a certificate with Let's Encrypt.
This is what I'm running:
Code:
letsencrypt certonly --webroot -w /certs -d example.com mail.example.com www.example.com
If I run:
[root@hostname]# letsencrypt certonly --webroot -w /certs -d example.com
I get this:
Code:
Failed authorization procedure. example.com (http-01): urn:acme:error:unauthorized :: 
The client lacks sufficient authorization :: 
Invalid response from http://example.com/.well-known/acme-challenge/randomlygeneratedstring [1.2.3.4]: 404
IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: example.com
   Type:   unauthorized
   Detail: Invalid response from http://example.com/.well-known
   /acme-challenge/randomlygeneratedstring
   [1.2.3.4]: 404

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A record(s) for that domain
   contain(s) the right IP address.
Any ideas how I should approach this problem?

Last edited by vincix; 04-13-2016 at 04:29 AM.
 
Old 04-13-2016, 05:16 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
You'll probably find that you're running letsencrypt wrongly.

If you're using the --webroot plugin then the -w parameter is the /path/to/your/site/webroot/ not to where you want to store the cert.

So if your files are in /var/www/html/example/ then you need to use that as the -w parameter.
 
Old 04-13-2016, 05:34 AM   #3
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by TenTenths View Post
You'll probably find that you're running letsencrypt wrongly.

If you're using the --webroot plugin then the -w parameter is the /path/to/your/site/webroot/ not to where you want to store the cert.

So if your files are in /var/www/html/example/ then you need to use that as the -w parameter.
Thank you. That makes sense. I was wondering how it knows where to store the challenge strings I'll let you know if it works. Thank you!
 
Old 04-13-2016, 06:26 AM   #4
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
The thing is, the root directory is /var/www/html, not /var/www/html/example.
I don't have a folder called example (my domain, I mean, of course) under the html folder.

So it still isn't working. Any ideas?
 
Old 04-13-2016, 06:57 AM   #5
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
I just gave those paths as examples, put the correct path to your DocumentRoot folder for your domain.
 
Old 04-13-2016, 07:36 AM   #6
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by TenTenths View Post
I just gave those paths as examples, put the correct path to your DocumentRoot folder for your domain.
Yes, I did so, but it's the same thing. I usually have a redirect directive configured in httpd.conf, but I deleted in order to see if it works - I saw that it uses 80 to check for the random string. But it doesn't work.
 
Old 04-13-2016, 07:43 AM   #7
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
So are you trying to renew a cert or is this the first time set-up you're doing?

Does your site make use of SSL already?
 
1 members found this post helpful.
Old 04-14-2016, 05:00 AM   #8
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
Hi,

Thanks for replying again

Yes, I already use a self-signed certificate. How does this affect the situation?
 
Old 04-14-2016, 11:01 AM   #9
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by vincix View Post
Yes, I already use a self-signed certificate. How does this affect the situation?
At a guess it's possible if you're redirecting the authentication request to SSL then LetsEncrypt is not accepting the self-signed cert.

Disable SSL (and redirection) on your site and just try it with pure http only
to see if that gets your cert issued.

For what it's worth, I changed my wife's blog to https with a letsencrypt cert in about 10 minutes. If you think it might be useful I captured each of my steps and can write it up.
 
1 members found this post helpful.
Old 04-14-2016, 12:08 PM   #10
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
What I did was back up httpd.conf and ssl.conf, the only configuration files that were different from the original, and I reinstalled apache. Then all of a sudden it worked:

Congratulations! Your certificate and chain have been saved at
/etc/letsencrypt/live/example.com/fullchain.pem.

The problem is that I don't know why it didn't work before. I had deleted the welcome screen, indeed, and I had a few password protected folders (using httpd, basic authentication, etc.), but I don't know exactly what the trouble was.
 
Old 04-14-2016, 12:12 PM   #11
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Well at least you got sorted
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Let’s Encrypt passed another major milestone by issuing first certificate jeremy Linux - News 0 09-15-2015 11:28 AM
Installing a Verisign Certificate adumith Linux - Newbie 1 07-10-2013 06:17 PM
crypt() perl function to encrypt Password in shell scripts or How Encrypt passwords ? balakrishnay Linux - General 13 01-14-2010 09:35 AM
encrypt and decrypt using encrypt(char block[64], int edflag) rockwell_001 Linux - Security 3 08-30-2009 09:16 AM
installing ssl certificate ilnli Linux - Software 1 08-05-2006 09:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration