about summary refs log tree commit diff
path: root/arunisaac/openconnect.scm
blob: 45238e49917016428b1771425f4d55bf772372c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
;;; guix-arunisaac --- arunisaac's Guix odds and ends
;;; Copyright © 2025 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; 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
;;; <https://www.gnu.org/licenses/>.

(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-poetry-core python-toml))
  #:use-module ((gnu packages python-crypto)
                #:select (python-keyring python-pyotp))
  #:use-module ((gnu packages python-web) #:select (python-requests))
  #:use-module ((gnu packages python-xyz)
                #:select (python-attrs python-colorama
                          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 git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages))

(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)))