mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
Create v-create-ip-ssl
This commit is contained in:
parent
f6680abdea
commit
4b61f02b43
1 changed files with 37 additions and 0 deletions
37
bin/v-create-ip-ssl
Normal file
37
bin/v-create-ip-ssl
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
echo usage: v-create-ip-ssl USER DOMAIN
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
user=$1
|
||||||
|
domain=$2
|
||||||
|
|
||||||
|
echo "Script ran with: $user $domain" >> /usr/local/vesta/log/v-create-ip-ssl.log
|
||||||
|
|
||||||
|
grepr=$(grep -c "^$domain:" /etc/exim4/virtual/interfaces)
|
||||||
|
if [ $grepr -ge 1 ]; then
|
||||||
|
grepr=$(grep "^$domain:" /etc/exim4/virtual/interfaces)
|
||||||
|
ip=${grepr/$domain: /}
|
||||||
|
if [ ! -z "$ip" ]; then
|
||||||
|
echo "Processinng $domain" >> /usr/local/vesta/log/v-create-ip-ssl.log
|
||||||
|
echo "IP = $ip" >> /usr/local/vesta/log/v-create-ip-ssl.log
|
||||||
|
cp /home/$user/conf/web/ssl.$domain.pem /usr/local/vesta/ssl/$ip.crt
|
||||||
|
cp /home/$user/conf/web/ssl.$domain.key /usr/local/vesta/ssl/$ip.key
|
||||||
|
|
||||||
|
exim_user="exim";
|
||||||
|
check_exim_username=$(grep -c '^Debian-exim:' /etc/passwd)
|
||||||
|
if [ "$check_exim_username" -eq 1 ]; then
|
||||||
|
exim_user="Debian-exim"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Assign exim permissions
|
||||||
|
chown $exim_user:mail /usr/local/vesta/ssl/$ip.crt
|
||||||
|
chown $exim_user:mail /usr/local/vesta/ssl/$ip.key
|
||||||
|
|
||||||
|
service exim4 restart
|
||||||
|
service dovecot restart
|
||||||
|
echo "Done." >> /usr/local/vesta/log/v-create-ip-ssl.log
|
||||||
|
fi
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue