Zpkgs krebs: add hashPassword
This commit is contained in:
parent
13cc704c60
commit
311e837c91
@ -8,4 +8,5 @@ pkgs //
|
|||||||
{
|
{
|
||||||
github-hosts-sync = callPackage ./github-hosts-sync.nix {};
|
github-hosts-sync = callPackage ./github-hosts-sync.nix {};
|
||||||
github-known_hosts = callPackage ./github-known_hosts.nix {};
|
github-known_hosts = callPackage ./github-known_hosts.nix {};
|
||||||
|
hashPassword = callPackage ./hashPassword.nix {};
|
||||||
}
|
}
|
||||||
|
16
Zpkgs/krebs/hashPassword.nix
Normal file
16
Zpkgs/krebs/hashPassword.nix
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
pkgs.writeScriptBin "hashPassword" ''
|
||||||
|
#! /bin/sh
|
||||||
|
# usage: hashPassword
|
||||||
|
set -euf
|
||||||
|
|
||||||
|
export PATH=${lib.makeSearchPath "bin" (with pkgs; [
|
||||||
|
coreutils
|
||||||
|
mkpasswd
|
||||||
|
openssl
|
||||||
|
])}
|
||||||
|
|
||||||
|
salt=$(openssl rand -base64 16 | tr -d '+=' | head -c 16)
|
||||||
|
exec mkpasswd -m sha-512 -S "$salt"
|
||||||
|
''
|
Loading…
Reference in New Issue
Block a user