summary refs log tree commit diff
path: root/nixos/modules/services/networking/globalprotect-vpn.nix
diff options
context:
space:
mode:
authorMatt McHenry <github@matt.mchenryfamily.org>2020-12-02 10:45:03 -0500
committerMatt McHenry <github@matt.mchenryfamily.org>2021-06-02 19:22:13 -0400
commite2b7cfedd6cf29db095dd469e4453c9138c87d1f (patch)
treef93775b38da2d66f65dbebe527f5404e753c8748 /nixos/modules/services/networking/globalprotect-vpn.nix
parent6160d7374f87af59555dc9f507075c471edf0c73 (diff)
downloadnixpkgs-e2b7cfedd6cf29db095dd469e4453c9138c87d1f.tar
nixpkgs-e2b7cfedd6cf29db095dd469e4453c9138c87d1f.tar.gz
nixpkgs-e2b7cfedd6cf29db095dd469e4453c9138c87d1f.tar.bz2
nixpkgs-e2b7cfedd6cf29db095dd469e4453c9138c87d1f.tar.lz
nixpkgs-e2b7cfedd6cf29db095dd469e4453c9138c87d1f.tar.xz
nixpkgs-e2b7cfedd6cf29db095dd469e4453c9138c87d1f.tar.zst
nixpkgs-e2b7cfedd6cf29db095dd469e4453c9138c87d1f.zip
globalprotect-openconnect: init at 1.2.6
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

Co-authored-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'nixos/modules/services/networking/globalprotect-vpn.nix')
-rw-r--r--nixos/modules/services/networking/globalprotect-vpn.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/globalprotect-vpn.nix b/nixos/modules/services/networking/globalprotect-vpn.nix
new file mode 100644
index 00000000000..80183f55d32
--- /dev/null
+++ b/nixos/modules/services/networking/globalprotect-vpn.nix
@@ -0,0 +1,43 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.globalprotect;
+
+  execStart = if cfg.csdWrapper == null then
+      "${pkgs.globalprotect-openconnect}/bin/gpservice"
+    else
+      "${pkgs.globalprotect-openconnect}/bin/gpservice --csd-wrapper=${cfg.csdWrapper}";
+in
+
+{
+  options.services.globalprotect = {
+    enable = mkEnableOption "globalprotect";
+
+    csdWrapper = mkOption {
+      description = ''
+        A script that will produce a Host Integrity Protection (HIP) report,
+        as described at <link xlink:href="https://www.infradead.org/openconnect/hip.html" />
+      '';
+      default = null;
+      example = literalExample "\${pkgs.openconnect}/libexec/openconnect/hipreport.sh";
+      type = types.nullOr types.path;
+    };
+  };
+
+  config = {
+    services.dbus.packages = [ pkgs.globalprotect-openconnect ];
+
+    systemd.services.gpservice = {
+      description = "GlobalProtect openconnect DBus service";
+      serviceConfig = {
+        Type="dbus";
+        BusName="com.yuezk.qt.GPService";
+        ExecStart=execStart;
+      };
+      wantedBy = [ "multi-user.target" ];
+      after = [ "network.target" ];
+    };
+  };
+}