Skip to content

ACME does not receive certificates #2403

@arut-plus

Description

@arut-plus

I'm trying to set up a simple proxy (to get familiar with the Membrane), but I can't set up HTTPS.
Of course, I did everything according to the instructions from the official guide to setting up SSL using ACME.

What I've tried (to no avail):

  • Wait until the certificates are requested (if they were requested at all) - waited more than 25 minutes
  • Both directory URL's: https://acme-staging-v02.api.letsencrypt.org/directory and https://acme-v02.api.letsencrypt.org/directory

All the necessary information is provided below (* all IP addresses and domain addresses have been replaced with fake ones):

docker-compose.yml
name: membrane
services:
  membrane:
    image: predic8/membrane:6.3.10
    container_name: membrane
    volumes:
      - ./proxies.xml:/opt/membrane/conf/proxies.xml
      - ./log4j2.xml:/opt/membrane/conf/log4j2.xml
    ports:
      - "0.0.0.0:80:80"
      - "0.0.0.0:443:443"
      - "0.0.0.0:2000:2000"
proxies.yml
<spring:beans xmlns="http://membrane-soa.org/proxies/1/"
			  xmlns:spring="http://www.springframework.org/schema/beans"
			  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			  xsi:schemaLocation="http://www.springframework.org/schema/beans
	                    http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
	                    http://membrane-soa.org/proxies/1/ http://membrane-soa.org/schemas/proxies-1.xsd">

	<ssl id="demoSSL">
	  <acme
	    experimental="true" 
	    directoryUrl="https://acme-v02.api.letsencrypt.org/directory"
	    contacts="mailto:[email protected]"
	    termsOfServiceAgreed="true"
	  >
	  <fileStorage dir="/tmp/acme-certs" />
	  </acme>
	</ssl>

	<router>

		<api port="80">
		  <acmeHttpChallenge />
		  <javascript>
		    exc.setResponse(Response.ok().build());
		    RETURN
		  </javascript>
		</api>

		<api host="mydomain.com" port="443">
			<log/>
		  <spring:ref bean="demoSSL" />
          <!--
            At this address, I launched nginx in docker to test redirection.
            I also tried to set the container name as the host.
          -->
		  <target host="mydomain.com" port="8888" />
		</api>

	</router>

</spring:beans>
log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
    <Appenders>
        <Console name="STDOUT" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{ABSOLUTE} %5p %tid %tn %c{1}:%L %X - %m%n" />
        </Console>
    </Appenders>
    <Loggers>
       <Logger name="com.predic8.membrane.core.transport" level="debug">
           <AppenderRef ref="STDOUT" />
       </Logger>
        <Root level="info">
            <AppenderRef ref="STDOUT" />
        </Root>
    </Loggers>
</Configuration>
docker compose logs --follow membrane
10:24:10,880  INFO 3 main LanguageAdapter:67 {} - Found Rhino Javascript engine.
10:24:12,319 DEBUG 3 main AcmeSSLContext:203 {} - ACME: do not yet have a key for mydomain.com
10:24:12,319 DEBUG 3 main AcmeSSLContext:203 {} - ACME: do not yet have a key for mydomain.com
10:24:12,415  INFO 3 main HttpEndpointListener:95 {} - listening at '*:80'
10:24:12,415  INFO 3 main HttpEndpointListener:95 {} - listening at '*:80'
10:24:12,431  INFO 3 main HttpEndpointListener:95 {} - listening at '*:443'
10:24:12,431  INFO 3 main HttpEndpointListener:95 {} - listening at '*:443'
10:24:12,440  INFO 3 main ApiInfo:35 {} - Started 2 APIs:
10:24:12,445  INFO 3 main ApiInfo:37 {} -   API 0.0.0.0:80
10:24:12,446  INFO 3 main ApiInfo:37 {} -   API mydomain.com:443
10:24:12,448  INFO 3 main Router:343 {} - Membrane API Gateway 6.3.10 up and running!
10:24:19,362 DEBUG 20 Connection Acceptor '*:443' HttpEndpointListener:120 {} - Accepted connection from /88.88.88.88:2042
10:24:19,362 DEBUG 20 Connection Acceptor '*:443' HttpEndpointListener:120 {} - Accepted connection from /88.88.88.88:2042
10:24:19,378 ERROR 22 router /88.88.88.88:2042 HttpServerHandler:140 {} -
java.lang.RuntimeException: ACME has not yet acquired a certificate.
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.getSocketFactory(AcmeSSLContext.java:112)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.check(AcmeSSLContext.java:164)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.wrap(AcmeSSLContext.java:159)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.wrapAcceptedSocket(AcmeSSLContext.java:154)
    at com.predic8.membrane.core.transport.http.HttpServerHandler.setup(HttpServerHandler.java:77)
    at com.predic8.membrane.core.transport.http.HttpServerHandler.run(HttpServerHandler.java:100)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
    at java.base/java.lang.Thread.run(Thread.java:1474)
10:24:19,378 ERROR 22 router /88.88.88.88:2042 HttpServerHandler:140 {} -
java.lang.RuntimeException: ACME has not yet acquired a certificate.
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.getSocketFactory(AcmeSSLContext.java:112)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.check(AcmeSSLContext.java:164)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.wrap(AcmeSSLContext.java:159)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.wrapAcceptedSocket(AcmeSSLContext.java:154)
    at com.predic8.membrane.core.transport.http.HttpServerHandler.setup(HttpServerHandler.java:77)
    at com.predic8.membrane.core.transport.http.HttpServerHandler.run(HttpServerHandler.java:100)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
    at java.base/java.lang.Thread.run(Thread.java:1474)
10:24:19,395 DEBUG 20 Connection Acceptor '*:443' HttpEndpointListener:120 {} - Accepted connection from /88.88.88.88:2046
10:24:19,395 DEBUG 20 Connection Acceptor '*:443' HttpEndpointListener:120 {} - Accepted connection from /88.88.88.88:2046
10:24:19,398 ERROR 23 router /88.88.88.88:2046 HttpServerHandler:140 {} -
java.lang.RuntimeException: ACME has not yet acquired a certificate.
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.getSocketFactory(AcmeSSLContext.java:112)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.check(AcmeSSLContext.java:164)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.wrap(AcmeSSLContext.java:159)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.wrapAcceptedSocket(AcmeSSLContext.java:154)
    at com.predic8.membrane.core.transport.http.HttpServerHandler.setup(HttpServerHandler.java:77)
    at com.predic8.membrane.core.transport.http.HttpServerHandler.run(HttpServerHandler.java:100)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
    at java.base/java.lang.Thread.run(Thread.java:1474)
10:24:19,398 ERROR 23 router /88.88.88.88:2046 HttpServerHandler:140 {} -
java.lang.RuntimeException: ACME has not yet acquired a certificate.
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.getSocketFactory(AcmeSSLContext.java:112)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.check(AcmeSSLContext.java:164)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.wrap(AcmeSSLContext.java:159)
    at com.predic8.membrane.core.transport.ssl.AcmeSSLContext.wrapAcceptedSocket(AcmeSSLContext.java:154)
    at com.predic8.membrane.core.transport.http.HttpServerHandler.setup(HttpServerHandler.java:77)
    at com.predic8.membrane.core.transport.http.HttpServerHandler.run(HttpServerHandler.java:100)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
    at java.base/java.lang.Thread.run(Thread.java:1474)
10:24:22,335 DEBUG 16 Timer-0 AcmeSSLContext:203 {} - ACME: do not yet have a key for mydomain.com
10:24:22,335 DEBUG 16 Timer-0 AcmeSSLContext:203 {} - ACME: do not yet have a key for mydomain.com
10:24:32,341 DEBUG 16 Timer-0 AcmeSSLContext:203 {} - ACME: do not yet have a key for mydomain.com
10:24:32,341 DEBUG 16 Timer-0 AcmeSSLContext:203 {} - ACME: do not yet have a key for mydomain.com
I get this error in the browser:
Secure Connection Failed
An error occurred during a connection to mydomain.com. PR_END_OF_FILE_ERROR
Error code: PR_END_OF_FILE_ERROR
    The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
    Please contact the website owners to inform them of this problem.
In addition to accessing it from the browser, I also tried the following commands from the console:
$ curl https://mydomain.com
curl: (35) Send failure: Broken pipe

$ curl --insecure https://mydomain.com
curl: (35) TLS connect error: error:0A000126:SSL routines::unexpected eof while reading

$ curl -v http://mydomain.com/.well-known/acme-challenge
* Host mydomain.com:80 was resolved.
* IPv6: (none)
* IPv4: 12.34.56.78
*   Trying 12.34.56.78:80...
* Established connection to mydomain.com (12.34.56.78 port 80) from 192.168.1.12 port 33494
* using HTTP/1.x
> GET /.well-known/acme-challenge HTTP/1.1
> Host: mydomain.com
> User-Agent: curl/8.16.0
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 Ok
< Server: Membrane API Gateway
< Content-Length: 0
<
* Connection #0 to host mydomain.com:80 left intact

$ openssl s_client -connect mydomain.com:443
Connecting to 12.34.56.78
CONNECTED(00000003)
40C715D7AA7F0000:error:0A000126:SSL routines::unexpected eof while reading:ssl/record/rec_lay
---
no peer certificate available
---
No client certificate CA names sent
Negotiated TLS1.3 group: <NULL>
---
SSL handshake has read 0 bytes and written 1558 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Protocol: TLSv1.3
This TLS version forbids renegotiation.
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
40C715D7AA7F0000:error:0A000197:SSL routines:SSL_shutdown:shutdown while in init:ssl/ssl_lib.c:2834:

$ openssl s_client -ignore_unexpected_eof -connect mydomain.com:443
Connecting to 12.34.56.78
CONNECTED(00000003)
closed
---
no peer certificate available
---
No client certificate CA names sent
Negotiated TLS1.3 group: <NULL>
---
SSL handshake has read 0 bytes and written 1551 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Protocol: TLSv1.3
This TLS version forbids renegotiation.
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---

Thank you in advance 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions