mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-03 04:25:52 -05:00
Verify the rebuilt VectorCraft Flatpak client negotiates TLS
This commit is contained in:
1 parent
842711853e
commit
bca9da3779
1 file changed
+80
@@ -0,0 +1,80 @@
|
||||
name: VectorCraft Flatpak IPPS verification
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [verify/vectorcraft-ipptool-flatpak]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
package:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: storytold/craft-common-actions/actions/install-apt-packages@main
|
||||
with:
|
||||
packages: flatpak flatpak-builder appstream librsvg2-common openssl
|
||||
- name: Build and install the release bundle with the new manifest
|
||||
env:
|
||||
VECTORCRAFT_VERSION: "0.25.1"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl --fail --location --silent --show-error --retry 3 \
|
||||
https://github.com/storytold/vectorcraft/releases/download/v0.25.1/vectorcraft-0.25.1-linux-x86_64.tar.gz \
|
||||
-o "$RUNNER_TEMP/vectorcraft-0.25.1-linux-x86_64.tar.gz"
|
||||
bash packaging/linux/flatpak-bundle.sh "$RUNNER_TEMP/vectorcraft-0.25.1-linux-x86_64.tar.gz"
|
||||
- name: Use the bundled CUPS client to negotiate a TLS session
|
||||
run: |
|
||||
set -euo pipefail
|
||||
app=ai.storyteller.vectorcraft
|
||||
flatpak run --command=sh "$app" -c 'test "$(command -v ipptool)" = /app/bin/ipptool && test -x /app/libexec/cups/ipptool'
|
||||
fixture="$RUNNER_TEMP/fixture"
|
||||
mkdir "$fixture"
|
||||
openssl req -x509 -newkey rsa:2048 -nodes -days 1 -subj /CN=127.0.0.1 \
|
||||
-addext subjectAltName=IP:127.0.0.1 -keyout "$fixture/key.pem" -out "$fixture/cert.pem"
|
||||
python3 -u - "$fixture" > "$fixture/tls.log" 2>&1 <<'PY' &
|
||||
import pathlib
|
||||
import socket
|
||||
import ssl
|
||||
import sys
|
||||
|
||||
folder = pathlib.Path(sys.argv[1])
|
||||
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
||||
context.load_cert_chain(folder / "cert.pem", folder / "key.pem")
|
||||
with socket.socket() as sock:
|
||||
sock.bind(("127.0.0.1", 0))
|
||||
sock.listen()
|
||||
sock.settimeout(15)
|
||||
(folder / "port").write_text(str(sock.getsockname()[1]))
|
||||
connection, _ = sock.accept()
|
||||
with connection, context.wrap_socket(connection, server_side=True) as tls:
|
||||
print(f"Negotiated {tls.version()}")
|
||||
PY
|
||||
server=$!
|
||||
trap 'kill "$server" 2>/dev/null || true' EXIT
|
||||
for i in {1..50}; do
|
||||
if test -s "$fixture/port"; then break; fi
|
||||
sleep 0.1
|
||||
done
|
||||
port=$(cat "$fixture/port")
|
||||
flatpak run --command=sh "$app" -c '
|
||||
query=$(mktemp)
|
||||
trap "rm -f -- \"$query\"" EXIT
|
||||
cat > "$query" <<"IPP"
|
||||
{
|
||||
OPERATION Get-Printer-Attributes
|
||||
GROUP operation-attributes-tag
|
||||
ATTR charset attributes-charset utf-8
|
||||
ATTR language attributes-natural-language en
|
||||
ATTR uri printer-uri $uri
|
||||
STATUS successful-ok
|
||||
}
|
||||
IPP
|
||||
ipptool -S -T 2 -t -v "$1" "$query" || true
|
||||
' sh "ipps://127.0.0.1:$port/printers/fixture"
|
||||
wait "$server"
|
||||
grep -E '^Negotiated TLSv1\.[23]$' "$fixture/tls.log"
|
||||
Reference in new issue
Block a user