2020-05-26 02:38:07 +00:00
|
|
|
# Barrier Server service barriers-@BARRIER_VERSION@
|
|
|
|
#
|
|
|
|
# This file is part of Barrier.
|
|
|
|
#
|
|
|
|
# This is a systemd template service for running the barriers server using a
|
|
|
|
# specific port or IP. Instances are started using @[ip]:<port>. For example:
|
|
|
|
#
|
|
|
|
# Starting:
|
|
|
|
# systemctl start barriers@0.0.0.0:24800
|
|
|
|
# or:
|
|
|
|
# systemctl start barriers@:24800
|
|
|
|
#
|
|
|
|
# Enabling:
|
|
|
|
# systemctl enable barriers@0.0.0.0:24800
|
|
|
|
#
|
2020-05-26 23:26:26 +00:00
|
|
|
# SSL data is stored in /var/lib/barrier<instance>/barrier/SSL for each
|
2020-05-26 02:38:07 +00:00
|
|
|
# instance.
|
|
|
|
|
|
|
|
[Unit]
|
|
|
|
Description=Barrier Server listening on %I (Open-source KVM software)
|
|
|
|
Documentation=man:barriers(1) man:barrierc(1)
|
|
|
|
Documentation=https://github.com/debauchee/barrier/wiki
|
|
|
|
# Require network before starting barrierc
|
|
|
|
After=network-online.target
|
|
|
|
Wants=network-online.target
|
|
|
|
# Don't run server if client or another server is running
|
|
|
|
Conflicts=barrierc@.service barriers.service
|
2020-05-26 23:26:26 +00:00
|
|
|
# Sanity check that /var/lib exists
|
|
|
|
ConditionPathExists=/var/lib
|
2020-05-26 02:38:07 +00:00
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=exec
|
|
|
|
# Log level may be FATAL, ERROR, WARNING, NOTE, INFO, DEBUG, DEBUG1, DEBUG2
|
|
|
|
Environment=LOG_LEVEL=INFO
|
|
|
|
# Default display is :0
|
|
|
|
Environment=DISPLAY=:0
|
|
|
|
# Store SSL data in instance specific directories
|
2020-05-26 23:26:26 +00:00
|
|
|
Environment=XDG_DATA_HOME=/var/lib/barrier%i
|
2020-05-26 02:38:07 +00:00
|
|
|
# SSL data directory
|
2020-05-26 23:26:26 +00:00
|
|
|
Environment=CERT_DIR=/var/lib/barrier%i/barrier/SSL
|
2020-05-26 02:38:07 +00:00
|
|
|
|
|
|
|
# Create the certificate directory
|
|
|
|
ExecStartPre=mkdir -p ${CERT_DIR}
|
|
|
|
# Create the Barrier.pem certificate if it doesn't exist
|
|
|
|
ExecStartPre=sh -c "[ -f ${CERT_DIR}/Barrier.pem ] || openssl req -x509 -nodes -days 365 -subj '/CN=Barrier' -newkey rsa:2048 -text -keyout ${CERT_DIR}/Barrier.pem -out ${CERT_DIR}/Barrier.pem"
|
|
|
|
|
|
|
|
# Main executable
|
|
|
|
ExecStart=/usr/bin/barriers --enable-crypto --display ${DISPLAY} --debug ${LOG_LEVEL} --config /etc/barrier.conf --no-daemon --address %i
|
|
|
|
# Restart on fail
|
|
|
|
Restart=always
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
# Install to graphical target
|
|
|
|
WantedBy=graphical.target
|
|
|
|
DefaultInstance=:24800
|