Skip to content

Add eturnal (STUN/TURN standalone server) systemd service unit #187

Merged
merged 7 commits into from
May 18, 2021

Commits on May 17, 2021

  1. systemd: Add service unit for eturnal.service

    Taken [from upstream][1].
    
    With `LogsDirectory=eturnal`, eturnal currently logs to
    `/var/log/eturnal/eturnal.log`.
    
    [1]: https://github.com/processone/eturnal/blob/master/config/eturnal.service
    pmenzel committed May 17, 2021
    Configuration menu
    Copy the full SHA
    bd69e5c View commit details
    Browse the repository at this point in the history
  2. eturnal: Set env variable ETURNAL_ETC_PREFIX for configuration file

    With `ETURNAL_ETC_PREFIX=/project/eturnal` eturnal uses
    `/project/eturnal/etc/eturnal.yml`.
    pmenzel committed May 17, 2021
    Configuration menu
    Copy the full SHA
    4d2ce76 View commit details
    Browse the repository at this point in the history
  3. systemd/eturnal: Let epmd only listen on localhost

    From [issues #9 (*Document ERL_EPMD_ADDRESS and ERL_EPMD_PORT*)][1]:
    
    > === ERL_EPMD_ADDRESS ===
    >
    > On eturnal startup, an Erlang Port Mapper Daemon (epmd) service is spawned (if
    > not running already). This service listens on all available interfaces by
    > default. Setting the `ERL_EPMD_ADDRESS' environment variable tells epmd to
    > listen on the specified comma-seperated list of IP addresses instead. Note that
    > the IPv4 and IPv6 loopback addresses are implicitly added to this list if not
    > specified. It's usually recommended to set `ERL_EPMD_ADDRESS' to `127.0.0.1'
    > (e.g., by calling `systemctl edit eturnal' and adding an
    > `Environment="ERL_EPMD_ADDRESS=127.0.0.1"' line to the `[Service]' section).
    
    [1]: https://github.com/processone/eturnal/issues/9
    pmenzel committed May 17, 2021
    Configuration menu
    Copy the full SHA
    f95afb4 View commit details
    Browse the repository at this point in the history
  4. systemd/eturnal: Listen on all hosts

    This reverts commit f95afb4.
    
    Despite `net.ipv6.conf.all.disable_ipv6 = 1`, epmd tries to bind to the
    IPv6 loopback device, [which fails][1].
    
        eturnalctl[91982]: Protocol 'inet_tcp': register/listen error: econnrefused
    
    So, remove `ERL_EPMD_ADDRESS=127.0.0.1`, which is no problem, as our
    firewall blocks access to epmd from the internet.
    
    [1]: https://github.com/processone/eturnal/issues/11
    pmenzel committed May 17, 2021
    Configuration menu
    Copy the full SHA
    dd75a7b View commit details
    Browse the repository at this point in the history
  5. systemd/eturnal: Log to directory log in installation prefix

    `LogsDirectory=` does not support absolute paths:
    
        Nov 03 13:23:09 pitti.molgen.mpg.de systemd[1]: /etc/systemd/system/eturnal.service:20: LogsDirectory= path is absolute, ignoring: /project/eturnal/log
    
    Therefore, [do not set it all][1]:
    
    > If this environment variable is unset as well, a `log' directory is
    > created within the installation prefix.
    
    The directory `log` is a symbolic link to `/project/eturnal/log`
    
    [1]: https://github.com/processone/eturnal/blob/f9168eb70d2a1b8f7f110f4022985adb65175e55/doc/overview.edoc#L178-L188
    pmenzel committed May 17, 2021
    Configuration menu
    Copy the full SHA
    c0c8435 View commit details
    Browse the repository at this point in the history

Commits on May 18, 2021

  1. systemd/eturnal: Remove install section to prevent accidental install…

    …ation
    
    We use mxstartupctl to start the service.
    pmenzel committed May 18, 2021
    Configuration menu
    Copy the full SHA
    beb0617 View commit details
    Browse the repository at this point in the history
  2. systemd/eturnal: Use ProtectSystem=strict

    [`ProtectSystem=strict` mounts more directories as read-only.][1]
    
    [The upstream service unit only sets it to `full` to support older
    systemd releases.][2] systemd 242, currently shipped by MarIuX, support
    `strict`, so use it.
    
    [1]: https://www.freedesktop.org/software/systemd/man/systemd.exec.html#ProtectSystem=
    [2]: https://github.com/processone/eturnal/issues/14#issuecomment-843021648
    pmenzel committed May 18, 2021
    Configuration menu
    Copy the full SHA
    c9686d4 View commit details
    Browse the repository at this point in the history