From 5b8c553fd4578fcc600cc0e0aa10214aa8d00000 Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Tue, 6 Aug 2019 10:33:46 +0200 Subject: [PATCH 1/9] prepare next iteration --- docker/my-dojo/.env | 2 +- keys/index-example.js | 2 +- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/my-dojo/.env b/docker/my-dojo/.env index 155846b..64913ef 100644 --- a/docker/my-dojo/.env +++ b/docker/my-dojo/.env @@ -10,7 +10,7 @@ COMPOSE_CONVERT_WINDOWS_PATHS=1 -DOJO_VERSION_TAG=1.1.0 +DOJO_VERSION_TAG=1.2.0 DOJO_DB_VERSION_TAG=1.1.0 DOJO_BITCOIND_VERSION_TAG=1.1.0 DOJO_NODEJS_VERSION_TAG=1.1.0 diff --git a/keys/index-example.js b/keys/index-example.js index e843b45..3628c21 100644 --- a/keys/index-example.js +++ b/keys/index-example.js @@ -15,7 +15,7 @@ module.exports = { /* * Dojo version */ - dojoVersion: '1.1.0', + dojoVersion: '1.2.0', /* * Bitcoind */ diff --git a/package-lock.json b/package-lock.json index 3f6076a..18ad854 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "samourai-dojo", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1829c84..fd9e629 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "samourai-dojo", - "version": "1.1.0", + "version": "1.2.0", "description": "Backend server for Samourai Wallet", "main": "accounts/index.js", "scripts": { From 62353a8777c0fa84b90fe76ceff0378c2b59ca84 Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Tue, 6 Aug 2019 17:38:57 +0200 Subject: [PATCH 2/9] add support of testnet --- doc/DOCKER_advanced_setups.md | 28 ++++++++- doc/DOCKER_setup.md | 7 ++- docker/my-dojo/.env | 7 ++- docker/my-dojo/bitcoin/restart.sh | 4 ++ docker/my-dojo/conf/docker-common.conf.tpl | 13 ++++ docker/my-dojo/docker-compose.yaml | 2 + docker/my-dojo/dojo.sh | 9 ++- docker/my-dojo/install/install-scripts.sh | 32 +++++++++- docker/my-dojo/install/upgrade-scripts.sh | 32 +++++++++- .../my-dojo/nginx/{dojo.conf => mainnet.conf} | 0 docker/my-dojo/nginx/testnet.conf | 63 +++++++++++++++++++ docker/my-dojo/node/keys.index.js | 11 +++- docker/my-dojo/node/restart.sh | 8 +-- .../my-dojo/overrides/bitcoind.install.yaml | 1 + .../admin/conf/{index.js => index-mainnet.js} | 0 static/admin/conf/index-testnet.js | 25 ++++++++ 16 files changed, 224 insertions(+), 18 deletions(-) create mode 100644 docker/my-dojo/conf/docker-common.conf.tpl rename docker/my-dojo/nginx/{dojo.conf => mainnet.conf} (100%) create mode 100644 docker/my-dojo/nginx/testnet.conf rename static/admin/conf/{index.js => index-mainnet.js} (100%) create mode 100644 static/admin/conf/index-testnet.js diff --git a/doc/DOCKER_advanced_setups.md b/doc/DOCKER_advanced_setups.md index 9eaec36..3825b57 100644 --- a/doc/DOCKER_advanced_setups.md +++ b/doc/DOCKER_advanced_setups.md @@ -1,9 +1,9 @@ # MyDojo - Advanced Setups -The 3 configuration files of Dojo provide a few advanced options allowing to tune your setup. +The configuration files of Dojo provide a few advanced options allowing to tune your setup. -A word of caution, though, the default values of these options try to maximize your privacy at a network level. All the advanced setups described in this document may damage your privacy. Use at your own risk! +A word of caution, though, the default values of these options try to maximize your privacy at a network level. Most of the advanced setups described in this document may damage your privacy. Use at your own risk! @@ -159,3 +159,27 @@ nano ./conf/docker-bitcoind.conf ``` Note: this option has no effect if your setup relies on a external full node (i.e. if BITCOIND_INSTALL is set to "off"). + + + + +## Support of testnet ## + +By default, Dojo is installed for running on Bitcoin mainnet. + +The following steps allow to install an instance of Dojo running on Bitcoin testnet. + +``` +# Edit the common config template file +nano ./conf/docker-common.conf.tpl + +# +# Set the value of COMMON_BTC_NETWORK to "testnet" +# +# Save and exit nano +# +``` + +Note: This option must be set before the first installation of Dojo and mustn't be changed after this first installation. + +Known limitation: A single instance of Dojo can be run per machine (a same machine can't host both a mainnet and a testnet instance of Dojo). diff --git a/doc/DOCKER_setup.md b/doc/DOCKER_setup.md index f92fd55..e3cbd13 100644 --- a/doc/DOCKER_setup.md +++ b/doc/DOCKER_setup.md @@ -177,16 +177,17 @@ Note: The upgrade process will override all manual modifications of the files st ## Configuration files ## -Each new release of Dojo is packaged with 3 template files stored in the `/docker/my-dojo/conf` directory: +Each new release of Dojo is packaged with 4 template files stored in the `/docker/my-dojo/conf` directory: +- docker-common.conf.tpl - docker-bitcoin.conf.tpl - docker-mysql.conf.tpl - docker-node.conf.tpl -These templates files define default values for configuration options of your Dojo. +These template files define default values for configuration options of your Dojo. During the first-time installation (dojo.sh install) these templates are used to initialize the configuration files (files with .conf extension) that will be used by your Dojo. -During an upgrade (dojo.sh upgrade), the content of the templates files is merged with the content of the configuration files, preserving the values that you may have modified in the configuration files. A backup of the configuration files is saved in the same directory (files with .save extension). +During an upgrade (dojo.sh upgrade), the content of the template files is merged with the content of the configuration files, preserving the values that you may have modified in the configuration files. A backup of the configuration files is saved in the same directory (files with .save extension). Most options provided in the configuration files can be later modified. New values will become active after a call to diff --git a/docker/my-dojo/.env b/docker/my-dojo/.env index 64913ef..f24f787 100644 --- a/docker/my-dojo/.env +++ b/docker/my-dojo/.env @@ -12,9 +12,9 @@ COMPOSE_CONVERT_WINDOWS_PATHS=1 DOJO_VERSION_TAG=1.2.0 DOJO_DB_VERSION_TAG=1.1.0 -DOJO_BITCOIND_VERSION_TAG=1.1.0 -DOJO_NODEJS_VERSION_TAG=1.1.0 -DOJO_NGINX_VERSION_TAG=1.1.0 +DOJO_BITCOIND_VERSION_TAG=1.2.0 +DOJO_NODEJS_VERSION_TAG=1.2.0 +DOJO_NGINX_VERSION_TAG=1.2.0 DOJO_TOR_VERSION_TAG=1.1.0 @@ -41,6 +41,7 @@ NODE_GAP_EXTERNAL=100 NODE_GAP_INTERNAL=100 NODE_ADDR_FILTER_THRESHOLD=1000 NODE_URL_OXT_API=https://api.oxt.me +NODE_URL_BTCCOM_API=https://tchain.api.btc.com/v3 NODE_ADDR_DERIVATION_MIN_CHILD=2 NODE_ADDR_DERIVATION_MAX_CHILD=2 NODE_ADDR_DERIVATION_THRESHOLD=10 diff --git a/docker/my-dojo/bitcoin/restart.sh b/docker/my-dojo/bitcoin/restart.sh index 2351c70..072433b 100644 --- a/docker/my-dojo/bitcoin/restart.sh +++ b/docker/my-dojo/bitcoin/restart.sh @@ -35,4 +35,8 @@ if [ "$BITCOIND_RPC_EXTERNAL" == "on" ]; then bitcoind_options+=(-zmqpubrawblock=tcp://0.0.0.0:9503) fi +if [ "$COMMON_BTC_NETWORK" == "testnet" ]; then + bitcoind_options+=(-testnet) +fi + bitcoind "${bitcoind_options[@]}" diff --git a/docker/my-dojo/conf/docker-common.conf.tpl b/docker/my-dojo/conf/docker-common.conf.tpl new file mode 100644 index 0000000..f77121b --- /dev/null +++ b/docker/my-dojo/conf/docker-common.conf.tpl @@ -0,0 +1,13 @@ +# +# EXPERT AND DEV SETTINGS +# + + +# +# NETWORK ENVIRONMENT +# + +# Select a Bitcoin network +# Do not modify this value after the first install +# Value: mainnet | testnet +COMMON_BTC_NETWORK=mainnet diff --git a/docker/my-dojo/docker-compose.yaml b/docker/my-dojo/docker-compose.yaml index b679107..e59c762 100644 --- a/docker/my-dojo/docker-compose.yaml +++ b/docker/my-dojo/docker-compose.yaml @@ -27,6 +27,7 @@ services: dockerfile: ./docker/my-dojo/node/Dockerfile env_file: - ./.env + - ./conf/docker-common.conf - ./conf/docker-mysql.conf - ./conf/docker-bitcoind.conf - ./conf/docker-node.conf @@ -50,6 +51,7 @@ services: context: ./nginx env_file: - ./.env + - ./conf/docker-common.conf restart: on-failure command: "/wait-for node:8080 --timeout=360 -- nginx" expose: diff --git a/docker/my-dojo/dojo.sh b/docker/my-dojo/dojo.sh index 0cff22e..beee1f0 100755 --- a/docker/my-dojo/dojo.sh +++ b/docker/my-dojo/dojo.sh @@ -10,6 +10,7 @@ source_file() { } source_file "$DIR/conf/docker-bitcoind.conf" +source_file "$DIR/conf/docker-common.conf" source_file "$DIR/.env" @@ -187,6 +188,7 @@ logs_node() { logs() { source_file "$DIR/conf/docker-bitcoind.conf" + source_file "$DIR/conf/docker-common.conf" case $1 in db ) @@ -194,7 +196,12 @@ logs() { ;; bitcoind ) if [ "$BITCOIND_INSTALL" == "on" ]; then - docker exec -ti bitcoind tail -f /home/bitcoin/.bitcoin/debug.log + if [ "$COMMON_BTC_NETWORK" == "testnet" ]; then + bitcoindDataDir="/home/bitcoin/.bitcoin/testnet3" + else + bitcoindDataDir="/home/bitcoin/.bitcoin" + fi + docker exec -ti bitcoind tail -f "$bitcoindDataDir/debug.log" else echo -e "Command not supported for your setup.\nCause: Your Dojo is using an external bitcoind" fi diff --git a/docker/my-dojo/install/install-scripts.sh b/docker/my-dojo/install/install-scripts.sh index a5067db..3fb6217 100755 --- a/docker/my-dojo/install/install-scripts.sh +++ b/docker/my-dojo/install/install-scripts.sh @@ -1,9 +1,21 @@ #!/bin/bash +if [ -f ./conf/docker-bitcoind.conf ]; then + source ./conf/docker-bitcoind.conf +else + source ./conf/docker-bitcoind.conf.tpl +fi + +if [ -f ./conf/docker-common.conf ]; then + source ./conf/docker-common.conf +else + source ./conf/docker-common.conf.tpl +fi + # Confirm installation get_confirmation() { while true; do - echo "This operation is going to install Dojo v$DOJO_VERSION_TAG on your computer." + echo "This operation is going to install Dojo v$DOJO_VERSION_TAG for $COMMON_BTC_NETWORK on your computer." read -p "Do you wish to continue? [y/n]" yn case $yn in [Yy]* ) return 0;; @@ -15,6 +27,7 @@ get_confirmation() { # Initialize configuration files from templates init_config_files() { + # Initialize db scripts cp ../../db-scripts/1_db.sql.tpl ../../db-scripts/1_db.sql echo "Initialized 1_db.sql" @@ -23,6 +36,10 @@ init_config_files() { echo "Deleted 2_update.sql" fi + # Initialize config files for MyDojo + cp ./conf/docker-common.conf.tpl ./conf/docker-common.conf + echo "Initialized docker-common.conf" + cp ./conf/docker-bitcoind.conf.tpl ./conf/docker-bitcoind.conf echo "Initialized docker-bitcoind.conf" @@ -31,4 +48,17 @@ init_config_files() { cp ./conf/docker-node.conf.tpl ./conf/docker-node.conf echo "Initialized docker-node.conf" + + # Initialize config files for nginx and the maintenance tool + if [ "$COMMON_BTC_NETWORK" == "testnet" ]; then + cp ./nginx/testnet.conf ./nginx/dojo.conf + echo "Initialized dojo.conf (nginx)" + cp ../../static/admin/conf/index-testnet.js ../../static/admin/conf/index.js + echo "Initialized index.js (admin module)" + else + cp ./nginx/mainnet.conf ./nginx/dojo.conf + echo "Initialized dojo.conf (nginx)" + cp ../../static/admin/conf/index-mainnet.js ../../static/admin/conf/index.js + echo "Initialized index.js (admin module)" + fi } diff --git a/docker/my-dojo/install/upgrade-scripts.sh b/docker/my-dojo/install/upgrade-scripts.sh index 757bd6e..34e3f2e 100755 --- a/docker/my-dojo/install/upgrade-scripts.sh +++ b/docker/my-dojo/install/upgrade-scripts.sh @@ -1,9 +1,17 @@ #!/bin/bash +if [ -f ./conf/docker-common.conf ]; then + source ./conf/docker-common.conf +else + source ./conf/docker-common.conf.tpl +fi + +source ./conf/docker-bitcoind.conf + # Confirm upgrade operation get_confirmation() { while true; do - echo "This operation is going to upgrade your Dojo to v$DOJO_VERSION_TAG." + echo "This operation is going to upgrade your Dojo to v$DOJO_VERSION_TAG for $COMMON_BTC_NETWORK." read -p "Do you wish to continue? [y/n]" yn case $yn in [Yy]* ) return 0;; @@ -15,6 +23,7 @@ get_confirmation() { # Update configuration files from templates update_config_files() { + # Initialize db scripts if [ -f ../../db-scripts/1_db.sql ]; then rm ../../db-scripts/1_db.sql echo "Deleted 1_db.sql" @@ -23,6 +32,14 @@ update_config_files() { cp ../../db-scripts/2_update.sql.tpl ../../db-scripts/2_update.sql echo "Initialized 2_update.sql" + # Initialize config files for MyDojo + if [ -f ./conf/docker-common.conf ]; then + update_config_file ./conf/docker-common.conf ./conf/docker-common.conf.tpl + else + cp ./conf/docker-common.conf.tpl ./conf/docker-common.conf + fi + echo "Initialized docker-common.conf" + update_config_file ./conf/docker-bitcoind.conf ./conf/docker-bitcoind.conf.tpl echo "Initialized docker-bitcoind.conf" @@ -31,6 +48,19 @@ update_config_files() { update_config_file ./conf/docker-node.conf ./conf/docker-node.conf.tpl echo "Initialized docker-node.conf" + + # Initialize config files for nginx and the maintenance tool + if [ "$COMMON_BTC_NETWORK" == "testnet" ]; then + cp ./nginx/testnet.conf ./nginx/dojo.conf + echo "Initialized dojo.conf (nginx)" + cp ../../static/admin/conf/index-testnet.js ../../static/admin/conf/index.js + echo "Initialized index.js (admin module)" + else + cp ./nginx/mainnet.conf ./nginx/dojo.conf + echo "Initialized dojo.conf (nginx)" + cp ../../static/admin/conf/index-mainnet.js ../../static/admin/conf/index.js + echo "Initialized index.js (admin module)" + fi } # Update a configuration file from template diff --git a/docker/my-dojo/nginx/dojo.conf b/docker/my-dojo/nginx/mainnet.conf similarity index 100% rename from docker/my-dojo/nginx/dojo.conf rename to docker/my-dojo/nginx/mainnet.conf diff --git a/docker/my-dojo/nginx/testnet.conf b/docker/my-dojo/nginx/testnet.conf new file mode 100644 index 0000000..4b9b71f --- /dev/null +++ b/docker/my-dojo/nginx/testnet.conf @@ -0,0 +1,63 @@ +# Proxy WebSockets +# https://www.nginx.com/blog/websocket-nginx/ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +# WebSocket server listening here +upstream websocket { + server node:8080; +} + +# Site Configuration +server { + listen 80; + server_name _; + + # Set proxy timeouts for the application + proxy_connect_timeout 600; + proxy_read_timeout 600; + proxy_send_timeout 600; + send_timeout 600; + + # Proxy WebSocket connections first + location /test/v2/inv { + proxy_pass http://websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + } + + # PushTX server is separate, so proxy first + location /test/v2/pushtx/ { + proxy_pass http://node:8081/; + } + + # Proxy requests to maintenance tool + location /admin/ { + proxy_pass http://node:8080/static/admin/; + } + + # Proxy all other v2 requests to the accounts server + location /test/v2/ { + proxy_pass http://node:8080/; + } + + # Redirect onion address to maintenance tool + location = / { + return 301 /admin; + } + + # Serve remaining requests + location / { + return 200 '{"status":"ok"}'; + add_header Content-Type application/json; + } + + location /test/ { + return 200 '{"status":"ok"}'; + add_header Content-Type application/json; + } +} + diff --git a/docker/my-dojo/node/keys.index.js b/docker/my-dojo/node/keys.index.js index 5b365a6..936a5bc 100644 --- a/docker/my-dojo/node/keys.index.js +++ b/docker/my-dojo/node/keys.index.js @@ -3,6 +3,9 @@ * Copyright (c) 2016-2018, Samourai Wallet (CC BY-NC-ND 4.0 License). */ +const bitcoinNetwork = (process.env.COMMON_BTC_NETWORK == 'testnet') + ? 'testnet' + : 'bitcoin' /** * Desired structure of /keys/index.js, which is ignored in the repository. @@ -11,7 +14,7 @@ module.exports = { /* * Mainnet parameters */ - bitcoin: { + [bitcoinNetwork]: { /* * Dojo version */ @@ -196,8 +199,10 @@ module.exports = { // Use a SOCKS5 proxy for all communications with external services // Values: null if no socks5 proxy used, otherwise the url of the socks5 proxy socks5Proxy: 'socks5h://172.28.1.4:9050', - // OXT - oxt: process.env.NODE_URL_OXT_API + // OXT (mainnet) + oxt: process.env.NODE_URL_OXT_API, + // BTC.COM (testnet) + btccom: process.env.NODE_URL_BTCCOM_API }, /* * Max number of transactions per address diff --git a/docker/my-dojo/node/restart.sh b/docker/my-dojo/node/restart.sh index dea0ff9..90cbd25 100644 --- a/docker/my-dojo/node/restart.sh +++ b/docker/my-dojo/node/restart.sh @@ -1,13 +1,13 @@ #!/bin/bash cd /home/node/app/accounts -forever start -a -l /dev/null -o /data/logs/api-output.log -e /data/logs/api-error.log index.js +forever start -a -l /dev/null -o /data/logs/api-output.log -e /data/logs/api-error.log index.js "$COMMON_BTC_NETWORK" cd /home/node/app/pushtx -forever start -a -l /dev/null -o /data/logs/pushtx-output.log -e /data/logs/pushtx-error.log index.js -forever start -a -l /dev/null -o /data/logs/pushtx-orchest-output.log -e /data/logs/pushtx-orchest-error.log index-orchestrator.js +forever start -a -l /dev/null -o /data/logs/pushtx-output.log -e /data/logs/pushtx-error.log index.js "$COMMON_BTC_NETWORK" +forever start -a -l /dev/null -o /data/logs/pushtx-orchest-output.log -e /data/logs/pushtx-orchest-error.log index-orchestrator.js "$COMMON_BTC_NETWORK" cd /home/node/app/tracker -forever start -a -l /dev/null -o /data/logs/tracker-output.log -e /data/logs/tracker-error.log index.js +forever start -a -l /dev/null -o /data/logs/tracker-output.log -e /data/logs/tracker-error.log index.js "$COMMON_BTC_NETWORK" forever --fifo logs 0 \ No newline at end of file diff --git a/docker/my-dojo/overrides/bitcoind.install.yaml b/docker/my-dojo/overrides/bitcoind.install.yaml index f817139..ff63912 100644 --- a/docker/my-dojo/overrides/bitcoind.install.yaml +++ b/docker/my-dojo/overrides/bitcoind.install.yaml @@ -8,6 +8,7 @@ services: context: ./bitcoin env_file: - ./.env + - ./conf/docker-common.conf - ./conf/docker-bitcoind.conf restart: on-failure command: "/wait-for-it.sh tor:9050 --timeout=360 --strict -- /restart.sh" diff --git a/static/admin/conf/index.js b/static/admin/conf/index-mainnet.js similarity index 100% rename from static/admin/conf/index.js rename to static/admin/conf/index-mainnet.js diff --git a/static/admin/conf/index-testnet.js b/static/admin/conf/index-testnet.js new file mode 100644 index 0000000..fdd53a0 --- /dev/null +++ b/static/admin/conf/index-testnet.js @@ -0,0 +1,25 @@ +var conf = { + + // Admin tool + adminTool: { + baseUri: '/admin' + //baseUri: '/static/admin' + }, + + // API + api: { + baseUri: '/test/v2' + //baseUri: '' + }, + + // Url prefixes + prefixes: { + // Prefix for /support endpoint + support: 'support', + // Prefix for /status endpoint + status: 'status', + // Prefix for pushtx /status endpoint + statusPushtx: 'status' + } + +}; \ No newline at end of file From a386b0dc2e50a187ace24f48ac7912c0d99ba438 Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Thu, 8 Aug 2019 16:59:51 +0200 Subject: [PATCH 3/9] add support of auth token passed through the authorization http header --- doc/DELETE_xpub.md | 2 +- doc/GET_fees.md | 2 +- doc/GET_header.md | 2 +- doc/GET_multiaddr.md | 2 +- doc/GET_tx.md | 2 +- doc/GET_txs.md | 2 +- doc/GET_unspent.md | 2 +- doc/GET_xpub.md | 2 +- doc/POST_auth_login.md | 2 +- doc/POST_auth_refresh.md | 2 +- doc/POST_pushtx.md | 2 +- doc/POST_xpub.md | 2 +- doc/POST_xpub_lock.md | 2 +- lib/auth/authorizations-manager.js | 27 +++++++++++++++++++++++++++ 14 files changed, 40 insertions(+), 13 deletions(-) diff --git a/doc/DELETE_xpub.md b/doc/DELETE_xpub.md index bb31a65..4242772 100644 --- a/doc/DELETE_xpub.md +++ b/doc/DELETE_xpub.md @@ -11,7 +11,7 @@ DELETE /xpub/:xpub ## Parameters * **address** - `string` - The first address of the internal chain for this `xpub`, derivation path `M/1/0`. Use compressed P2PHK address regardless of HD derivation scheme. * **signature** - `string` - The base64-encoded signature of the double SHA256 hash of `[varuint length of xpub string, xpub string]`. Signature scheme follows [bitcoinjs-message](https://github.com/bitcoinjs/bitcoinjs-message/blob/master/index.js) with a message prefix matching the [coin type](https://github.com/bitcoinjs/bitcoinjs-lib/blob/v3.1.1/src/networks.js). Use the ECPair associated with the `M/1/0` address to sign. -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Example diff --git a/doc/GET_fees.md b/doc/GET_fees.md index dcfb5cf..68c86ce 100644 --- a/doc/GET_fees.md +++ b/doc/GET_fees.md @@ -8,7 +8,7 @@ GET /fees ``` ## Parameters -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Examples diff --git a/doc/GET_header.md b/doc/GET_header.md index 2b9fd75..782cc3c 100644 --- a/doc/GET_header.md +++ b/doc/GET_header.md @@ -9,7 +9,7 @@ GET /header/:hash ## Parameters * **hash** - `string` - The block hash -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Examples diff --git a/doc/GET_multiaddr.md b/doc/GET_multiaddr.md index d2ae1ee..08b9a96 100644 --- a/doc/GET_multiaddr.md +++ b/doc/GET_multiaddr.md @@ -38,7 +38,7 @@ GET /multiaddr?active=...[&new=...][&bip49=...][&bip84=...][&pubkey=...] * **bip49** - `string` - A pipe-separated list of **new** extended public keys to be derived via [BIP49](https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki) and/or new P2WPKH/P2SH loose addresses * **bip84** - `string` - A pipe-separated list of **new** extended public keys to be derived via [BIP84](https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki) and/or new P2WPKH Bech32 loose addresses * **pubkey** - `string` - A pipe-separated list of **new** public keys to be derived as P2PKH, P2WPKH/P2SH, P2WPKH Bech32 addresses -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Examples diff --git a/doc/GET_tx.md b/doc/GET_tx.md index 95f2aeb..8d64f3d 100644 --- a/doc/GET_tx.md +++ b/doc/GET_tx.md @@ -11,7 +11,7 @@ GET /tx/:txid?fees=1 ## Parameters * **txid** - `string` - The transaction ID * **fees** - `string` - (optional) Scan previous outputs to compute fees -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Examples diff --git a/doc/GET_txs.md b/doc/GET_txs.md index 0c84e33..8d1337b 100644 --- a/doc/GET_txs.md +++ b/doc/GET_txs.md @@ -12,7 +12,7 @@ GET /txs?active=... * **active** - `string` - A pipe-separated list of extended public keys and/or loose addresses and/or pubkeys (`xpub1|address1|address2|pubkey1|...`) * **page** - `integer` - Index of the requested page (first page is index 0) * **count** - `integer` - Number of transactions returned per page -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Examples diff --git a/doc/GET_unspent.md b/doc/GET_unspent.md index 427960f..1e81758 100644 --- a/doc/GET_unspent.md +++ b/doc/GET_unspent.md @@ -36,7 +36,7 @@ GET /unspent?active=...&new=...&bip49=...&bip84=...&pubkey=... * **bip49** - `string` - A pipe-separated list of **new** extended public keys to be derived via [BIP49](https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki) and/or new P2WPKH/P2SH loose addresses * **bip84** - `string` - A pipe-separated list of **new** extended public keys to be derived via [BIP84](https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki) and/or new P2WPKH Bech32 loose addresses * **pubkey** - `string` - A pipe-separated list of **new** public keys to be derived as P2PKH, P2WPKH/P2SH, P2WPKH Bech32 addresses -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Examples diff --git a/doc/GET_xpub.md b/doc/GET_xpub.md index d9e1770..e8aa473 100644 --- a/doc/GET_xpub.md +++ b/doc/GET_xpub.md @@ -10,7 +10,7 @@ GET /xpub/:xpub ## Parameters * **:xpub** - `string` - The extended public key for the HD Account -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Example diff --git a/doc/POST_auth_login.md b/doc/POST_auth_login.md index 8a4e750..1899168 100644 --- a/doc/POST_auth_login.md +++ b/doc/POST_auth_login.md @@ -1,6 +1,6 @@ # Authentication -Authenticate to the backend by providing the API key expected by the server. If authentication succeeds, the endpoint returns a json embedding an access token and a refresh token (JSON Web Tokens). The access token must be passed as an argument for all later calls to the backend (account & pushtx REST API + websockets). The refresh token must be passed as an argument for later calls to /auth/refresh allowing to generate a new access token. +Authenticate to the backend by providing the API key expected by the server. If authentication succeeds, the endpoint returns a json embedding an access token and a refresh token (JSON Web Tokens). The access token must be passed as an argument or in the `Authorization` HTTP header for all later calls to the backend (account & pushtx REST API + websockets). The refresh token must be passed as an argument or in the `Authorization` HTTP header for later calls to /auth/refresh allowing to generate a new access token. Authentication is activated in /keys/inndex.js configuration file diff --git a/doc/POST_auth_refresh.md b/doc/POST_auth_refresh.md index 7c86189..62ca803 100644 --- a/doc/POST_auth_refresh.md +++ b/doc/POST_auth_refresh.md @@ -1,6 +1,6 @@ # Refresh the access token -Request a new access token from the backend. A valid refresh token must be passed as an argument. +Request a new access token from the backend. A valid refresh token must be passed as an argument or through the `Authorization` HTTP header (with the `Bearer` scheme). ``` diff --git a/doc/POST_pushtx.md b/doc/POST_pushtx.md index b5c6f54..0ead767 100644 --- a/doc/POST_pushtx.md +++ b/doc/POST_pushtx.md @@ -8,7 +8,7 @@ POST /pushtx/ ## Parameters * **tx** - `hex string` - The raw transaction hex -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Example diff --git a/doc/POST_xpub.md b/doc/POST_xpub.md index 8a1afc8..2d900a6 100644 --- a/doc/POST_xpub.md +++ b/doc/POST_xpub.md @@ -13,7 +13,7 @@ POST /xpub * **type** - `string` - Whether this is a newly-created account or one being restored. Recognized values are `'new'` and `'restore'`. * **segwit** - `string` (optional) - What type of SegWit support for this xpub, if any. Valid values: `'bip49'` and `'bip84'` * **force** - `boolean` (optional) - Force an override of derivation scheme even if xpub is locked. Used for `'restore'` operation. -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Example diff --git a/doc/POST_xpub_lock.md b/doc/POST_xpub_lock.md index b74219a..8a61a05 100644 --- a/doc/POST_xpub_lock.md +++ b/doc/POST_xpub_lock.md @@ -10,7 +10,7 @@ POST /xpub/:xpub/lock * **address** - `string` - The first address of the internal chain for this `xpub`, derivation path `M/1/0`. Use compressed P2PHK address regardless of HD derivation scheme. * **message** - `string` - Either `"lock"` or `"unlock"` * **signature** - `string` - The base64-encoded signature of the double SHA256 hash of `[varuint length of message string, message string]`. Signature scheme follows [bitcoinjs-message](https://github.com/bitcoinjs/bitcoinjs-message/blob/master/index.js) with a message prefix matching the [coin type](https://github.com/bitcoinjs/bitcoinjs-lib/blob/v3.1.1/src/networks.js). Use the ECPair associated with the `M/1/0` address to sign. -* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. +* **at** - `string` (optional) - Access Token (json web token). Required if authentication is activated. Alternatively, the access token can be passed through the `Authorization` HTTP header (with the `Bearer` scheme). ### Example diff --git a/lib/auth/authorizations-manager.js b/lib/auth/authorizations-manager.js index c3e1f71..82cbc41 100644 --- a/lib/auth/authorizations-manager.js +++ b/lib/auth/authorizations-manager.js @@ -220,6 +220,10 @@ class AuthorizationsManager { * @returns {Object} returns the json web token */ _extractAccessToken(req) { + const token = this._extractBearerAuthorizationHeader(req) + if (token) + return token + if (req.body && req.body.at && validator.isJWT(req.body.at)) return req.body.at @@ -269,6 +273,10 @@ class AuthorizationsManager { * @returns {Object} returns the json web token */ _extractRefreshToken(req) { + const token = this._extractBearerAuthorizationHeader(req) + if (token) + return token + if (req.body && req.body.rt && validator.isJWT(req.body.rt)) return req.body.rt @@ -291,6 +299,25 @@ class AuthorizationsManager { return payload } + + /** + * Extract a bearer JWT auth token + * from the Authorization HTTP header + * Returns null if it doesn't exist or is an onvalid JWT + * @param {Object} req - http request object + * @returns {Object} returns the json web token + */ + _extractBearerAuthorizationHeader(req) { + if (req.get('Authorization')) { + const authHeader = req.get('Authorization') + if (authHeader.startsWith('Bearer ')) { + const token = authHeader.substring(7) + if (validator.isJWT(token)) + return token + } + } + return null + } } module.exports = new AuthorizationsManager() From 0eaaf51f4eae3043f0129cb45285700f12f204fa Mon Sep 17 00:00:00 2001 From: pxsocs Date: Thu, 8 Aug 2019 12:09:03 -0300 Subject: [PATCH 4/9] Consolidated Mac Instructions --- doc/DOCKER_mac_setup.MD | 134 ++++++++++++++++++++++++++++++---------- 1 file changed, 100 insertions(+), 34 deletions(-) diff --git a/doc/DOCKER_mac_setup.MD b/doc/DOCKER_mac_setup.MD index 2802aa0..6a9f6ee 100644 --- a/doc/DOCKER_mac_setup.MD +++ b/doc/DOCKER_mac_setup.MD @@ -1,54 +1,120 @@ -# MacOS Installation -This installation was tested on an iMac (mid 2011) with a 2.7GHz i5 processor with 8GB RAM and 1TB external Hard Drive. +# MacOS Installation -## Getting Started +Users can choose a full install (Dojo + bitcoin full node) or installing using an external full node. -#### Create a new user: +1. [Full install using a VirtualBox](#macos-installation-using-a-virtual-machine) +2. [Full install using Docker for MacOS](#macos-installation-using-docker-for-macos) +3. [Install the Dojo using an external full node](#install-the-dojo-using-an-external-full-node) -1. Launch System Preferences by clicking the **System Preferences** icon in the **Dock**, or selecting **System Preferences** from the Apple menu. -2. Click on __Users & Groups__ -3. If settings are locked, click on the __Lock__ at the bottom of window and enter your password. -4. Click on __+__ to add a new User -5. Under __New Account__ select __Administrator__ -6. Fill the remaining fields with your choice of User Name and Password -#### Move the __New User Folder__ into the __External HD__ + +## 1. MacOS Installation using a Virtual Machine +__The instructions below are for a full install of the Dojo, including a new bitcoind node that will synch from scratch__ + +This installation was tested on an iMac (mid 2011) with a 2.7GHz i5 processor with 8GB RAM and 1TB external Hard Drive. For this specific machine, this proved to be a more stable alternative to installing Docker for Mac. + +### Getting Started + +#### Download and install Virtualbox with Debian 9: + +Follow the instructions in this [video](https://www.youtube.com/watch?v=6M1DivpQSdo&t=703s). This will guide you to set up the VirtualBox and Debian 9. Make sure to follow all the steps, including the virtual box additions towards the end. + +Also, remember to install the virtual box at a directory where you have __enough free space__ to install the Dojo. Specially if you are running a full node. + +After the setup is complete, start the virtual box and open a terminal window then proceed to install the Dojo following these [instructions](https://github.com/Samourai-Wallet/samourai-dojo/blob/develop/doc/DOCKER_setup.md#install). + + + + +## 2. MacOs Installation using Docker for MacOs + +This installation was tested on an iMac (mid 2011) with a 2.7GHz i5 processor with 8GB RAM and 1TB external Hard Drive. + +### Getting Started + +#### Create a new user: + +1. Launch System Preferences by clicking the __System Preferences__ icon in the __Dock__, or selecting __System Preferences__ from the Apple menu. +2. Click on __Users & Groups__ +3. If settings are locked, click on the __Lock__ at the bottom of window and enter your password. +4. Click on __+__ to add a new User +5. Under __New Account__ select __Administrator__ +6. Fill the remaining fields with your choice of User Name and Password + +##### Move the __New User Folder__ into the __External HD__ Note: _This is an important step, otherwise, it's probable that when you run the container, it will be installed in your main OS Hard Drive and will run out of space as it validates the Bitcoin blockchain._ -1. Open **Finder** and navigate to your startup drive's **/Users** folder. For most people, this is **/Macintosh HD/Users**. In the **Users** **folder**, you'll find your user's folder. -2. On your external Hard Drive, create a folder named **Users**. -3. Select your user folder and drag it to the external HD **/Users** folder you created. _Because you're using a different drive for the destination, the operating system will copy the data rather than move it. This ok for now but delete it later._ -4. Launch System Preferences again. -5. In the **Users & Groups** click the lock icon in the bottom left corner, then provide an administrator name and password. -6. From the list of user accounts, right-click on the account whose home folder you moved, and select **Advanced Options** from the pop-up menu. +1. Open __Finder__ and navigate to your startup drive's __/Users__ folder. For most people, this is __/Macintosh HD/Users__. In the __Users__ __folder__, you'll find your user's folder. +2. On your external Hard Drive, create a folder named __Users__. +3. Select your user folder and drag it to the external HD __/Users__ folder you created. _Because you're using a different drive for the destination, the operating system will copy the data rather than move it. This ok for now but delete it later._ +4. Launch System Preferences again. +5. In the __Users & Groups__ click the lock icon in the bottom left corner, then provide an administrator name and password. +6. From the list of user accounts, right-click on the account whose home folder you moved, and select __Advanced Options__ from the pop-up menu. _Do not make any changes to Advanced Options except for those noted here. Doing so can cause quite a few unforeseen problems that could lead to data loss or the need to reinstall the operating system._ -7. In the **Advanced Options** sheet, click **Choose**, located to the right of the **Home directory** field. -8. Navigate to the location you moved your home folder to, select the new home folder, and click **OK**. -9. Click **OK** to dismiss the **Advanced Options** sheet, and then close **System Preferences**. -10. __Restart your Mac__ - -#### Download and install Docker, Kitematic and TOR -1. Make sure your system fills the [requirements]([https://docs.docker.com/docker-for-mac/install/](https://docs.docker.com/docker-for-mac/install/)) (particularly MacOS Sierra 10.12 or higher. If not, upgrade before proceeding). -2. [Download Docker]([https://docs.docker.com/docker-for-mac/install/](https://docs.docker.com/docker-for-mac/install/)) and follow the installation steps. -3. _Optional_: Download [Kitematic]([https://kitematic.com/) and follow installation instructions. +7. In the __Advanced Options__ sheet, click __Choose__, located to the right of the __Home directory__ field. +8. Navigate to the location you moved your home folder to, select the new home folder, and click __OK__. +9. Click __OK__ to dismiss the __Advanced Options__ sheet, and then close __System Preferences__. +10. __Restart your Mac__ + +##### Download and install Docker, Kitematic and TOR + +1. Make sure your system fills the [requirements]([https://docs.docker.com/docker-for-mac/install/](https://docs.docker.com/docker-for-mac/install/)) (particularly MacOS Sierra 10.12 or higher. If not, upgrade before proceeding). +2. [Download Docker]([https://docs.docker.com/docker-for-mac/install/](https://docs.docker.com/docker-for-mac/install/)) and follow the installation steps. +3. _Optional_: Download [Kitematic]([https://kitematic.com/) and follow installation instructions. (_This may be system specific but I've found that monitoring the logs with Kitematic was more stable than using the Terminal_). -4. Install [Tor Browser](https://www.torproject.org/projects/torbrowser.html.en) on the host machine. +4. Install [Tor Browser](https://www.torproject.org/projects/torbrowser.html.en) on the host machine. -## Adjust Docker Settings -1. Click on the Docker icon (![whale menu](https://docs.docker.com/docker-for-mac/images/whale-x.png)) at the status bar and select __Preferences__. +### Adjust Docker Settings +1. Click on the Docker icon (![whale menu](https://docs.docker.com/docker-for-mac/images/whale-x.png)) at the status bar and select __Preferences__. 2. Under Disk, click on __Reveal in Finder__ and double check that the disk image is saved under the external HD. -3. __Adjust Disk__ Image size to 400GB+ and click Apply. -4. Click __Advanced__ and increase the CPU count, Memory and Swap sizes. Adjusting these will speed up the blockchain validation process +3. __Adjust Disk__ Image size to 400GB+ and click Apply. +4. Click __Advanced__ and increase the CPU count, Memory and Swap sizes. Adjusting these will speed up the blockchain validation process (_At 4 CPUs, 8GB of RAM and a 4GiB Swap - the initial block download took 4.5 days at the time of writing_). -## Install the DOJO +### Install the DOJO Follow the instructions [here](https://github.com/Samourai-Wallet/samourai-dojo/blob/develop/doc/DOCKER_setup.md) starting at the step: __"Download the most recent release of Dojo from Github"__ _Note: For tracking progress, open Kitematic and follow the bitcoind logs. You'll be able to see the Blockchain verification process under the _progress_ log variable (1.00 = fully validated). This process takes a long time. Just let it do its thing. In my system it took 3 days._ __Some possible optimization tips:__ -. If you notice that progress has stopped. Click the whale icon and select Restart. Check Kitematic logs of bitcoind to confirm that progress has resumed. +. If you notice that progress has stopped. Click the whale icon and select Restart. Check Kitematic logs of bitcoind to confirm that progress has resumed. . This may optimize speed: open __Activity Monitor__, check the PID (Process ID) of your docker process. Open Terminal and type: -`sudo renice-20 -p [enter your PID]` +`sudo renice-20 -p [enter your PID]` + + + +## 3. Install the Dojo using an external full node + + +This installation was tested on an iMac (late 2014) with a 3.5GHz i5 processor with 12GB RAM and 1TB Internal Hard Drive. This Setup is Geared for using Docker on Mac and pointing to an external bitcoind. + +### Getting Started + +#### Download and install Docker and TOR +1. Make sure your system fills the [requirements]([https://docs.docker.com/docker-for-mac/install/](https://docs.docker.com/docker-for-mac/install/)) (particularly MacOS Sierra 10.12 or higher. If not, upgrade before proceeding). +2. [Download Docker]([https://docs.docker.com/docker-for-mac/install/](https://docs.docker.com/docker-for-mac/install/)) and follow the installation steps. +3. Install [Tor Browser](https://www.torproject.org/projects/torbrowser.html.en) on the host machine. + +### Adjust Docker Settings +1. Click on the Docker icon (![whale menu](https://docs.docker.com/docker-for-mac/images/whale-x.png)) at the status bar and select __Preferences__. +2. Under Disk, click on __Reveal in Finder__ and allow the disk image to be saved in defult location +3. __Adjust Disk__ Image size to 400GB+ and click Apply. +(Since pointing to an external bitcoind and not having an internal container for bitcoind the Disk Image Size could potentially be much smaller. Currently mine shows 13.4 GB on Disk.) +4. Click __Advanced__ and increase the CPU count, Memory and Swap sizes. Adjusting these will speed up the blockchain validation process + +### Install the DOJO Pointing and Existing bitcoind +Follow the instructions [here](https://github.com/Samourai-Wallet/samourai-dojo/blob/develop/doc/DOCKER_setup.md) starting at the step: +__"Download the most recent release of Dojo from Github"__ until you reach __"Launch the Installation of Your Dojo with"__ ***DO NOT LAUNCH DOJO YET*** + +Once you Reach Step __"Launch the Installation of Your Dojo with"__ from above you will need to read and follow the instructions from [here](https://github.com/Samourai-Wallet/samourai-dojo/blob/develop/doc/DOCKER_advanced_setups.md) +Once adjustments are made to your external bitcoind bitcoin.conf __(location dependent on what device you have bitcoind)__ and docker-bitcoind.conf.tpl __(dojo_dir > docker > my-dojo > conf)__ you can proceed with Install and revert back to original instructions [here](https://github.com/Samourai-Wallet/samourai-dojo/blob/develop/doc/DOCKER_setup.md) at section __"Launch the Installation of Your Dojo with"__ + +_Note: For tracking progress, open terminal, change directory to my-dojo and run /dojo.sh logs tracker +__Some possible optimization tips:__ +If you notice that progress has stopped. Click the whale icon and select Restart. Restart Logs Tracker from step above to verify progress has resumed. + +This may optimize speed: open __Activity Monitor__, check the PID (Process ID) of your docker process. Open Terminal and type: + +sudo renice-20 -p [enter your PID] From e0a98f0dfe2c45f73fb256eaee6110d3b1771e21 Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Fri, 9 Aug 2019 15:24:18 +0200 Subject: [PATCH 5/9] remove /dump/heap endpoint and dependency on heapdump package --- accounts/support-rest-api.js | 29 ----------------------------- package-lock.json | 5 ----- package.json | 1 - 3 files changed, 35 deletions(-) diff --git a/accounts/support-rest-api.js b/accounts/support-rest-api.js index 1544a0e..50ddbeb 100644 --- a/accounts/support-rest-api.js +++ b/accounts/support-rest-api.js @@ -4,7 +4,6 @@ */ 'use strict' -const heapdump = require('heapdump') const validator = require('validator') const bodyParser = require('body-parser') const errors = require('../lib/errors') @@ -69,13 +68,6 @@ class SupportRestApi { HttpServer.sendAuthError ) - this.httpServer.app.get( - `/${keys.prefixes.support}/dump/heap`, - authMgr.checkHasAdminProfile.bind(authMgr), - this.getHeapDump.bind(this), - HttpServer.sendAuthError - ) - this.httpServer.app.get( `/${keys.prefixes.support}/pairing`, authMgr.checkHasAdminProfile.bind(authMgr), @@ -283,27 +275,6 @@ class SupportRestApi { } } - /** - * Get a dump of the heap - * and store it on the filesystem - */ - async getHeapDump(req, res) { - try { - heapdump.writeSnapshot(function(err, filename) { - Logger.info(`Dump written to ${filename}`) - }) - HttpServer.sendOk(res) - } catch(e) { - const ret = { - status: 'error' - } - Logger.error(e, 'SupportRestApi.getHeapDump() : Support head dump error') - HttpServer.sendError(res, JSON.stringify(ret, null, 2)) - } finally { - debugApi && Logger.info(`Completed GET /dump/heap`) - } - } - /** * Get pairing info */ diff --git a/package-lock.json b/package-lock.json index 18ad854..126bec6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1012,11 +1012,6 @@ "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, - "heapdump": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/heapdump/-/heapdump-0.3.9.tgz", - "integrity": "sha1-A8dOsN9dZ74Jgug0KbqcnSs7f3g=" - }, "helmet": { "version": "3.12.1", "resolved": "https://registry.npmjs.org/helmet/-/helmet-3.12.1.tgz", diff --git a/package.json b/package.json index fd9e629..c0952b3 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "express": "4.16.3", "express-jwt": "5.3.1", "generic-pool": "3.4.2", - "heapdump": "0.3.9", "helmet": "3.12.1", "lodash": "4.17.14", "lru-cache": "4.0.2", From d7f43b13e38c89b663022abcfd1b9466173b2f2c Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Fri, 9 Aug 2019 16:03:51 +0200 Subject: [PATCH 6/9] upgrade bitcoind to bitcoin core 0.18.1 --- docker/my-dojo/bitcoin/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/my-dojo/bitcoin/Dockerfile b/docker/my-dojo/bitcoin/Dockerfile index 5f1c454..9d638de 100644 --- a/docker/my-dojo/bitcoin/Dockerfile +++ b/docker/my-dojo/bitcoin/Dockerfile @@ -5,10 +5,10 @@ FROM debian:stretch # INSTALL BITCOIN ################################################################# ENV BITCOIN_HOME /home/bitcoin -ENV BITCOIN_VERSION 0.18.0 -ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-0.18.0/bitcoin-0.18.0-x86_64-linux-gnu.tar.gz -ENV BITCOIN_SHA256 5146ac5310133fbb01439666131588006543ab5364435b748ddfc95a8cb8d63f -ENV BITCOIN_ASC_URL https://bitcoincore.org/bin/bitcoin-core-0.18.0/SHA256SUMS.asc +ENV BITCOIN_VERSION 0.18.1 +ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-x86_64-linux-gnu.tar.gz +ENV BITCOIN_SHA256 600d1db5e751fa85903e935a01a74f5cc57e1e7473c15fd3e17ed21e202cfe5a +ENV BITCOIN_ASC_URL https://bitcoincore.org/bin/bitcoin-core-0.18.1/SHA256SUMS.asc ENV BITCOIN_PGP_KEY 01EA5486DE18A882D4C2684590C8019E36C2E964 RUN set -ex && \ From c183f39f0e3181cfe268fceb403bb8967cdb4424 Mon Sep 17 00:00:00 2001 From: Gigi <109058+dergigi@users.noreply.github.com> Date: Sat, 10 Aug 2019 12:58:23 +0200 Subject: [PATCH 7/9] Add instructions to resolve pairing failure Also changed the unordered list to an ordered list, since it is a 2-step instruction. --- doc/DOCKER_setup.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/DOCKER_setup.md b/doc/DOCKER_setup.md index f92fd55..26436b1 100644 --- a/doc/DOCKER_setup.md +++ b/doc/DOCKER_setup.md @@ -264,9 +264,11 @@ Sign in with the value entered for `NODE_ADMIN_KEY`. Once the database has finished syncing, you can pair your Samourai Wallet with your Dojo in 2 steps: -* Open the maintenance tool in a Tor browser (Tor v3 onion address) and sign in with your admin key. +1. Open the maintenance tool in a Tor browser (Tor v3 onion address) and sign in with your admin key. -* Get your smartphone and launch the Samourai Wallet app. Scan the QRCode displayed in the "Pairing" tab of the maintenance tool. +2. Get your smartphone and launch the Samourai Wallet app. Scan the QRCode displayed in the "Pairing" tab of the maintenance tool. + +If you experience any problems when pairing, try re-installing the app and select "Connect to existing Dojo" from the [⋮] menu. From 7d431ede6747eed8a42ee3e1fe28c05a60c4e1a8 Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Sat, 17 Aug 2019 16:40:03 +0200 Subject: [PATCH 8/9] fix for #59 --- docker/my-dojo/dojo.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docker/my-dojo/dojo.sh b/docker/my-dojo/dojo.sh index beee1f0..d5f5620 100755 --- a/docker/my-dojo/dojo.sh +++ b/docker/my-dojo/dojo.sh @@ -6,18 +6,23 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" source_file() { if [ -f $1 ]; then source $1 + elif [ -f "$1.tpl" ]; then + source "$1.tpl" + else + echo "Unable to find file $1" fi } +# Source config files source_file "$DIR/conf/docker-bitcoind.conf" source_file "$DIR/conf/docker-common.conf" source_file "$DIR/.env" +# Export some variables for compose +export BITCOIND_RPC_EXTERNAL_IP # Select YAML files select_yaml_files() { - source_file "$DIR/conf/docker-bitcoind.conf" - yamlFiles="-f $DIR/docker-compose.yaml" if [ "$BITCOIND_INSTALL" == "on" ]; then @@ -25,7 +30,6 @@ select_yaml_files() { if [ "$BITCOIND_RPC_EXTERNAL" == "on" ]; then yamlFiles="$yamlFiles -f $DIR/overrides/bitcoind.rpc.expose.yaml" - export BITCOIND_RPC_EXTERNAL_IP fi fi @@ -151,6 +155,8 @@ upgrade() { yamlFiles=$(select_yaml_files) update_config_files cleanup + source_file "$DIR/conf/docker-bitcoind.conf" + export BITCOIND_RPC_EXTERNAL_IP eval "docker-compose $yamlFiles build --no-cache" docker_up --remove-orphans update_dojo_db From db892086a5f8b0973145c54cb93131c1963ae83c Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Sat, 17 Aug 2019 17:53:51 +0200 Subject: [PATCH 9/9] update release notes --- RELEASES.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index 6ce777e..d4a1c6f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,6 +1,67 @@ # Release Notes +## Releases ## +- [v1.2.0](#1_2_0) +- [v1.1.0](#1_1_0) + + + + +## Samourai Dojo v1.2.0 ## + + +### Notable changes ### + + +#### Support of testnet #### + +Support of testnet has been added to MyDojo. + +See this [doc](./doc/https://github.com/Samourai-Wallet/samourai-dojo/blob/develop/doc/DOCKER_advanced_setups.md#support-of-testnet) for more details. + + +#### Upgrade of bitcoind to v0.18.1 #### + +Upgrade to Bitcoin Core v0.18.1. + + +#### Fix for issue #59 #### + +Fix a bug introduced by Dojo v1.1 when bitcoind is exposed to external apps. + +See [issue #59](https://github.com/Samourai-Wallet/samourai-dojo/issues/59). + + +### Change log ### + +#### MyDojo #### + +- [#46](https://github.com/Samourai-Wallet/samourai-dojo/pull/46) add testnet support to my-dojo +- [#49](https://github.com/Samourai-Wallet/samourai-dojo/pull/49) add support of auth token passed through the authorization http header +- [#54](https://github.com/Samourai-Wallet/samourai-dojo/pull/54) remove /dump/heap endpoint and dependency on heapdump package +- [#55](https://github.com/Samourai-Wallet/samourai-dojo/pull/55) upgrade bitcoind to bitcoin core 0.18.1 +- [#60](https://github.com/Samourai-Wallet/samourai-dojo/pull/55) fix for #59 (dojo with exposed bitcoind ports doesn't start) + + +#### Documentation #### + +- [#50](https://github.com/Samourai-Wallet/samourai-dojo/pull/50) consolidated Mac Instructions +- [#58](https://github.com/Samourai-Wallet/samourai-dojo/pull/58) add instructions to resolve pairing failure + + +### Credits ### + +- dergigi +- kenshin-samourai +- LaurentMT +- Mark Engelberg +- PuraVida +- pxsocs + + + + ## Samourai Dojo v1.1.0 ##