openshift-letsencrypt icon indicating copy to clipboard operation
openshift-letsencrypt copied to clipboard

Certificate Not Connected?

Open jonrogoff opened this issue 8 years ago • 20 comments

I initially had a similar issue to #21. I was able to get past that by changing the insecureEdgeTerminationPolicy from Redirect to Allow.

Now I get the following: `watching routes with selector butter.sh/letsencrypt-managed=yes

  | Processing route /oapi/v1/namespaces/XXX/routes/XXX.com with domain XXX.com.   | unable to load certificate   | 140546834421664:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE   | Getting new certificate for XXX.com   | Adding well-known route.   | calling dehydrated with domain name 'XXX.com'   | # INFO: Using main config file /usr/share/letsencrypt-container/config   | Using private key /etc/openshift-letsencrypt/account-key instead of account key   | Processing XXX.com   | + Signing domains...   | + Generating private key...   | + Generating signing request...   | + Requesting challenge for XXX.com...   | + Already validated!   | + Requesting certificate...   | + Checking certificate...   | + Done!   | + Creating fullchain.pem...   | Defer deploying certificate for routes.   | + Done!   | Running exit_hook ` However, when I access https://XXX.com I still receive either an insecure website warning or a mismatched certificate notification depending on which browser I am using. What am I missing?

jonrogoff avatar Oct 08 '17 18:10 jonrogoff

Sorry, for not answering earlier.

Can you please confirm, that there is a certificate in your route:

 oc get route XXX.com -o yaml

This should include the certificate and private key. Does it?

ibotty avatar Oct 10 '17 12:10 ibotty

No. It has neither.

I double checked and the letsencrypt serviceaccount has been bound to the edit role. However, when I check oc policy who-can edit route it only includes system:admin, system:cluster-admins, and system:masters. I'd prefer not to bind the letsencrypt serviceaccount to the admin role, unless absolutely necessary. Do I need to add do something else to allow the edit role or the letsencrypt serviceaccount to edit routes or am I comparing apples and oranges?

On a separate note, I'm curious if this project truly requires 512 MiB for each container. Could I safely scale each container back to the minimum of 255 MiB?

jonrogoff avatar Oct 10 '17 14:10 jonrogoff

Hi, I am sure, it does not need 512MiB in total ;). You can surely grant it only the minimum.

Regarding your route not getting updated can you please check that the letsencrypt service account can patch routes?

 oc policy who-can patch routes -n the_right_namespace

If this does not include the letsencrypt service account, can you double check, that you granted it in the right namespace?

ibotty avatar Oct 11 '17 08:10 ibotty

For now, I only have 1 namespace. I need to create more, but I want to get 1 working first.

I did confirm that system:serviceaccount:XXX:letsencrypt is in the Users list for patching routes.

jonrogoff avatar Oct 11 '17 13:10 jonrogoff

Is there no log entry after "Running exit_hook"? Does the pod exit ungracefully? (What does oc describe po letsencrypt-... say?

ibotty avatar Oct 11 '17 14:10 ibotty

Nothing after "Running exit_hook". Pod is running fine. The describe is very long but essentially says that watcher, cron, and nginx are all running.

jonrogoff avatar Oct 11 '17 14:10 jonrogoff

Is there no indication of any containers having restarted?

ibotty avatar Oct 11 '17 14:10 ibotty

Nope. I was getting that when the insecureEdgeTerminationPolicy was set to Redirect rather than Allow. At that time, the cron container kept restarting, which occasionally forced a restart of the entire pod. However, since changing the policy to Allow it all stays up and running nicely.

jonrogoff avatar Oct 11 '17 14:10 jonrogoff

Can you please rsh to the cron container, and delete contents below /var/lib/letsencrypt-container:

rm -r /var/lib/letsencrypt-container/*

And see, whether it changes anything?

ibotty avatar Oct 12 '17 07:10 ibotty

Now I'm getting this when requesting the certificate:

` Details:

  | {   | "type": "urn:acme:error:rateLimited",   | "detail": "Error creating new cert :: too many certificates already issued for exact set of domains: XXX.com",   | "status": 429   | } `

I suppose I'll have to check again later.

jonrogoff avatar Oct 12 '17 13:10 jonrogoff

Unfortunately yes. Please do comment, Wien it works again. Alternatively you might switch to the test acme server.

ibotty avatar Oct 12 '17 17:10 ibotty

I created a new subdomain for testing. Now I get this:

Processing XXX.com
--
  | + Signing domains...
  | + Generating private key...
  | + Generating signing request...
  | + Requesting challenge for XXX.com...
  | Running deploy_challenge hook
  | + Responding to challenge for XXX.com...
  | Deleting well-known route.
  | + Challenge is valid!
  | + Requesting certificate...
  | + Checking certificate...
  | + Done!
  | + Creating fullchain.pem...
  | Defer deploying certificate for routes.
  | + Done!
  | Running exit_hook

As before, attempting to access XXX.com complains because the certificate has the wrong name.

jonrogoff avatar Oct 13 '17 20:10 jonrogoff

That's an error I did not encounter before. Can you try to patch the route manually? Please don't delete the pod (so the certificate is still in the filesystem). I will write instructions Monday, if you don't know how to generate the patch and apply it manually (See common.sh for the source).

ibotty avatar Oct 14 '17 08:10 ibotty

I'm familiar with starting a new build, but that creates a new deployment/pod. So I may need to be pointed in the right direction for how to patch the pod directly. I know linux so if the patch is applied via ssh, it should be easy enough.

jonrogoff avatar Oct 14 '17 17:10 jonrogoff

Sorry, that was a little terse. I will write tomorrow if time permits, but in short, you don't have to change the deployment (or stop the running pod) at all. To add the certificate to the route, openshift-letsencrypt patches the route (see common.sh). I wanted to do that manually, so we can see explicitly what's wrong.

ibotty avatar Oct 15 '17 14:10 ibotty

Same here. Would be glad to help out. Patching the route still doesn't seem to work after getting the certs. Any progress on this?

malagant avatar Oct 20 '17 10:10 malagant

It has been a busy week. I'm just getting back to this today. After reviewing common.sh, I ran common.sh then manually called add_certificate_to_route <mydomain> /oapi/v1/namespaces/<myproject>/routes/<myroute>. It returned without an error. However, the info specified in the data section was not added to the yaml for myroute.

I edited common.sh to echo the data parameter passed to patch_route. I then attempted to manually edit my route to add that data and received errors that spec.tls.certificate and spec.tls.key are immutable.

I am using OpenShift Online Pro (not Starter) so I should be able to specify certificates. I therefore tried deleting and recreating my route using the key and certificate info from the data parameter and got this error: Reason: - spec.tls.certificate: Invalid value: 'redacted certificate data': Could not read any certificates - spec.tls.key: Invalid value: 'redacted key data': tls: failed to find any PEM data in certificate input.

I notice that the data actually includes 2 certificates within the value for spec.tls.certificate. They have the line http://cert.int-x3.letsencrypt.org/ in between them. Is this correct?

jonrogoff avatar Oct 20 '17 17:10 jonrogoff

#26 is IMO also related to this, which makes me believe that origin 3.6 introduces an API change. I will dig deeper into this and keep you informed about any progress I make. @jonrogoff thanks for the information.

malagant avatar Oct 20 '17 17:10 malagant

Note, that I won't be able to take care of any support requests for at least a month starting tomorrow. I am sorry.

ibotty avatar Oct 28 '17 08:10 ibotty

can confirm that's related to #https://github.com/openshift/origin/issues/18397. It's a right issue

hypery2k avatar Feb 07 '18 15:02 hypery2k