Skip to content

Commit a19c972

Browse files
committed
Merge #865: Init: add elementsd.service file
536939e init: update the elementsd.service file with some additions found in last Bitcoin Core version, ie PermissionsStartONly=true, ExecStartPre=/bin/chgrp elements /etc/elements, TimeoutStopSec=600 and ProtectHome=true (Sosthene00) c884cad init: renamed bitcoind.service to elementsd.service (Sosthene00) Pull request description: (This is a cleaned up version of #849 ) I set up a Bitcoin Core and an Elements node on a Ubuntu machine for testing, and noticed that there was no elementsd.service file available in Elements repo as I expected, but a bitcoind.service file that seems to be an outdated version of the file in the Bitcoin Core repository. Since I needed to create a systemd service, I modified the most recent version of bitcoind.service file for elementsd as it seems fit to me. Besides replacing all occurrences of bitcoin and bitcoind, I also moved the debug.log file to another dir and the path to the bin is also different (/usr/local/bin/elementsd). This might be too specific to my project though. I suggest to add it to the Elements repository along the existing files, as maybe some people might find it useful. I'm pretty rookie with systemd too, I tried to stick to the example and recommandation in the Bitcoin Core repository, but I'd be glad if someone had suggestions to improve this. Tree-SHA512: 8b07203b5e7c44d46fe5a9e6ba399ee44b89e037d000b51a0ecd473c4e924f5f8305369a8c7718d9d058a6d1a299d52fa1a397a264cd4c4e5733e286567caad2
2 parents af23572 + 536939e commit a19c972

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

contrib/init/bitcoind.service renamed to contrib/init/elementsd.service

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,53 @@
11
# It is not recommended to modify this file in-place, because it will
22
# be overwritten during package upgrades. If you want to add further
33
# options or overwrite existing ones then use
4-
# $ systemctl edit bitcoind.service
4+
# $ systemctl edit elementsd.service
55
# See "man systemd.service" for details.
66

77
# Note that almost all daemon options could be specified in
8-
# /etc/bitcoin/bitcoin.conf, except for those explicitly specified as arguments
9-
# in ExecStart=
8+
# /etc/elements/elements.conf, but keep in mind those explicitly
9+
# specified as arguments in ExecStart= will override those in the
10+
# config file.
1011

1112
[Unit]
12-
Description=Bitcoin daemon
13+
Description=Elements daemon
1314
After=network.target
1415

1516
[Service]
16-
ExecStart=/usr/bin/bitcoind -daemon \
17-
-pid=/run/bitcoind/bitcoind.pid \
18-
-conf=/etc/bitcoin/bitcoin.conf \
19-
-datadir=/var/lib/bitcoind
17+
ExecStart=/usr/bin/elementsd -daemon \
18+
-pid=/run/elementsd/elementsd.pid \
19+
-conf=/etc/elements/elements.conf \
20+
-datadir=/var/lib/elementsd
21+
22+
# Make sure the config directory is readable by the service user
23+
PermissionsStartOnly=true
24+
ExecStartPre=/bin/chgrp elements /etc/elements
2025

2126
# Process management
2227
####################
2328

2429
Type=forking
25-
PIDFile=/run/bitcoind/bitcoind.pid
30+
PIDFile=/run/elementsd/elementsd.pid
2631
Restart=on-failure
32+
TimeoutStopSec=600
2733

2834
# Directory creation and permissions
2935
####################################
3036

31-
# Run as bitcoin:bitcoin
32-
User=bitcoin
33-
Group=bitcoin
37+
# Run as elements:elements
38+
User=elements
39+
Group=elements
3440

35-
# /run/bitcoind
36-
RuntimeDirectory=bitcoind
41+
# /run/elementsd
42+
RuntimeDirectory=elementsd
3743
RuntimeDirectoryMode=0710
3844

39-
# /etc/bitcoin
40-
ConfigurationDirectory=bitcoin
45+
# /etc/elements
46+
ConfigurationDirectory=elements
4147
ConfigurationDirectoryMode=0710
4248

43-
# /var/lib/bitcoind
44-
StateDirectory=bitcoind
49+
# /var/lib/elementsd
50+
StateDirectory=elementsd
4551
StateDirectoryMode=0710
4652

4753
# Hardening measures
@@ -53,6 +59,9 @@ PrivateTmp=true
5359
# Mount /usr, /boot/ and /etc read-only for the process.
5460
ProtectSystem=full
5561

62+
# Deny access to /home, /root and /run/user
63+
ProtectHome=true
64+
5665
# Disallow the process and all of its children to gain
5766
# new privileges through execve().
5867
NoNewPrivileges=true

0 commit comments

Comments
 (0)