diff --git a/flake.nix b/flake.nix index 767ed1b..94505cf 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,7 @@ packages."${system}" = { h3c = import ./h3c { inherit pkgs; }; + qzsec = import ./qzsec { inherit pkgs; }; }; nixosModules = diff --git a/qzsec/access-client/access-client b/qzsec/access-client/access-client new file mode 100644 index 0000000..2bed3d6 --- /dev/null +++ b/qzsec/access-client/access-client @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +URL="$1" + +ARGS=$(echo $URL | sed 's|accessclient://||' | base64 -d | minideflate -d ) + +APP=$(echo $ARGS | jq -r.app) +if [ "$APP" != "putty" ]; then + echo "Unsupported app, should be putty." + sleep 5 + exit 1 +fi + +HOSTNAME=$(echo $ARGS | jq -r .hn) +PORT_NUM=$(echo $ARGS | jq -r .pn) +USERNAME=$(echo $ARGS | jq -r .un) +PASSWORD=$(echo $ARGS | jq -r .pw) + +passh -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o HostKeyAlgorithms=+ssh-rsa -p $PORT_NUM $USERNAME@$HOSTNAME \ No newline at end of file diff --git a/qzsec/access-client/access-client.desktop b/qzsec/access-client/access-client.desktop new file mode 100644 index 0000000..3ef33c7 --- /dev/null +++ b/qzsec/access-client/access-client.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Type=Application +Version=@VERSION +Name=Access Client +GenericName=Access Client +Comment=Resource monitor that shows usage and stats for processor, memory, disks, network and processes +Comment[zh_CN]=齐治、H3C 运维审计系统连接代理 +Terminal=true +Categories=System;ConsoleOnly; +Keywords=system;h3c; +NoDisplay=true +Exec=@EXEC +MimeType=x-scheme-handler/accessclient \ No newline at end of file diff --git a/qzsec/access-client/package.nix b/qzsec/access-client/package.nix new file mode 100644 index 0000000..fa222ad --- /dev/null +++ b/qzsec/access-client/package.nix @@ -0,0 +1,33 @@ +{ + stdenv, + + jq, + zlib-ng, + passh, + ... +}: +let + bin = ./access-client; + desktop = ./access-client.desktop; +in +stdenv.mkDerivation rec { + pname = "access-client"; + version = "1.0.0"; + + buildInputs = [ + jq + zlib-ng + passh + ]; + + phases = [ "installPhase" ]; + + installPhase = '' + mkdir -p $out/bin + cp -rv "${bin}" $out/bin + chmod +x $out/bin/* + + mkdir -p $out/share/applications + cp -rv "${desktop}" $out/share/applications + ''; +} diff --git a/qzsec/default.nix b/qzsec/default.nix new file mode 100644 index 0000000..ce342b5 --- /dev/null +++ b/qzsec/default.nix @@ -0,0 +1,4 @@ +{ pkgs }: +{ + access-client = pkgs.callPackage ./access-client/package.nix { }; +}