Current File : //root/panel/modules/csr/code/csr.sh |
#!/bin/sh
domain=$1
organization=$2
department=$3
city=$4
state=$5
country=$6
echo $domain
echo $organization
echo $department
echo $city
echo $state
echo $country
csrdir="/etc/csr/"
if [ ! -d "$csrdir" ]
then
mkdir $csrdir
fi
dir="/etc/csr/$domain"
if [ ! -d "$dir" ]
then
mkdir $dir
fi
cd $dir
domain_log=/etc/csr/$domain/$domain.log
touch $domain_log
openssl req -new -newkey rsa:2048 -nodes -out $domain.csr -keyout $domain.key -subj "/C=$country/ST=$state/L=$city/O=$organization/OU=$department/CN=www.$domain" > $domain_log
tmpdir="/etc/csr/tmp"
if [ ! -d "$tmpdir" ]
then
mkdir $tmpdir
chown -R apache:apache $tmpdir
fi
comodo="/etc/csr/COMODO"
if [ ! -d "$comodo" ]
then
mkdir $comodo
fi
comodo_file="/etc/csr/COMODO/COMODOCABUNDLE.crt"
if [ ! -f "$comodo_file" ]
then
cd $comodo
wget http://hostingraja.info/api/crtbundle/COMODOCABUNDLE.crt
fi