Install Trigger Client on OpenBSD

OpenBSD 7.9, i686 / amd64

Application location: /opt/trigger_cl

1 Deploy the Trigger Client to /opt/trigger_cl

Create the install directory, copy the binary and config.ini into it, and mark the executable runnable. The rc.d wrapper expects it exactly here.


doas mkdir -p /opt/trigger_cl
doas cp trigger_cl config.ini /opt/trigger_cl/
doas chmod +x /opt/trigger_cl/trigger_cl
    
2 Point the client at the server

Edit config.ini and fill in the [server] section. These two lines are the only required change before first start.


doas vi /opt/trigger_cl/config.ini

# in section [server] set
ip = trigger.itperfectservice.com
port = 9000
    
3 Generate the device key

Export a per-host key file and print the matching key string. Both are needed to pair this machine with the mobile app.


doas /opt/trigger_cl/trigger_cl --export-bin /opt/trigger_cl/key.bin
doas /opt/trigger_cl/trigger_cl --show-key
    
4 Register the key on your Android device

Hand the key material to your phone: the binary file onto the device, the printed string into your account. From now on the phone can issue commands to this host.

  1. Copy key.bin to your Android device.
  2. In the Trigger mobile app, add it under your account.
  3. Save the printed KEY-XXXXXXXXXXXXX string — it identifies this host in the mobile UI.
5 Install the rc.d script

Write a tiny rc.d wrapper that calls rc_cmd and tells rc.subr to background the process. 555 permissions let root execute it without accidental writes.


doas tee /etc/rc.d/trigger_cl > /dev/null <<'EOF'
#!/bin/ksh
#
# OpenBSD rc.d wrapper for trigger_cl.

daemon="/opt/trigger_cl/trigger_cl"
daemon_flags=""
daemon_user="root"
rc_bg=YES

. /etc/rc.d/rc.subr

rc_cmd $1
EOF
doas chmod 555 /etc/rc.d/trigger_cl
    
6 Enable autostart and start the daemon

rcctl enable records the service in rc.conf.local so it comes up at boot. rcctl start launches it right now.


doas rcctl enable trigger_cl
doas rcctl start trigger_cl
    
7 Verify it is running

rcctl check reports the current state of the service. OpenBSD routes rc.d stdout/stderr to /var/log/daemon, so tail it to watch the client talk to the server.


doas rcctl check trigger_cl
doas tail -f /var/log/daemon