Skip to content

Commit e525219

Browse files
authored
Merge pull request #137 from FieldDB/couchdb_https
Couchdb https
2 parents 4244a73 + 9f22941 commit e525219

File tree

7 files changed

+29
-60
lines changed

7 files changed

+29
-60
lines changed

Dockerfile-couchdb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ FROM couchdb:3.5.1
33
WORKDIR /
44

55
COPY etc/* /opt/couchdb/etc/
6+
COPY config/fielddb_debug.* /opt/couchdb/etc/
67

78
RUN set +x; \
8-
curl -X PUT http://admin:none@127.0.0.1:5984/_users; \
9-
curl -X PUT http://admin:none@127.0.0.1:5984/_replicator; \
9+
curl -Xk PUT https://admin:none@127.0.0.1:6984/_users; \
10+
curl -Xk PUT https://admin:none@127.0.0.1:6984/_replicator; \
1011
ls -alt /opt/couchdb/etc; \
1112
cat /opt/couchdb/etc/local.ini; \
1213
ls /opt/couchdb/etc/local.d;
13-
14-
# COPY fielddb_debug.* /usr/local/etc/couchdb

config/ssl_debug.crt

Lines changed: 0 additions & 26 deletions
This file was deleted.

config/ssl_debug.key

Lines changed: 0 additions & 27 deletions
This file was deleted.

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ services:
1313
dockerfile: ./Dockerfile-couchdb
1414
ports:
1515
- 5984:5984
16+
- 6984:6984
1617
environment:
1718
- COUCHDB_USER=admin
1819
- COUCHDB_PASSWORD=none

etc/local.ini

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,18 @@ admin = -pbkdf2-3f04b4318f9a5b3c20ff99fa9194744d0cffa603,e5fbfb69d2a5db31325d234
1414

1515
[replicator]
1616
auth_plugins = couch_replicator_auth_noop
17+
18+
[daemons]
19+
; enable SSL support by uncommenting the following line and supply the PEM's below.
20+
; the default ssl port CouchDB listens on is 6984
21+
httpsd = {couch_httpd, start_link, [https]}
22+
23+
[ssl]
24+
enable = true
25+
; secure_renegotiate = undefined
26+
cert_file = /opt/couchdb/etc/fielddb_debug.crt
27+
key_file = /opt/couchdb/etc/fielddb_debug.key
28+
; set to true to validate peer certificates
29+
verify_ssl_certificates = false
30+
; maximum peer certificate depth
31+
ssl_certificate_max_depth = 1

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@
6464
"docker:build": "docker build -t fielddb-auth .",
6565
"docker:test": "echo 'module.exports = { usersDbConnection: { url: \"http://localhost:5984\" } };' > config/local.js && docker compose up -d && sleep 3 && docker compose logs && npm run setup && npm run test:deprecated",
6666
"docker:test:no-cache": "echo 'module.exports = { usersDbConnection: { url: \"http://localhost:5984\" } };' > config/local.js && docker compose build --no-cache && docker compose up -d && sleep 15 && docker compose logs && npm run setup && npm run test:deprecated",
67-
"coverage": "NODE_ENV=test BUNYAN_LOG_LEVEL=FATAL NODE_TLS_REJECT_UNAUTHORIZED=0 nyc npm test",
67+
"coverage": "NODE_ENV=test BUNYAN_LOG_LEVEL=FATAL nyc npm test",
6868
"lint": "eslint ",
6969
"lint:ci": "eslint .",
70-
"setup": "REPLAY=bloody SOURCE_URL=${SOURCE_URL:-https://public:none@corpusdev.example.org} mocha --timeout 20000 test/integration/install.js",
70+
"setup": "REPLAY=bloody NODE_TLS_REJECT_UNAUTHORIZED=0 SOURCE_URL=${SOURCE_URL:-https://public:none@corpusdev.example.org} mocha --timeout 20000 test/integration/install.js",
7171
"start": "node ./bin/www.js",
7272
"test": "SOURCE_URL=${SOURCE_URL:-https://public:none@corpusdev.example.org} NODE_ENV=test NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --timeout 100000 --recursive test",
7373
"test:debug": "node-debug _mocha test/integration/oauth.js",
74-
"test:deprecated": "DEBUG=${DEBUG:-lib:user} REPLAY=bloody nyc mocha --timeout 25000 test/routes/deprecated-spec.js",
74+
"test:deprecated": "DEBUG=${DEBUG:-lib:user} REPLAY=bloody NODE_TLS_REJECT_UNAUTHORIZED=0 nyc mocha --timeout 25000 test/routes/deprecated-spec.js",
7575
"test:fielddb": "NODE_ENV=localhost jasmine-node node_modules/fielddb/tests",
7676
"test:production": "ls config/production.js",
7777
"watch": "nodemon ./bin/www.js"

test/integration/install.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ const originalLocalhosts = replay._localhosts;
1010
// eslint-disable-next-line no-underscore-dangle
1111
debug('replay localhosts', replay._localhosts);
1212

13+
// FIXME: unable to use replication on https
14+
/*
15+
application: mochiweb, "Accept failed error", "{error,
16+
{tls_alert,
17+
{certificate_unknown,
18+
\"TLS server: In state wait_finished received CLIENT ALERT: Fatal - Certificate Unknown\\n\"}}}"
19+
*/
1320
let destination = 'http://admin:none@localhost:5984';
1421
if (!destination) {
1522
destination = url.parse(config.usersDbConnection.url);

0 commit comments

Comments
 (0)