summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon
diff options
context:
space:
mode:
Diffstat (limited to 'other/bootstrap_daemon')
-rw-r--r--other/bootstrap_daemon/README.md70
-rw-r--r--other/bootstrap_daemon/tox-bootstrapd.conf53
-rw-r--r--other/bootstrap_daemon/tox-bootstrapd.service19
3 files changed, 85 insertions, 57 deletions
diff --git a/other/bootstrap_daemon/README.md b/other/bootstrap_daemon/README.md
index 9a2dff4b..d0c16eb1 100644
--- a/other/bootstrap_daemon/README.md
+++ b/other/bootstrap_daemon/README.md
@@ -1,29 +1,32 @@
1##Instructions for Debian 1##Instructions
2
3This instruction primarily tested on Linux but, may be, will work on other POSIX-compliant systems.
2 4
3For security reasons we run the daemon under its own user. 5For security reasons we run the daemon under its own user.
6
4Create a new user by executing the following: 7Create a new user by executing the following:
5```sh 8```sh
6sudo useradd --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd 9sudo useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
7``` 10```
8 11
9Create a directory where the daemon will store its keys: 12Copy `tox-bootstrapd.conf` file to where `CFGFILE` variable from `tox-bootstrapd.sh` tells (for `init.d` users) or `ExecStart=` from `tox-bootstrap.service` ( for `systemd` users). By default it's `/etc/tox-bootstrapd.conf`.
10```sh 13
11sudo mkdir /var/lib/tox-bootstrapd/ 14Go over everything in `tox-bootstrapd.conf`. Make sure `pid_file_path` matches `PIDFILE` from `tox-bootstrapd.sh` (`init.d`) or `PIDFile=` from `tox-bootstrap.service` AND file in `ExecStartPre`(`systemd`).
12``` 15
13 16
14Restrain other users from accessing the directory: 17Restrict access to home directory:
15```sh 18```sh
16sudo chown tox-bootstrapd:tox-bootstrapd /var/lib/tox-bootstrapd/ 19sudo chmod 700 /var/lib/tox-bootstrapd
17sudo chmod 700 /var/lib/tox-bootstrapd/
18``` 20```
19 21
20Look at the variable declarations in the beginning of `tox-bootstrapd.sh` init script to see if you need to change anything for it to work for you. The default values must be fine for most users and we assume that you use those next. 22##For `init.d` users:
21
22Go over everything in `tox-bootstrapd.conf`. Make sure `pid_file_path` matches `PIDFILE` from `tox-bootstrapd.sh`.
23 23
24Place `tox-bootstrapd.conf` file to where `CFGFILE` variable from `tox-bootstrapd.sh` tells. By default it's `/etc/tox-bootstrapd.conf`. 24Look at the variable declarations in the beginning of `tox-bootstrapd.sh` init script to see if you need to change anything for it to work for you. The default values must be fine for most users and we assume that you use those next.
25 25
26Place `tox-bootstrapd.sh` init file at `/etc/init.d/tox-bootstrapd` (note the disappearance of ".sh" ending). 26Copy `tox-bootstrapd.sh` init file to `/etc/init.d/tox-bootstrapd` (note the disappearance of ".sh" ending).
27```sh
28sudo cp tox-bootstrapd.sh /etc/init.d/tox-bootstrapd
29```
27 30
28Set permissions for the init system to run the script: 31Set permissions for the init system to run the script:
29```sh 32```sh
@@ -50,23 +53,56 @@ Get your public key and check that the daemon initialized correctly:
50sudo grep "tox-bootstrapd" /var/log/syslog 53sudo grep "tox-bootstrapd" /var/log/syslog
51``` 54```
52 55
56##For `systemd` users:
57
58Copy tox-bootstrap.service to /etc/systemd/system/:
59```sh
60sudo cp tox-bootstrap.service /etc/systemd/system/
61```
62
63Make sure, that path to `chown` and `mkdir` is correct in `tox-bootstrap.service` (they may be different in some distributions, by default `/bin/chown` and `/bin/mkdir`)
64
65You must uncomment the next line in tox-bootstrap.service, if you want to use port number <1024
66
67 #CapabilityBoundingSet=CAP_NET_BIND_SERVICE
68
69and, possibly, install `libcap2-bin` or `libcap2` package, depending of your distribution.
70
53 71
72Reload systemd units definitions, enable service for automatic start (if needed), and start it:
73```sh
74sudo systemctl daemon-reload
75sudo systemctl enable tox-bootstrap.service
76sudo systemctl start tox-bootstrap.service
77```
54###Troubleshooting: 78###Troubleshooting:
55 79
56- Check daemon's status: 80- Check daemon's status:
57```sh 81```sh
82#init.d
58sudo service tox-bootstrapd status 83sudo service tox-bootstrapd status
84
85#systemd
86sudo systemctl status tox-bootstrap.service
59``` 87```
60 88
61- Check the log for errors: 89- Check the log for errors:
62```sh 90```sh
91#init.d
63sudo grep "tox-bootstrapd" /var/log/syslog 92sudo grep "tox-bootstrapd" /var/log/syslog
93
94#systemd
95sudo journalctl -f _SYSTEMD_UNIT=tox-bootstrap.service
64``` 96```
65 97
98`init.d`:
66- Check that variables in the beginning of `/etc/init.d/tox-bootstrapd` are valid. 99- Check that variables in the beginning of `/etc/init.d/tox-bootstrapd` are valid.
67 100
68- Make sure `pid_file_path` in `/etc/tox-bootstrapd.conf` matches `PIDFILE` from `/etc/init.d/tox-bootstrapd`.
69 101
70- Make sure you have write permission for keys and pid files. 102Common:
103
104- Make sure tox-bootstrapd user has write permission for keys and pid files (in systemd pid file insured by unit definition).
105
106- Make sure tox-bootstrapd has read permission for the config file.
71 107
72- Make sure you have read permission for the config file. 108- Make sure tox-bootstrapd location matches its path in init scripts, if you specified non-default `--prefix`, when building.
diff --git a/other/bootstrap_daemon/tox-bootstrapd.conf b/other/bootstrap_daemon/tox-bootstrapd.conf
index 4547d83d..d02eb3d0 100644
--- a/other/bootstrap_daemon/tox-bootstrapd.conf
+++ b/other/bootstrap_daemon/tox-bootstrapd.conf
@@ -24,8 +24,8 @@ enable_lan_discovery = true
24 24
25enable_tcp_relay = true 25enable_tcp_relay = true
26 26
27// Tox uses 443, 3389 and 33445 ports by default, so it's highly encouraged to keep 27// While Tox uses 33445 port by default, 443 (https) and 3389 (rdp) ports are very
28// them. 28// common among nodes, so it's encouraged to keep them in place.
29tcp_relay_ports = [443, 3389, 33445] 29tcp_relay_ports = [443, 3389, 33445]
30 30
31// Reply to MOTD (Message Of The Day) requests. 31// Reply to MOTD (Message Of The Day) requests.
@@ -45,48 +45,21 @@ motd = "tox-bootstrapd"
45// in both cases this will be interpreted as if you don't want to bootstrap 45// in both cases this will be interpreted as if you don't want to bootstrap
46// from anyone. 46// from anyone.
47// 47//
48// address = any ipv4 or ipv6 address and also any US-ASCII domain name. 48// address = any IPv4 or IPv6 address and also any US-ASCII domain name.
49bootstrap_nodes = ( 49bootstrap_nodes = (
50 { 50 { // Example Node 1 (IPv4)
51 // NikolaiToryzin - US 51 address = "127.0.0.1"
52 address = "192.254.75.98"
53 port = 33445 52 port = 33445
54 public_key = "951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F" 53 public_key = "728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854"
55 }, 54 },
56 { 55 { // Example Node 2 (IPv6)
57 // Proplex - US 56 address = "::1/128"
58 address = "107.161.17.51"
59 port = 33445 57 port = 33445
60 public_key = "7BE3951B97CA4B9ECDDA768E8C52BA19E9E2690AB584787BF4C90E04DBB75111" 58 public_key = "3E78BACF0F84235B30054B54898F56793E1DEF8BD46B1038B9D822E8460FAB67"
61 }, 59 },
62 { 60 { // Example Node 3 (US-ASCII domain name)
63 // SonOfRa - DE 61 address = "example.org"
64 address = "144.76.60.215"
65 port = 33445 62 port = 33445
66 public_key = "04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F" 63 public_key = "8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858"
67 },
68 {
69 // Astonex - FR
70 address = "37.59.102.176"
71 port = 33445
72 public_key = "B98A2CEAA6C6A2FADC2C3632D284318B60FE5375CCB41EFA081AB67F500C1B0B"
73 },
74 {
75 // SylvieLorxu - NL
76 address = "178.21.112.187"
77 port = 33445
78 public_key = "4B2C19E924972CB9B57732FB172F8A8604DE13EEDA2A6234E348983344B23057"
79 },
80 {
81 // aitjcize - JP
82 address = "54.199.139.199"
83 port = 33445
84 public_key = "7F9C31FE850E97CEFD4C4591DF93FC757C7C12549DDD55F8EEAECC34FE76C029"
85 },
86 {
87 // NikolaiToryzin - CH
88 address = "31.7.57.236"
89 port = 443
90 public_key = "2A4B50D1D525DA2E669592A20C327B5FAD6C7E5962DC69296F9FEC77C4436E4E"
91 } 64 }
92) 65) \ No newline at end of file
diff --git a/other/bootstrap_daemon/tox-bootstrapd.service b/other/bootstrap_daemon/tox-bootstrapd.service
new file mode 100644
index 00000000..4b499311
--- /dev/null
+++ b/other/bootstrap_daemon/tox-bootstrapd.service
@@ -0,0 +1,19 @@
1[Unit]
2Description=Tox DHT Bootstrap Daemon
3After=network.target
4
5[Service]
6Type=forking
7PermissionsStartOnly=true
8ExecStartPre=-/bin/mkdir /var/run/tox-bootstrapd -p
9ExecStartPre=/bin/chown tox-bootstrapd:tox-bootstrapd -R /var/run/tox-bootstrapd
10WorkingDirectory=/var/lib/tox-bootstrapd
11ExecStart=/usr/local/bin/tox-bootstrapd /etc/tox-bootstrapd.conf
12User=tox-bootstrapd
13Group=tox-bootstrapd
14PIDFile=/var/run/tox-bootstrapd/tox-bootstrapd.pid
15#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
16
17[Install]
18WantedBy=multi-user.target
19