diff options
author | Rob Crittenden <rcritten@redhat.com> | 2016-02-29 16:43:14 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2016-02-29 16:45:09 -0500 |
commit | ce5a624ca88bcccf1591265d26bc28d27e822da1 (patch) | |
tree | 01779aef1834048624c317ba83bba77caf61c70d | |
parent | ef90eb1b1e5b68aa53164813bd4a70697dcbef17 (diff) | |
download | mod_nss-ce5a624ca88bcccf1591265d26bc28d27e822da1.tar.gz mod_nss-ce5a624ca88bcccf1591265d26bc28d27e822da1.tar.xz mod_nss-ce5a624ca88bcccf1591265d26bc28d27e822da1.zip |
Check for test and netstat before trying to use them
These may not be available on all systems. Work around it best
we can. In the case of netstat this can be replaced by using
/dev/urandom or /dev/random instead and piping it through tr
to produce only ASCII strings.
-rwxr-xr-x | gencert.in | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -39,7 +39,11 @@ getFQDN() { return fi defhost=`hostname` - hosthost=`host $defhost | grep -v "not found" | awk '{print $1}'` + if [ -e /usr/bin/host -o -e /bin/host ]; then + hosthost=`host $defhost | grep -v "not found" | awk '{print $1}'` + else + hosthost='' + fi for host in $defhost $hosthost `hostname -f` `hostname -a` ; do len=`echo $host | wc -c` if [ $len -gt $max ]; then @@ -124,7 +128,11 @@ function generate_server_sni_cert { echo "#####################################################################" echo "Generating $NICKNAME server certificate request" echo "#####################################################################" - (ps -elf; date; netstat -a) > $DEST/noise + if [ -e /dev/urandom ]; then + (ps -elf; date; dd if=/dev/urandom count=1 bs=1024 2>/dev/null| tr -dc 'a-zA-Z0-9') > $DEST/noise + else + (ps -elf; date; dd if=/dev/random count=1 bs=128 2>/dev/null| tr -dc 'a-zA-Z0-9') > $DEST/noise + fi $CERTUTIL -R -d $DBDIR \ -s "$SERVER_DN" \ -o $DEST/tmpcertreq \ |