I'm currently trying to get my CouchDb installation up and running with a SSL certificate. My configuration is as follows:
[ssl]
port = 6984
enable = true
cert_file = /ssl/bws2020.crt
key_file = /ssl/bws2020.key
;password = N3sHfhgV4
; set to true to validate peer certificates
;verify_ssl_certificates = false
; Set to true to fail if the client does not send a certificate. Only used if verify_ssl_certificates is true.
;fail_if_no_peer_cert = false
; Path to file containing PEM encoded CA certificates (trusted
; certificates used for verifying a peer certificate). May be omitted if
; you do not want to verify the peer.
;cacert_file = /full/path/to/cacertf
; The verification fun (optional) if not specified, the default
; verification fun will be used.
;verify_fun = {Module, VerifyFun}
; maximum peer certificate depth
;ssl_certificate_max_depth = 1
After restarting the CouchDb instance I can still access the service through regular HTTP, but when I try using HTTPS it just loads forever. If I open the log file I find the following entries:
2020-04-22T09:02:52Z couchdb.server[55847]: [error] 2020-04-22T09:02:52.403204Z couchdb@127.0.0.1 <0.29802.2065> -------- application: mochiweb, "Accept failed error", "{error,{options,{certfile,\"/ssl/bws2020.crt\",{error,enoent}}}}"
2020-04-22T09:02:52Z couchdb.server[55847]: [error] 2020-04-22T09:02:52.404265Z couchdb@127.0.0.1 <0.29802.2065> -------- CRASH REPORT Process (<0.29802.2065>) with 0 neighbors exited with reason: {error,accept_failed} at mochiweb_acceptor:init/4(line:75) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {mochiweb_acceptor,init,['Argument__1','Argument__2',...]}, ancestors: [https,couch_secondary_services,couch_sup,<0.212.0>], messages: [], links: [<0.261.0>], dictionary: [], trap_exit: false, status: running, heap_size: 1598, stack_size: 27, reductions: 1041
2020-04-22T09:02:52Z couchdb.server[55847]: [error] 2020-04-22T09:02:52.414818Z couchdb@127.0.0.1 <0.30525.2065> -------- application: mochiweb, "Accept failed error", "{error,{options,{certfile,\"/ssl/bws2020.crt\",{error,enoent}}}}"
2020-04-22T09:02:52Z couchdb.server[55847]: [error] 2020-04-22T09:02:52.415121Z couchdb@127.0.0.1 <0.30525.2065> -------- CRASH REPORT Process (<0.30525.2065>) with 0 neighbors exited with reason: {error,accept_failed} at mochiweb_acceptor:init/4(line:75) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {mochiweb_acceptor,init,['Argument__1','Argument__2',...]}, ancestors: [https,couch_secondary_services,couch_sup,<0.212.0>], messages: [], links: [<0.261.0>], dictionary: [], trap_exit: false, status: running, heap_size: 1598, stack_size: 27, reductions: 1041
If I understand the logs correctly it means that it cannot find the certificate file. However I have verified the path multiple times and even chmod'ed the certificate and key files to 777, but the issue remains.
We are using CouchDb 2.3.1 on Ubuntu Server 18.04.
Can someone help me understand what causes this error?
The /ssl folder looks like this:
root@couchdb-s1:~# ls -la /ssl
total 28
drwxrwxrwx 2 root root 4096 Apr 23 09:13 .
drwxr-xr-x 24 root root 4096 Apr 29 06:09 ..
-rwxrwxrwx 1 root root 2618 Mar 10 12:12 bws2020.crt
-rwxrwxrwx 1 root root 2108 Mar 10 12:12 bws2020.key
-rwxrwxrwx 1 root root 1310 Apr 23 09:13 self.crt
-rw-r--r-- 1 root root 1050 Apr 23 09:13 self.csr
-rwxrwxrwx 1 root root 1675 Apr 23 09:09 self.key