diff options
author | Maxim Biro <nurupo.contributions@gmail.com> | 2014-08-17 01:53:54 -0400 |
---|---|---|
committer | Maxim Biro <nurupo.contributions@gmail.com> | 2014-08-17 01:53:54 -0400 |
commit | ba7058c891dbace8b90e5e2b126efee58df2ef75 (patch) | |
tree | 9eeb5c25a43197c047b98dd7ecaa9ffb5b556059 /other/bootstrap_daemon/README.md | |
parent | e474a32e716994f262a6402857626af7cab7b074 (diff) |
Made possible to run the daemon under its own user
Diffstat (limited to 'other/bootstrap_daemon/README.md')
-rw-r--r-- | other/bootstrap_daemon/README.md | 84 |
1 files changed, 47 insertions, 37 deletions
diff --git a/other/bootstrap_daemon/README.md b/other/bootstrap_daemon/README.md index d13c0415..ec1653d2 100644 --- a/other/bootstrap_daemon/README.md +++ b/other/bootstrap_daemon/README.md | |||
@@ -1,62 +1,72 @@ | |||
1 | ##Instructions for Debian | 1 | ##Instructions for Debian |
2 | 2 | ||
3 | The following commands are to be executed as root: | 3 | For security reasons we run the daemon under its own user. |
4 | 4 | Create a new user by executing the following: | |
5 | 1. In `tox-bootstrapd.sh` file change: | 5 | ```sh |
6 | - `CFG` to where your config file (`conf`) will be; read rights required | 6 | sudo useradd --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd |
7 | - `DAEMON` to point to the executable | ||
8 | - `PIDFILE` to point to a pid file daemon would have rights to create | ||
9 | |||
10 | 2. Go over everything in `conf`. Make sure `pid_file_path` matches `PIDFILE` from `tox-bootstrapd.sh` | ||
11 | |||
12 | 3. Execute: | ||
13 | ``` | ||
14 | mv tox-bootstrapd.sh /etc/init.d/tox-bootstrapd | ||
15 | ``` | 7 | ``` |
16 | *(note that we removed `.sh` ending)* | ||
17 | 8 | ||
18 | 4. Give the right permissions to this file: | 9 | Create a directory where the daemon will store its keys: |
19 | ``` | 10 | ```sh |
20 | chmod 755 /etc/init.d/tox-bootstrapd | 11 | sudo mkdir /var/lib/tox-bootstrapd/ |
21 | ``` | 12 | ``` |
22 | 13 | ||
23 | 5. Execute: | 14 | Restrain other users from accessing the directory: |
24 | ``` | 15 | ```sh |
25 | update-rc.d tox-bootstrapd defaults | 16 | sudo chown tox-bootstrapd:tox-bootstrapd /var/lib/tox-bootstrapd/ |
17 | sudo chmod 700 /var/lib/tox-bootstrapd/ | ||
26 | ``` | 18 | ``` |
27 | 19 | ||
28 | 6. Start the service: | 20 | Look 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. |
29 | ``` | ||
30 | service tox-bootstrapd start | ||
31 | ``` | ||
32 | 21 | ||
33 | 7. Verify that the service is running: | 22 | Go over everything in `conf`. Make sure `pid_file_path` matches `PIDFILE` from `tox-bootstrapd.sh`. |
34 | ``` | 23 | |
35 | service tox-bootstrapd status | 24 | Place `conf` file to where `CFGFILE` variable from `tox-bootstrapd` tells. By default it's `/etc/tox-bootstrapd.conf`. |
25 | |||
26 | Place `tox-bootstrapd.sh` init file at `/etc/init.d/tox-bootstrapd`. | ||
27 | |||
28 | Set permissions for the init system to run the script: | ||
29 | ```sh | ||
30 | sudo chmod 755 /etc/init.d/tox-bootstrapd | ||
36 | ``` | 31 | ``` |
37 | 32 | ||
38 | -- | 33 | Make the init system aware of the script: |
34 | ```sh | ||
35 | sudo update-rc.d tox-bootstrapd defaults | ||
36 | ``` | ||
39 | 37 | ||
40 | You can see daemon's log with | 38 | Start the daemon: |
39 | ```sh | ||
40 | sudo service tox-bootstrapd start | ||
41 | ``` | 41 | ``` |
42 | grep "tox-bootstrapd" /var/log/syslog | 42 | |
43 | Verify it's running: | ||
44 | ```sh | ||
45 | sudo service tox-bootstrapd status | ||
43 | ``` | 46 | ``` |
44 | 47 | ||
45 | **Note that system log is where you find your public key** | 48 | Get your public key and check that the daemon initialized correctly: |
49 | ```sh | ||
50 | sudo grep "tox-bootstrapd" /var/log/syslog | ||
51 | ``` | ||
46 | 52 | ||
47 | -- | ||
48 | 53 | ||
49 | ###Troubleshooting: | 54 | ###Troubleshooting: |
50 | 55 | ||
51 | 1. Check the log for errors with | 56 | - Check daemon's status: |
57 | ```sh | ||
58 | sudo service tox-bootstrapd status | ||
52 | ``` | 59 | ``` |
53 | grep "tox-bootstrapd" /var/log/syslog | 60 | |
61 | - Check the log for errors: | ||
62 | ```sh | ||
63 | sudo grep "tox-bootstrapd" /var/log/syslog | ||
54 | ``` | 64 | ``` |
55 | 65 | ||
56 | 2. Check that paths in the beginning of `/etc/init.d/tox-bootstrapd` are valid | 66 | - Check that variables in the beginning of `/etc/init.d/tox-bootstrapd` are valid. |
57 | 67 | ||
58 | 3. Make sure that `PIDFILE` from `/etc/init.d/tox-bootstrapd` matches with the `pid_file_path` from `conf` | 68 | - Make sure `pid_file_path` in `/etc/tox-bootstrapd.conf` matches `PIDFILE` from `/etc/init.d/tox-bootstrapd`. |
59 | 69 | ||
60 | 4. Make sure you have write permission to keys and pid files | 70 | - Make sure you have write permission for keys and pid files. |
61 | 71 | ||
62 | 5. Make sure you have read permission for config file \ No newline at end of file | 72 | - Make sure you have read permission for the config file. \ No newline at end of file |