added random passwd to install.sh

git-svn-id: svn://svn.cccv.de/engel-system@276 29ba0400-6e00-0410-a75a-ca02368028f8
This commit is contained in:
ichdasich 2008-04-13 00:50:10 +00:00
parent f68806d63f
commit 6055cf5361
1 changed files with 26 additions and 9 deletions

View File

@ -1,7 +1,5 @@
#!/bin/sh #!/bin/sh
# todo: -fix the sql-server pw-stuff (idea: random-seed, printed in the end) # todo: -install asterisk
# -set random admin-pw (same as sql-foo)
# -install asterisk
# -use ip if dns not configured # -use ip if dns not configured
# -check ssl-stuff (want to have userinput when the script just started) # -check ssl-stuff (want to have userinput when the script just started)
@ -10,8 +8,13 @@ echo "updating system"
apt-get -qqq upgrade apt-get -qqq upgrade
echo "installing software" echo "installing software"
apt-get -qq install vim apache2 mysql-common mysql-server php4-mysql \ apt-get -qq install vim apache2 mysql-common mysql-server php5-mysql \
libapache2-mod-php4 subversion openssl ssl-cert ssh less libapache2-mod-php5 subversion openssl ssl-cert ssh less makepasswd
echo "setting local vars"
SQL_PASSWD=`makepasswd --chars=8 --noverbose`
ADM_PASSWD=`makepasswd --chars=8 --noverbose`
echo "getting sources" echo "getting sources"
svn co svn://svn.cccv.de/engel-system svn co svn://svn.cccv.de/engel-system
@ -45,6 +48,14 @@ echo "setting sources in place"
rm /var/www/https/inc/config.php rm /var/www/https/inc/config.php
cat `pwd`/engel-system/default-conf/www-ssl/inc/config.php|sed s/SEDENGELURL/`cat /etc/hostname`.`dnsdomainname`/ |sed s/MD5SED/`openssl x509 -noout -fingerprint -md5 -in /etc/apache2/ssl/apache.pem|sed s/MD5\ Fingerprint\=//`/|sed s/SHA1SED/`openssl x509 -noout -fingerprint -sha1 -in /etc/apache2/ssl/apache.pem|sed s/SHA1\ Fingerprint\=//`/ >> /var/www/https/inc/config.php cat `pwd`/engel-system/default-conf/www-ssl/inc/config.php|sed s/SEDENGELURL/`cat /etc/hostname`.`dnsdomainname`/ |sed s/MD5SED/`openssl x509 -noout -fingerprint -md5 -in /etc/apache2/ssl/apache.pem|sed s/MD5\ Fingerprint\=//`/|sed s/SHA1SED/`openssl x509 -noout -fingerprint -sha1 -in /etc/apache2/ssl/apache.pem|sed s/SHA1\ Fingerprint\=//`/ >> /var/www/https/inc/config.php
rm /var/www/https/inc/config_db.php
cat `pwd`/engel-system/default-conf/www-ssl/inc/config_db.php|sed s/changeme/$SQL_PASSWD/ >> /var/www/https/inc/config_db.php
cp `pwd`/engel-system/DB/User.sql `pwd`/engel-system/DB/User.sql2
rm `pwd`/engel-system/DB/User.sql
cat `pwd`/engel-system/DB/User.sql2|sed s/21232f297a57a5a743894a0e4a801fc3/`echo -n $ADM_PASSWD|md5sum|sed s/\ \ \-//`/ >> `pwd`/engel-system/DB/User.sql
mysql tabel -u root < `pwd`/engel-system/DB/ChangeLog.sql mysql tabel -u root < `pwd`/engel-system/DB/ChangeLog.sql
mysql tabel -u root < `pwd`/engel-system/DB/Himmel.sql mysql tabel -u root < `pwd`/engel-system/DB/Himmel.sql
mysql tabel -u root < `pwd`/engel-system/DB/Messages.sql mysql tabel -u root < `pwd`/engel-system/DB/Messages.sql
@ -55,13 +66,19 @@ echo "setting sources in place"
echo "cleaning up" echo "cleaning up"
rm -rf `pwd`/engel-system/ rm -rf `pwd`/engel-system/
mysql -u root mysql -e "UPDATE user SET Password=PASSWORD('changeme') WHERE user='root';" mysql -u root mysql -e "UPDATE user SET Password=PASSWORD('$SQL_PASSWD') WHERE user='root';"
mysql -u root mysql -e "FLUSH PRIVILEGES;" mysql -u root mysql -e "FLUSH PRIVILEGES;"
echo "SQL-User: root" >> /root/cfg.info
echo "SQL-Pass: $SQL_PASSWD" >> /root/cfg.info
echo "Web-User: admin" >> /root/cfg.info
echo "Web-Pass: $ADM_PASSWD" >> /root/cfg.info
echo "final hints:" echo "final hints:"
echo "-reset passwort for sqluser, don't forget to change /var/www/https/inc/config_db.php" echo "-reset passwort for sqluser, don't forget to change /var/www/https/inc/config_db.php"
echo "-change the adminpassword in the webfrontend" echo "-change the adminpassword in the webfrontend"
echo "-the webfrontend user/pass combo is: admin:admin" echo "-the webfrontend user/pass combo is: admin:$ADM_PASSWD"
echo "-the sql-server uses root:changeme" echo "-the sql-server uses root:$SQL_PASSWD"
echo "-you can find further information and the passwords in /root/cfg.info"
echo "-make sure \$url in /var/www/https/inc/config.php is correct" echo "-make sure \$url in /var/www/https/inc/config.php is correct"