;;; guix-arunisaac --- arunisaac's Guix odds and ends ;;; Copyright © 2025, 2026 Arun Isaac ;;; ;;; This file is part of guix-arunisaac. ;;; ;;; guix-arunisaac is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as ;;; published by the Free Software Foundation, either version 3 of the ;;; License, or (at your option) any later version. ;;; ;;; guix-arunisaac is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with guix-arunisaac. If not, see ;;; . (define-module (arunisaac openconnect) #:use-module ((gnu packages check) #:select (python-pytest python-pytest-asyncio python-pytest-httpserver)) #:use-module ((gnu packages freedesktop) #:select (python-pyxdg)) #:use-module ((gnu packages python-build) #:select (python-colorama python-jaraco-classes python-poetry-core python-setuptools python-setuptools-scm python-toml python-wheel)) #:use-module ((gnu packages python-crypto) #:select (python-keyring python-pyotp python-secretstorage)) #:use-module ((gnu packages python-web) #:select (python-requests python-urllib3)) #:use-module ((gnu packages python-xyz) #:select (python-attrs python-charset-normalizer python-prompt-toolkit python-pysocks python-structlog)) #:use-module ((gnu packages qt) #:select (python-pyqt-6 python-pyqtwebengine-6)) #:use-module ((gnu packages vpn) #:select (openconnect)) #:use-module ((gnu packages xml) #:select (python-lxml-4.9)) #:use-module (guix build-system pyproject) #:use-module ((guix build-system python) #:hide (pypi-uri)) #:use-module (guix download) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages)) (define-public python-keyring-23.9 (package (inherit python-keyring) (version "23.9.3") (source (origin (method url-fetch) (uri (pypi-uri "keyring" version)) (sha256 (base32 "19f4jpsxng9sjfqi8ww5hgg196r2zh1zb8g71wjr1xa27kc1vc39")))) (arguments (list #:tests? #f)) (native-inputs (list python-toml python-pytest python-setuptools python-setuptools-scm python-wheel)) (propagated-inputs (list python-jaraco-classes python-secretstorage)))) (define-public openconnect-sso (package (name "openconnect-sso") ;; 0.8.0 was released in 2021, the latest update on master HEAD is ;; from 2023. (properties '((commit . "94128073ef49acb3bad84a2ae19fdef926ab7bdf") (revision . "0"))) (version (git-version "0.8.0" (assoc-ref properties 'revision) (assoc-ref properties 'commit))) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/vlaci/openconnect-sso") (commit (assoc-ref properties 'commit)))) (file-name (git-file-name name version)) (sha256 (base32 "08cqd40p9vld1liyl6qrsdrilzc709scyfghfzmmja3m1m7nym94")))) (build-system pyproject-build-system) (arguments `(#:phases (modify-phases %standard-phases (add-after 'unpack 'use-poetry-core (lambda _ ;; Patch to use the core poetry API. (substitute* "pyproject.toml" (("poetry.masonry.api") "poetry.core.masonry.api")))) (add-after 'unpack 'patch-openconnect (lambda* (#:key inputs #:allow-other-keys) (substitute* "openconnect_sso/app.py" (("\"openconnect\"") (string-append "\"" (search-input-file inputs "/sbin/openconnect") "\"")))))))) (inputs (list openconnect python-attrs python-colorama python-keyring python-lxml-4.9 python-prompt-toolkit python-pyotp python-pyqt-6 python-pyqtwebengine-6 python-pysocks python-pyxdg python-requests python-structlog python-toml)) (native-inputs (list python-poetry-core python-pytest python-pytest-asyncio python-pytest-httpserver)) (home-page "https://github.com/vlaci/openconnect-sso") (synopsis "OpenConnect wrapper script supporting Azure AD (SAMLv2)") (description "This package provides a wrapper script for OpenConnect supporting Azure AD (SAMLv2) authentication to Cisco SSL-VPNs.") (license license:gpl3))) (define python-charset-normalizer-2.10 (package (inherit python-charset-normalizer) (version "2.1.0") (source (origin (method url-fetch) (uri (pypi-uri "charset-normalizer" version)) (sha256 (base32 "04zlajr77f6c7ai59l46as1idi0jjgbvj72lh4v5wfpz2s070pjp")))) (build-system python-build-system) (arguments (list #:tests? #f)))) (define python-urllib3-1.26 (package (inherit python-urllib3) (version "1.26.15") (source (origin (method url-fetch) (uri (pypi-uri "urllib3" version)) (sha256 (base32 "01dkqv0rsjqyw4wrp6yj8h3bcnl7c678qkj845596vs7p4bqff4a")))) (build-system python-build-system))) (define python-requests-2.28 (package (inherit python-requests) (name "python-requests") (version "2.28.1") (source (origin (method url-fetch) (uri (pypi-uri "requests" version)) (sha256 (base32 "10vrr7bijzrypvms3g2sgz8vya7f9ymmcv423ikampgy0aqrjmbw")))) (build-system python-build-system) (arguments (list #:tests? #f)) (native-inputs (modify-inputs (package-native-inputs python-requests) (delete "python-pytest" "python-pytest-mock"))) (propagated-inputs (modify-inputs (package-propagated-inputs python-requests) (replace "python-charset-normalizer" python-charset-normalizer-2.10) (replace "python-urllib3" python-urllib3-1.26))))) ;; Login to the UTHSC VPN fails with an SSLV3_ALERT_HANDSHAKE_FAILURE on newer ;; python-requests. (define openconnect-sso-uthsc (package (inherit openconnect-sso) (name "openconnect-sso-uthsc") (inputs (modify-inputs (package-inputs openconnect-sso) (replace "python-requests" python-requests-2.28)))))