]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
make it more portable. Address #5375
authorAlan T. DeKok <aland@freeradius.org>
Wed, 17 Jul 2024 14:57:55 +0000 (10:57 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 17 Jul 2024 14:57:55 +0000 (10:57 -0400)
src/main/radsecret

index 2a03a2e7bce3979aaca1908314be7be7511044b4..0c344a0daa899b725c5c844c20c6c92e2e3d33b2 100755 (executable)
@@ -1,7 +1,12 @@
-#!/usr/bin/env perl
+#!/bin/sh
 #
 #  A tool which generates strong shared secrets.
 #
-use Convert::Base32;
-use Crypt::URandom();
-print join('-', unpack("(A4)*", lc encode_base32(Crypt::URandom::urandom(12)))), "\n";
+openssl rand -base64 12 2>/dev/null && exit 0
+
+(dd if=/dev/random bs=1 count=12 | base64 2>/dev/null) && exit 0
+
+(dd if=/dev/random bs=1 count=12 | base32 2>/dev/null) && exit 0
+
+echo "Failed finding 'openssl', 'base64', or 'base32' tools".
+exit 1