Skip to content

Instantly share code, notes, and snippets.

@drizzt
Created March 22, 2018 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drizzt/135409e05fd98e438fc5ffb66c0fca55 to your computer and use it in GitHub Desktop.
Save drizzt/135409e05fd98e438fc5ffb66c0fca55 to your computer and use it in GitHub Desktop.
bitcoin service files
[Unit]
BindsTo=bitcoind.service
After=bitcoind.service
[Service]
User=bitcoin
Group=bitcoin
Type=notify
ExecStart=/bin/sh -c 'while sleep 10; do /home/bitcoin/bin/bitcoin-cli ping && exec /usr/bin/systemd-notify --ready; done'
RemainAfterExit=yes
SyslogIdentifier=bitcoind-online
TimeoutStartSec=600s
CPUQuota=10%
[Install]
WantedBy=multi-user.target
[Unit]
Description=Bitcoin's distributed currency daemon
After=tor.service network.target
[Service]
User=bitcoin
Group=bitcoin
RuntimeDirectory=bitcoind
PIDFile=/run/bitcoind/bitcoind.pid
Environment=MALLOC_ARENA_MAX=1
ExecStart=/home/bitcoin/bin/bitcoind -server -pid=/run/bitcoind/bitcoind.pid -printtoconsole
Restart=always
TimeoutStopSec=120s
StartLimitInterval=120s
StartLimitBurst=5
# 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
[Unit]
BindsTo=bitcoind-online.service
After=bitcoind-online.service network.target
[Service]
User=bitcoin
Group=bitcoin
PIDFile=/run/lnd.pid
Environment=MALLOC_ARENA_MAX=1
ExecStart=/home/bitcoin/bin/lnd
Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=2s
StartLimitInterval=120s
StartLimitBurst=5
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment