mirror of
https://github.com/ben-grande/qusal.git
synced 2025-02-11 20:48:43 -05:00
![Ben Grande](/assets/img/avatar_default.png)
- Document preferred method for socket use depending on use case; - Fix Github web-flow key; - Standardize naming of services; - Use sys-ssh in ansible formula; - Start services conditionally with Qubes Service and evaluated by systemd ConditionPathExists= instead of installing on a per qube basis with rc.local scripts; - Change Qusal services to "qusal-" prefix instead of "qubes-" prefix. Fixes: https://github.com/ben-grande/qusal/issues/80 Fixes: https://github.com/ben-grande/qusal/issues/79
31 lines
795 B
Bash
31 lines
795 B
Bash
#!/bin/sh
|
|
|
|
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
set -eu
|
|
|
|
untrusted_agent="$QREXEC_SERVICE_ARGUMENT"
|
|
|
|
if test -z "${untrusted_agent}"; then
|
|
echo "Agent name is empty" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! (echo "${untrusted_agent}" | grep -q "^[A-Za-z0-9][A-Za-z0-9_.-]\+$")
|
|
then
|
|
die "Forbidden characters in agent name. Allowed chars: letters, numbers, hyphen, underscore and dot. It cannot begin with hyphen, underscore or dot"
|
|
fi
|
|
|
|
## Length arbitrarily set.
|
|
if test "${#untrusted_agent}" -gt 128; then
|
|
die "Repository name is too long: ${#untrusted_agent}"
|
|
fi
|
|
|
|
agent="${untrusted_agent}"
|
|
socket="/tmp/qusal-ssh-agent/${agent}.sock"
|
|
|
|
qvm-ssh-agent add "${agent}" >/dev/null
|
|
exec socat STDIO UNIX-CLIENT:"${socket}"
|