diff --git a/build/deb/debian/blockbook-bch-testnet.conffiles b/build/deb/debian/blockbook-bch-testnet.conffiles new file mode 100644 index 00000000..51318941 --- /dev/null +++ b/build/deb/debian/blockbook-bch-testnet.conffiles @@ -0,0 +1 @@ +/opt/blockbook/bch-testnet/config/blockchaincfg.json diff --git a/build/deb/debian/blockbook-bch-testnet.cron.daily b/build/deb/debian/blockbook-bch-testnet.cron.daily new file mode 100644 index 00000000..4827959f --- /dev/null +++ b/build/deb/debian/blockbook-bch-testnet.cron.daily @@ -0,0 +1,2 @@ +#!/bin/sh +find /opt/blockbook/bch-testnet/logs -mtime +6 -type f -delete diff --git a/build/deb/debian/blockbook-bch-testnet.dirs b/build/deb/debian/blockbook-bch-testnet.dirs new file mode 100644 index 00000000..c2be0d25 --- /dev/null +++ b/build/deb/debian/blockbook-bch-testnet.dirs @@ -0,0 +1,2 @@ +/data/bch-testnet/blockbook +/opt/blockbook/bch-testnet/logs diff --git a/build/deb/debian/blockbook-bch-testnet.install b/build/deb/debian/blockbook-bch-testnet.install new file mode 100755 index 00000000..ac6b38e6 --- /dev/null +++ b/build/deb/debian/blockbook-bch-testnet.install @@ -0,0 +1,5 @@ +#!/usr/bin/dh-exec +blockbook /opt/blockbook/bch-testnet/bin +server/testcert.* /opt/blockbook/bch-testnet/cert +server/static /opt/blockbook/bch-testnet +configs/bch-testnet.json => /opt/blockbook/bch-testnet/config/blockchaincfg.json diff --git a/build/deb/debian/blockbook-bch-testnet.links b/build/deb/debian/blockbook-bch-testnet.links new file mode 100644 index 00000000..a2ffacc3 --- /dev/null +++ b/build/deb/debian/blockbook-bch-testnet.links @@ -0,0 +1,2 @@ +/opt/blockbook/bch-testnet/cert/testcert.crt /opt/blockbook/bch-testnet/cert/blockbook.crt +/opt/blockbook/bch-testnet/cert/testcert.key /opt/blockbook/bch-testnet/cert/blockbook.key diff --git a/build/deb/debian/blockbook-bch-testnet.postinst b/build/deb/debian/blockbook-bch-testnet.postinst new file mode 100644 index 00000000..6e94b440 --- /dev/null +++ b/build/deb/debian/blockbook-bch-testnet.postinst @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +case "$1" in + + configure) + if ! id -u blockbook &> /dev/null + then + useradd --system -M -U blockbook + fi + + for dir in /data/bch-testnet/blockbook /opt/blockbook/bch-testnet/logs + do + if [ "$(stat -c '%U' $dir)" != "blockbook" ] + then + chown -R blockbook:blockbook $dir + fi + done + ;; + +esac + +#DEBHELPER# diff --git a/build/deb/debian/blockbook-bch-testnet.service b/build/deb/debian/blockbook-bch-testnet.service new file mode 100644 index 00000000..ee5b1d7f --- /dev/null +++ b/build/deb/debian/blockbook-bch-testnet.service @@ -0,0 +1,39 @@ +# It is not recommended to modify this file in-place, because it will +# be overwritten during package upgrades. If you want to add further +# options or overwrite existing ones then use +# $ systemctl edit blockbook-bch-testnet.service +# See "man systemd.service" for details. + +[Unit] +Description=Blockbook daemon (BCH testnet) +After=network.target + +[Service] +ExecStart=/opt/blockbook/bch-testnet/bin/blockbook -coin=bch-testnet -blockchaincfg=/opt/blockbook/bch-testnet/config/blockchaincfg.json -datadir=/data/bch-testnet/blockbook/db -sync -httpserver=:18435 -socketio=:18436 -certfile=/opt/blockbook/bch-testnet/cert/blockbook -explorer=https://bch-bitcore1.trezor.io/ -log_dir=/opt/blockbook/bch-testnet/logs +User=blockbook +Type=simple +Restart=on-failure +WorkingDirectory=/opt/blockbook/bch-testnet + +# Hardening measures +#################### + +# Provide a private /tmp and /var/tmp. +PrivateTmp=true + +# Mount /usr, /boot/ and /etc read-only for the process. +ProtectSystem=full + +# Disallow the process and all of its children to gain +# new privileges through execve(). +NoNewPrivileges=true + +# Use a new /dev namespace only populated with API pseudo devices +# such as /dev/null, /dev/zero and /dev/random. +PrivateDevices=true + +# Deny the creation of writable and executable memory mappings. +MemoryDenyWriteExecute=true + +[Install] +WantedBy=multi-user.target diff --git a/build/deb/debian/blockbook-bch.conffiles b/build/deb/debian/blockbook-bch.conffiles new file mode 100644 index 00000000..7195f6f3 --- /dev/null +++ b/build/deb/debian/blockbook-bch.conffiles @@ -0,0 +1 @@ +/opt/blockbook/bch/config/blockchaincfg.json diff --git a/build/deb/debian/blockbook-bch.cron.daily b/build/deb/debian/blockbook-bch.cron.daily new file mode 100644 index 00000000..f6fc7427 --- /dev/null +++ b/build/deb/debian/blockbook-bch.cron.daily @@ -0,0 +1,2 @@ +#!/bin/sh +find /opt/blockbook/bch/logs -mtime +6 -type f -delete diff --git a/build/deb/debian/blockbook-bch.dirs b/build/deb/debian/blockbook-bch.dirs new file mode 100644 index 00000000..5f081d6a --- /dev/null +++ b/build/deb/debian/blockbook-bch.dirs @@ -0,0 +1,2 @@ +/data/bch/blockbook +/opt/blockbook/bch/logs diff --git a/build/deb/debian/blockbook-bch.install b/build/deb/debian/blockbook-bch.install new file mode 100755 index 00000000..bec00277 --- /dev/null +++ b/build/deb/debian/blockbook-bch.install @@ -0,0 +1,5 @@ +#!/usr/bin/dh-exec +blockbook /opt/blockbook/bch/bin +server/testcert.* /opt/blockbook/bch/cert +server/static /opt/blockbook/bch +configs/bch.json => /opt/blockbook/bch/config/blockchaincfg.json diff --git a/build/deb/debian/blockbook-bch.links b/build/deb/debian/blockbook-bch.links new file mode 100644 index 00000000..e236a84c --- /dev/null +++ b/build/deb/debian/blockbook-bch.links @@ -0,0 +1,2 @@ +/opt/blockbook/bch/cert/testcert.crt /opt/blockbook/bch/cert/blockbook.crt +/opt/blockbook/bch/cert/testcert.key /opt/blockbook/bch/cert/blockbook.key diff --git a/build/deb/debian/blockbook-bch.postinst b/build/deb/debian/blockbook-bch.postinst new file mode 100644 index 00000000..f40d9728 --- /dev/null +++ b/build/deb/debian/blockbook-bch.postinst @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +case "$1" in + + configure) + if ! id -u blockbook &> /dev/null + then + useradd --system -M -U blockbook + fi + + for dir in /data/bch/blockbook /opt/blockbook/bch/logs + do + if [ "$(stat -c '%U' $dir)" != "blockbook" ] + then + chown -R blockbook:blockbook $dir + fi + done + ;; + +esac + +#DEBHELPER# diff --git a/build/deb/debian/blockbook-bch.service b/build/deb/debian/blockbook-bch.service new file mode 100644 index 00000000..e9c74a4f --- /dev/null +++ b/build/deb/debian/blockbook-bch.service @@ -0,0 +1,39 @@ +# It is not recommended to modify this file in-place, because it will +# be overwritten during package upgrades. If you want to add further +# options or overwrite existing ones then use +# $ systemctl edit blockbook-bch.service +# See "man systemd.service" for details. + +[Unit] +Description=Blockbook daemon (BCH mainnet) +After=network.target + +[Service] +ExecStart=/opt/blockbook/bch/bin/blockbook -coin=bch -blockchaincfg=/opt/blockbook/bch/config/blockchaincfg.json -datadir=/data/bch/blockbook/db -sync -httpserver=:8435 -socketio=:8436 -certfile=/opt/blockbook/bch/cert/blockbook -explorer=https://bitcore1.trezor.io/ -log_dir=/opt/blockbook/bch/logs +User=blockbook +Type=simple +Restart=on-failure +WorkingDirectory=/opt/blockbook/bch + +# Hardening measures +#################### + +# Provide a private /tmp and /var/tmp. +PrivateTmp=true + +# Mount /usr, /boot/ and /etc read-only for the process. +ProtectSystem=full + +# Disallow the process and all of its children to gain +# new privileges through execve(). +NoNewPrivileges=true + +# Use a new /dev namespace only populated with API pseudo devices +# such as /dev/null, /dev/zero and /dev/random. +PrivateDevices=true + +# Deny the creation of writable and executable memory mappings. +MemoryDenyWriteExecute=true + +[Install] +WantedBy=multi-user.target diff --git a/build/deb/debian/control b/build/deb/debian/control index 5ab64d64..74a071a1 100644 --- a/build/deb/debian/control +++ b/build/deb/debian/control @@ -8,14 +8,24 @@ Standards-Version: 3.9.5 Package: blockbook-btc Architecture: amd64 Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils -Description: Satoshilabs blockbook server +Description: Satoshilabs blockbook server (Bitcoin mainnet) Package: blockbook-btc-testnet Architecture: amd64 Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils -Description: Satoshilabs blockbook server +Description: Satoshilabs blockbook server (Bitcoin testnet) Package: blockbook-zec Architecture: amd64 Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils -Description: Satoshilabs blockbook server +Description: Satoshilabs blockbook server (ZCash mainnet) + +Package: blockbook-bch +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils +Description: Satoshilabs blockbook server (Bitcoin Cash mainnet) + +Package: blockbook-bch-testnet +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils +Description: Satoshilabs blockbook server (Bitcoin Cash testnet) diff --git a/configs/bch-testnet.json b/configs/bch-testnet.json new file mode 100644 index 00000000..606eb66a --- /dev/null +++ b/configs/bch-testnet.json @@ -0,0 +1,8 @@ +{ + "rpcURL": "http://localhost:18432", + "rpcUser": "rpc", + "rpcPass": "rpc", + "rpcTimeout": 25, + "parse": true, + "zeroMQBinding": "tcp://127.0.0.1:18434" +} diff --git a/configs/bch.json b/configs/bch.json new file mode 100644 index 00000000..e124c7af --- /dev/null +++ b/configs/bch.json @@ -0,0 +1,8 @@ +{ + "rpcURL": "http://127.0.0.1:8432", + "rpcUser": "rpc", + "rpcPass": "rpc", + "rpcTimeout": 25, + "parse": true, + "zeroMQBinding": "tcp://127.0.0.1:8434" +}