From: Alan T. DeKok Date: Wed, 17 Jul 2024 14:57:55 +0000 (-0400) Subject: make it more portable. Address #5375 X-Git-Tag: release_3_2_6~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b77c4e295a55451efea4ff44029a2551c855386c;p=thirdparty%2Ffreeradius-server.git make it more portable. Address #5375 --- diff --git a/src/main/radsecret b/src/main/radsecret index 2a03a2e7bce..0c344a0daa8 100755 --- a/src/main/radsecret +++ b/src/main/radsecret @@ -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