From 4ce7757990e39f3eddaa9b81d1ba12289abd5ee3 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 26 Aug 2015 14:39:33 -0400 Subject: [PATCH] Added TLS/SSL options to the integration tests. - The integration tests will now use https and a self-signed cert. --- integration/data/bitcoin.conf | 3 +++ integration/data/bitcoind.crt | 14 ++++++++++++++ integration/data/bitcoind_no_pass.key | 15 +++++++++++++++ integration/regtest-node.js | 9 +++++---- integration/regtest.js | 9 +++++---- 5 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 integration/data/bitcoind.crt create mode 100644 integration/data/bitcoind_no_pass.key diff --git a/integration/data/bitcoin.conf b/integration/data/bitcoin.conf index 840c95a3..ac6a7812 100644 --- a/integration/data/bitcoin.conf +++ b/integration/data/bitcoin.conf @@ -1,5 +1,8 @@ server=1 whitelist=127.0.0.1 +rpcssl=1 +rpcsslcertificatechainfile=../bitcoind.crt +rpcsslprivatekeyfile=../bitcoind_no_pass.key txindex=1 rpcallowip=127.0.0.1 rpcuser=bitcoin diff --git a/integration/data/bitcoind.crt b/integration/data/bitcoind.crt new file mode 100644 index 00000000..280edc50 --- /dev/null +++ b/integration/data/bitcoind.crt @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICDTCCAXYCCQCsGf/7CM97gDANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJV +UzELMAkGA1UECBMCR0ExDDAKBgNVBAcTA2ZvbzEhMB8GA1UEChMYSW50ZXJuZXQg +V2lkZ2l0cyBQdHkgTHRkMB4XDTE1MDgyNjE3NTAwOFoXDTE1MDkyNTE3NTAwOFow +SzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkdBMQwwCgYDVQQHEwNmb28xITAfBgNV +BAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCBnzANBgkqhkiG9w0BAQEFAAOB +jQAwgYkCgYEA7SXnPpKk+0qXTTa42jzvu/C/gdGby0arY50bE2A+epI7FlI5YqKd +hQWoNRpuehF3jH6Ij3mbeeImtTA7TaUYlgHKpn63xfJ0cRj55+6vqq09nDxf0Lm9 +IpTbgllu1l+SHtSuzFBVtGuNRSqObf8gD5XCD5lWK1vXHQ6PFSnAakMCAwEAATAN +BgkqhkiG9w0BAQUFAAOBgQBNARLDgsw7NCBVkn57AEgwZptxeyvFWlGZCd0BmYIX +ZFk7T1OQDwn7GlHry2IBswI0QRi076RQ4oJq+fg2O3XdFvEYV0cyypW7AxrnYTHP +m1h2xr6Y5vhxFKP8DxpAxST27DHbR18YvTD+IGtp2UjLj646587N0MWxt8vmaU3c +og== +-----END CERTIFICATE----- diff --git a/integration/data/bitcoind_no_pass.key b/integration/data/bitcoind_no_pass.key new file mode 100644 index 00000000..353f5af2 --- /dev/null +++ b/integration/data/bitcoind_no_pass.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXwIBAAKBgQDtJec+kqT7SpdNNrjaPO+78L+B0ZvLRqtjnRsTYD56kjsWUjli +op2FBag1Gm56EXeMfoiPeZt54ia1MDtNpRiWAcqmfrfF8nRxGPnn7q+qrT2cPF/Q +ub0ilNuCWW7WX5Ie1K7MUFW0a41FKo5t/yAPlcIPmVYrW9cdDo8VKcBqQwIDAQAB +AoGBAOzYFxyCPu2OMI/4ICQuCcwtBEa2Ph+Fo/Rn2ru+OogV9Zc0ZYWiHSnWXYkz +rbSSL1CMqvyIGoRfHgOFeSTxxxtVyRo5LayI6Ce6V04yUFua16uo6hMX5bfGKZ9d +uq/HCDmdQvgifxUFpTpoSencuxwVCSYstMqjGfpobc5nxN2RAkEA+23BWNyA2qcq +yqSplgTQO0laXox9ksr1k2mJB2HtG3GNs1kapP+Z8AVtn/Mf9Va0hgbSnqpF9fll +1xpBqfidSQJBAPF1rizAm7xP7AeRRET36YKjZCVayA/g4rp7kecrNJTTupJIuxHr +JUlOTtXEWjIVcutSM7bP7bytPv4SAaApBysCQQDEZhqnCC+bHQO/IVrbNc1W0ljG +DGY22VV1HfYND0CAtHXkx9CZXJPpusPEMs0e/uiq3P9/MzDNEFCt8vOiCvMJAkEA +65oDIKGzk/R7/wpMjetEyva5AgXpjizFrmZigCjVPp61voT/G8XQ9Q1WuRjFVXc+ +UcU8tpV+iIqXG3vgYDGITwJBANb0NFFF8QsygbENtad1tw1C/hNabHk8n9hu+Z8+ +OSzEMlP7SsvddPaqusGydhTUxazoG3s4kEh5WmCWKgZGKO0= +-----END RSA PRIVATE KEY----- diff --git a/integration/regtest-node.js b/integration/regtest-node.js index 0832e89f..b7f580f3 100644 --- a/integration/regtest-node.js +++ b/integration/regtest-node.js @@ -1,7 +1,7 @@ 'use strict'; -// These tests require bitcoind.js Bitcoin Core bindings to be compiled with -// the environment variable BITCOINDJS_ENV=test. This enables the use of regtest +// These tests require bitcore-node Bitcoin Core bindings to be compiled with +// the environment variable BITCORENODE_ENV=test. This enables the use of regtest // functionality by including the wallet in the build. // To run the tests: $ mocha -R spec integration/regtest-node.js @@ -72,11 +72,12 @@ describe('Node Functionality', function() { node.on('ready', function() { client = new BitcoinRPC({ - protocol: 'http', + protocol: 'https', host: '127.0.0.1', port: 18332, user: 'bitcoin', - pass: 'local321' + pass: 'local321', + rejectUnauthorized: false }); var syncedHandler = function() { diff --git a/integration/regtest.js b/integration/regtest.js index 62d66803..6e16ad0d 100644 --- a/integration/regtest.js +++ b/integration/regtest.js @@ -1,7 +1,7 @@ 'use strict'; -// These tests require bitcoind.js Bitcoin Core bindings to be compiled with -// the environment variable BITCOINDJS_ENV=test. This enables the use of regtest +// These tests require bitcore-node Bitcoin Core bindings to be compiled with +// the environment variable BITCORENODE_ENV=test. This enables the use of regtest // functionality by including the wallet in the build. // To run the tests: $ mocha -R spec integration/regtest.js @@ -76,11 +76,12 @@ describe('Daemon Binding Functionality', function() { log.info('Bitcoind started'); client = new BitcoinRPC({ - protocol: 'http', + protocol: 'https', host: '127.0.0.1', port: 18332, user: 'bitcoin', - pass: 'local321' + pass: 'local321', + rejectUnauthorized: false }); log.info('Generating 100 blocks...');