[enh] removing the unmaintained upnp package

This commit is contained in:
Benjamin Sonntag 2017-10-07 15:12:18 +02:00
parent ddeefbde63
commit ca6b1cf4d9
18 changed files with 1 additions and 569 deletions

View File

@ -29,8 +29,6 @@ E: alternc: dir-or-file-in-var-run var/run/alternc/
W: alternc: binary-without-manpage usr/bin/alternc_get_path
W: alternc: binary-without-manpage usr/bin/alternc_reload
W: alternc: maintainer-script-ignores-errors prerm
E: alternc-upnp: php-script-but-no-phpX-cli-dep usr/lib/alternc/update_upnp.sh
W: alternc-upnp: executable-not-elf-or-script usr/lib/alternc/install.d/upnp-install
W: alternc-awstats: possible-debconf-note-abuse preinst:13 alternc-awstats/errorinstall
E: alternc: duplicate-conffile etc/cron.d/alternc
@ -67,7 +65,6 @@ W: alternc: script-not-executable usr/lib/alternc/functions_dns.sh
W: alternc: script-not-executable usr/lib/alternc/functions_hosting.sh
W: alternc: script-not-executable var/alternc/bureau/class/export_account.php
W: alternc source: debhelper-but-no-misc-depends alternc-upnp
W: alternc source: debhelper-but-no-misc-depends alternc-slave
W: alternc source: debhelper-but-no-misc-depends alternc-roundcube
W: alternc source: debhelper-but-no-misc-depends alternc-squirrelmail

View File

@ -28,7 +28,7 @@ build:
# gettext are built at runtime, to be able to MERGE them from CORE + MODULES before msgfmt
install:
#install-alternc install-squirrelmail install-roundcube install-upnp install-awstats
#install-alternc install-squirrelmail install-roundcube install-awstats
# install AlternC files common between ALTERNC and ALTERNC-SLAVE
install-common:
@ -84,9 +84,6 @@ install-roundcube:
install-squirrelmail:
make -C squirrelmail install DESTDIR=$(DESTDIR)
install-upnp:
make -C upnp install DESTDIR=$(DESTDIR)
install-api:
make -C api install DESTDIR=$(DESTDIR)

View File

@ -1528,20 +1528,6 @@ class m_admin {
return true; // congratulations !
}
/**
* hook function called by AlternC-upnp to know which open
* tcp or udp ports this class requires or suggests
*
* @access private
* @return array a key => value list of port protocol name mandatory values
*/
function hook_upnp_list() {
return array(
"http" => array("port" => 80, "protocol" => "tcp", "mandatory" => 1),
"https" => array("port" => 443, "protocol" => "tcp", "mandatory" => 0),
"ssh" => array("port" => 22, "protocol" => "tcp", "mandatory" => 0),
);
}
}

View File

@ -2175,19 +2175,6 @@ class m_dom {
}
/** hook function called by AlternC-upnp to know which open
* tcp or udp ports this class requires or suggests
* @return array a key => value list of port protocol name mandatory values
* @access private
*/
function hook_upnp_list() {
return array(
"dns-tcp" => array("port" => 53, "protocol" => "tcp", "mandatory" => 1),
"dns-udp" => array("port" => 53, "protocol" => "udp", "mandatory" => 1),
);
}
/**
* List if there is problems in the domains.
* Problems can appear when editing domains type properties

View File

@ -498,17 +498,5 @@ class m_ftp {
}
/**
* hook function called by AlternC-upnp to know which open
* tcp or udp ports this class requires or suggests
* @return array a key => value list of port protocol name mandatory values
* @access private
*/
function hook_upnp_list() {
return array(
"ftp" => array("port" => 21, "protocol" => "tcp", "mandatory" => 1),
);
}
} /* Class m_ftp */

View File

@ -1062,23 +1062,5 @@ ORDER BY
}
/**
* hook function called by AlternC-upnp to know which open
* tcp or udp ports this class requires or suggests
* @return array a key => value list of port protocol name mandatory values
* @access private
*/
function hook_upnp_list() {
return array(
"imap" => array("port" => 143, "protocol" => "tcp", "mandatory" => 1),
"imaps" => array("port" => 993, "protocol" => "tcp", "mandatory" => 1),
"pop" => array("port" => 110, "protocol" => "tcp", "mandatory" => 1),
"pops" => array("port" => 995, "protocol" => "tcp", "mandatory" => 1),
"smtp" => array("port" => 25, "protocol" => "tcp", "mandatory" => 1),
"sieve" => array("port" => 2000, "protocol" => "tcp", "mandatory" => 1),
"submission" => array("port" => 587, "protocol" => "tcp", "mandatory" => 0),
);
}
} /* Class m_mail */

View File

@ -1,6 +0,0 @@
etc/cron.d
usr/share/alternc/panel/class/
usr/share/alternc/panel/admin/
usr/lib/alternc/
usr/lib/alternc/install.d
usr/share/alternc/install/

32
debian/control vendored
View File

@ -275,38 +275,6 @@ Description: Awstats statistics module for AlternC
.
More information on http://www.alternc.com/.
Package: alternc-upnp
Architecture: all
Pre-depends: debconf (>= 0.5.00) | debconf-2.0
Depends: debianutils (>= 1.13.1)
, alternc (>= 3.0~rc1)
, miniupnpc
, php5-cli
, ${misc:Depends}
Description: UPnP client for AlternC
AlternC is a mutualized hosting software manager for Linux.
It allows you to manage your websites, domains, ftp, emails, aliases,
web statistics, mailing-lists, jabber accounts, etc.
.
This extension to AlternC is installing a UPnP IGD client and make it so
that your router required tcp and udp port are forwarded to AlternC.
You need that only if your AlternC's server is behind a NAT router.
.
More information at http://www.alternc.com/
Homepage: http://www.alternc.com/
Description-fr.UTF-8: Client UPnP pour AlternC
AlternC est un logiciel d'hébergement mutualisé pour serveur Linux.
Il permet de gérer les sites web, domaines, ftp, emails, alias,
statistiques web, listes de discussions, comptes jabber, etc.
.
Cette extension d'AlternC installe un client UPnP IGD et fait de telle
sorte que les ports udp et tcp nécessaire au fonctionnement de votre
serveur sous AlternC soient transmis depuis votre routeur.
Vous n'avez besoin de cette extension que si votre serveur AlternC est
situé derrière un routeur NAT.
.
Pour plus d'informations, consultez http://www.alternc.com/
Package: alternc-api
Architecture: all
Pre-depends: debconf (>= 0.5.00) | debconf-2.0

1
debian/rules vendored
View File

@ -13,7 +13,6 @@ override_dh_install:
$(MAKE) install-alternc DESTDIR=$(CURDIR)/debian/alternc
$(MAKE) install-squirrelmail DESTDIR=$(CURDIR)/debian/alternc-squirrelmail
$(MAKE) install-roundcube DESTDIR=$(CURDIR)/debian/alternc-roundcube
$(MAKE) install-upnp DESTDIR=$(CURDIR)/debian/alternc-upnp
$(MAKE) install-awstats DESTDIR=$(CURDIR)/debian/alternc-awstats
$(MAKE) install-slave DESTDIR=$(CURDIR)/debian/alternc-slave
$(MAKE) install-api DESTDIR=$(CURDIR)/debian/alternc-api

View File

@ -1,32 +0,0 @@
# ----------------------------------------------------------------------
# AlternC - Web Hosting System
# Copyright (C) 2000-2012 by the AlternC Development Team.
# https://alternc.org/
# ----------------------------------------------------------------------
# LICENSE
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# To read the license please visit http://www.gnu.org/copyleft/gpl.html
# ----------------------------------------------------------------------
# Purpose of file: Install the files of alternc-upnp packages
# ----------------------------------------------------------------------
install:
# Desktop files
install -m 644 m_upnp.php $(DESTDIR)/usr/share/alternc/panel/class/
install -m 644 upnp_list.php upnp_change.php $(DESTDIR)/usr/share/alternc/panel/admin/
install -m 644 adminmenu_upnp.php $(DESTDIR)/usr/share/alternc/panel/admin/
# Cron
install -m 755 update_upnp.sh $(DESTDIR)/usr/lib/alternc/
# Install script
install -m 644 upnp.sql $(DESTDIR)/usr/share/alternc/install/
install -m 755 upnp-install $(DESTDIR)/usr/lib/alternc/install.d

View File

@ -1 +0,0 @@
<a href="upnp_list.php"><?php __("Manage UPnP port forwarding"); ?></a>

View File

@ -1,238 +0,0 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: Manage UPnP ports forwarding from router
----------------------------------------------------------------------
*/
/**
* This class handle UPnP forwarding from a IGD/UPnP compliant router
* you need this only when you are behind a IGD-compliant router
* each class may exports a hook that defined named port/protocol to
* forward to the local IP address of the server.
* this class manage the upnp table
* and its configuration from admin control panel
*/
class m_upnp {
/* ----------------------------------------------------------------- */
/** get the list of current upnp forwards and their status
* @return array the attributes of all port-forwards
*/
function get_forward_list() {
global $db,$err;
$err->log("upnp","get_forward_list");
$db->query("SELECT * FROM upnp");
$res=array();
while ($db->next_record()) {
$res[]=$db->Record;
}
return $res;
}
/* ----------------------------------------------------------------- */
/** enable a upnp port in the upnp table
* @param integer the id of the port to enable
* @return boolean TRUE if the port has been properly forwarded
* FALSE if an error occurred
*/
function enable_port($id) {
global $db,$err;
$id=intval($id);
$err->log("upnp","enable_port($id)");
$db->query("SELECT enabled FROM upnp WHERE id=$id;");
if (!$db->next_record()) {
$err->raise("upnp",_("The required port is not currently defined"));
return false;
}
if (!$db->f("enabled")) {
$db->query("UPDATE upnp SET enabled=1 WHERE id=$id;");
$err->raise("upnp",_("The specified upnp port is now enabled"));
return true;
}
$err->raise("upnp",_("The specified upnp port is already enabled"));
return true;
}
/* ----------------------------------------------------------------- */
/** disable a upnp port in the upnp table
* @param integer the id of the port to disable
* @return boolean TRUE if the port has been properly forwarded
* FALSE if an error occurred
*/
function disable_port($id) {
global $db,$err;
$id=intval($id);
$err->log("upnp","disable_port($id)");
$db->query("SELECT enabled,mandatory FROM upnp WHERE id=$id;");
if (!$db->next_record()) {
$err->raise("upnp",_("The required port is not currently defined"));
return false;
}
if ($db->f("mandatory")) {
$err->raise("upnp",_("You can't disable that mandatory port forward"));
return false;
}
if ($db->f("enabled")) {
$db->query("UPDATE upnp SET enabled=0 WHERE id=$id;");
$err->raise("upnp",_("The specified upnp port is now disabled"));
return true;
}
$err->raise("upnp",_("The specified upnp port is already disabled"));
return true;
}
/* ----------------------------------------------------------------- */
/** cron launched every minute to check the status of UPnP forwarding
*/
function cron() {
global $hooks,$db,$L_INTERNAL_IP,$PUBLIC_IP;
// if we check anything less than 5 minutes ago, or if the upnp table is empty, let's make a check...
$db->query("SELECT UNIX_TIMESTAMP(lastcheck) AS lc, * FROM upnp ORDER BY lastcheck ASC;");
$forwards=array();
$bigcheck=false;
if (!$db->next_record()) {
$bigcheck=true;
} else {
if ($db->f("lc")+600<time()) {
$bigcheck=true;
}
do {
$db->Record["found"]=false;
$forwards[]=$db->Record;
} while ($db->next_record());
}
if ($bigcheck) {
// Do the check first by calling the hooks & comparing the arrays
$res=$hooks->invoke("hooks_upnp_list");
foreach($res as $c=>$tmp) {
if (is_array($tmp) && count($tmp)) {
foreach($tmp as $name=>$v) {
// We compare the hook array with the forwards array
$found=false;
for($i=0;$i<count($forwards);$i++) {
if ($forwards[$i]["class"]==$c &&
$forwards[$i]["name"]==$name &&
$forwards[$i]["protocol"]==$v["protocol"] &&
$forwards[$i]["port"]==$v["port"] &&
$forwards[$i]["mandatory"]==$v["mandatory"]) {
// Found it and unchanged
$forwards[$i]["found"]=true;
$found=true;
}
} // compare with forwards class.
if (!$found) {
// Mark it for creation
$db->query("INSERT INTO upnp SET mandatory='".addslashes($v["mandatory"])."', protocol='".addslashes($v["protocol"])."', port='".addslashes($v["port"])."', name='".addslashes($name)."', action='CREATE'");
$id=$db->last_id();
$forwards[]=array("id"=>$id, "mandatory" => intval($v["mandatory"]), "protocol" => $v["protocol"], "port" => intval($v["port"]), "name" => $name, "action" => "CREATE");
}
} // for each port forward in that class
}
} // for each hooked class
// Now We search the "not found" and remove them from the array
for($i=0;$i<count($forwards);$i++) {
if (!$forwards[$i]["found"]) {
$forwards[$i]["action"]="DELETING";
$db->query("UPDATE upnp SET action='DELETING' WHERE id=".$forwards[$i]["id"].";");
}
}
} // bigcheck ?
// Ask for the current upnp status of forwarded ports
$status=array(); $statusout=array(); $bad=false;
unset($out);
exec("upnpc -l 2>&1",$res,$out);
if ( is_array($out) && !empty($out)) {
foreach($out as $line) {
// example line: 1 TCP 222->192.168.0.5:22 'libminiupnpc' ''
if (preg_match("#^ *([0-9]+) (TCP|UDP) *([0-9]+)\-\>([0-9\.]+):([0-9]+) *#",$line,$mat)) {
if ($mat[4]==$L_INTERNAL_IP) {
$status[]=array("protocol" => $mat[2], "port" => $mat[3]);
} else {
$statusout[]=array("protocol" => $mat[2], "port" => $mat[3], "ip" => $mat[4]);
}
}
if (preg_match("#No IGD UPnP Device found on the network#",$line)) {
$bad=true;
}
} // For each line in upnpc -l (check list)
}
// No UPnP peripheral !! maybe you should not have installed AlternC-upnp altogether ?
if ($bad) {
foreach($forwards as $f) {
if ($f["action"]!="OK") {
$db->query("UPDATE upnp SET lastupdate=NOW(), lastcheck=NOW(), result='No UPnP device detected in your network !' WHERE id=".$f["id"].";");
} else {
$db->query("UPDATE upnp SET lastupdate=NOW(), lastcheck=NOW(), WHERE id=".$f["id"].";");
}
}
return;
}
// Now, for each forward, we either
// * check it (via upnpc -l parsing)
// * add it (via upnpc -a)
// * remove it (via upnpc -d)
foreach($forwards as $f) {
switch ($f["action"]) {
case "OK": // check
$found=false;
foreach($status as $s) {
if ($s["port"]==$f["port"] && $s["protocol"]==$s["protocol"]) {
$found=true;
$db->query("UPDATE upnp SET lastcheck=NOW() WHERE id=".$f["id"].";");
}
}
if (!$found) {
// Search this protocol+port in the OTHER list ... if found, tell it ...
}
break;
case "CREATE":
break;
case "DELETE":
case "DELETING":
break;
case "DISABLE":
break;
case "ENABLE":
break;
}
}
} // CRON function
} /* Class UPnP */

View File

@ -1,31 +0,0 @@
#!/usr/bin/php
<?php
$f=@fopen("/etc/alternc/local.sh","rb");
if (!$f) {
echo "Can't find /etc/alternc/local.sh, please install AlternC properly !\n";
exit();
}
$ALTERNC_LOC="";
while ($s=fgets($f,1024)) {
if (strpos($s,"=")!==false) {
list($key,$val)=explode("=",trim($s),2);
if (trim($key)=="ALTERNC_LOC") {
$val=trim(trim($val,"'\""));
$ALTERNC_LOC=$val;
break;
}
}
}
fclose($f);
if (!$ALTERNC_LOC) {
echo "Can't find ALTERNC_LOC in /etc/alternc/local.sh, please install AlternC properly !\n";
exit();
}
require_once($ALTERNC_LOC."/class/config_nochk.php");
$upnp->cron();

View File

@ -1,3 +0,0 @@
# This shell script configures the UPnP client if necessary:
* * * * * root /usr/lib/alternc/update_upnp.sh

View File

@ -1,2 +0,0 @@
#!/bin/bash

View File

@ -1,16 +0,0 @@
CREATE TABLE IF NOT EXISTS `upnp` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
`class` varchar(64) NOT NULL,
`protocol` varchar(3) NOT NULL,
`port` int(10) unsigned NOT NULL,
`mandatory` tinyint(3) unsigned NOT NULL,
`enabled` tinyint(3) unsigned NOT NULL,
`lastcheck` datetime NOT NULL,
`lastupdate` datetime NOT NULL,
`action` enum('CREATE','OK','DISABLE','ENABLE','DELETE','DELETING') NOT NULL DEFAULT 'CREATE',
`result` varchar(128) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM COMMENT='UPnP port forwards and their status.';

View File

@ -1,46 +0,0 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: Enable or disable a UPnP port forwarding
----------------------------------------------------------------------
*/
require_once("../class/config.php");
include_once("head.php");
if (!$admin->enabled) {
__("This page is restricted to authorized staff");
exit();
}
$fields = array (
"id" => array ("request", "integer", 0),
"action" => array("request", "string", "enable"),
);
getFields($fields);
if ($action=="disable") {
$upnp->disable($id);
} else {
$upnp->enable($id);
}
require_once("upnp_list.php");

View File

@ -1,97 +0,0 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2000-2012 by the AlternC Development Team.
https://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Purpose of file: Show the UPnP port forwarding list
----------------------------------------------------------------------
*/
require_once("../class/config.php");
include_once("head.php");
if (!$admin->enabled) {
__("This page is restricted to authorized staff");
exit();
}
$r=$upnp->get_forward_list();
$aaction=array("CREATE" => _("Creation in progress"),
"DELETE" => _("Deletion in progress"),
"DELETING" => _("Deletion in progress"),
"DISABLE" => _("Will be disabled soon"),
"ENABLE" => _("Will be enabled soon"),
"OK" => _("OK"),
);
?>
<h3><?php __("UPnP port forwarding list"); ?></h3>
<hr id="topbar"/>
<br />
<?php
if (isset($error) && $error ) {
echo "<p class=\"error\">$error</p>";
}
?>
<p>
<?php __("Here is the list of the requested port forward for AlternC's services, and their status. You can enable or disable some of them."); ?>
<table class="tlist">
<tr>
<th></th>
<th><?php __("Name"); ?></th>
<th><?php __("Class"); ?></th>
<th><?php __("Protocol/Port") ?></th>
<th><?php __("Mandatory") ?></th>
<th><?php __("Enabled") ?></th>
<th><?php __("Last Check"); ?></th>
<th><?php __("Last Update"); ?></th>
<th><?php __("Status"); ?></th>
</tr>
<?php
reset($r);
$col=1;
while (list($key,$val)=each($r))
{
$col=3-$col;
?>
<tr class="lst<?php echo $col; ?>">
<?php
if ($val["mandatory"]) { ?>
<td>&nbsp;</td>
<?php } else { ?>
<td><?php if ($val["enabled"]) { ?><a href="upnp_change.php?action=disable&id=<?php echo $val["id"]; ?>"><?php __("Disable"); ?></a><?php } else { ?><a href="upnp_change.php?action=enable&id=<?php echo $val["id"]; ?>"><?php __("Enable"); ?></a><?php } ?></td>
<?php } ?>
<td><?php echo $val["class"] ?></td>
<td><?php echo $val["protocol"]."/".$val["port"] ?></td>
<td><?php if ($val["mandatory"]) __("Yes"); else __("No"); ?></td>
<td><?php if ($val["enabled"]) __("Yes"); else __("No"); ?></td>
<td><?php echo $val["lastcheck"] ?></td>
<td><?php echo $val["lastupdate"] ?></td>
<td><?php echo $aaction[$val["status"]]; ?><br /><?php echo $val["result"]; ?></td>
</tr>
<?php
} // for loop
?>
</table>
</form>
<?php include_once("foot.php"); ?>