diff options
author | Philip Häusler <msquare@notrademark.de> | 2013-12-03 16:18:22 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2013-12-03 16:18:22 +0100 |
commit | e9565a79eaa6b23bbf530dd8611feb1f170be781 (patch) | |
tree | df5a5d6934107d1c175c6b4f4079cfe69a48a197 | |
parent | d5b03110613df849222fa3efec348f92a84e5896 (diff) |
simplified config
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | config/.gitignore | 5 | ||||
-rw-r--r-- | config/config.default.php (renamed from install/default-conf/config.php) | 46 | ||||
-rw-r--r-- | db/update.php | 5 | ||||
-rw-r--r-- | includes/sys_auth.php | 4 | ||||
-rw-r--r-- | install/HOWTO_create_new_file | 9 | ||||
-rw-r--r-- | install/default-conf/config_db.php | 9 | ||||
-rw-r--r-- | install/default-conf/etc/apache/default | 47 | ||||
-rw-r--r-- | install/default-conf/etc/apache/https | 19 | ||||
-rw-r--r-- | install/default-conf/etc/crontab | 1 | ||||
-rw-r--r-- | install/default-conf/etc/festival.scm | 17 | ||||
-rw-r--r-- | install/fresh_install.sh | 103 | ||||
-rw-r--r-- | install/install.sh | 104 | ||||
-rw-r--r-- | public/index.php | 5 |
14 files changed, 27 insertions, 350 deletions
@@ -12,8 +12,7 @@ Vorgehen: * Empfehlung: Dirlisting sollte deaktiviert sein. * Es muss eine MySQL-Datenbank angelegt werden und ein User existieren, der alle Rechte auf dieser Datenbank besitzt. * Es muss die db/install.sql importiert/ausgeführt werden. - * Es müssen die Default-Configs von install/default-conf/*.php nach config/ kopiert werden. - * Die kopierten Configs in config/ müssen an die Installation angepasst werden, Erklärungen dazu gibt es in der jeweiligen Config-Datei. + * Erstelle bei Bedarf eine config/config.php, die die Werte (z.B. DB-Zugang) aus der config/config.default.php überschreibt. * Engelsystem im Browser aufrufen, Anmeldung mit admin:admin vornehmen und Admin-Passwort ändern. Das Engelsystem ist jetzt einsatzbereit. diff --git a/config/.gitignore b/config/.gitignore index cb667ea2..4f4773fb 100644 --- a/config/.gitignore +++ b/config/.gitignore @@ -1,6 +1 @@ -config_db.php -config_jabber.php -config_modem.php config.php -config_IAX.php -config_MessegeServer.php diff --git a/install/default-conf/config.php b/config/config.default.php index 958db3ce..1356beaf 100644 --- a/install/default-conf/config.php +++ b/config/config.default.php @@ -1,56 +1,39 @@ <?php + +// URL to the angel faq and job description +$faq_url = "https://events.ccc.de/congress/2013/wiki/Static:Volunteers"; + // Default-Theme auf der Startseite, 1=style1.css usw. $default_theme = 1; -// System disable message, ist ist set is: bages schow only this text -//$SystemDisableMessage="<H1>This system ist moved to a server in the BCC, you can in the moment only youse it in the in Engel Room</H1>"; - // Anzahl der News, die auf einer Seite ausgeben werden koennen... $DISPLAY_NEWS = 6; // Anzahl Stunden bis zum Austragen eigener Schichten -$LETZTES_AUSTRAGEN=3; +$LETZTES_AUSTRAGEN = 3; // Setzt den zu verwendenden Crypto-Algorismus (entsprechend der Dokumentation von crypt()). // Falls ein Benutzerpasswort in einem anderen Format gespeichert ist, // wird es bei der ersten Benutzung des Klartext-Passworts in das neue Format // konvertiert. -//define('CRYPT_ALG', '$1'); // MD5 -//define('CRYPT_ALG', '$2y$13'); // Blowfish -//define('CRYPT_ALG', '$5$rounds=5000'); // SHA-256 +// define('CRYPT_ALG', '$1'); // MD5 +// define('CRYPT_ALG', '$2y$13'); // Blowfish +// define('CRYPT_ALG', '$5$rounds=5000'); // SHA-256 define('CRYPT_ALG', '$6$rounds=5000'); // SHA-512 define('MIN_PASSWORD_LENGTH', 8); // Wenn Engel beim Registrieren oder in ihrem Profil eine T-Shirt Größe angeben sollen, auf true setzen: -$enable_tshirt_size = false; - -// timezonen offsett -$gmdateOffset=3600; - -// für Developen 1, sonst = 0 -$debug = 0; - -//globale const. fuer schischtplan -$GlobalZeileProStunde = 4; - -//Tempdir -$Tempdir="./tmp"; +$enable_tshirt_size = true; // local timezone date_default_timezone_set("Europe/Berlin"); -//Pentabarf ConferenzDI für UpdateDB +// Pentabarf ConferenzDI für UpdateDB $PentabarfXMLhost = "cccv.pentabarf.org"; $PentabarfXMLpath = "Xcal/conference/"; $PentabarfXMLEventID = "31"; -//Mailing List: is is not defined, the option is not shown -//$SubscribeMailinglist = "*-subscribe@lists.*"; - -/// Passord for external Authorization, function only active if the var is defined -//$CurrentExternAuthPass = 23; - // multiply "night shifts" (start or end between 2 and 6 exclusive) by 2 $shift_sum_formula = "SUM( (1+( @@ -61,9 +44,16 @@ $shift_sum_formula = "SUM( )"; // weigh every shift the same -//$shift_sum_formula = "SUM(`end` - `start`)"; +// $shift_sum_formula = "SUM(`end` - `start`)"; // For accessing stats $api_key = ""; +// MySQL-Connection Settings +$config = array( + 'host' => "localhost", + 'user' => "root", + 'pw' => "", + 'db' => "engelsystem" +); ?> diff --git a/db/update.php b/db/update.php index 05f2cd73..992ce715 100644 --- a/db/update.php +++ b/db/update.php @@ -1,8 +1,9 @@ <?php require_once (dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'bootstrap.php'); require_once ('includes/mysql_provider.php'); -require_once ('config/config.php'); -require_once ('config/config_db.php'); +require_once('config/config.default.php'); +if(file_exists('config/config.php')) + require_once ('config/config.php'); sql_connect($config['host'], $config['user'], $config['pw'], $config['db']); error_reporting(E_ALL | E_NOTICE); diff --git a/includes/sys_auth.php b/includes/sys_auth.php index 9718f0c0..3902aea2 100644 --- a/includes/sys_auth.php +++ b/includes/sys_auth.php @@ -55,7 +55,7 @@ function verify_password($password, $salt, $uid = false) { // JSON Authorisierungs-Schnittstelle function json_auth_service() { - global $CurrentExternAuthPass; + global $api_key; header("Content-Type: application/json"); @@ -63,7 +63,7 @@ function json_auth_service() { $Pass = $_REQUEST['pw']; $SourceOuth = $_REQUEST['so']; - if (isset($CurrentExternAuthPass) && $SourceOuth == $CurrentExternAuthPass) { + if (isset($api_key) && $SourceOuth == $api_key) { $sql = "SELECT `UID`, `Passwort` FROM `User` WHERE `Nick`='" . sql_escape($User) . "'"; $Erg = sql_select($sql); diff --git a/install/HOWTO_create_new_file b/install/HOWTO_create_new_file deleted file mode 100644 index 35b17164..00000000 --- a/install/HOWTO_create_new_file +++ /dev/null @@ -1,9 +0,0 @@ -*outdated* - -1. Create file -2. Create DB entry in table UserCVS (admin/userDefaultSetting.php9 -3. update file DB/UserCVS.sql -4. Create DB entry in table Sprache (admin/sprache.php) - When you down't wont a menupount set the Text to ' ' -5. update file DB/Sprache.sql - diff --git a/install/default-conf/config_db.php b/install/default-conf/config_db.php deleted file mode 100644 index d07529c0..00000000 --- a/install/default-conf/config_db.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - - -// MySQL-Connection Settings -$config['host'] = "localhost"; -$config['user'] = "root"; -$config['pw'] = ""; -$config['db'] = "engelsystem"; -?> diff --git a/install/default-conf/etc/apache/default b/install/default-conf/etc/apache/default deleted file mode 100644 index 49e60ba1..00000000 --- a/install/default-conf/etc/apache/default +++ /dev/null @@ -1,47 +0,0 @@ -NameVirtualHost *:80 -<VirtualHost *:80> - ServerAdmin webmaster@localhost - - DocumentRoot /var/www/http/ - php_admin_value open_basedir "/var/www/" - <Directory /> - Options FollowSymLinks - AllowOverride None - </Directory> - <Directory /var/www/http/> - Options Indexes FollowSymLinks MultiViews - AllowOverride None - Order allow,deny - allow from all - # This directive allows us to have apache2's default start page - # in /apache2-default/, but still have / go to the right place - #RedirectMatch ^/$ /apache2-default/ - </Directory> - - ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ - <Directory "/usr/lib/cgi-bin"> - AllowOverride None - Options ExecCGI -MultiViews +SymLinksIfOwnerMatch - Order allow,deny - Allow from all - </Directory> - - ErrorLog /var/log/apache2/error.log - - # Possible values include: debug, info, notice, warn, error, crit, - # alert, emerg. - LogLevel warn - - CustomLog /var/log/apache2/access.log combined - ServerSignature On - - Alias /doc/ "/usr/share/doc/" - <Directory "/usr/share/doc/"> - Options Indexes MultiViews FollowSymLinks - AllowOverride None - Order deny,allow - Deny from all - Allow from 127.0.0.0/255.0.0.0 ::1/128 - </Directory> - -</VirtualHost> diff --git a/install/default-conf/etc/apache/https b/install/default-conf/etc/apache/https deleted file mode 100644 index aaa0bf3f..00000000 --- a/install/default-conf/etc/apache/https +++ /dev/null @@ -1,19 +0,0 @@ - -<VirtualHost *:443> - # SSL (START) - SSLEngine on - SSLCertificateFile /etc/apache2/ssl/apache.pem - SSLCertificateKeyFile /etc/apache2/apache.pem - # SSL (ENDE) - ServerAdmin webmaster@localhost - #kann auch einfach eine IP sein - ServerName localhost - php_admin_value open_basedir "/var/www/" - DocumentRoot /var/www/https - <Directory /var/www/https> - Order Deny,Allow - Allow from all - # Zeige keine Verzeichnisse an - Options -Indexes - </Directory> -</VirtualHost> diff --git a/install/default-conf/etc/crontab b/install/default-conf/etc/crontab deleted file mode 100644 index d58671bc..00000000 --- a/install/default-conf/etc/crontab +++ /dev/null @@ -1 +0,0 @@ -*/15 * * * * www-data (cd /var/www/services/ ; php5 cron_dect.php) diff --git a/install/default-conf/etc/festival.scm b/install/default-conf/etc/festival.scm deleted file mode 100644 index d39be33e..00000000 --- a/install/default-conf/etc/festival.scm +++ /dev/null @@ -1,17 +0,0 @@ -;; Any site-wide Festival initialization can be added to this file. -;; It is marked as a configuration file, so your changes will be saved -;; across upgrades of the Festival package. -;; - - -; Server access list (hosts) -(set! server_access_list '("[^.]+" "127.0.0.1" "localhost.*")) - -;; Command for Asterisk begin -(define (tts_textasterisk string mode) - "(tts_textasterisk STRING MODE) - Apply tts to STRING. This function is specifically designed for - use in server mode so a single function call may synthesize the string. - This function name may be added to the server safe functions." - (utt.send.wave.client (utt.wave.resample (utt.wave.rescale (utt.synth (eval (list 'Utterance 'Text string))) 5) 8000))) - diff --git a/install/fresh_install.sh b/install/fresh_install.sh deleted file mode 100644 index 722f2eb9..00000000 --- a/install/fresh_install.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash -# todo: -install asterisk -# -use ip if dns not configured (dig +short @141.1.1.1) - -echo "updating system" - apt-get -qq update - apt-get -qq upgrade - -echo "installing software" - apt-get -qq install vim apache2 mysql-common mysql-server php5-mysql \ - 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` - - SQL_USER=`makepasswd --chars=8 --noverbose` - SQL_UPWD=`makepasswd --chars=8 --noverbose` - - state=DE - province=Berlin - town=Berlin - org="CCC e.V." - section="Congress" - adminmail="admin@`cat /etc/hostname`.`dnsdomainname`" - - FQDN=`/bin/hostname -f` - -echo "getting sources" - svn co svn://svn.cccv.de/engel-system - -echo "setting up apache2" - mkdir /var/www/http/ - mkdir /var/www/https/ - - mkdir /etc/apache2/ssl/ - - echo -ne $state'\n'$province'\n'$town'\n'$org'\n'$section'\n'$FQDN'\n'$adminmail'\n'|openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/apache.pem - - chmod 600 /etc/apache2/ssl/apache.pem - - cp `pwd`/engel-system/default-conf/etc/default /etc/apache2/sites-available/default - cp `pwd`/engel-system/default-conf/etc/https /etc/apache2/sites-available/https - - echo "Listen 443" >> /etc/apache2/ports.conf - - a2enmod ssl - a2ensite https - /etc/init.d/apache2 restart - -echo "setting up mysql" - mysql -u root mysql -e "CREATE DATABASE tabel;" - -echo "setting sources in place" - cp -r `pwd`/engel-system/www/* /var/www/http/ - cp -r `pwd`/engel-system/www-ssl/* /var/www/https/ - cp -r `pwd`/engel-system/includes/ /var/www/ - cp -r `pwd`/engel-system/default-conf/www-ssl/inc/* /var/www/https/inc/ - - rm /var/www/https/inc/config.php - cat `pwd`/engel-system/default-conf/www-ssl/inc/config.php|sed s/SEDENGELURL/$FQDN/ |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_UPWD/|sed s/root/$SQL_USER/ >> /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/Himmel.sql - mysql tabel -u root < `pwd`/engel-system/DB/Messages.sql - mysql tabel -u root < `pwd`/engel-system/DB/Sprache.sql - mysql tabel -u root < `pwd`/engel-system/DB/User.sql - mysql tabel -u root < `pwd`/engel-system/DB/UserCVS.sql - mysql tabel -u root < `pwd`/engel-system/DB/UserPicture.sql - -echo "cleaning up" - rm -rf `pwd`/engel-system/ - - mysql -u root mysql -e "GRANT SELECT,INSERT,ALTER,UPDATE,INDEX,DELETE,DROP,CREATE ON tabel.* TO '$SQL_USER'@'localhost' IDENTIFIED BY 'password';" - - mysql -u root mysql -e "UPDATE user SET Password=PASSWORD('$SQL_PASSWD') WHERE user='root';" - mysql -u root mysql -e "UPDATE user SET Password=PASSWORD('$SQL_UPWD') WHERE user='$SQL_USER';" - - mysql -u root mysql -e "DELETE FROM user WHERE User='debian-sys-maint';" - mysql -u root mysql -e "FLUSH PRIVILEGES;" - - echo "SQL-Root: root" >> /root/cfg.info - echo "SQL-Root-Pass: $SQL_PASSWD" >> /root/cfg.info - echo "SQL-User: $SQL_USER" >> /root/cfg.info - echo "SQL-User-Pass: $SQL_UPWD" >> /root/cfg.info - echo "Web-User: admin" >> /root/cfg.info - echo "Web-User-Pass: $ADM_PASSWD" >> /root/cfg.info - -echo "final hints:" -echo "-the webfrontend user/pass combo is: admin:$ADM_PASSWD" -echo "-the sql-server root account is: root:$SQL_PASSWD" -echo "-the sql-server user account is: $SQL_USER:$SQL_UPWD" -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" - diff --git a/install/install.sh b/install/install.sh deleted file mode 100644 index baeed134..00000000 --- a/install/install.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash -# todo: -install asterisk -# -use ip if dns not configured (dig +short @141.1.1.1) - -echo "updating system" - apt-get -qq update - apt-get -qq upgrade - -echo "installing software" - apt-get -qq install vim apache2 mysql-common mysql-server php5-mysql \ - 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` - - SQL_USER=`makepasswd --chars=8 --noverbose` - SQL_UPWD=`makepasswd --chars=8 --noverbose` - - state=DE - province=Berlin - town=Berlin - org="CCC e.V." - section="Congress" - adminmail="admin@`cat /etc/hostname`.`dnsdomainname`" - - FQDN=`/bin/hostname -f` - -echo "getting sources" - svn co svn://svn.cccv.de/engel-system - -echo "setting up apache2" - mkdir /var/www/http/ - mkdir /var/www/https/ - - mkdir /etc/apache2/ssl/ - - echo -ne $state'\n'$province'\n'$town'\n'$org'\n'$section'\n'$FQDN'\n'$adminmail'\n'|openssl req $@ -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/apache.pem - - chmod 600 /etc/apache2/ssl/apache.pem - - cp `pwd`/engel-system/default-conf/etc/default /etc/apache2/sites-available/default - cp `pwd`/engel-system/default-conf/etc/https /etc/apache2/sites-available/https - - echo "Listen 443" >> /etc/apache2/ports.conf - - a2enmod ssl - a2ensite https - /etc/init.d/apache2 restart - -echo "setting up mysql" - mysql -u root mysql -e "CREATE DATABASE tabel;" - -echo "setting sources in place" - cp -r `pwd`/engel-system/www/* /var/www/http/ # meant to be removed - cp -r `pwd`/engel-system/www-ssl/* /var/www/https/ - cp -r `pwd`/engel-system/includes/ /var/www/ - cp -r `pwd`/engel-system/default-conf/var_www_includes/* /var/www/includes/ - cp -r `pwd`/engel-system/service/ /var/www/ - - rm /var/www/includes/config.php - cat `pwd`/engel-system/default-conf/var_www_includes/config.php|sed s/SEDENGELURL/$FQDN/ |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/includes/config.php - - rm /var/www/includes/config_db.php - cat `pwd`/engel-system/default-conf/var_www_includes/config_db.php|sed s/changeme/$SQL_UPWD/|sed s/root/$SQL_USER/ >> /var/www/includes/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/Himmel.sql - mysql tabel -u root < `pwd`/engel-system/DB/Messages.sql - mysql tabel -u root < `pwd`/engel-system/DB/Sprache.sql - mysql tabel -u root < `pwd`/engel-system/DB/User.sql - mysql tabel -u root < `pwd`/engel-system/DB/UserCVS.sql - mysql tabel -u root < `pwd`/engel-system/DB/UserPicture.sql - -echo "cleaning up" - rm -rf `pwd`/engel-system/ - - mysql -u root mysql -e "GRANT SELECT,INSERT,ALTER,UPDATE,INDEX,DELETE,DROP,CREATE ON tabel.* TO '$SQL_USER'@'localhost' IDENTIFIED BY 'password';" - - mysql -u root mysql -e "UPDATE user SET Password=PASSWORD('$SQL_PASSWD') WHERE user='root';" - mysql -u root mysql -e "UPDATE user SET Password=PASSWORD('$SQL_UPWD') WHERE user='$SQL_USER';" - - mysql -u root mysql -e "DELETE FROM user WHERE User='debian-sys-maint';" - mysql -u root mysql -e "FLUSH PRIVILEGES;" - - echo "SQL-Root: root" >> /root/cfg.info - echo "SQL-Root-Pass: $SQL_PASSWD" >> /root/cfg.info - echo "SQL-User: $SQL_USER" >> /root/cfg.info - echo "SQL-User-Pass: $SQL_UPWD" >> /root/cfg.info - echo "Web-User: admin" >> /root/cfg.info - echo "Web-User-Pass: $ADM_PASSWD" >> /root/cfg.info - -echo "final hints:" -echo "-the webfrontend user/pass combo is: admin:$ADM_PASSWD" -echo "-the sql-server root account is: root:$SQL_PASSWD" -echo "-the sql-server user account is: $SQL_USER:$SQL_UPWD" -echo "-you can find further information and the passwords in /root/cfg.info" -echo "-make sure \$url in /var/www/includes/config.php is correct" - diff --git a/public/index.php b/public/index.php index 82ece193..08eb433e 100644 --- a/public/index.php +++ b/public/index.php @@ -22,8 +22,9 @@ require_once ('includes/helper/internationalization_helper.php'); require_once ('includes/helper/message_helper.php'); require_once ('includes/helper/error_helper.php'); -require_once ('config/config.php'); -require_once ('config/config_db.php'); +require_once ('config/config.default.php'); +if(file_exists('config/config.php')) + require_once ('config/config.php'); require_once ('includes/pages/admin_active.php'); require_once ('includes/pages/admin_angel_types.php'); |