summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2018-09-11 22:11:20 +0200
committertv <tv@krebsco.de>2018-09-11 22:11:20 +0200
commit312eb6e569a3b61325fcf15112500fbf0face65a (patch)
treee23db39240a1135627cba1236bde7ee23465f979
parent4fc5cf354f386d495918aec22df9b482e8676555 (diff)
syncthing-device-id: use openssl
-rw-r--r--krebs/5pkgs/simple/syncthing-device-id.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/krebs/5pkgs/simple/syncthing-device-id.nix b/krebs/5pkgs/simple/syncthing-device-id.nix
index 9fe2b8ffb..9533800fd 100644
--- a/krebs/5pkgs/simple/syncthing-device-id.nix
+++ b/krebs/5pkgs/simple/syncthing-device-id.nix
@@ -1,4 +1,4 @@
-{ writePython2Bin }:
+{ openssl, writePython2Bin }:
writePython2Bin "syncthing-device-id" {
flakeIgnore = [
@@ -24,7 +24,12 @@ writePython2Bin "syncthing-device-id" {
return alphabet[-result]
def main(incert):
- der_data = subprocess.check_output(['openssl', 'x509', '-outform', 'DER'], stdin=incert)
+ der_data = subprocess.check_output([
+ '${openssl}/bin/openssl',
+ 'x509',
+ '-outform',
+ 'DER',
+ ], stdin=incert)
data_hash = hashlib.sha256(der_data)
b32_hash = base64.b32encode(data_hash.digest()).decode('ascii')