Take only the first hostname if there are aliases
authorJoni Hahkala <joni.hahkala@cern.ch>
Wed, 15 Feb 2012 14:33:18 +0000 (14:33 +0000)
committerJoni Hahkala <joni.hahkala@cern.ch>
Wed, 15 Feb 2012 14:33:18 +0000 (14:33 +0000)
bin/generate-test-certificates.sh

index 20a18f4..854e98e 100755 (executable)
@@ -999,7 +999,7 @@ function create_all {
        TYPE="altname3"
        CTYPE="altname"
        
-       create_cert $CERT_DIR/${catype}_${TYPE}_2 "$catype altname without hosname/CN=$hostname_full" ${TYPE} $DAYS
+       create_cert $CERT_DIR/${catype}_${TYPE}_2 "$catype altname without hostname/CN=$hostname_full" ${TYPE} $DAYS
        
        TYPE="server"
        CTYPE="server2"
@@ -1224,8 +1224,8 @@ openssl version
 
 #get full hostname
 hostname_space=`hostname -A 2>/dev/null || hostname -f`
-#remove trailing space
-hostname_full=`echo $hostname_space`
+#remove trailing space, take fist one if there are aliases
+hostname_full=`echo $hostname_space | awk '{print $1}'`
 echo host name is [$hostname_full]
 
 export DNS_HOSTNAME=DNS:$hostname_full