如何configurationCouchDB的SSL

我如何configurationCouchdb使用SSL,我已经按照这里的说明没有成功。

我生成自己的自签名证书:

mkdir cert && cd cert openssl genrsa > privkey.pem openssl req -new -x509 -key privkey.pem -out mycert.pem -days 1095 

我取消注释/usr/local/etc/couchdb/local.ini中的相关行

 httpsd = {couch_httpd, start_link, [https]} 

并指向我的证书

 cert_file = /usr/local/etc/couchdb/certs/mycert.pem key_file = /usr/local/etc/couchdb/certs/privkey.pem 

但是当我尝试testing它

 curl -k -v https://127.0.0.1:6984 * About to connect() to 127.0.0.1 port 6984 (#0) * Trying 127.0.0.1... connected * successfully set certificate verify locations: * CAfile: none CApath: /etc/ssl/certs * SSLv3, TLS handshake, Client hello (1): * Unknown SSL protocol error in connection to 127.0.0.1:6984 * Closing connection #0 curl: (35) Unknown SSL protocol error in connection to 127.0.0.1:6984 

我真的不知道什么是错的。

笔记

我已经按照说明在这里安装了couchdb 1.2。

    所以我执行了下面的命令:

     # openssl genrsa -out localhost.key 2048 # openssl req -new -x509 -key localhost.key -out localhost.crt -days 3650 -subj /CN=localhost 

    之后,我configurationlocal.ini如下:(确保那些证书文件可以从couchdb用户访问):

     [daemons] httpsd = {couch_httpd, start_link, [https]} [ssl] cert_file = /opt/couchdb/etc/cert/localhost.crt key_file = /opt/couchdb/etc/cert/localhost.key 

    当我在我的电脑上运行这个命令,这工作正常:

     curl -v -k https://localhost:6984/ 

    我发疯的基本上是相同的问题,但在RHEL6上与CouchDB 1.6.1。

    通过浏览无尽的邮件列表,我意识到这可能是erlang SSL库造成这种沉默失败的“未知身份”问题。

    我的解决方法(这对我有用)是使用stunnel 。

    • 下载/安装
    • 像以前一样创build你的证书

    下面是stunnel的设置草案,假设您有一个使用开放式SSL自签名的密钥/ crt对:

     fips = no [couchdb] accept = 6984 key = [path to your key file] cert = [path to your cert file] connect = 127.0.0.1:5984 

    请注意,stunnel在我当地正在抱怨与FIPS有关的事情,所以我最终禁用了快速满足,因此fips = no line。