Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD rc.d service script #883

Merged
merged 9 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [With Docker](#with-docker)
- [With Kubernetes](#with-kubernetes)
- [From a package repository](#from-a-package-repository)
- [With FreeBSD](#with-freebsd)
- [From source](#from-source)
- [Backend](#backend)
- [Frontend](#frontend)
Expand Down Expand Up @@ -208,6 +209,14 @@ Each package places lldap's configuration file at `/etc/lldap.toml` and offers
[systemd service](https://wiki.archlinux.org/title/systemd#Using_units)
`lldap.service` to (auto-)start and stop lldap.

### With FreeBSD

You can also install it as a rc.d service in FreeBSD, see
[FreeBSD-install.md](example_configs/freebsd/freebsd-install.md).

The rc.d script file
[rc.d_lldap](example_configs/freebsd/rc.d_lldap).

### From source

#### Backend
Expand Down
18 changes: 18 additions & 0 deletions example_configs/freebsd/freebsd-install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Extract lldap's [FreeBSD tar.gz](https://github.com/n-connect/rustd-hbbx/blob/main/x86_64-freebsd_lldap-0.5.1.tar.gz) under /usr/local/:

`tar -xvf x86_64-freebsd_lldap-0.5.1.tar.gz -C /usr/local/`

Move rc.d script into the right place:
`mv /usr/local/lldap_server/rc.d_lldap /usr/local/etc/rc.d/lldap`

Make your config, if your want to enable LDAPS, copy your server key and certification files, and set the owneship (currently www):

`cp /usr/local/lldap_server/lldap_config.docker_template.toml /usr/local/lldap_server/lldap_config..toml`

Enable lldap service in /etc/rc.conf:

`echo "lldap_enable=YES" > /etc/rc.conf`

Start your service:

`service lldap start`
27 changes: 27 additions & 0 deletions example_configs/freebsd/rc.d_lldap
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

# PROVIDE: lldap
# REQUIRE: DAEMON NETWORKING
# KEYWORD: shutdown

# Add the following lines to /etc/rc.conf to enable lldap:
# lldap_enable : set to "YES" to enable the daemon, default is "NO"

. /etc/rc.subr

name=lldap
rcvar=lldap_enable

lldap_chdir="/usr/local/lldap_server"

load_rc_config $name

lldap_enable=${lldap_enable:-"NO"}

logfile="/var/log/${name}.log"

procname=/usr/local/lldap_server/lldap
command="/usr/sbin/daemon"
command_args="-u www -o ${logfile} -t ${name} /usr/local/lldap_server/lldap run"

run_rc_command "$1"