mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge branch 'master' of https://github.com/ray65536/toxcore
This commit is contained in:
commit
93b1c346fe
|
@ -1,29 +1,32 @@
|
||||||
##Instructions for Debian
|
##Instructions
|
||||||
|
|
||||||
|
This instruction primarily tested on Linux but, may be, will work on other POSIX-compliant systems.
|
||||||
|
|
||||||
For security reasons we run the daemon under its own user.
|
For security reasons we run the daemon under its own user.
|
||||||
|
|
||||||
Create a new user by executing the following:
|
Create a new user by executing the following:
|
||||||
```sh
|
```sh
|
||||||
sudo useradd --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
|
sudo 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
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a directory where the daemon will store its keys:
|
Copy `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`.
|
||||||
|
|
||||||
|
Go 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`).
|
||||||
|
|
||||||
|
|
||||||
|
Restrict access to home directory:
|
||||||
```sh
|
```sh
|
||||||
sudo mkdir /var/lib/tox-bootstrapd/
|
sudo chmod 700 /var/lib/tox-bootstrapd
|
||||||
```
|
```
|
||||||
|
|
||||||
Restrain other users from accessing the directory:
|
##For `init.d` users:
|
||||||
```sh
|
|
||||||
sudo chown tox-bootstrapd:tox-bootstrapd /var/lib/tox-bootstrapd/
|
|
||||||
sudo chmod 700 /var/lib/tox-bootstrapd/
|
|
||||||
```
|
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
Go over everything in `tox-bootstrapd.conf`. Make sure `pid_file_path` matches `PIDFILE` from `tox-bootstrapd.sh`.
|
Copy `tox-bootstrapd.sh` init file to `/etc/init.d/tox-bootstrapd` (note the disappearance of ".sh" ending).
|
||||||
|
```sh
|
||||||
Place `tox-bootstrapd.conf` file to where `CFGFILE` variable from `tox-bootstrapd.sh` tells. By default it's `/etc/tox-bootstrapd.conf`.
|
sudo cp tox-bootstrapd.sh /etc/init.d/tox-bootstrapd
|
||||||
|
```
|
||||||
Place `tox-bootstrapd.sh` init file at `/etc/init.d/tox-bootstrapd` (note the disappearance of ".sh" ending).
|
|
||||||
|
|
||||||
Set permissions for the init system to run the script:
|
Set permissions for the init system to run the script:
|
||||||
```sh
|
```sh
|
||||||
|
@ -50,23 +53,56 @@ Get your public key and check that the daemon initialized correctly:
|
||||||
sudo grep "tox-bootstrapd" /var/log/syslog
|
sudo grep "tox-bootstrapd" /var/log/syslog
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##For `systemd` users:
|
||||||
|
|
||||||
|
Copy tox-bootstrap.service to /etc/systemd/system/:
|
||||||
|
```sh
|
||||||
|
sudo cp tox-bootstrap.service /etc/systemd/system/
|
||||||
|
```
|
||||||
|
|
||||||
|
Make 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`)
|
||||||
|
|
||||||
|
You must uncomment the next line in tox-bootstrap.service, if you want to use port number <1024
|
||||||
|
|
||||||
|
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||||
|
|
||||||
|
and, possibly, install `libcap2-bin` or `libcap2` package, depending of your distribution.
|
||||||
|
|
||||||
|
|
||||||
|
Reload systemd units definitions, enable service for automatic start (if needed), and start it:
|
||||||
|
```sh
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable tox-bootstrap.service
|
||||||
|
sudo systemctl start tox-bootstrap.service
|
||||||
|
```
|
||||||
###Troubleshooting:
|
###Troubleshooting:
|
||||||
|
|
||||||
- Check daemon's status:
|
- Check daemon's status:
|
||||||
```sh
|
```sh
|
||||||
|
#init.d
|
||||||
sudo service tox-bootstrapd status
|
sudo service tox-bootstrapd status
|
||||||
|
|
||||||
|
#systemd
|
||||||
|
sudo systemctl status tox-bootstrap.service
|
||||||
```
|
```
|
||||||
|
|
||||||
- Check the log for errors:
|
- Check the log for errors:
|
||||||
```sh
|
```sh
|
||||||
|
#init.d
|
||||||
sudo grep "tox-bootstrapd" /var/log/syslog
|
sudo grep "tox-bootstrapd" /var/log/syslog
|
||||||
|
|
||||||
|
#systemd
|
||||||
|
sudo journalctl -f _SYSTEMD_UNIT=tox-bootstrap.service
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`init.d`:
|
||||||
- Check that variables in the beginning of `/etc/init.d/tox-bootstrapd` are valid.
|
- Check that variables in the beginning of `/etc/init.d/tox-bootstrapd` are valid.
|
||||||
|
|
||||||
- Make sure `pid_file_path` in `/etc/tox-bootstrapd.conf` matches `PIDFILE` from `/etc/init.d/tox-bootstrapd`.
|
|
||||||
|
|
||||||
- Make sure you have write permission for keys and pid files.
|
Common:
|
||||||
|
|
||||||
- Make sure you have read permission for the config file.
|
- Make sure tox-bootstrapd user has write permission for keys and pid files (in systemd pid file insured by unit definition).
|
||||||
|
|
||||||
|
- Make sure tox-bootstrapd has read permission for the config file.
|
||||||
|
|
||||||
|
- Make sure tox-bootstrapd location matches its path in init scripts, if you specified non-default `--prefix`, when building.
|
||||||
|
|
19
other/bootstrap_daemon/tox-bootstrapd.service
Normal file
19
other/bootstrap_daemon/tox-bootstrapd.service
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Tox DHT Bootstrap Daemon
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
PermissionsStartOnly=true
|
||||||
|
ExecStartPre=-/bin/mkdir /var/run/tox-bootstrapd -p
|
||||||
|
ExecStartPre=/bin/chown tox-bootstrapd:tox-bootstrapd -R /var/run/tox-bootstrapd
|
||||||
|
WorkingDirectory=/var/lib/tox-bootstrapd
|
||||||
|
ExecStart=/usr/local/bin/tox-bootstrapd /etc/tox-bootstrapd.conf
|
||||||
|
User=tox-bootstrapd
|
||||||
|
Group=tox-bootstrapd
|
||||||
|
PIDFile=/var/run/tox-bootstrapd/tox-bootstrapd.pid
|
||||||
|
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Reference in New Issue
Block a user