| 1 | #!/usr/bin/perl |
|---|
| 2 | # |
|---|
| 3 | # AlternC Main install perl script. |
|---|
| 4 | # This script should be launched only once, when installing AlternC |
|---|
| 5 | # on a new server. THIS SCRIPT ERASE ALL DATA ON THE AlternC SYSTEM !! |
|---|
| 6 | # YOU HAVE BEEN WARNED ! |
|---|
| 7 | # |
|---|
| 8 | # |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | ######################################################################### |
|---|
| 12 | # 1. Confirmation |
|---|
| 13 | ######################################################################### |
|---|
| 14 | |
|---|
| 15 | print " |
|---|
| 16 | ------------------------------------------------------------------------- |
|---|
| 17 | This is the main install perl script for AlternC |
|---|
| 18 | This script should be launched only once, when installing AlternC |
|---|
| 19 | on a new server. THIS SCRIPT ERASE ALL DATA ON THE AlternC SYSTEM !! |
|---|
| 20 | (/var/alternc) YOU HAVE BEEN WARNED ! |
|---|
| 21 | ------------------------------------------------------------------------- |
|---|
| 22 | |
|---|
| 23 | Are you sure that you want to install AlternC software on this computer ? |
|---|
| 24 | (y/n) "; |
|---|
| 25 | |
|---|
| 26 | chop($c=<STDIN>); |
|---|
| 27 | if ($c ne "y") { |
|---|
| 28 | exit(); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | ######################################################################### |
|---|
| 33 | # 2. Check that the user changed /etc/alternc/alternc.conf |
|---|
| 34 | ######################################################################### |
|---|
| 35 | |
|---|
| 36 | open C,"</etc/alternc/alternc.conf"; |
|---|
| 37 | if (<C> eq "exit\n") { |
|---|
| 38 | print " |
|---|
| 39 | YOU DID NOT CHANGE THE MAIN CONFIGURATION FILE OF ALTERNC. |
|---|
| 40 | PLEASE READ AND CHANGE /etc/alternc/alternc.conf |
|---|
| 41 | AND LAUNCH THIS SCRIPT AGAIN. |
|---|
| 42 | |
|---|
| 43 | "; |
|---|
| 44 | close(C); |
|---|
| 45 | exit(); |
|---|
| 46 | } |
|---|
| 47 | close(C); |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | ######################################################################### |
|---|
| 51 | # 3. Parse the conf file |
|---|
| 52 | ######################################################################### |
|---|
| 53 | |
|---|
| 54 | print "reading configuration file\n"; |
|---|
| 55 | |
|---|
| 56 | open C,"</etc/alternc/alternc.conf"; |
|---|
| 57 | while ($c=<C>) { |
|---|
| 58 | chop($c); |
|---|
| 59 | if ($c !~ /^#/) { |
|---|
| 60 | if ($c =~ /^(.*)= *([^ ].*)$/) { |
|---|
| 61 | # print "[$1] = $2\n"; |
|---|
| 62 | $conf{$1}=$2; |
|---|
| 63 | } |
|---|
| 64 | } |
|---|
| 65 | } |
|---|
| 66 | close(C); |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | ######################################################################### |
|---|
| 70 | # 4. Read the conf variables |
|---|
| 71 | ######################################################################### |
|---|
| 72 | |
|---|
| 73 | %vars = ( |
|---|
| 74 | "hosting" => "Nom du service d'hebergement ", |
|---|
| 75 | "mx" => "Nom du serveur de mail ", |
|---|
| 76 | "ns1" => "Nom du serveur DNS primaire ", |
|---|
| 77 | "ns2" => "Nom du serveur DNS secondaire ", |
|---|
| 78 | "myip" => "Adresse ip de moi-meme ! ", |
|---|
| 79 | "mynetwork" => "Liste des réseaux autorisés en SMTP", |
|---|
| 80 | "fqdn" => "Nom de domaine du serveur hébergé ", |
|---|
| 81 | "ldap_userpwd" => "Mot de passe de l'utilisateur non root du serveur ldap ", |
|---|
| 82 | "ldap_rootpwd" => "Mot de passe de root du serveur ldap ", |
|---|
| 83 | "bind_internal" => "Adresse IP ou classe d'IP des machines à l'intérieur de notre réseau de confiance DNS, séparés par ';', facultatif ", |
|---|
| 84 | "bind_slaves" => "Adresse IP ou classe d'IP des machines esclaves DNS, séparés par ';', facultatif ", |
|---|
| 85 | "data_part" => "Nom de la partition contenant /%DATA/, pour la gestion des quotas (ex: /dev/hda3)", |
|---|
| 86 | "dbname" => "Base de données systeme de MySQL à créer", |
|---|
| 87 | "dbuser" => "Nom d'utilisateur mysql réservé pour le Bureau", |
|---|
| 88 | "dbpwd" => "Mot de passe de l'utilisateur mysql du Bureau", |
|---|
| 89 | "monitor_ip" => "Adresse IP (ou ip/prefixe) du(des) serveur(s) dont on veut autoriser le ping vers nous et le status apache (pour le monitoring de serveur.) ", |
|---|
| 90 | "myrandom" => "Debian : Mot de passe de l'utilisateur 'debian-maint' de mysql.", |
|---|
| 91 | "DATA_PART" => "General : Partition contenant /var/alternc (pour les quotas)" |
|---|
| 92 | ); |
|---|
| 93 | |
|---|
| 94 | ######################################################################### |
|---|
| 95 | # 5. Read etclist and dirlist |
|---|
| 96 | ######################################################################### |
|---|
| 97 | |
|---|
| 98 | %conf_vars = ( |
|---|
| 99 | |
|---|
| 100 | # Squirrelmail Plugin changepass_ldap |
|---|
| 101 | "change_ldappass/config.php" => "[Squirrelmail] Change Ldap Password file", |
|---|
| 102 | "change_ldappass/options.php" => "[Squirrelmail] Change Ldap Password file", |
|---|
| 103 | "change_ldappass/setup.php" => "[Squirrelmail] Change Ldap Password file", |
|---|
| 104 | "change_ldappass/README" => "[Squirrelmail] Change Ldap Password file", |
|---|
| 105 | "change_ldappass/install" => "[Squirrelmail] Change Ldap Password file", |
|---|
| 106 | |
|---|
| 107 | # PHPMYAdmin, Config file, |
|---|
| 108 | "config.inc.php" => "[PHPMyAdmin] Config File", |
|---|
| 109 | |
|---|
| 110 | # Scripts-Shells generaux : |
|---|
| 111 | "local.php" => "[General] Fichier de configuration general du Bureau virtuel", |
|---|
| 112 | |
|---|
| 113 | # Taches planifiees : |
|---|
| 114 | "etc/cron.d/domaines" => "[Cron] Gestion des domaines", |
|---|
| 115 | "etc/cron.d/webalizer" => "[Cron] Gestion des statistiques web", |
|---|
| 116 | |
|---|
| 117 | # Externalisation des mots de passe utilises dans les shells systeme : |
|---|
| 118 | "etc/alternc/local.sh" => "[Pass] Mots de passe mysql utilisés par les shells systeme", |
|---|
| 119 | |
|---|
| 120 | # Bind9 (serveur DNS) |
|---|
| 121 | "etc/bind/named.conf" => "[Bind9] Fichier de configuration principal", |
|---|
| 122 | "etc/bind/automatic.conf" => "[Bind9] Fichier (vide) dynamiquement genere par PHP", |
|---|
| 123 | "etc/bind/domaines.template" => "[Bind9] Patron pour les entrees de domaine dans named.conf", |
|---|
| 124 | "etc/bind/master/domaines.template" => "[Bind9] Patron de zone maitre", |
|---|
| 125 | "etc/bind/master/ip.template" => "[Bind9] Patron d'IP pour les zones maitre", |
|---|
| 126 | "etc/bind/master/slave.template" => "[BInd9] Patron de zone pour les DNS esclaves", |
|---|
| 127 | "domaines.template" => "[Bind9] Patron de zone esclave, à recopier dans /usr/lib/alternc/bind2/", |
|---|
| 128 | |
|---|
| 129 | # LdapAuth (LibNSS_Ldap LibPam_Ldap Authentification) |
|---|
| 130 | |
|---|
| 131 | "etc/courier/authldaprc" => "[LdapAuth] Fichier de configuration de Courier Ldap", |
|---|
| 132 | "etc/courier/authdaemonrc" => "[LdapAuth] Fihcier de configuration de Courier", |
|---|
| 133 | |
|---|
| 134 | # ProFTPd (serveur FTP) |
|---|
| 135 | "etc/proftpd.conf" => "[ProFTPd] Fichier de configuration du serveur FTP", |
|---|
| 136 | "etc/welcome.msg" => "[ProFTPd] Message de bienvenue du serveur FTP", |
|---|
| 137 | |
|---|
| 138 | # MySQL (serveur de donnees) |
|---|
| 139 | "etc/mysql/my.cnf" => "[MySQL] Fichier de configuration du serveur de donnees", |
|---|
| 140 | "etc/mysql/debian.cnf" => "[MySQL] Fichier de configuration Debian", |
|---|
| 141 | "etc/cron.d/bcksql" => "[MySQL] Cron de Backup quotidien / hebdomadaire", |
|---|
| 142 | |
|---|
| 143 | # PHP4 (Language server-side pour Apache) |
|---|
| 144 | "etc/php4/apache/php.ini" => "[PHP4] Fichier de configuration generale", |
|---|
| 145 | "etc/php4/cgi/php.ini" => "[PHP4] Fichier de configuratin en mode Shell-Script", |
|---|
| 146 | "etc/alternc/sendmail" => "[PHP4] Sendmail script perl pour php", |
|---|
| 147 | |
|---|
| 148 | # Apache (serveur Web) |
|---|
| 149 | "etc/apache-ssl/httpd.conf" => "[Apache-SSL] Fichier de configuration principal d'Apache", |
|---|
| 150 | "etc/apache/httpd.conf" => "[Apache] Fichier de configuration principal d'Apache", |
|---|
| 151 | |
|---|
| 152 | # Ldap (Base de donnees arborescente du systeme) |
|---|
| 153 | "etc/ldap/slapd.conf" => "[Ldap] Fichier de configuration principal de Ldap", |
|---|
| 154 | "etc/ldap/alternc.schema" => "[Ldap] Schema specifique a AlternC", |
|---|
| 155 | "etc/ldap/core.schema" => "[Ldap] Schema general de Ldap", |
|---|
| 156 | "etc/ldap/conf/postfix.conf" => "[Ldap] Fichier de configuration de la base Ldap Postfix", |
|---|
| 157 | "etc/ldap/conf/system.conf" => "[Ldap] Fichier de configuration de la base Ldap System", |
|---|
| 158 | "ldap.ldif" => "[Ldap] Fichier LDIF contenant les entrees de base de l'arbre.", |
|---|
| 159 | "ldap.sh" => "[Ldap] Script Shell de creation des entrees de base de l'arbre.", |
|---|
| 160 | |
|---|
| 161 | # [IPTables] Firewall de base... |
|---|
| 162 | "etc/init.d/iptables" => "[IPTables] Firewall lance au demarrage. ", |
|---|
| 163 | |
|---|
| 164 | # Postfix (serveur SMTP) |
|---|
| 165 | "etc/postfix/main.cf" => "[ProFTPd] Fichier de configuration principal de postfix", |
|---|
| 166 | "etc/postfix/body_checks" => "[Postfix] Regles de filtrage des mails", |
|---|
| 167 | "etc/postfix/header_checks" => "[Postfix] Regles de filtrage des en-tetes", |
|---|
| 168 | "etc/postfix/master.cf" => "[Postfix] Fichier de configuration des services MTA", |
|---|
| 169 | |
|---|
| 170 | "redir.htaccess" => "[WebMail] Redirection url interne", |
|---|
| 171 | "etc/logrotate.d/apache" => "[Apache] Rotation quotidienne des logs", |
|---|
| 172 | |
|---|
| 173 | "etc/webalizer/template.conf" => "[Webalizer] Fichier de configuration modèle", |
|---|
| 174 | "etc/squirrelmail/apache.conf" => "[Squirrelmail] Fichier de conf apache", |
|---|
| 175 | |
|---|
| 176 | ); |
|---|
| 177 | |
|---|
| 178 | @etcdir = ( |
|---|
| 179 | "etc/alternc", "etc/bind", "etc/bind/master", "etc/mysql", "etc/courier", |
|---|
| 180 | "etc/php4", "etc/php4/apache", "etc/apache-ssl", "etc/apache", "etc/ldap", |
|---|
| 181 | "etc/ldap/conf", "etc/init.d","etc/ldap/tmp","etc/postfix","etc/cron.d", |
|---|
| 182 | "etc/logrotate.d", "etc/webalizer", "etc/squirrelmail", "etc/php4/cgi", |
|---|
| 183 | "change_ldappass", "etc/pop-before-smtp" |
|---|
| 184 | ); |
|---|
| 185 | |
|---|
| 186 | |
|---|
| 187 | ######################################################################### |
|---|
| 188 | # 6. Compute some stuffs. |
|---|
| 189 | ######################################################################### |
|---|
| 190 | |
|---|
| 191 | %varscalc = ( |
|---|
| 192 | "ldap_tree" => "Racine de l'arbre Ldap du systeme", # dc=alternc,dc=globenet,dc=org |
|---|
| 193 | "fqdn_lettre" => "Premiere lettre de l'avant dernier membre du fqdn" # a |
|---|
| 194 | ); |
|---|
| 195 | |
|---|
| 196 | @fq=split /\./, $conf{fqdn}; |
|---|
| 197 | |
|---|
| 198 | $ldap_tree=""; |
|---|
| 199 | for($i=0;$i<scalar @fq;$i++) { |
|---|
| 200 | if ($i) { |
|---|
| 201 | $ldap_tree.=","; |
|---|
| 202 | } |
|---|
| 203 | $ldap_tree .= "dc=".$fq[$i]; |
|---|
| 204 | } |
|---|
| 205 | |
|---|
| 206 | $conf{ldap_tree} = $ldap_tree; |
|---|
| 207 | $conf{fqdn_lettre} = substr($fq[(scalar @fq)-2],0,1); |
|---|
| 208 | |
|---|
| 209 | if ($conf{bind_internal}) { |
|---|
| 210 | $conf{bind_internal} .= ";"; |
|---|
| 211 | } |
|---|
| 212 | if ($conf{bind_slaves}) { |
|---|
| 213 | $conf{bind_slaves} .= ";"; |
|---|
| 214 | } |
|---|
| 215 | if (!$conf{monitor_ip}) { |
|---|
| 216 | $conf{monitor_ip} = "127.0.0.1"; |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | ######################################################################### |
|---|
| 220 | # 7. Create the temporary etc files, and parse them |
|---|
| 221 | ######################################################################### |
|---|
| 222 | |
|---|
| 223 | system("rm -rf /tmp/alternc.install.tmp"); |
|---|
| 224 | mkdir("/tmp/alternc.install.tmp",0777); |
|---|
| 225 | mkdir("/tmp/alternc.install.tmp/etc",0777); |
|---|
| 226 | |
|---|
| 227 | for ($i=0;$i<scalar @etcdir;$i++) { |
|---|
| 228 | print "creating directory /".$etcdir[$i]."\n"; |
|---|
| 229 | mkdir("/tmp/alternc.install.tmp/".$etcdir[$i]."",0777); |
|---|
| 230 | } |
|---|
| 231 | |
|---|
| 232 | while (($key,$val) = each(%conf_vars)) { |
|---|
| 233 | print "parsing configuration file /$key $val "; |
|---|
| 234 | open F,"</usr/share/alternc/1.0/install/$key" || die "Erreur Ouverture R"; |
|---|
| 235 | open G,">/tmp/alternc.install.tmp/$key" || die "Erreur Ouverture W"; |
|---|
| 236 | while ($buffer = <F>) { |
|---|
| 237 | # Replace user variables : |
|---|
| 238 | while (($kv,$vv)=each(%vars)) { |
|---|
| 239 | $buffer=~ s/%%$kv%%/$conf{$kv}/; |
|---|
| 240 | } |
|---|
| 241 | # Replace computed variables : |
|---|
| 242 | while (($kv,$vv)=each(%varscalc)) { |
|---|
| 243 | # printf $kv." : ".$conf{$kv}."\n"; |
|---|
| 244 | $buffer=~ s/%%$kv%%/$conf{$kv}/; |
|---|
| 245 | } |
|---|
| 246 | print G $buffer; |
|---|
| 247 | } |
|---|
| 248 | close(F); |
|---|
| 249 | close(G); |
|---|
| 250 | print "\n"; |
|---|
| 251 | } |
|---|
| 252 | # Chmod the shell scripts (a+x) |
|---|
| 253 | system("find /tmp/alternc.install.tmp/ -name \"*.sh\" -exec chmod a+x {} \\;"); |
|---|
| 254 | |
|---|
| 255 | |
|---|
| 256 | ######################################################################### |
|---|
| 257 | # 8. Backup current conf files |
|---|
| 258 | ######################################################################### |
|---|
| 259 | |
|---|
| 260 | print "backup current system files (/etc)\n"; |
|---|
| 261 | |
|---|
| 262 | # Creation des dossiers dans /tmp/system.DATEDUJOUR |
|---|
| 263 | chop($TS=`date +%Y%m%d-%H%M`); |
|---|
| 264 | $TMP="/tmp/system.$TS"; |
|---|
| 265 | system("rm -rf $TMP >/dev/null 2>&1"); |
|---|
| 266 | mkdir($TMP,0777); |
|---|
| 267 | mkdir("$TMP/etc",0777); |
|---|
| 268 | for ($i=0;$i<scalar @etcdir;$i++) { |
|---|
| 269 | mkdir("$TMP/etc/".$etcdir[$i]."",0777); |
|---|
| 270 | } |
|---|
| 271 | # Copie des fichiers de /etc/... vers /tmp/system.DATE |
|---|
| 272 | while (($key,$val) = each(%conf_vars)) { |
|---|
| 273 | system("cp /$key /$TMP/$key >/dev/null 2>&1"); |
|---|
| 274 | } |
|---|
| 275 | mkdir("/usr/lib/alternc/backups"); |
|---|
| 276 | system("tar -czf /usr/lib/alternc/backups/system.$TS.tgz $TMP >/dev/null 2>&1"); |
|---|
| 277 | system("rm -rf $TMP >/dev/null 2>&1"); |
|---|
| 278 | system("/usr/share/alternc/1.0/install/dopo.sh"); |
|---|
| 279 | |
|---|
| 280 | ######################################################################### |
|---|
| 281 | # 9. Stop services |
|---|
| 282 | ######################################################################### |
|---|
| 283 | |
|---|
| 284 | print "Stopping services : \n"; |
|---|
| 285 | |
|---|
| 286 | print "--Apache :\n"; |
|---|
| 287 | system("/etc/init.d/apache stop"); |
|---|
| 288 | print "--Apache-ssl :\n"; |
|---|
| 289 | system("/etc/init.d/apache-ssl stop"); |
|---|
| 290 | print "--Postfix :\n"; |
|---|
| 291 | system("/etc/init.d/postfix stop"); |
|---|
| 292 | print "--Bind :\n"; |
|---|
| 293 | system("/etc/init.d/bind9 stop"); |
|---|
| 294 | print "--Courier :\n"; |
|---|
| 295 | system("/etc/init.d/courier-authdaemon stop"); |
|---|
| 296 | system("/etc/init.d/courier-imap stop"); |
|---|
| 297 | system("/etc/init.d/courier-imap-ssl stop"); |
|---|
| 298 | system("/etc/init.d/courier-pop stop"); |
|---|
| 299 | system("/etc/init.d/courier-pop-ssl stop"); |
|---|
| 300 | print "--Ldap :\n"; |
|---|
| 301 | system("/etc/init.d/slapd stop"); |
|---|
| 302 | print "--Cron :\n"; |
|---|
| 303 | system("/etc/init.d/cron stop"); |
|---|
| 304 | print "--ProFTPd :\n"; |
|---|
| 305 | system("/etc/init.d/proftpd stop"); |
|---|
| 306 | print "--MySQL :\n"; |
|---|
| 307 | system("/etc/init.d/mysql stop"); |
|---|
| 308 | print "\n"; |
|---|
| 309 | |
|---|
| 310 | |
|---|
| 311 | ######################################################################### |
|---|
| 312 | # 10. Create dir structure and copy panel files |
|---|
| 313 | ######################################################################### |
|---|
| 314 | |
|---|
| 315 | print "Creating directory structure in /var/alternc\n"; |
|---|
| 316 | system("/usr/share/alternc/1.0/install/initrep.sh"); |
|---|
| 317 | |
|---|
| 318 | |
|---|
| 319 | ######################################################################### |
|---|
| 320 | # 11. Send etc files to /etc :) |
|---|
| 321 | ######################################################################### |
|---|
| 322 | |
|---|
| 323 | print "Copying files to /etc\n"; |
|---|
| 324 | system("rsync /tmp/alternc.install.tmp/etc/* /etc/ -a"); |
|---|
| 325 | system("rsync /tmp/alternc.install.tmp/change_ldappass /usr/share/squirrelmail/plugins/ -a"); |
|---|
| 326 | system("rsync /tmp/alternc.install.tmp/config.inc.php /usr/share/phpmyadmin/ -a"); |
|---|
| 327 | system("cp /tmp/alternc.install.tmp/redir.htaccess /var/alternc/bureau/admin/webmail/.htaccess"); |
|---|
| 328 | system("cp /tmp/alternc.install.tmp/domaines.template /usr/lib/alternc/system/bind2/"); |
|---|
| 329 | system("cp /tmp/alternc.install.tmp/local.php /var/alternc/bureau/class"); |
|---|
| 330 | system("chmod a+x /etc/init.d/iptables"); |
|---|
| 331 | system("chmod 750 /etc/alternc -R"); |
|---|
| 332 | system("chown root.root /etc/alternc -R"); |
|---|
| 333 | system("mkdir /var/run/alternc"); |
|---|
| 334 | system("mkdir /var/log/alternc"); |
|---|
| 335 | system("chown www-data.www-data /var/alternc/bureau/admin/webmail/.htaccess /etc/webalizer /var/alternc/bureau /var/alternc/html /var/alternc/mail /var/alternc/dns /var/run/alternc /var/log/alternc -R"); |
|---|
| 336 | system("chown root.www-data /usr/lib/alternc/ -R"); |
|---|
| 337 | system("chmod 0750 /usr/lib/alternc"); |
|---|
| 338 | system("chmod 0750 /usr/lib/alternc/*"); |
|---|
| 339 | system("chmod 4750 /usr/lib/alternc/mem_add"); |
|---|
| 340 | system("chmod 4750 /usr/lib/alternc/quota_edit"); |
|---|
| 341 | system("chmod 4750 /usr/lib/alternc/quota_get"); |
|---|
| 342 | system("chmod 4750 /usr/lib/alternc/mail_add"); |
|---|
| 343 | system("chmod 4750 /usr/lib/alternc/mail_del"); |
|---|
| 344 | system("chmod 4750 /usr/lib/alternc/mem_del"); |
|---|
| 345 | system("chmod 4750 /usr/lib/alternc/db_create"); |
|---|
| 346 | system("chmod 0640 /var/alternc/bureau/class/*.php"); |
|---|
| 347 | system("chown root.www-data /var/alternc/bureau/class/*.php"); |
|---|
| 348 | system("chown root.www-data /var/alternc/bureau/class"); |
|---|
| 349 | system("chgrp www-data /etc/alternc"); |
|---|
| 350 | system("chgrp www-data /etc/alternc/local.sh"); |
|---|
| 351 | system("chgrp www-data /etc/alternc/sendmail"); |
|---|
| 352 | |
|---|
| 353 | |
|---|
| 354 | @fq=split /\./, $conf{fqdn}; |
|---|
| 355 | $fl=substr($fq[(scalar @fq)-2],0,1); |
|---|
| 356 | system("ln /var/alternc/bureau /var/alternc/dns/$fl/$conf{fqdn} -s"); |
|---|
| 357 | |
|---|
| 358 | ######################################################################### |
|---|
| 359 | # 13. Create Ldap database, restart ldap and add default values |
|---|
| 360 | ######################################################################### |
|---|
| 361 | |
|---|
| 362 | print "Creating ldap db, starting ldap, then add the default tree\n"; |
|---|
| 363 | system("/tmp/alternc.install.tmp/ldap.sh"); |
|---|
| 364 | |
|---|
| 365 | ######################################################################### |
|---|
| 366 | # 14. Create MySQL database, restart mysql and add default users |
|---|
| 367 | ######################################################################### |
|---|
| 368 | |
|---|
| 369 | print "Creating MySQL db, restarting mysql.\n"; |
|---|
| 370 | system("/usr/share/alternc/1.0/install/mysql.sh '".$conf{dbuser}."' '".$conf{dbpwd}."' '".$conf{dbname}."' '".$conf{myrandom}."'"); |
|---|
| 371 | |
|---|
| 372 | |
|---|
| 373 | ######################################################################### |
|---|
| 374 | # 15. Start services |
|---|
| 375 | ######################################################################### |
|---|
| 376 | |
|---|
| 377 | print "Starting services : \n"; |
|---|
| 378 | |
|---|
| 379 | print "--Apache :\n"; |
|---|
| 380 | system("/etc/init.d/apache start"); |
|---|
| 381 | print "--Apache-ssl :\n"; |
|---|
| 382 | system("/etc/init.d/apache-ssl start"); |
|---|
| 383 | print "--Postfix :\n"; |
|---|
| 384 | system("/etc/init.d/postfix start"); |
|---|
| 385 | print "--Bind :\n"; |
|---|
| 386 | system("/etc/init.d/bind9 start"); |
|---|
| 387 | print "--Courier :\n"; |
|---|
| 388 | system("/etc/init.d/courier-authdaemon start"); |
|---|
| 389 | system("/etc/init.d/courier-imap start"); |
|---|
| 390 | system("/etc/init.d/courier-imap-ssl start"); |
|---|
| 391 | system("/etc/init.d/courier-pop start"); |
|---|
| 392 | system("/etc/init.d/courier-pop-ssl start"); |
|---|
| 393 | print "--Cron :\n"; |
|---|
| 394 | system("/etc/init.d/cron start"); |
|---|
| 395 | print "--ProFTPd :\n"; |
|---|
| 396 | system("/etc/init.d/proftpd start"); |
|---|
| 397 | print "\n"; |
|---|
| 398 | |
|---|
| 399 | ######################################################################### |
|---|
| 400 | # 16. Create the first user |
|---|
| 401 | ######################################################################### |
|---|
| 402 | |
|---|
| 403 | print "Creating user root, with password root (change it as soon as possible)\n"; |
|---|
| 404 | |
|---|
| 405 | system("su www-data -c /usr/share/alternc/1.0/install/newone.php"); |
|---|
| 406 | |
|---|
| 407 | ######################################################################### |
|---|
| 408 | # 17. Job's done ! Ready to serve... |
|---|
| 409 | ######################################################################### |
|---|
| 410 | |
|---|
| 411 | print " |
|---|
| 412 | AlternC Install complete. |
|---|
| 413 | You may use you server now. Don't forget to change your root password |
|---|
| 414 | as soon as possible. |
|---|
| 415 | If you use this software, please send a mail to tech\@alternc.org |
|---|
| 416 | so that we know who use it :) and build some kind of statistics. Thanks. |
|---|
| 417 | |
|---|
| 418 | "; |
|---|
| 419 | |
|---|