diff --git a/contrib/backends/Makefile b/contrib/backends/Makefile index bc6b128c..0531302a 100644 --- a/contrib/backends/Makefile +++ b/contrib/backends/Makefile @@ -1,4 +1,4 @@ -TARGETS = bitcoin zcash bcash ethereum bgold +TARGETS = bitcoin zcash bcash ethereum bgold dash IMAGE = blockbook-backend-build-deb NO_CACHE = false diff --git a/contrib/backends/dash/Makefile b/contrib/backends/dash/Makefile new file mode 100644 index 00000000..9f379102 --- /dev/null +++ b/contrib/backends/dash/Makefile @@ -0,0 +1,14 @@ +DASH_VERSION := 0.12.2 +DASH_BUILD := .3 + +all: + wget https://github.com/dashpay/dash/releases/download/v${DASH_VERSION}${DASH_BUILD}/dashcore-${DASH_VERSION}${DASH_BUILD}-linux64.tar.gz + tar -xf dashcore-${DASH_VERSION}${DASH_BUILD}-linux64.tar.gz + mv dashcore-${DASH_VERSION} dash + rm dash/bin/dash-qt + rm dash/bin/test_dash + + +clean: + rm -rf dash + rm -f dashcore-${DASH_VERSION}${DASH_BUILD}-linux64.tar.gz diff --git a/contrib/backends/dash/dash.conf b/contrib/backends/dash/dash.conf new file mode 100644 index 00000000..b5425fc1 --- /dev/null +++ b/contrib/backends/dash/dash.conf @@ -0,0 +1,20 @@ +daemon=1 +server=1 +nolisten=1 +rpcuser=rpc +rpcpassword=rpc +rpcport=8033 +txindex=1 +addressindex=1 +timestampindex=1 +spentindex=1 + +zmqpubhashtx=tcp://127.0.0.1:38333 +zmqpubhashblock=tcp://127.0.0.1:38333 +zmqpubrawblock=tcp://127.0.0.1:38333 +zmqpubrawtx=tcp://127.0.0.1:38333 + +mempoolexpiry=72 +rpcworkqueue=1100 +maxmempool=2000 +dbcache=1000 diff --git a/contrib/backends/dash/dash_testnet.conf b/contrib/backends/dash/dash_testnet.conf new file mode 100644 index 00000000..ffb85a0c --- /dev/null +++ b/contrib/backends/dash/dash_testnet.conf @@ -0,0 +1,20 @@ +daemon=1 +server=1 +testnet=1 +nolisten=1 +rpcuser=rpc +rpcpassword=rpc +rpcport=18033 +txindex=1 +addressindex=1 +timestampindex=1 +spentindex=1 + +zmqpubhashtx=tcp://127.0.0.1:48333 +zmqpubhashblock=tcp://127.0.0.1:48333 +zmqpubrawblock=tcp://127.0.0.1:48333 +zmqpubrawtx=tcp://127.0.0.1:48333 + +rpcworkqueue=1100 +maxmempool=2000 +dbcache=1000 diff --git a/contrib/backends/dash/debian/changelog b/contrib/backends/dash/debian/changelog new file mode 100644 index 00000000..3283a8fd --- /dev/null +++ b/contrib/backends/dash/debian/changelog @@ -0,0 +1,5 @@ +dash (0.12.2-satoshilabs1) unstable; urgency=medium + + * Initial build + + -- Jakub Matys Fri, 08 Jun 2018 11:27:03 +0200 diff --git a/contrib/backends/dash/debian/compat b/contrib/backends/dash/debian/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/contrib/backends/dash/debian/compat @@ -0,0 +1 @@ +9 diff --git a/contrib/backends/dash/debian/control b/contrib/backends/dash/debian/control new file mode 100644 index 00000000..d7f3e93f --- /dev/null +++ b/contrib/backends/dash/debian/control @@ -0,0 +1,16 @@ +Source: dash +Section: satoshilabs +Priority: optional +Maintainer: jakub.matys@satoshilabs.com +Build-Depends: debhelper, wget, tar, gzip, make, dh-systemd, dh-exec +Standards-Version: 3.9.5 + +Package: dash +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, logrotate +Description: Satoshilabs packaged dash server + +Package: dash-testnet +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, logrotate +Description: Satoshilabs packaged dash server diff --git a/contrib/backends/dash/debian/dash-testnet.conffiles b/contrib/backends/dash/debian/dash-testnet.conffiles new file mode 100644 index 00000000..ca92fe83 --- /dev/null +++ b/contrib/backends/dash/debian/dash-testnet.conffiles @@ -0,0 +1 @@ +/opt/coins/nodes/dash_testnet/dash_testnet.conf diff --git a/contrib/backends/dash/debian/dash-testnet.dirs b/contrib/backends/dash/debian/dash-testnet.dirs new file mode 100644 index 00000000..552e900d --- /dev/null +++ b/contrib/backends/dash/debian/dash-testnet.dirs @@ -0,0 +1 @@ +/opt/coins/data/dash_testnet/backend diff --git a/contrib/backends/dash/debian/dash-testnet.install b/contrib/backends/dash/debian/dash-testnet.install new file mode 100644 index 00000000..2159f454 --- /dev/null +++ b/contrib/backends/dash/debian/dash-testnet.install @@ -0,0 +1,2 @@ +dash/* /opt/coins/nodes/dash_testnet +dash_testnet.conf /opt/coins/nodes/dash_testnet diff --git a/contrib/backends/dash/debian/dash-testnet.logrotate b/contrib/backends/dash/debian/dash-testnet.logrotate new file mode 100644 index 00000000..b87cf5a3 --- /dev/null +++ b/contrib/backends/dash/debian/dash-testnet.logrotate @@ -0,0 +1,10 @@ +/opt/coins/data/dash_testnet/backend/testnet3/debug.log +/opt/coins/data/dash_testnet/backend/testnet3/db.log +{ + rotate 7 + daily + compress + missingok + notifempty + copytruncate +} diff --git a/contrib/backends/dash/debian/dash-testnet.postinst b/contrib/backends/dash/debian/dash-testnet.postinst new file mode 100644 index 00000000..33c0a50b --- /dev/null +++ b/contrib/backends/dash/debian/dash-testnet.postinst @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +case "$1" in + + configure) + if ! id -u dash &> /dev/null + then + useradd --system -M -U dash -s /bin/false + fi + + if [ "$(stat -c '%U' /opt/coins/data/dash_testnet/backend)" != "dash" ] + then + chown -R dash:dash /opt/coins/data/dash_testnet/backend + fi + ;; + +esac + +#DEBHELPER# diff --git a/contrib/backends/dash/debian/dash-testnet.service b/contrib/backends/dash/debian/dash-testnet.service new file mode 100644 index 00000000..f2496a91 --- /dev/null +++ b/contrib/backends/dash/debian/dash-testnet.service @@ -0,0 +1,47 @@ +# 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 dash-testnet.service +# See "man systemd.service" for details. + +# Note that almost all daemon options could be specified in +# /opt/coins/nodes/dash_testnet/dash_testnet.conf + +[Unit] +Description=DASH daemon (testnet) +After=network.target + +[Service] +ExecStart=/opt/coins/nodes/dash_testnet/bin/dashd -datadir=/opt/coins/data/dash_testnet/backend -conf=/opt/coins/nodes/dash_testnet/dash_testnet.conf -pid=/run/dashd/dash_testnet.pid +# Creates /run/dashd owned by dash +RuntimeDirectory=dashd +User=dash +Type=forking +PIDFile=/run/dashd/dash_testnet.pid +Restart=on-failure + +# Resource limits +LimitNOFILE=500000 + +# 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/contrib/backends/dash/debian/dash.conffiles b/contrib/backends/dash/debian/dash.conffiles new file mode 100644 index 00000000..a760cf85 --- /dev/null +++ b/contrib/backends/dash/debian/dash.conffiles @@ -0,0 +1 @@ +/opt/coins/nodes/dash/dash.conf diff --git a/contrib/backends/dash/debian/dash.dirs b/contrib/backends/dash/debian/dash.dirs new file mode 100644 index 00000000..d96cc5d2 --- /dev/null +++ b/contrib/backends/dash/debian/dash.dirs @@ -0,0 +1 @@ +/opt/coins/data/dash/backend diff --git a/contrib/backends/dash/debian/dash.install b/contrib/backends/dash/debian/dash.install new file mode 100644 index 00000000..08e4581a --- /dev/null +++ b/contrib/backends/dash/debian/dash.install @@ -0,0 +1,2 @@ +dash/* /opt/coins/nodes/dash +dash.conf /opt/coins/nodes/dash diff --git a/contrib/backends/dash/debian/dash.logrotate b/contrib/backends/dash/debian/dash.logrotate new file mode 100644 index 00000000..689060ea --- /dev/null +++ b/contrib/backends/dash/debian/dash.logrotate @@ -0,0 +1,10 @@ +/opt/coins/data/dash/backend/debug.log +/opt/coins/data/dash/backend/db.log +{ + rotate 7 + daily + compress + missingok + notifempty + copytruncate +} diff --git a/contrib/backends/dash/debian/dash.postinst b/contrib/backends/dash/debian/dash.postinst new file mode 100644 index 00000000..3e34a47b --- /dev/null +++ b/contrib/backends/dash/debian/dash.postinst @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +case "$1" in + + configure) + if ! id -u dash &> /dev/null + then + useradd --system -M -U dash -s /bin/false + fi + + if [ "$(stat -c '%U' /opt/coins/data/dash/backend)" != "dash" ] + then + chown -R dash:dash /opt/coins/data/dash/backend + fi + ;; + +esac + +#DEBHELPER# diff --git a/contrib/backends/dash/debian/dash.service b/contrib/backends/dash/debian/dash.service new file mode 100644 index 00000000..151491a1 --- /dev/null +++ b/contrib/backends/dash/debian/dash.service @@ -0,0 +1,47 @@ +# 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 dash.service +# See "man systemd.service" for details. + +# Note that almost all daemon options could be specified in +# /opt/coins/nodes/dash/dash.conf + +[Unit] +Description=DASH daemon (mainnet) +After=network.target + +[Service] +ExecStart=/opt/coins/nodes/dash/bin/dashd -datadir=/opt/coins/data/dash/backend -conf=/opt/coins/nodes/dash/dash.conf -pid=/run/dashd/dash.pid +# Creates /run/dashd owned by dash +RuntimeDirectory=dashd +User=dash +Type=forking +PIDFile=/run/dashd/dash.pid +Restart=on-failure + +# Resource limits +LimitNOFILE=500000 + +# 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/contrib/backends/dash/debian/rules b/contrib/backends/dash/debian/rules new file mode 100755 index 00000000..f69489df --- /dev/null +++ b/contrib/backends/dash/debian/rules @@ -0,0 +1,11 @@ +#!/usr/bin/make -f + +DH_VERBOSE = 1 + +%: + dh $@ --with=systemd + +override_dh_systemd_start: + dh_systemd_start --no-start + +override_dh_installinit: