change paths

fix hardcoded hostname
This commit is contained in:
Chris Simons 2020-05-26 16:26:26 -07:00
parent 591f1bf927
commit e413c46d78
3 changed files with 15 additions and 17 deletions

View File

@ -13,7 +13,7 @@
# Enabling: # Enabling:
# systemctl enable barrierc@myserver # systemctl enable barrierc@myserver
# #
# SSL Fingerprints are stored in /var/db/barrier@<hostname> for each client # SSL Fingerprints are stored in /var/lib/barrier@<hostname> for each client
# instance. # instance.
[Unit] [Unit]
@ -25,8 +25,6 @@ After=network-online.target
Wants=network-online.target Wants=network-online.target
# Don't run client if server is running # Don't run client if server is running
Conflicts=barriers.service Conflicts=barriers.service
# Sanity check that /var/db exists
ConditionPathExists=/var/db
[Service] [Service]
Type=exec Type=exec
@ -35,17 +33,19 @@ Environment=LOG_LEVEL=INFO
# Default display is :0 # Default display is :0
Environment=DISPLAY=:0 Environment=DISPLAY=:0
# Store fingerprints in instnace specific directories # Store fingerprints in instnace specific directories
Environment=XDG_DATA_HOME=/var/db/barrier@%i Environment=XDG_DATA_HOME=/var/lib/barrier@%i
# TrustedServers.txt Directory # TrustedServers.txt Directory
Environment=FP_DIR=/var/db/barrier@%i/barrier/SSL/Fingerprints Environment=FP_DIR=/var/lib/barrier@%i/barrier/SSL/Fingerprints
# Ensure the Fingerprints directory exists # Ensure the Fingerprints directory exists
ExecStartPre=mkdir -p "${FP_DIR}" ExecStartPre=mkdir -p "${FP_DIR}"
# This uses openssl commands and grep to get the server's key and # This uses openssl commands and grep to get the server's key and
# store it in the TrustedServers.txt file. OpenSSL is a requirement # store it in the TrustedServers.txt file. OpenSSL is a requirement
# for barrier on Linux so these commands should exist. # for barrier on Linux so these commands should exist. This will only
# work if using the default 24800 port (since the port number must be
# specified for openssl)
ExecStartPre=sh -c "[ -f "${FP_DIR}/TrustedServers.txt" ] ||\ ExecStartPre=sh -c "[ -f "${FP_DIR}/TrustedServers.txt" ] ||\
openssl s_client -connect big.home:24800 2>/dev/null |\ openssl s_client -connect %i:24800 2>/dev/null |\
openssl x509 -noout -sha1 -fingerprint |\ openssl x509 -noout -sha1 -fingerprint |\
grep -oE '([A-Z0-9]{2}:?){20}' > ${FP_DIR}/TrustedServers.txt" grep -oE '([A-Z0-9]{2}:?){20}' > ${FP_DIR}/TrustedServers.txt"

View File

@ -4,7 +4,7 @@
# #
# This systemd service starts barrier on the default port 24800. # This systemd service starts barrier on the default port 24800.
# #
# SSL data is stored in /var/db/barrier:24800/barrier/SSL # SSL data is stored in /var/lib/barrier:24800/barrier/SSL
[Unit] [Unit]
Description=Barrier Server listening on 24800 (Open-source KVM software) Description=Barrier Server listening on 24800 (Open-source KVM software)
@ -15,8 +15,6 @@ After=network-online.target
Wants=network-online.target Wants=network-online.target
# Don't run server if client or another instance is running # Don't run server if client or another instance is running
Conflicts=barrierc@.service barriers@.service Conflicts=barrierc@.service barriers@.service
# Sanity check that /var/db exists
ConditionPathExists=/var/db
[Service] [Service]
Type=exec Type=exec
@ -25,9 +23,9 @@ Environment=LOG_LEVEL=INFO
# Default display is :0 # Default display is :0
Environment=DISPLAY=:0 Environment=DISPLAY=:0
# Store SSL data in instance specific directories # Store SSL data in instance specific directories
Environment=XDG_DATA_HOME=/var/db/barrier:24800 Environment=XDG_DATA_HOME=/var/lib/barrier:24800
# SSL data directory # SSL data directory
Environment=CERT_DIR=/var/db/barrier:24800/barrier/SSL Environment=CERT_DIR=/var/lib/barrier:24800/barrier/SSL
# Create the certificate directory # Create the certificate directory
ExecStartPre=mkdir -p ${CERT_DIR} ExecStartPre=mkdir -p ${CERT_DIR}

View File

@ -13,7 +13,7 @@
# Enabling: # Enabling:
# systemctl enable barriers@0.0.0.0:24800 # systemctl enable barriers@0.0.0.0:24800
# #
# SSL data is stored in /var/db/barrier<instance>/barrier/SSL for each # SSL data is stored in /var/lib/barrier<instance>/barrier/SSL for each
# instance. # instance.
[Unit] [Unit]
@ -25,8 +25,8 @@ After=network-online.target
Wants=network-online.target Wants=network-online.target
# Don't run server if client or another server is running # Don't run server if client or another server is running
Conflicts=barrierc@.service barriers.service Conflicts=barrierc@.service barriers.service
# Sanity check that /var/db exists # Sanity check that /var/lib exists
ConditionPathExists=/var/db ConditionPathExists=/var/lib
[Service] [Service]
Type=exec Type=exec
@ -35,9 +35,9 @@ Environment=LOG_LEVEL=INFO
# Default display is :0 # Default display is :0
Environment=DISPLAY=:0 Environment=DISPLAY=:0
# Store SSL data in instance specific directories # Store SSL data in instance specific directories
Environment=XDG_DATA_HOME=/var/db/barrier%i Environment=XDG_DATA_HOME=/var/lib/barrier%i
# SSL data directory # SSL data directory
Environment=CERT_DIR=/var/db/barrier%i/barrier/SSL Environment=CERT_DIR=/var/lib/barrier%i/barrier/SSL
# Create the certificate directory # Create the certificate directory
ExecStartPre=mkdir -p ${CERT_DIR} ExecStartPre=mkdir -p ${CERT_DIR}