Skip to content

Commit

Permalink
test interactive install
Browse files Browse the repository at this point in the history
  • Loading branch information
libvoid committed Aug 25, 2023
1 parent fe49c9a commit cd2fd13
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build & Release

on:
workflow_dispatch:
push:
tags:
- '*'
Expand Down
1 change: 1 addition & 0 deletions packaging/etc/systemd/system/sshportal.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RestartSec=10s
StandardOutput=append:/var/log/sshportal/audit/audit.log
LogsDirectory=sshportal
StateDirectory=sshportal
Environment=SSHPORTAL_DB_DRIVER=sqlite3
Environment=SSHPORTAL_LOGS_LOCATION=/var/log/sshportal/session
Environment=SSHPORTAL_DATABASE_URL=/var/lib/sshportal/sshportal.db
ExecStartPre=mkdir -p /var/log/sshportal/audit
Expand Down
13 changes: 13 additions & 0 deletions packaging/postinstall.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#!/bin/sh

set -e

printf "Use mariadb as database instead of Sqlite [y/N]: "
read -r

if [ "$REPLY" = 'y' ]; then
useradd -rd /nonexistent -s /usr/sbin/nologin sshportal # can't use systemd dynamic user to access the unix socket
apt-get install -y mariadb-server
mariadb -e "CREATE DATABASE sshportal CHARACTER SET utf8; grant all on sshportal.* to 'sshportal'@'localhost' identified via unix_socket;" || true
sed -i -r 's/Environment=SSHPORTAL_DB_DRIVER=.*/Environment=SSHPORTAL_DB_DRIVER=mysql/' /etc/systemd/system/sshportal.service
sed -i -r 's|Environment=SSHPORTAL_DATABASE_URL=.*|Environment=SSHPORTAL_DATABASE_URL=sshportal@unix(/run/mysqld/mysqld.sock)/sshportal?charset=utf8&parseTime=true&loc=Local|' /etc/systemd/system/sshportal.service
fi

mkdir -p /var/log/sshportal/audit
echo "0 1 * * 0 root find /var/log/sshportal/session/ -ctime +365 -type f -delete" > /etc/cron.d/sshportal
systemctl daemon-reload
Expand Down

0 comments on commit cd2fd13

Please sign in to comment.