Skip to content

Commit

Permalink
Merge pull request #219 from Raphux/master
Browse files Browse the repository at this point in the history
Added systemd service support
  • Loading branch information
Raphux committed Nov 3, 2017
2 parents 83b1da2 + 42d9aec commit d159e83
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
14 changes: 7 additions & 7 deletions tools/openssl-for-passhportd.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ authorityKeyIdentifier = keyid:always,issuer
[req_distinguished_name]

[ alternate_names ]
DNS.1 = 127.0.0.1
DNS.2 = localhost
DNS.3 = passhport
DNS.4 = bastion
DNS.5 = bastion.passhport.org
DNS.6 = bastion.librit.fr
DNS.7 = passhport.librit.fr
DNS.1 = localhost
DNS.2 = passhport
DNS.3 = passhport.passhport.org
DNS.4 = passhport.librit.fr
DNS.5 = bastion
DNS.6 = bastion.passhport.org
DNS.7 = bastion.librit.fr
21 changes: 13 additions & 8 deletions tools/passhport-install-script-debian-8-9.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,18 @@ openssl req -new -key "/home/passhport/certs/key.pem" \
-days 365 \
-sha256 \
-extensions v3_req
echo 'Do you want to launch passhportd daemon ? (y/N)'
read ANSWER
if [ "${ANSWER}" == 'y' ] || [ "${ANSWER}" == 'yes' ]
# We try to detect if we run on a systemd OS.
if (stat /proc/1/exe | head -n 1 | grep systemd &>/dev/null)
then
su - passhport -c "/home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/passhportd"
else
echo 'To launch passhportd, run one of the following :'
echo '- As root : # su - passhport -c "/home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/passhportd"'
echo '- As passhport user : $ /home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/passhportd'
echo '##############################################################'
echo '# Importing passhportd service in systemd…'
echo '##############################################################'
cp /home/passhport/passhport/tools/passhportd.service /etc/systemd/system/passhportd.service
systemctl daemon-reload
systemctl enable passhportd
echo "passhportd has been enabled at startup."
systemctl start passhportd
echo "passhportd has been started."
echo 'Please use systemctl to start/stop service.'
fi

12 changes: 12 additions & 0 deletions tools/passhportd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=passhportd server
After=network.target

[Service]
User=passhport
ExecStart=/home/passhport/passhport-run-env/bin/python /home/passhport/passhport/passhportd/passhportd
WorkingDirectory=~
Restart=on-failure

[Install]
WantedBy=multi-user.target

0 comments on commit d159e83

Please sign in to comment.