Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cato: init at 5.2.1.1 #339533

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22773,6 +22773,12 @@
githubId = 15948162;
name = "Yanni Papandreou";
};
yarekt = {
name = "Yarek T";
email = "[email protected]";
github = "yarektyshchenko";
githubId = 185304;
};
yarny = {
github = "Yarny0";
githubId = 41838844;
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,7 @@
./services/networking/bitlbee.nix
./services/networking/blockbook-frontend.nix
./services/networking/blocky.nix
./services/networking/cato-client.nix
./services/networking/centrifugo.nix
./services/networking/cgit.nix
./services/networking/charybdis.nix
Expand Down
48 changes: 48 additions & 0 deletions nixos/modules/services/networking/cato-client.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) mkIf mkEnableOption mkPackageOption;

cfg = config.services.cato-client;
in
{
options.services.cato-client = {
enable = mkEnableOption "cato-client service";
package = mkPackageOption pkgs "cato-client" { };
};

config = mkIf cfg.enable {
#users.users = {
# cato-client = {
# isSystemUser = true;
# group = "cato-client";
# description = "Cato Client daemon user";
# };
#};
users.groups = {
cato-client = { };
};

systemd.services.cato-client = {
enable = true;
description = "Cato Networks Linux client - connects tunnel to Cato cloud";
after = [ "network.target" ];

serviceConfig = {
Type = "simple";
#User = "cato-client";
User = "root";
Group = "cato-client";
ExecStart = "${cfg.package}/bin/cato-clientd systemd";
WorkingDirectory = "${cfg.package}";
Restart = "always";
};

wantedBy = [ "multi-user.target" ];
};
};
}
67 changes: 67 additions & 0 deletions pkgs/by-name/ca/cato-client/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
config,
pkgs,
lib,
...
}:
with pkgs;
stdenv.mkDerivation rec {
pname = "cato-client";
version = "5.2.1.1";

src = fetchurl {
url = "https://clients.catonetworks.com/linux/${version}/cato-client-install.deb";
sha256 = "sha256-0hUchaxaiKJth2ByQMFfjsCLi/4kl+SrNSQ33Y6r3WA=";
};

passthru.updateScript = writeScript "update-cato-client" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl pcre2 common-updater-scripts
set -eu -o pipefail
version="$(curl -sI https://clientdownload.catonetworks.com/public/clients/cato-client-install.deb | grep -Fi 'Location:' | pcre2grep -o1 '/(([0-9]\.?)+)/')"
update-source-version cato-client "$version"
'';

dontConfigure = true;

nativeBuildInputs = [
autoPatchelfHook
dpkg
];

buildInputs = [
libz
stdenv.cc.cc
];

unpackPhase = ''
runHook preUnpack
dpkg -x $src source
cd source
runHook postUnpack
'';

installPhase = ''
runHook preInstall
mkdir $out
mv usr/lib $out/lib
mkdir -p $out/bin
mv usr/sbin/* $out/bin
mv usr/bin/* $out/bin
runHook postInstall
'';

meta = {
description = "Cato Client is a lightweight agent that provides secure zero-trust access to resources everywhere";
homepage = "https://www.catonetworks.com/platform/cato-client/";
mainProgram = "cato-sdp";
license = lib.licenses.unfree;
maintainers = with maintainers; [ yarekt ];
platforms = [ "x86_64-linux" ];
};
}