Add create_ssl script

This commit is contained in:
Greg Hellings
2024-02-13 23:01:01 -06:00
parent c50b658b5a
commit ab1be19b86
3 changed files with 41 additions and 8 deletions
+1
View File
@@ -33,5 +33,6 @@
networking.hostName = "genesis"; # Define your hostname.
environment.systemPackages = with pkgs; [
awscli2
create_ssl
];
}
+28
View File
@@ -0,0 +1,28 @@
{ writeShellScriptBin, openssl, ...}:
writeShellScriptBin "create_ssl" ''
set -e -o pipefail
name="''${1}"
root_key="''${2}"
function usage {
echo "USAGE: create_ssl <cert name> <root path>"
}
if [ -z "''${name}" ]; then
usage
exit 1
fi
if [ -z "''${root_key}" ]; then
usage
exit 1
fi
# Create the certificate key
${openssl}/bin/openssl ecparam -out "''${name}.key" -name prime256v1 -genkey
# Create the CSR
${openssl}/bin/openssl req -name -sha256 -key "''${name}.key" -out "''${name}.csr"
# Sign it
${openssl}/bin/openssl x509 -req -in "''${name}.csr" -CA "''${root_key}.crt" -CAkey "''${root_key}.key" -CAcreateserial -out "''${name}.crt" -days 3650 -sha256
''
+12 -8
View File
@@ -47,9 +47,20 @@ in rec {
})
];
# My own packages
aacs = prev.callPackage ./aacs.nix {};
brew = prev.callPackage ./homebrew.nix {};
configure_aws_creds = prev.callPackage ./configure_aws_creds.nix {};
create_ssl = prev.callPackage ./create_ssl.nix {};
hms = prev.callPackage ./hms {
pkgs = final.pkgs;
};
enwiki-dump = prev.callPackage ./enwiki-dump.nix {};
setup-ssh = prev.callPackage ./setup-ssh {
pkgs = final.pkgs;
};
# Overrides of packages
brew = prev.callPackage ./homebrew.nix {};
copier = (if is2405 then prev.copier.overridePythonAttrs (old: {
version = "9.1.0";
src = final.fetchFromGitHub {
@@ -60,18 +71,11 @@ in rec {
postFetch = "rm $out/tests/demo/doc/ma*ana.txt";
};
}) else prev.copier);
enwiki-dump = prev.callPackage ./enwiki-dump.nix {};
hms = prev.callPackage ./hms {
pkgs = final.pkgs;
};
inject = prev.callPackage ./inject.nix { inherit (final) pkgs; };
libbluray-custom = prev.libbluray.override {
withAACS = true;
withBDplus = true;
};
setup-ssh = prev.callPackage ./setup-ssh {
pkgs = final.pkgs;
};
template = prev.callPackage ./template.nix { };
handbrake = prev.handbrake.override {
libbluray = libbluray-custom;