Subversion Repositories ALCASAR

Rev

Rev 1934 | Rev 1961 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1934 Rev 1941
Line 52... Line 52...
52
	fi
52
	fi
53
}
53
}
54
 
54
 
55
function domainName() # change the domain name in the conf files
55
function domainName() # change the domain name in the conf files
56
{
56
{
57
 
-
 
58
	fqdn=$(openssl x509 -noout -subject -in $cert | sed -n '/^subject/s/^.*CN=//p' | cut -d'/' -f 1)
57
	fqdn=$(openssl x509 -noout -subject -in $cert | sed -n '/^subject/s/^.*CN=//p' | cut -d'/' -f 1)
59
 
58
 
60
        #check if there is a wildcard in $fqdn
59
        #check if there is a wildcard in $fqdn
61
        mystar='*'
-
 
62
        if [[ $fqdn == *"${mystar}"* ]];
60
        if [[ $fqdn == *"*"* ]];
63
        then
61
        then
64
                hostname="alcasar"
62
                hostname="alcasar"
65
                fqdn=${fqdn/$mystar/$hostname}
63
                fqdn=${fqdn/"*"/$hostname}
66
        else
64
        else
67
                hostname=`echo $fqdn | awk -F'.' '{ print $1 }'`
65
                hostname=`echo $fqdn | awk -F'.' '{ print $1 }'`
68
        fi
66
        fi
69
        domain=`echo $fqdn | awk -F'.' '{$1="";OFS=".";print $0}' |sed 's/^.//'`
67
        domain=`echo $fqdn | awk -F'.' '{$1="";OFS=".";print $0}' |sed 's/^.//'`
70
        echo "fqdn=$fqdn hostname=$hostname domain=$domain"
68
        echo "fqdn=$fqdn hostname=$hostname domain=$domain"