Vaguement :

- correction de qques identation (et surement rajout d'erreur)
 - supression de apache 1 (c'est plus maintenu, on va pas s'étaler)
 - suppression du mass vhosting
 - corrections de bugs divers et varié
This commit is contained in:
Alan Garcia 2011-03-06 18:06:27 +00:00
parent 68d7a7dd15
commit 4e0f98b93e
27 changed files with 238 additions and 530 deletions

5
.gitattributes vendored
View File

@ -349,8 +349,6 @@ debian/po/templates.pot -text
debian/rules -text
debian/templates -text
etc/alternc/alternc.ini -text
etc/alternc/apache-ssl.conf -text
etc/alternc/apache.conf -text
etc/alternc/apache2-ssl.conf -text
etc/alternc/apache2.conf -text
etc/alternc/functions_hosting/hosting_massvhost.sh -text
@ -396,9 +394,7 @@ install/mysql.sql -text
install/newone.php -text
install/reset_root.php -text
install/upgrade_check.sh -text
install/upgrades/0.9.1.sh -text
install/upgrades/0.9.1.sql -text
install/upgrades/0.9.10.sh -text
install/upgrades/0.9.10.sql -text
install/upgrades/0.9.1_migrationldap.php -text
install/upgrades/0.9.2.php -text
@ -434,7 +430,6 @@ src/Makefile -text
src/alternc-check -text
src/alternc-passwd -text
src/alternc_reload -text
src/basedir_prot.sh -text
src/du.pl -text
src/fixperms.sh -text
src/functions.sh -text

View File

@ -65,7 +65,7 @@ function dnsoff() {
</script>
<h3><?php printf(_("Editing subdomains of %s"),$domain); ?></h3>
<?php
if ($error) {
if (isset($error) && $error) {
echo "<p class=\"error\">$error</p>";
}
?>

View File

@ -57,7 +57,7 @@ if (!isset($restrictip)) {
<p id="logo"> <img src="logo.png" border="0" alt="<?php __("Web Hosting Control Panel"); ?>" title="<?php __("Web Hosting Control Panel"); ?>" /></a>
</p>
<p>&nbsp;</p>
<?php if ($error) echo "<font color=red>$error</font>"; ?>
<?php if (isset($error) && $error) echo "<font color=red>$error</font>"; ?>
<?php
/*
if (!$_SERVER[HTTPS]) {

View File

@ -64,7 +64,7 @@ if (ini_get("safe_mode")) {
// For people who want to authenticate with HTTP AUTH
if (isset($_GET['http_auth'])) $http_auth=strval($_GET['http_auth']);
if ($http_auth) {
if (isset($http_auth) && $http_auth) {
if (empty($_SERVER['PHP_AUTH_USER']) || empty($_SERVER['PHP_AUTH_PW'])) {
header('WWW-Authenticate: Basic realm="Test Authentication System"');
header('HTTP/1.0 401 Unauthorized');
@ -93,7 +93,7 @@ require_once($root."class/functions.php");
require_once($root."class/variables.php");
// Redirection si appel à https://(!fqdn)/
if ($_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) {
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) {
header("Location: https://$L_FQDN/");
}

View File

@ -723,8 +723,9 @@ EOF;
" HAVING status=2 or status=3 ORDER BY status DESC, expiry;"))
return false;
else {
$res=array();
while($db->next_record())
$res[] = $db->Record;
$res[] = $db->Record;
return $res;
}
}

View File

@ -66,7 +66,7 @@ class m_dom {
*/
var $islocked=false;
var $type_local = "LOCAL";
var $type_local = "VHOST";
var $type_url = "URL";
var $type_ip = "IP";
var $type_webmail = "WEBMAIL";
@ -223,7 +223,7 @@ class m_dom {
$this->domains=array();
if ($db->num_rows()>0) {
while ($db->next_record()) {
$this->domains[]=$db->f("domaine");
$this->domains[]=$db->f("domaine");
}
}
return $this->domains;
@ -347,16 +347,16 @@ class m_dom {
if (!$force) {
$v=checkhostallow($domain,$this->dns);
if ($v==-1) {
$err->raise("dom",7); // TLD interdit
return false;
$err->raise("dom",7); // TLD interdit
return false;
}
if ($dns && $v==-2) {
$err->raise("dom",12); // Domaine non trouvé dans le whois
return false;
$err->raise("dom",12); // Domaine non trouvé dans le whois
return false;
}
if ($dns && $v==-3) {
$err->raise("dom",23); // Domaine non trouvé dans le whois
return false;
$err->raise("dom",23); // Domaine non trouvé dans le whois
return false;
}
if ($dns) $dns="1"; else $dns="0";
@ -365,11 +365,11 @@ class m_dom {
if ($tld[$v]==5) $dns=0;
// It must be a real domain (no subdomain)
if (!$dns) {
$v=checkhostallow_nodns($domain);
if ($v) {
$err->raise("dom",22);
return false;
}
$v=checkhostallow_nodns($domain);
if ($v) {
$err->raise("dom",22);
return false;
}
}
}
// Check the quota :
@ -385,8 +385,8 @@ class m_dom {
$db->query("SELECT domaine FROM domaines WHERE compte='$cuid' AND domaine='$slavedom';");
$db->next_record();
if (!$db->Record["domaine"]) {
$err->raise("dom",1,$slavedom);
$isslave=false;
$err->raise("dom",1,$slavedom);
$isslave=false;
}
// Point to the master domain :
$this->set_sub_domain($domain, '', $this->type_url, 'http://www.'.$slavedom);
@ -399,7 +399,7 @@ class m_dom {
$domshort=str_replace("-","",str_replace(".","",$domain));
if (! is_dir($dest_root . "/". $domshort)) {
mkdir($dest_root . "/". $domshort);
mkdir($dest_root . "/". $domshort);
}
// Creation des 3 sous-domaines par défaut : Vide, www et mail
@ -412,19 +412,19 @@ class m_dom {
// Declenchons les autres classes.
foreach($classes as $c) {
if (method_exists($GLOBALS[$c],"alternc_add_domain")) {
$GLOBALS[$c]->alternc_add_domain($domain);
$GLOBALS[$c]->alternc_add_domain($domain);
}
}
foreach($classes as $c) {
if (method_exists($GLOBALS[$c],"alternc_add_mx_domain")) {
$GLOBALS[$c]->alternc_add_mx_domain($domain);
$GLOBALS[$c]->alternc_add_mx_domain($domain);
}
}
if ($isslave) {
foreach($classes as $c) {
if (method_exists($GLOBALS[$c],"alternc_add_slave_domain")) {
$GLOBALS[$c]->alternc_add_slave_domain($domain,$slavedom);
}
if (method_exists($GLOBALS[$c],"alternc_add_slave_domain")) {
$GLOBALS[$c]->alternc_add_slave_domain($domain,$slavedom);
}
}
}
return true;
@ -449,11 +449,11 @@ class m_dom {
global $db,$err;
$err->log("dom","whois",$domain);
// pour ajouter un nouveau TLD, utiliser le code ci-dessous.
// echo "whois : $domain<br />";
// echo "whois : $domain<br />";
ereg(".*\.([^\.]*)",$domain,$out);
$ext=$out[1];
// pour ajouter un nouveau TLD, utiliser le code ci-dessous.
// echo "ext: $ext<br />";
// echo "ext: $ext<br />";
if (($fp=@fsockopen("whois.iana.org", 43))>0) {
fputs($fp, "$domain\r\n");
@ -475,43 +475,43 @@ class m_dom {
break;
}
// pour ajouter un nouveau TLD, utiliser le code ci-dessous.
// echo "serveur : $serveur <br />";
// echo "serveur : $serveur <br />";
if (($fp=@fsockopen($serveur, 43))>0) {
fputs($fp, "$egal$domain\r\n");
$found = false;
$state=0;
while (!feof($fp)) {
$ligne = fgets($fp,128);
// pour ajouter un nouveau TLD, utiliser le code ci-dessous.
// echo "| $ligne<br />";
switch($ext) {
case "org":
case "com":
case "net":
case "info":
case "biz":
case "name":
case "cc":
if (ereg("Name Server:", $ligne)) {
$found = true;
$tmp=strtolower(ereg_replace(chr(10), "",ereg_replace(chr(13),"",ereg_replace(" ","", ereg_replace("Name Server:","", $ligne)))));
if ($tmp)
$server[]=$tmp;
}
break;
case "cx":
$ligne = ereg_replace(chr(10), "",ereg_replace(chr(13),"",ereg_replace(" ","", $ligne)));
if ($ligne=="" && $state==1)
$state=2;
if ($state==1)
$server[]=strtolower($ligne);
if ($ligne=="Nameservers:" && $state==0) {
$state=1;
$found = true;
}
break;
$ligne = fgets($fp,128);
// pour ajouter un nouveau TLD, utiliser le code ci-dessous.
// echo "| $ligne<br />";
switch($ext) {
case "org":
case "com":
case "net":
case "info":
case "biz":
case "name":
case "cc":
if (ereg("Name Server:", $ligne)) {
$found = true;
$tmp=strtolower(ereg_replace(chr(10), "",ereg_replace(chr(13),"",ereg_replace(" ","", ereg_replace("Name Server:","", $ligne)))));
if ($tmp)
$server[]=$tmp;
}
break;
case "cx":
$ligne = ereg_replace(chr(10), "",ereg_replace(chr(13),"",ereg_replace(" ","", $ligne)));
if ($ligne=="" && $state==1)
$state=2;
if ($state==1)
$server[]=strtolower($ligne);
if ($ligne=="Nameservers:" && $state==0) {
$state=1;
$found = true;
}
break;
case "eu":
case "be":
case "be":
$ligne=preg_replace("/^ *([^ ]*) \(.*\)$/","\\1",trim($ligne));
if($found)
$tmp = trim($ligne);
@ -540,8 +540,8 @@ class m_dom {
$server[]=$tmp;
}
break;
case "fr":
case "re":
case "fr":
case "re":
if (ereg("nserver:", $ligne)) {
$found=true;
$tmp=strtolower(preg_replace("/nserver:\s*([^\s]*)\s*.*$/","\\1", $ligne));
@ -549,25 +549,25 @@ class m_dom {
$server[]=$tmp;
}
break;
case "ca":
case "ws";
if (ereg('^[[:space:]]*Name servers:[[:space:]]*$', $ligne)) {
// found the server
$state = 1;
} elseif ($state) {
if (ereg('^[^%]', $ligne) && $ligne = ereg_replace('[[:space:]]', "", $ligne)) {
// first non-whitespace line is considered to be the nameservers themselves
$found = true;
$server[] = $ligne;
}
}
break;
case "ca":
case "ws";
if (ereg('^[[:space:]]*Name servers:[[:space:]]*$', $ligne)) {
// found the server
$state = 1;
} elseif ($state) {
if (ereg('^[^%]', $ligne) && $ligne = ereg_replace('[[:space:]]', "", $ligne)) {
// first non-whitespace line is considered to be the nameservers themselves
$found = true;
$server[] = $ligne;
}
}
break;
case "coop":
if (preg_match('/Host Name:\s*([^\s]+)/', $ligne, $matches)) {
$found = true;
$server[] = $matches[1];
}
} // switch
} // switch
} // while
fclose($fp);
} else {
@ -669,7 +669,7 @@ class m_dom {
$r["dns_result"]=$db->Record["dns_result"];
$r["mail"]=$db->Record["gesmx"];
$r["mx"]=$db->Record["mx"];
$r[noerase]=$db->Record[noerase];
$r['noerase']=$db->Record['noerase'];
$db->free();
$db->query("select count(*) as cnt from sub_domaines where compte='$cuid' and domaine='$dom'");
$db->next_record();
@ -690,8 +690,8 @@ class m_dom {
$r["sub"][$i]["web_action"]=$db->Record["web_action"];
/*
if ($db->Record["type"]==3) { // Webmail
$this->webmail=1;
$r["sub"][$i]["dest"]=_("Webmail access");
$this->webmail=1;
$r["sub"][$i]["dest"]=_("Webmail access");
}
*/
}
@ -754,6 +754,8 @@ class m_dom {
function check_type_value($type, $value) {
global $db,$err,$cuid;
// check the type we can have in domaines_type.target
switch ($this->domains_type_target_values($type)) {
@ -986,14 +988,14 @@ class m_dom {
$vmx = $this->checkmx($dom,$mx);
if ($vmx == 1) {
// Aucun champ mx de spécifié sur le dns
$err->raise("dom",25);
return false;
$err->raise("dom",25);
return false;
}
if ($vmx == 2) {
// Serveur non spécifié parmi les champx mx
$err->raise("dom",25);
return false;
$err->raise("dom",25);
return false;
}
}
@ -1002,18 +1004,18 @@ class m_dom {
if ($gesmx && !$r["mail"]) { // on a associé le MX : on cree donc l'entree dans LDAP
// Lancement de add_dom sur les classes domain_sensitive :
foreach($classes as $c) {
if (method_exists($GLOBALS[$c],"alternc_add_mx_domain")) {
$GLOBALS[$c]->alternc_add_mx_domain($dom);
}
if (method_exists($GLOBALS[$c],"alternc_add_mx_domain")) {
$GLOBALS[$c]->alternc_add_mx_domain($dom);
}
}
}
if (!$gesmx && $r["mail"]) { // on a dissocié le MX : on détruit donc l'entree dans LDAP
// Lancement de del_dom sur les classes domain_sensitive :
foreach($classes as $c) {
if (method_exists($GLOBALS[$c],"alternc_del_mx_domain")) {
$GLOBALS[$c]->alternc_del_mx_domain($dom);
}
if (method_exists($GLOBALS[$c],"alternc_del_mx_domain")) {
$GLOBALS[$c]->alternc_del_mx_domain($dom);
}
}
}
@ -1034,15 +1036,15 @@ class m_dom {
* through AXFR Transfers from the bind server.
*/
function enum_slave_ip() {
global $db,$err;
$db->query("SELECT * FROM slaveip;");
if (!$db->next_record()) {
return false;
}
do {
$res[]=$db->Record;
} while ($db->next_record());
return $res;
global $db,$err;
$db->query("SELECT * FROM slaveip;");
if (!$db->next_record()) {
return false;
}
do {
$res[]=$db->Record;
} while ($db->next_record());
return $res;
}
/* ----------------------------------------------------------------- */
@ -1050,23 +1052,23 @@ class m_dom {
* Add an ip address (or a ip class) to the list of allowed slave ip access list.
*/
function add_slave_ip($ip,$class="32") {
global $db,$err;
if (!checkip($ip)) {
$err->raise("dom",19);
return false;
}
$class=intval($class);
if ($class<8 || $class>32) $class=32;
$db->query("SELECT * FROM slaveip WHERE ip='$ip' AND class='$class';");
if ($db->next_record()) {
$err->raise("err",22);
return false;
}
$db->query("INSERT INTO slaveip (ip,class) VALUES ('$ip','$class');");
$f=fopen(SLAVE_FLAG,"w");
fputs($f,"yopla");
fclose($f);
return true;
global $db,$err;
if (!checkip($ip)) {
$err->raise("dom",19);
return false;
}
$class=intval($class);
if ($class<8 || $class>32) $class=32;
$db->query("SELECT * FROM slaveip WHERE ip='$ip' AND class='$class';");
if ($db->next_record()) {
$err->raise("err",22);
return false;
}
$db->query("INSERT INTO slaveip (ip,class) VALUES ('$ip','$class');");
$f=fopen(SLAVE_FLAG,"w");
fputs($f,"yopla");
fclose($f);
return true;
}
/* ----------------------------------------------------------------- */
@ -1074,16 +1076,16 @@ class m_dom {
* Remove an ip address (or a ip class) from the list of allowed slave ip access list.
*/
function del_slave_ip($ip) {
global $db,$err;
if (!checkip($ip)) {
$err->raise("dom",19);
return false;
}
$db->query("DELETE FROM slaveip WHERE ip='$ip'");
$f=fopen(SLAVE_FLAG,"w");
fputs($f,"yopla");
fclose($f);
return true;
global $db,$err;
if (!checkip($ip)) {
$err->raise("dom",19);
return false;
}
$db->query("DELETE FROM slaveip WHERE ip='$ip'");
$f=fopen(SLAVE_FLAG,"w");
fputs($f,"yopla");
fclose($f);
return true;
}
@ -1093,12 +1095,12 @@ class m_dom {
* Check for a slave account
*/
function check_slave_account($login,$pass) {
global $db,$err;
$db->query("SELECT * FROM slaveaccount WHERE login='$login' AND pass='$pass';");
if ($db->next_record()) {
return true;
}
return false;
global $db,$err;
$db->query("SELECT * FROM slaveaccount WHERE login='$login' AND pass='$pass';");
if ($db->next_record()) {
return true;
}
return false;
}
/* ----------------------------------------------------------------- */
@ -1106,12 +1108,12 @@ class m_dom {
* Out (echo) the complete hosted domain list :
*/
function echo_domain_list() {
global $db,$err;
$db->query("SELECT domaine FROM domaines WHERE gesdns=1 ORDER BY domaine");
while ($db->next_record()) {
echo $db->f("domaine")."\n";
}
return true;
global $db,$err;
$db->query("SELECT domaine FROM domaines WHERE gesdns=1 ORDER BY domaine");
while ($db->next_record()) {
echo $db->f("domaine")."\n";
}
return true;
}
@ -1120,17 +1122,17 @@ class m_dom {
* Returns the complete hosted domain list :
*/
function get_domain_list($uid=-1) {
global $db,$err;
$uid=intval($uid);
$res=array();
if ($uid!=-1) {
$sql=" AND compte='$uid' ";
}
$db->query("SELECT domaine FROM domaines WHERE gesdns=1 $sql ORDER BY domaine");
while ($db->next_record()) {
$res[]=$db->f("domaine");
}
return $res;
global $db,$err;
$uid=intval($uid);
$res=array();
if ($uid!=-1) {
$sql=" AND compte='$uid' ";
}
$db->query("SELECT domaine FROM domaines WHERE gesdns=1 $sql ORDER BY domaine");
while ($db->next_record()) {
$res[]=$db->f("domaine");
}
return $res;
}
@ -1139,14 +1141,14 @@ class m_dom {
* Return the list of allowed slave accounts
*/
function enum_slave_account() {
global $db,$err;
$db->query("SELECT * FROM slaveaccount;");
$res=array();
while ($db->next_record()) {
$res[]=$db->Record;
}
if (!count($res)) return false;
return $res;
global $db,$err;
$db->query("SELECT * FROM slaveaccount;");
$res=array();
while ($db->next_record()) {
$res[]=$db->Record;
}
if (!count($res)) return false;
return $res;
}
/* ----------------------------------------------------------------- */
@ -1154,14 +1156,14 @@ class m_dom {
* Add a slave account that will be allowed to access the domain list
*/
function add_slave_account($login,$pass) {
global $db,$err;
$db->query("SELECT * FROM slaveaccount WHERE login='$login'");
if ($db->next_record()) {
$err->raise("err",23);
return false;
}
$db->query("INSERT INTO slaveaccount (login,pass) VALUES ('$login','$pass')");
return true;
global $db,$err;
$db->query("SELECT * FROM slaveaccount WHERE login='$login'");
if ($db->next_record()) {
$err->raise("err",23);
return false;
}
$db->query("INSERT INTO slaveaccount (login,pass) VALUES ('$login','$pass')");
return true;
}
/* ----------------------------------------------------------------- */
@ -1169,9 +1171,9 @@ class m_dom {
* Remove a slave account
*/
function del_slave_account($login) {
global $db,$err;
$db->query("DELETE FROM slaveaccount WHERE login='$login'");
return true;
global $db,$err;
$db->query("DELETE FROM slaveaccount WHERE login='$login'");
return true;
}
/*************/

View File

@ -488,15 +488,15 @@ Cordialement.
*/
function show_help($file,$force=false) {
global $err;
$err->log("mem","show_help",$show);
$err->log("mem","show_help");
if ($this->user["show_help"] || $force) {
$hlp=_("hlp_$file");
if ($hlp!="hlp_$file") {
$hlp=ereg_replace(
$hlp=ereg_replace(
"HELPID_([0-9]*)",
"<a href=\"javascript:help(\\1);\"><img src=\"/admin/aide/help.png\" width=\"17\" height=\"17\" style=\"vertical-align: middle;\" alt=\""._("Help")."\" /></a>",$hlp);
echo "<p class=\"hlp\">".$hlp."</p>";
return true;
echo "<p class=\"hlp\">".$hlp."</p>";
return true;
}
return false;
} else {

View File

@ -5,7 +5,6 @@ alternc-slave: setuid-binary usr/lib/alternc/mem_add 4750 root/www-data
alternc-slave: setuid-binary usr/lib/alternc/mem_del 4750 root/www-data
alternc-slave: setuid-binary usr/lib/alternc/quota_edit 4750 root/www-data
alternc-slave: setuid-binary usr/lib/alternc/quota_get 4750 root/www-data
alternc-slave: executable-is-not-world-readable usr/lib/alternc/basedir_prot.sh 0750 != 0755
alternc-slave: executable-is-not-world-readable usr/lib/alternc/du.pl 4750
alternc-slave: executable-is-not-world-readable usr/lib/alternc/fixperms.sh 0750 != 0755
alternc-slave: executable-is-not-world-readable usr/lib/alternc/mail_add 4750

112
debian/alternc.dirs vendored
View File

@ -17,123 +17,13 @@ usr/share/locale/fr/LC_MESSAGES
usr/share/lintian/overrides/
var/alternc/apache-vhost
var/alternc/apacheconf
var/alternc/apacheconf/_
var/alternc/apacheconf/0
var/alternc/apacheconf/1
var/alternc/apacheconf/2
var/alternc/apacheconf/3
var/alternc/apacheconf/4
var/alternc/apacheconf/5
var/alternc/apacheconf/6
var/alternc/apacheconf/7
var/alternc/apacheconf/8
var/alternc/apacheconf/9
var/alternc/apacheconf/a
var/alternc/apacheconf/b
var/alternc/apacheconf/c
var/alternc/apacheconf/d
var/alternc/apacheconf/e
var/alternc/apacheconf/f
var/alternc/apacheconf/g
var/alternc/apacheconf/h
var/alternc/apacheconf/i
var/alternc/apacheconf/j
var/alternc/apacheconf/k
var/alternc/apacheconf/l
var/alternc/apacheconf/m
var/alternc/apacheconf/n
var/alternc/apacheconf/o
var/alternc/apacheconf/p
var/alternc/apacheconf/q
var/alternc/apacheconf/r
var/alternc/apacheconf/s
var/alternc/apacheconf/t
var/alternc/apacheconf/u
var/alternc/apacheconf/v
var/alternc/apacheconf/w
var/alternc/apacheconf/x
var/alternc/apacheconf/y
var/alternc/apacheconf/z
var/alternc/bind
var/alternc/bind/zones
var/alternc/bureau
var/alternc/cgi-bin
var/alternc/db
var/alternc/dns
var/alternc/dns/_
var/alternc/dns/0
var/alternc/dns/1
var/alternc/dns/2
var/alternc/dns/3
var/alternc/dns/4
var/alternc/dns/5
var/alternc/dns/6
var/alternc/dns/7
var/alternc/dns/8
var/alternc/dns/9
var/alternc/dns/a
var/alternc/dns/b
var/alternc/dns/c
var/alternc/dns/d
var/alternc/dns/e
var/alternc/dns/f
var/alternc/dns/g
var/alternc/dns/h
var/alternc/dns/i
var/alternc/dns/j
var/alternc/dns/k
var/alternc/dns/l
var/alternc/dns/m
var/alternc/dns/n
var/alternc/dns/o
var/alternc/dns/p
var/alternc/dns/q
var/alternc/dns/r
var/alternc/dns/redir/_
var/alternc/dns/redir/0
var/alternc/dns/redir/1
var/alternc/dns/redir/2
var/alternc/dns/redir/3
var/alternc/dns/redir/4
var/alternc/dns/redir/5
var/alternc/dns/redir/6
var/alternc/dns/redir/7
var/alternc/dns/redir/8
var/alternc/dns/redir/9
var/alternc/dns/redir/a
var/alternc/dns/redir/b
var/alternc/dns/redir/c
var/alternc/dns/redir/d
var/alternc/dns/redir/e
var/alternc/dns/redir/f
var/alternc/dns/redir/g
var/alternc/dns/redir/h
var/alternc/dns/redir/i
var/alternc/dns/redir/j
var/alternc/dns/redir/k
var/alternc/dns/redir/l
var/alternc/dns/redir/m
var/alternc/dns/redir/n
var/alternc/dns/redir/o
var/alternc/dns/redir/p
var/alternc/dns/redir/q
var/alternc/dns/redir/r
var/alternc/dns/redir/s
var/alternc/dns/redir/t
var/alternc/dns/redir/u
var/alternc/dns/redir/v
var/alternc/dns/redir/w
var/alternc/dns/redir/x
var/alternc/dns/redir/y
var/alternc/dns/redir/z
var/alternc/dns/s
var/alternc/dns/t
var/alternc/dns/u
var/alternc/dns/v
var/alternc/dns/w
var/alternc/dns/x
var/alternc/dns/y
var/alternc/dns/z
var/alternc/dns/redir/
var/alternc/exec.usr
var/alternc/html
var/alternc/html/_

View File

@ -11,7 +11,6 @@ alternc: setuid-binary usr/lib/alternc/db_create 4750 root/www-data
alternc: setuid-binary usr/lib/alternc/du.pl 4750 root/www-data
alternc: non-standard-executable-perm usr/lib/alternc/quota_edit.sh 0750 != 0755
alternc: non-standard-executable-perm usr/lib/alternc/quota_get.sh 0750 != 0755
alternc: non-standard-executable-perm usr/lib/alternc/basedir_prot.sh 0750 != 0755
alternc: non-standard-executable-perm usr/lib/alternc/sqlbackup.sh 0750 != 0755
alternc: non-standard-executable-perm usr/lib/alternc/rawstat.daily 0750 != 0755
alternc: non-standard-executable-perm usr/lib/alternc/quota_init 0750 != 0755
@ -41,7 +40,6 @@ alternc: executable-is-not-world-readable usr/lib/alternc/functions_hosting.sh 0
alternc: executable-is-not-world-readable usr/lib/alternc/functions_dns.sh 0750 != 0755
alternc: executable-is-not-world-readable usr/lib/alternc/du.pl 4750
alternc: executable-is-not-world-readable usr/lib/alternc/quota_init 0750 != 0755
alternc: executable-is-not-world-readable usr/lib/alternc/basedir_prot.sh 0750 != 0755
alternc: executable-is-not-world-readable usr/lib/alternc/spoolsize.php 0750 != 0755
alternc: executable-is-not-world-readable usr/lib/alternc/rawstat.daily 0750 != 0755
alternc: using-first-person-in-templates alternc/monitor_ip

View File

@ -192,7 +192,6 @@ EOF
# They will be regenerated without the bug by upgrade_check.sh below.
if dpkg --compare-versions "$2" le "0.9.3.9-globenet14"; then
rm -f /var/alternc/apacheconf/*/*
rm -f /var/alternc/apacheconf/override_php.conf
fi
echo "checking for upgrades"
@ -214,12 +213,6 @@ EOF
#clean old access to the management panel
find /var/alternc/dns/ -type l -lname /var/alternc/bureau -exec rm {} \;
# Add access to the management panel
PUBLIC_IP_C=$(echo $PUBLIC_IP|cut -c 1)
ln -nsf /var/alternc/bureau /var/alternc/dns/$FQDN_LETTER/$FQDN
mkdir -p /var/alternc/dns/$PUBLIC_IP_C
ln -nsf /var/alternc/bureau /var/alternc/dns/$PUBLIC_IP_C/$PUBLIC_IP
# Bind stuff
touch /var/alternc/bind/automatic.conf /var/alternc/bind/slaveip.conf
chown root:bind /var/alternc/bind/automatic.conf /var/alternc/bind/slaveip.conf
@ -227,7 +220,6 @@ EOF
touch /var/run/alternc/refresh_slave
/usr/lib/alternc/slave_dns
# Apache will not start without this file
touch /var/alternc/apacheconf/override_php.conf
touch /var/alternc/apache-vhost/vhosts_all.conf
# Update l18n files
@ -239,9 +231,6 @@ EOF
echo "running alternc.install"
alternc.install
# Add basedir protection
/usr/lib/alternc/basedir_prot.sh
;;
abort-upgrade|abort-remove|abort-deconfigure)

2
debian/rules vendored
View File

@ -61,7 +61,7 @@ install: build
chown -R www-data:www-data debian/alternc/var/alternc/dns debian/alternc/var/alternc/html debian/alternc/var/run/alternc debian/alternc/var/log/alternc debian/alternc/var/alternc/tmp
chmod a+x debian/alternc/usr/share/alternc/install/alternc.install debian/alternc/usr/share/alternc/install/dopo.sh debian/alternc/usr/share/alternc/install/mysql.sh debian/alternc/usr/share/alternc/install/newone.php debian/alternc/usr/share/alternc/install/reset_root.php debian/alternc/usr/share/alternc/install/upgrade_check.sh debian/alternc/usr/share/alternc/install/upgrades/*.php debian/alternc/usr/share/alternc/install/upgrades/*.sh
for sub in dns dns/redir mail html apacheconf; do \
for sub in mail html ; do \
for i in a b c d e f g h i j k l m n o p q r s t u v w x y z _ 0 1 2 3 4 5 6 7 8 9; do \
mkdir -p debian/alternc/var/alternc/${sub}/${i} ;\
chown www-data debian/alternc/var/alternc/${sub}/${i} ;\

View File

@ -1,6 +0,0 @@
<VirtualHost *:443>
SSLEnable
SSLRequireSSL
DocumentRoot /var/alternc/bureau
Include /etc/alternc/bureau.conf
</VirtualHost>

View File

@ -1,42 +0,0 @@
# This module is loaded in /etc/apache/modules, and enabled by apache-modconf
# LoadModule vhost_alias_module /usr/lib/apache/1.3/mod_vhost_alias.so
ScriptAlias /cgi-bin/ /var/alternc/cgi-bin/
<Directory /var/alternc/cgi-bin/>
Options FollowSymLinks IncludesNOEXEC ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AddHandler cgi-script .cgi
</Directory>
<VirtualHost *:80>
# ***ALTERNC_ALIASES***
Alias /icons/ /usr/share/apache/icons/
UseCanonicalName Off
VirtualDocumentRoot /var/alternc/dns/%-2.1/%0
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %{Host}i" alternc
CustomLog /var/log/apache/access.log alternc
</VirtualHost>
<Directory /var/alternc>
AllowOverride AuthConfig FileInfo
Options Indexes Includes FollowSymLinks MultiViews
Order allow,deny
Allow from all
php_admin_flag safe_mode_gid on
php_admin_flag safe_mode on
php_admin_value disable_functions chmod,chown,chgrp,link,symlink
php_admin_value safe_mode_exec_dir /var/alternc/exec.usr
php_admin_value disable_functions chgrp,link,symlink
php_admin_flag enable_dl off
php_admin_value upload_tmp_dir /var/alternc/tmp
php_admin_value sendmail_path /usr/lib/alternc/sendmail
</Directory>
Include /etc/alternc/bureau.conf
Include /var/alternc/apache-vhost/vhosts_all.conf

View File

@ -11,12 +11,27 @@ ScriptAlias /cgi-bin/ /var/alternc/cgi-bin/
AddHandler cgi-script .cgi
</Directory>
<Directory /var/alternc>
Order allow,deny
Allow from none
</Directory>
<Directory /var/alternc/html>
AllowOverride AuthConfig FileInfo Limit Options Indexes
Options Indexes Includes FollowSymLinks MultiViews
Order allow,deny
Allow from all
php_admin_flag safe_mode_gid on
php_admin_flag safe_mode on
php_admin_value disable_functions chmod,chown,chgrp,link,symlink
php_admin_value safe_mode_exec_dir /var/alternc/exec.usr
php_admin_value disable_functions chgrp,link,symlink
php_admin_flag enable_dl off
php_admin_value upload_tmp_dir /var/alternc/tmp
php_admin_value sendmail_path /usr/lib/alternc/sendmail
</Directory>
<Directory /usr/share/phpmyadmin>
AllowOverride AuthConfig Options FileInfo Limit Indexes
Options Indexes Includes FollowSymLinks MultiViews

View File

@ -1,19 +1,21 @@
<VirtualHost *:80>
DocumentRoot /var/alternc/bureau
ServerName %%fqdn%%
alias /admin/sql /usr/share/phpmyadmin
alias /webmail /usr/share/squirrelmail
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/alternc/bureau>
php_admin_flag safe_mode_gid off
php_admin_flag safe_mode off
php_admin_flag register_globals on
AddDefaultCharset ISO-8859-1
php_admin_value open_basedir /etc/alternc/:/var/run/alternc/:/var/alternc/bureau/:/var/alternc/html/:/var/alternc/tmp:/tmp:/usr/share/php/:/var/cache/alternc-webalizer/
</Directory>
DocumentRoot /var/alternc/bureau
ServerName %%fqdn%%
alias /admin/sql /usr/share/phpmyadmin
alias /webmail /usr/share/squirrelmail
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/alternc/bureau>
Order allow,deny
Allow from all
php_admin_flag safe_mode_gid off
php_admin_flag safe_mode off
php_admin_flag register_globals on
AddDefaultCharset ISO-8859-1
php_admin_value open_basedir /etc/alternc/:/var/run/alternc/:/var/alternc/bureau/:/var/alternc/html/:/var/alternc/tmp:/tmp:/usr/share/php/:/var/cache/alternc-webalizer/
</Directory>
</VirtualHost>

View File

@ -10,10 +10,16 @@
AllowOverride None
</Directory>
<Directory /var/alternc/bureau>
Order allow,deny
Allow from all
php_admin_flag safe_mode_gid off
php_admin_flag safe_mode off
php_admin_flag register_globals on
AddDefaultCharset ISO-8859-1
php_admin_value open_basedir /etc/alternc/:/var/run/alternc/:/var/alternc/bureau/:/var/alternc/html/:/var/alternc/tmp:/tmp:/usr/share/php/:/var/cache/alternc-webalizer/
</Directory>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %{Host}i" alternc
CustomLog /var/log/apache2/access.log alternc
</VirtualHost>

View File

@ -1,9 +1,11 @@
<Virtualhost *:80>
ServerName %%fqdn%%
ServerName %%fqdn%%
KeepAlive Off
KeepAlive Off
RewriteEngine On
RewriteRule ^/(.*)$ %%redirect%%/$1 [R=301,L]
RewriteEngine On
RewriteRule ^/(.*)$ %%redirect%%/$1 [R=301,L]
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %{Host}i" alternc
CustomLog /var/log/apache2/access.log alternc
</Virtualhost>

View File

@ -6,20 +6,6 @@
php_admin_value open_basedir "%%document_root%%:/usr/share/php/:/var/alternc/tmp:/tmp"
</Directory>
AllowOverride AuthConfig FileInfo Limit Options Indexes
Options Indexes Includes FollowSymLinks MultiViews
Order allow,deny
Allow from all
php_admin_flag safe_mode_gid on
php_admin_flag safe_mode on
php_admin_value disable_functions chmod,chown,chgrp,link,symlink
php_admin_value safe_mode_exec_dir /var/alternc/exec.usr
php_admin_value disable_functions chgrp,link,symlink
php_admin_flag enable_dl off
php_admin_value upload_tmp_dir /var/alternc/tmp
php_admin_value sendmail_path /usr/lib/alternc/sendmail
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %{Host}i" alternc
CustomLog /var/log/apache2/access.log alternc
</VirtualHost>

View File

@ -1,11 +1,14 @@
<VirtualHost *:80>
ServerName %%fqdn%%
DocumentRoot /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
# php_value register_globals On # refer to Debian bug #128226
php_flag register_globals on
php_value open_basedir /usr/share/squirrelmail
php_admin_flag safe_mode off
Options Indexes FollowSymLinks
</Directory>
ServerName %%fqdn%%
DocumentRoot /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
# php_value register_globals On # refer to Debian bug #128226
php_flag register_globals on
php_value open_basedir /usr/share/squirrelmail
php_admin_flag safe_mode off
Options Indexes FollowSymLinks
</Directory>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T %{Host}i" alternc
CustomLog /var/log/apache2/access.log alternc
</VirtualHost>

View File

@ -210,10 +210,6 @@ then
ln -sf /etc/alternc/apache.conf /etc/apache/conf.d/alternc.conf
fi
touch /var/alternc/apacheconf/override_php.conf
if [ ! -h /etc/apache/conf.d/override_php.conf ] && [ -e /etc/apache/conf.d/ ]; then
ln -sf /var/alternc/apacheconf/override_php.conf /etc/apache/conf.d/override_php.conf
fi
SERVICES="$SERVICES apache apache-ssl"
fi
if [ -x /usr/sbin/apache2 ]; then
@ -251,10 +247,6 @@ if [ -x /usr/sbin/apache2 ]; then
ln -sf /etc/alternc/apache2.conf /etc/apache2/conf.d/alternc.conf
s="apache2"
fi
if [ ! -h /etc/apache2/conf.d/override_php.conf ] && [ -e /etc/apache2/conf.d/ ]; then
ln -sf /var/alternc/apacheconf/override_php.conf /etc/apache2/conf.d/override_php.conf
s="apache2"
fi
if [ -e /etc/apache2/sites-enabled/000-default ]; then
a2dissite default
s="apache2"
@ -338,9 +330,6 @@ done
# Last touches
#
ln -nsf /var/alternc/bureau /var/alternc/dns/$FQDN_LETTER/$FQDN
ln -nsf /var/alternc/bureau /var/alternc/dns/$PUBLIC_IP_BEGIN/$PUBLIC_IP
# Creating admin user if needed
HAS_ROOT=`mysql --defaults-file=/etc/alternc/my.cnf -e "SELECT COUNT(*) FROM membres WHERE login = 'admin' OR login = 'root' and su = 1" | tail -1`

View File

@ -1,17 +0,0 @@
#!/bin/sh
set -e
# protect all domains, not just new ones
. /usr/lib/alternc/basedir_prot.sh
servers="apache-ssl apache"
for server in $servers; do
includefile=/var/alternc/apacheconf/override_php.conf
. /usr/share/wwwconfig-common/apache-include_all.sh
[ "$status" = "uncomment" -o "$status" = "include" ] && restart="$server $restart"
done
. /usr/share/wwwconfig-common/restart.sh

View File

@ -1,22 +0,0 @@
#!/bin/sh
set -e
# We load local.sh
. /etc/alternc/local.sh
find ${ALTERNC_LOC}/dns -lname "${ALTERNC_LOC}/dns/redir/mail" -print -exec rm -f '{}' \; -exec ln -sf ${ALTERNC_LOC}/bureau/admin/webmail '{}' \;
rm -rf ${ALTERNC_LOC}/apacheconf
/usr/lib/alternc/basedir_prot.sh
# if apache exists we reload
if [ -x /etc/init.d/apache ] ; then
invoke-rc.d apache reload
invoke-rc.d apache-ssl reload
fi
# if apache2 exists we reload
if [ -x /etc/init.d/apache2 ] ; then
invoke-rc.d apache2 force-reload
fi

View File

@ -26,7 +26,7 @@
# ----------------------------------------------------------------------
#
SETUID=mail_add mail_del quota_edit quota_get mem_add mem_del
SCRIPTS=quota_edit.sh quota_get.sh basedir_prot.sh sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh
SCRIPTS=quota_edit.sh quota_get.sh sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh
LIBS=functions.sh functions_hosting.sh functions_dns.sh
BIN=$(DESTDIR)/usr/lib/alternc/

View File

@ -56,9 +56,6 @@ if [ ! -z "$RELOAD_ZONES" ]; then
$sudo rndc reload "$zone" > /dev/null || echo "Cannot reload bind for zone $zone" >> "$DOMAIN_LOG_FILE"
done
fi
if [ -x /usr/sbin/apachectl ]; then
$sudo /usr/sbin/apachectl graceful > /dev/null || echo "Cannot restart apache" >> "$DOMAIN_LOG_FILE"
fi
if [ -x /usr/sbin/apache2ctl ]; then
$sudo /usr/sbin/apache2ctl graceful > /dev/null || echo "Cannot restart apache" >> "$DOMAIN_LOG_FILE"
fi

View File

@ -1,80 +0,0 @@
#!/bin/sh
set -e
# Ceci créé un hack php pour chacun des domaines hébergés par alternc
# ce hack consiste à restreindre chaque usager à son propre répertoire
# dans alternc/html/u/user avec open_base_dir
# ce script a les dépendances suivantes:
# (mysql, /etc/alternc/local.sh) OR /usr/bin/get_account_by_domain dans
# l'ancien package alternc-admintools désormais dans alternc natif.
# cut, awk, sort
override_d=/var/alternc/apacheconf
override_f=${override_d}/override_php.conf
extra_paths="/var/alternc/dns/redir:/usr/share/php/:/var/alternc/tmp:/tmp"
. /etc/alternc/local.sh
. /usr/lib/alternc/functions.sh
echo -n "adding open_base_dir protection for:"
# boucle sur tous les domaines hébergés, ou sur les arguments de la
# ligne de commande
if [ $# -gt 0 ]; then
for i in "$*"
do
if echo "$i" | grep -q '^\*\.'
then
echo skipping wildcard "$i" >&2
continue
fi
if echo "$i" | grep -q /var/alternc/dns > /dev/null; then
dom="$i"
else
initial_domain=`print_domain_letter "$i"`
dom="/var/alternc/dns/$initial_domain/$i"
fi
doms="$doms $dom"
done
else
doms=`find /var/alternc/dns -type l`
fi
for i in $doms
do
# don't "protect" squirrelmail, it legitimatly needs to consult
# files out of its own directory
if readlink "$i" | grep -q '^/var/alternc/bureau/admin/webmail/*$' || \
readlink "$i" | grep -q '^/var/alternc/bureau/*$'
then
continue
fi
domain=`basename "$i"`
account=`get_account_by_domain $domain`
if [ -z "$account" ]; then
continue
fi
# la première lettre de l'avant-dernière partie du domaine (e.g.
# www.alternc.org -> a)
initial_domain=`print_domain_letter "$domain"`
# la première lettre du username
initial_account=`print_user_letter "$account"`
path1="/var/alternc/dns/$initial_domain/$domain"
path2="/var/alternc/html/$initial_account/$account"
mkdir -p "$override_d/$initial_domain"
if append_no_dupe "$override_d/$initial_domain/$domain" <<EOF
<Directory ${path1}>
php_admin_value open_basedir ${path2}/:${extra_paths}
</Directory>
EOF
then
true
else
echo -n " $domain"
add_dom_entry "Include $override_d/$initial_domain/$domain"
fi
done
echo .

View File

@ -95,7 +95,7 @@ done
for dom in $( mysql_query "select domaine from domaines where dns_action = 'DELETE';") ; do
dns_delete $dom
# Web configurations have already bean cleaned previously
mysql_query "delete sub_domaines where domaine='$dom'; delete domaines where domaine='$dom';"
mysql_query "delete from sub_domaines where domaine='$dom'; delete from domaines where domaine='$dom';"
RELOAD_ZONES="$RELOAD_ZONES $dom"
done
@ -114,7 +114,8 @@ fi
mv "$tempo" "$VHOST_FILE"
# we assume we run apache and bind on the master
/usr/bin/alternc_reload $RELOAD_ZONES || true
#/usr/bin/alternc_reload $RELOAD_ZONES || true
/usr/bin/alternc_reload all || true
for slave in $ALTERNC_SLAVES; do
if [ "$slave" != "localhost" ]; then
ssh alternc@$slave alternc_reload "$RELOAD_ZONES" || true