Created
February 29, 2016 16:05
-
-
Save hamishforbes/402c4cebef665969cb34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hamish@Hamish-MBP ~/e/e/t/cert> curl -vs --cacert rootCA.pem https://localhost:443/ | |
* Trying 127.0.0.1... | |
* Connected to localhost (127.0.0.1) port 443 (#0) | |
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 | |
* Server certificate: localhost | |
> GET / HTTP/1.1 | |
> Host: localhost | |
> User-Agent: curl/7.43.0 | |
> Accept: */* | |
> | |
< HTTP/1.1 200 OK | |
< Server: openresty/1.9.7.3 | |
< Date: Mon, 29 Feb 2016 15:55:48 GMT | |
< Content-Type: text/plain | |
< Transfer-Encoding: chunked | |
< Connection: keep-alive | |
< | |
OK | |
* Connection #0 to host localhost left intact | |
hamish@Hamish-MBP ~/e/e/t/cert> curl -vs --cacert rootCA.pem https://localhost:444/ | |
* Trying 127.0.0.1... | |
* Connected to localhost (127.0.0.1) port 444 (#0) | |
* Server aborted the SSL handshake | |
* Closing connection 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2016/02/29 15:55:48 [debug] 53386#0: [lua] ssl_certificate_by_lua:2: localhost | |
2016/02/29 15:55:48 [info] 53386#0: *1 client 127.0.0.1 closed keepalive connection | |
2016/02/29 15:55:50 [debug] 53386#0: [lua] ssl_certificate_by_lua:2: localhost | |
2016/02/29 15:55:50 [error] 53386#0: [lua] ssl_certificate_by_lua:6: PEM_read_bio_X509_AUX() failed, context: ssl_certificate_by_lua*, client: 127.0.0.1, server: 0.0.0.0:444 | |
2016/02/29 15:55:50 [crit] 53386#0: *2 SSL_do_handshake() failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: TRUSTED CERTIFICATE) while SSL handshaking, client: 127.0.0.1, server: 0.0.0.0:444 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error_log /var/log/openresty/error.log debug; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
access_log off; | |
ssl_certificate "/etc/openresty/ssl/localhost.crt"; | |
ssl_certificate_key "/etc/openresty/ssl/localhost.key"; | |
server { | |
listen 443 ssl; | |
server_name 'localhost'; | |
ssl_certificate_by_lua_block { | |
ngx.log(ngx.DEBUG, require("ngx.ssl").server_name()) | |
} | |
location / { | |
echo "OK"; | |
} | |
} | |
server { | |
listen 444 ssl; | |
server_name 'localhost'; | |
ssl_certificate_by_lua_block { | |
ngx.log(ngx.DEBUG, require("ngx.ssl").server_name()) | |
local der, err = require("ngx.ssl").cert_pem_to_der("Garbage value") | |
if not der then | |
ngx.log(ngx.ERR, err) | |
end | |
} | |
location / { | |
echo "OK"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
am trying to
ngx.log(ngx.ERR,"test")
insidessl_certificate_by_lua_block
,but that doesn't seem to work at all. currently onopenresty-1.11.2.2
installed through rpm. am i missing something?