Skip to content

Commit f7da8ec

Browse files
committed
Added Helper scripts to setup ispconfig in a openvz enviroment. Thanks to Carlos Alocen for providing these scripts.
1 parent 78a9cd6 commit f7da8ec

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# diff openssl.cnf /usr/lib/ssl/openssl.cnf
2+
68c68
3+
< default_days = 3653 # how long to certify for
4+
---
5+
> default_days = 365 # how long to certify for
6+
125c125
7+
< countryName_default = YOURCOUNTRY
8+
---
9+
> countryName_default = AU
10+
130c130
11+
< stateOrProvinceName_default = YOURPROVINCE
12+
---
13+
> stateOrProvinceName_default = Some-State
14+
135c135
15+
< 0.organizationName_default = YOURDOMAIN
16+
---
17+
> 0.organizationName_default = Internet Widgits Pty Ltd
18+
142c142
19+
< organizationalUnitName_default = ISP
20+
---
21+
> #organizationalUnitName_default =
22+
145d144
23+
< commonName_default = YOURHOSTNAME
24+
149d147
25+
< emailAddress_default = postmaster@YOURDOMAIN
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
# Script to configuring an ispconfig3 server in a Debian VPS
3+
# by calocen [at] gmail [dot] com
4+
5+
# getting some enviromment values
6+
myhostname=`hostname -f`
7+
mydomain=`hostname -d`
8+
myip=`hostname -i`
9+
[ ! -x /usr/bin/geoiplookup ] && apt-get --assume-yes install geoip-bin
10+
mycountry=`geoiplookup $myip | cut -f4 -d" " | cut -f1 -d","`
11+
myprovince=`geoiplookup $myip | cut -f5 -d" "`
12+
13+
# reconfiguring webalizer, postfix
14+
# could be cool to modify here webalizer values
15+
dpkg-reconfigure -u webalizer
16+
postconf -e "myhostname = $myhostname"
17+
postconf -e "mydestination = $myhostname, localhost"
18+
echo $myhostname > /etc/mailname
19+
dpkg-reconfigure -u postfix
20+
21+
# request new password
22+
oldpwd=`grep password /root/.my.cnf | tr "\t" " " | tr -s " " | cut -f3 -d" "`
23+
read -p "mysql password: [$oldpwd] " mysqlpwd
24+
[ -z $mysqlpwd ] && mysqlpwd=$oldpwd
25+
echo $mysqlpwd
26+
#read -p "Are you sure? (y/n) " sure
27+
## who said fear ##
28+
set -x
29+
mysqladmin -u root -p$oldpwd password $mysqlpwd
30+
mysqladmin -u root -p$mysqlpwd -h localhost password $mysqlpwd
31+
cat << EOF > /root/.my.cnf
32+
[client]
33+
password = $mysqlpwd
34+
EOF
35+
chmod 600 /root/.my.cnf
36+
37+
# changing mydns password
38+
mysql -e "SET PASSWORD FOR 'mydns'@'%' = PASSWORD( '$mysqlpwd' )"
39+
mysql -e "SET PASSWORD FOR 'mydns'@'localhost' = PASSWORD( '$mysqlpwd' )"
40+
cp -ax /etc/mydns.conf /etc/mydns.conf~
41+
sed s/$oldpwd/$mysqlpwd/g < /etc/mydns.conf~ > /etc/mydns.conf
42+
43+
# enabling mydns
44+
mydns --create-tables > /tmp/mydns.sql
45+
mysql -e "CREATE DATABASE IF NOT EXISTS mydns ; USE mydns ; SOURCE /tmp/mydns.sql;"
46+
rm /tmp/mydns.*
47+
invoke-rc.d mydns restart
48+
49+
# preparing server installation
50+
mv /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf~
51+
sed s/"YOURHOSTNAME"/"$myhostname"/g < /usr/local/bin/openssl.cnf |
52+
sed s/"YOURDOMAIN"/"$mydomain"/g | \
53+
sed s/"YOURCOUNTRY"/"$mycountry"/g | \
54+
sed s/"YOURPROVINCE"/"$myprovince"/g > /etc/ssl/openssl.cnf
55+
56+
tar xfz /root/downloads/ISPConfig-3.0.0.7-beta.tar.gz -C /usr/local/src
57+
# here would be some stuff to update from SVN
58+
cd /usr/local/src/ispconfig3_install/install/
59+
php -q install.php
60+
61+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -x
3+
echo "" > /etc/resolv.conf
4+
echo "" > /etc/hostname
5+
echo "" > /etc/mailname
6+
rm -f /etc/ssh/ssh_host_*
7+
cat << EOF > /etc/rc2.d/S15ssh_gen_host_keys
8+
#!/bin/bash
9+
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''
10+
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''
11+
dpkg-reconfigure -u webalizer
12+
postconf -e "myhostname = $(hostname -f)"
13+
postconf -e "mydestination = $(hostname -f), localhost"
14+
echo $(hostname -f) > /etc/mailname
15+
dpkg-reconfigure -u postfix
16+
rm -f \$0
17+
EOF
18+
chmod a+x /etc/rc2.d/S15ssh_gen_host_keys

0 commit comments

Comments
 (0)