2022-04-04 08:33:16 +09:00
|
|
|
# I2Pd RC script for OpenBSD
|
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
Instructions on how to compile I2Pd on OpenBSD, together with a makefile and an
|
|
|
|
RC script to make it a system service, allowing it to be started at boot and so
|
|
|
|
on.
|
2022-04-04 08:33:16 +09:00
|
|
|
|
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
## Description
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
[I2Pd](https://i2pd.website/) is packaged in
|
|
|
|
[OpenBSD](https://www.openbsd.org/)'s official repositories, but the provided
|
|
|
|
versions are old, and older versions don't always run reliably when interacting
|
|
|
|
with newer versions on the I2P network.
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
Fortunately, compiling the latest version from source on OpenBSD is painless.
|
|
|
|
LibreSSL is supported, the official instructions work out of the box, and only a
|
|
|
|
small manual intervention is required to make the daemon start at system boot.
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
This repository contains instructions on how to compile I2Pd on OpenBSD together
|
|
|
|
with a makefile and an RC script to make it a system service, which allows it
|
|
|
|
to be started at boot, restarted if it crashes, managed by `rcctl`, and more.
|
2022-04-04 08:33:16 +09:00
|
|
|
|
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
## Compiling and installing
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
This part is taken from
|
|
|
|
[the official instructions](https://i2pd.readthedocs.io/en/latest/devs/building/unix/#building-on-unix-systems)
|
|
|
|
for compiling and installing I2Pd on a generic Unix system.
|
|
|
|
If the instructions listed here differ from the official instructions,
|
|
|
|
prioritize the official instructions, unless a detail specific to OpenBSD is
|
|
|
|
stated here.
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
First, install
|
|
|
|
[a few dependencies](https://i2pd.readthedocs.io/en/latest/devs/building/requirements/).
|
|
|
|
Git is not in their list, but is needed as it does not come with OpenBSD's base
|
|
|
|
system:
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
$ doas pkg_add boost cmake git lzlib
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
Next, clone their git repository:
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
$ cd /a/folder/of/your/choice/where/to/clone/the/repo
|
|
|
|
$ git clone https://github.com/PurpleI2P/i2pd.git
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
Then, generate the makefile and compile the source. You can
|
|
|
|
[pass options to cmake](https://i2pd.readthedocs.io/en/latest/devs/building/unix/#cmake-options)
|
|
|
|
to customize your makefile:
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
$ cd i2pd/build
|
|
|
|
$ cmake .
|
|
|
|
$ make
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
Next, install the binaries you just compiled:
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
$ doas make install
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
Finally, the base config files and certificates must be copied in the
|
|
|
|
appropriate folders. This step is not clearly listed in the official
|
|
|
|
installation instructions. It is only mentionned
|
|
|
|
[on this page](https://i2pd.readthedocs.io/en/latest/user-guide/run/#recommended-way-to-run-i2pd-built-from-source).
|
2022-05-16 22:41:07 +09:00
|
|
|
These base files are in the `contrib` folder at the root of the git repository.
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
$ cd ../contrib
|
|
|
|
$ doas mkdir -p /etc/i2pd /var/lib/i2pd
|
|
|
|
$ doas cp -R i2pd.conf tunnels.* /etc/i2pd
|
|
|
|
$ doas cp -R certificates /var/lib/i2pd
|
2022-04-04 08:33:16 +09:00
|
|
|
|
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
## Making I2Pd start at boot
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
At this point, you can start I2Pd manually, but it won't start automatically
|
|
|
|
when the system boots. This section describes how to achieve this.
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
The first thing to do is to create a new login class to increase the number of
|
|
|
|
files I2Pd will be able to open simultaneously. By default, OpenBSD restricts
|
|
|
|
this number to a value that is too low for I2Pd to work properly. Symptoms of a
|
|
|
|
number that is too small include difficulties connecting to eepsites and high
|
|
|
|
CPU usage.
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
To create a login class, simply add the following lines at the end of
|
|
|
|
`/etc/login.conf`:
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
i2pd:\
|
|
|
|
:openfiles-cur=102400:\
|
|
|
|
:openfiles-max=102400:\
|
|
|
|
:tc=daemon:
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
This login class will be used by the user `_i2pd` created in the following
|
|
|
|
steps. Next, clone this git repository:
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
$ cd /a/folder/of/your/choice/where/to/clone/the/repo
|
2022-04-06 10:02:37 +09:00
|
|
|
$ git clone https://gitlab.com/alpou/i2pd-rc-openbsd.git
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
Then, simply run the makefile. This step creates a dedicated `_i2pd` user and a
|
|
|
|
group of the same name if they don't already exist, makes the binaries
|
|
|
|
previously compiled belong to them, and copies the init script in `/etc/rc.d`.
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
$ cd i2pd-rc-openbsd
|
|
|
|
$ doas make install
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
The final step is to enable the service to make it start at boot time and
|
|
|
|
manually start it:
|
2022-04-04 08:33:16 +09:00
|
|
|
|
2022-04-04 08:37:59 +09:00
|
|
|
$ doas rcctl enable i2pd
|
|
|
|
$ doas rcctl start i2pd
|