initial commit of file from CVS for smeserver-bandwidthd on Sat Sep 7 20:10:36 AEST 2024
This commit is contained in:
parent
39d69687d3
commit
bd26bff825
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*.rpm
|
||||
*.log
|
||||
*spec-20*
|
||||
*.tar.gz
|
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
# Makefile for source rpm: smeserver-bandwidthd
|
||||
# $Id: Makefile,v 1.1 2020/10/20 11:11:11 brianr Exp $
|
||||
NAME := smeserver-bandwidthd
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
15
README.md
15
README.md
@ -1,3 +1,16 @@
|
||||
# smeserver-bandwidthd
|
||||
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-bandwidthd
|
||||
|
||||
SMEServer Koozali developed git repo for smeserver-bandwidthd smecontribs
|
||||
|
||||
## Wiki
|
||||
<br />https://wiki.koozali.org/Bandwidthd
|
||||
<br />https://wiki.koozali.org/Bandwidthd/fr
|
||||
|
||||
## Bugzilla
|
||||
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-bandwidthd&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||
|
||||
## Description
|
||||
|
||||
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
|
||||
*Once it has been checked, then this comment will be deleted*
|
||||
<br />
|
||||
|
1
contriborbase
Normal file
1
contriborbase
Normal file
@ -0,0 +1 @@
|
||||
contribs10
|
59
createlinks
Normal file
59
createlinks
Normal file
@ -0,0 +1,59 @@
|
||||
#! /usr/bin/perl -w
|
||||
|
||||
use esmith::Build::CreateLinks qw(:all);
|
||||
|
||||
####################
|
||||
# links to add
|
||||
|
||||
# templates to expand
|
||||
templates2events("/etc/e-smith/sql/init/80bandwidthd", qw( conf-bandwidthd bootstrap-console-save post-upgrade));
|
||||
templates2events("/etc/bandwidthd.conf", qw( conf-bandwidthd bootstrap-console-save post-upgrade));
|
||||
templates2events("/var/www/bandwidthd/phphtdocs/config.conf", qw( conf-bandwidthd bootstrap-console-save post-upgrade));
|
||||
templates2events("/etc/httpd/conf/httpd.conf", qw( conf-bandwidthd ));
|
||||
|
||||
# services to launch on event
|
||||
safe_symlink("restart", "root/etc/e-smith/events/conf-bandwidthd/services2adjust/bandwidthd");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/conf-bandwidthd/services2adjust/httpd-e-smith");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/conf-bandwidthd/services2adjust/mysql.init");
|
||||
safe_symlink("reload-or-restart", "root/etc/e-smith/events/conf-bandwidthd/services2adjust/php74-php-fpm");
|
||||
|
||||
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/var/www/bandwidthd/phphtdocs/config.conf/template-begin");
|
||||
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/var/www/bandwidthd/phphtdocs/config.conf/template-end");
|
||||
|
||||
#Server manager link
|
||||
#safe_symlink("../../../functions/wrapper", "root/etc/e-smith/web/panels/manager/cgi-bin/bandwidthd");
|
||||
panel_link("bandwidthd","manager");
|
||||
|
||||
# our event specific for updating with yum without reboot
|
||||
$event = "smeserver-bandwidthd-update";
|
||||
#add here the path to your templates needed to expand
|
||||
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
|
||||
|
||||
foreach my $file (qw(
|
||||
/etc/systemd/system-preset/49-koozali.preset
|
||||
/etc/e-smith/sql/init/80bandwidthd
|
||||
/etc/bandwidthd.conf
|
||||
/var/www/bandwidthd/phphtdocs/config.conf
|
||||
/etc/httpd/conf/httpd.conf
|
||||
))
|
||||
{
|
||||
templates2events( $file, $event );
|
||||
}
|
||||
|
||||
#action needed in case we have a systemd unit
|
||||
event_link("systemd-default", $event, "10");
|
||||
event_link("systemd-reload", $event, "50");
|
||||
|
||||
#action specific to this package
|
||||
#event_link("conf-timezone", $event, "30");
|
||||
#services we need to restart
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/bandwidthd");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
|
||||
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php74-php-fpm");
|
||||
|
||||
|
||||
use esmith::Build::Backup qw(:all);
|
||||
backup_includes("smeserver-bandwidthd", qw(
|
||||
/var/www/bandwidthd/
|
||||
));
|
1
root/etc/cron.d/bandwidthd_mysql_purge
Normal file
1
root/etc/cron.d/bandwidthd_mysql_purge
Normal file
@ -0,0 +1 @@
|
||||
5 5 * * 4 root /bin/sh /usr/share/doc/bandwidthd-2.0.1.1/phphtdocs/bd_mysql_purge.sh |mysql `/sbin/e-smith/db configuration getprop bandwidthd DbName`|grep -vE '(Msg_text|already up to date|status.*OK)'
|
1
root/etc/cron.d/bandwidthd_rotate
Normal file
1
root/etc/cron.d/bandwidthd_rotate
Normal file
@ -0,0 +1 @@
|
||||
0 0 * * * root /bin/kill -HUP `cat /var/run/bandwidthd.pid`
|
1
root/etc/e-smith/db/accounts/defaults/bandwidthd/type
Normal file
1
root/etc/e-smith/db/accounts/defaults/bandwidthd/type
Normal file
@ -0,0 +1 @@
|
||||
reserved
|
@ -0,0 +1 @@
|
||||
bandwidthd
|
@ -0,0 +1 @@
|
||||
bandwidthd
|
@ -0,0 +1 @@
|
||||
bandwidthd
|
@ -0,0 +1 @@
|
||||
enabled
|
@ -0,0 +1 @@
|
||||
service
|
@ -0,0 +1 @@
|
||||
private
|
16
root/etc/e-smith/db/configuration/migrate/80bandwidthd
Normal file
16
root/etc/e-smith/db/configuration/migrate/80bandwidthd
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
use MIME::Base64 qw(encode_base64);
|
||||
|
||||
my $rec = $DB->get('bandwidthd') || $DB->new_record('bandwidthd', {type => 'service'});
|
||||
|
||||
if (my $grapCutofff = $DB->get_prop_and_delete('bandwidthd', 'grapCutofff')) {
|
||||
$rec->merge_props('grapCutoff', $grapCutofff);
|
||||
}
|
||||
|
||||
|
||||
my $pw = $rec->prop('DbPassword');
|
||||
return "" if $pw;
|
||||
$pw = MIME::Base64::encode(int( (1000000000000000) * rand() ));
|
||||
chomp($pw);
|
||||
$rec->set_prop('DbPassword', "$pw" );
|
||||
}
|
2
root/etc/e-smith/events/actions/bandwidthd-enable
Normal file
2
root/etc/e-smith/events/actions/bandwidthd-enable
Normal file
@ -0,0 +1,2 @@
|
||||
#/bin/sh
|
||||
systemctl enable bandwidthd.service
|
2
root/etc/e-smith/events/actions/bandwidthd-start
Normal file
2
root/etc/e-smith/events/actions/bandwidthd-start
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
systemctl start bandwidthd.service
|
3
root/etc/e-smith/templates.metadata/etc/bandwidthd.conf
Normal file
3
root/etc/e-smith/templates.metadata/etc/bandwidthd.conf
Normal file
@ -0,0 +1,3 @@
|
||||
PERMS="0640"
|
||||
UID="root"
|
||||
GID="www"
|
@ -0,0 +1 @@
|
||||
PERMS=0750
|
@ -0,0 +1,3 @@
|
||||
PERMS="0640"
|
||||
UID="admin"
|
||||
GID="www"
|
7
root/etc/e-smith/templates/etc/bandwidthd.conf/05header
Normal file
7
root/etc/e-smith/templates/etc/bandwidthd.conf/05header
Normal file
@ -0,0 +1,7 @@
|
||||
####################################################
|
||||
# Bandwidthd.conf
|
||||
#
|
||||
# Commented out options are here to provide
|
||||
# documentation and represent defaults
|
||||
|
||||
|
73
root/etc/e-smith/templates/etc/bandwidthd.conf/07subnet
Normal file
73
root/etc/e-smith/templates/etc/bandwidthd.conf/07subnet
Normal file
@ -0,0 +1,73 @@
|
||||
# Subnets to collect statistics on. Traffic that
|
||||
# matches none of these subnets will be ignored.
|
||||
# Syntax is either IP Subnet Mask or CIDR
|
||||
{
|
||||
# here we add list of local networks
|
||||
use esmith::NetworksDB;
|
||||
|
||||
my $ndb = esmith::NetworksDB->open_ro();
|
||||
|
||||
$localAccess = $ndb->local_access_spec();
|
||||
$localAccess =~ s/ /,/g;
|
||||
$localAccess =~ s:/: :g;
|
||||
my @LocalAccess = split(/,/, $localAccess);
|
||||
|
||||
foreach $rec (@LocalAccess)
|
||||
{
|
||||
next if $rec eq "127.0.0.1";
|
||||
$rec= ($rec=~ /[.\d]+ [.\d]+/ )? $rec : "$rec 255.255.255.255";
|
||||
$OUT .= "subnet $rec \n";
|
||||
}
|
||||
|
||||
#$OUT .= "subnet $localAccess \n";
|
||||
|
||||
# subnet for external access
|
||||
|
||||
my $validFrom = ${'httpd-admin'}{'ValidFrom'} || "disabled";
|
||||
if ($validFrom ne "disabled")
|
||||
{
|
||||
#$validFrom =~ s/,/ /g;
|
||||
$validFrom =~ s:/: :g;
|
||||
#$externalSSLAccess = $validFrom;
|
||||
my @externalSSLAccess = split(/,/, $validFrom);
|
||||
|
||||
foreach $rec (@externalSSLAccess)
|
||||
{
|
||||
$OUT .= "subnet $rec \n";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# subnet of external interface
|
||||
|
||||
my $externalNet = ${'ExternalInterface'}{'IPAddress'};
|
||||
if (defined $externalNet )
|
||||
{
|
||||
#$externalNet =~ s/[0-9]+$)/0/g;
|
||||
$OUT .= "subnet ". ${'ExternalInterface'}{'IPAddress'} ." ". ${'ExternalInterface'}{'Netmask'} ." \n";
|
||||
}
|
||||
|
||||
# subnet of adsl peer if(bandwidthd=service|remotePeers|enabled)
|
||||
|
||||
|
||||
# also manually added (bandwidthd=service|subnet|172.16.0.0/12,192.168.0.0/16)
|
||||
my $subnet = $bandwidthd{'subnet'} || "disabled";
|
||||
if ($subnet ne "disabled")
|
||||
{
|
||||
#$validFrom =~ s/,/ /g;
|
||||
#$subnet =~ s:/: :g;# here we ask to have a syntax with /24 so keeping the /
|
||||
#$externalSSLAccess = $validFrom;
|
||||
@externalSSLAccess = split(/,/, $subnet);
|
||||
|
||||
foreach $rec (@externalSSLAccess)
|
||||
{
|
||||
$OUT .= "subnet $rec \n";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
11
root/etc/e-smith/templates/etc/bandwidthd.conf/08device
Normal file
11
root/etc/e-smith/templates/etc/bandwidthd.conf/08device
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
# Device to listen on
|
||||
# Bandwidthd listens on the first device it detects
|
||||
# by default. Run "bandwidthd -l" for a list of
|
||||
# devices.
|
||||
#dev "eth0"
|
||||
{
|
||||
# dev "any" unless $device
|
||||
my $device = $bandwidthd{'device'} ||"any";
|
||||
$OUT .= "dev \"$device\"\n";
|
||||
}
|
72
root/etc/e-smith/templates/etc/bandwidthd.conf/09options
Normal file
72
root/etc/e-smith/templates/etc/bandwidthd.conf/09options
Normal file
@ -0,0 +1,72 @@
|
||||
###################################################
|
||||
# Options that don't usually get changed
|
||||
|
||||
# An interval is 2.5 minutes, this is how many
|
||||
# intervals to skip before doing a graphing run
|
||||
#skip_intervals 0
|
||||
{
|
||||
my $interval = $bandwidthd{'skipInterval'} || "0";
|
||||
$OUT .= "skip_intervals $interval\n"
|
||||
|
||||
}
|
||||
|
||||
# Graph cutoff is how many k must be transfered by an
|
||||
# ip before we bother to graph it
|
||||
#graph_cutoff 1024
|
||||
{
|
||||
my $cutoff = $bandwidthd{'grapCutoff'} || "1024";
|
||||
$OUT .= "graph_cutoff $cutoff\n"
|
||||
|
||||
}
|
||||
|
||||
#Put interface in promiscuous mode to score to traffic
|
||||
#that may not be routing through the host machine.
|
||||
#promiscuous true
|
||||
{
|
||||
my $promiscuous = $bandwidthd{'promiscuous'} || "false";
|
||||
$OUT .= "promiscuous $promiscuous\n"
|
||||
|
||||
}
|
||||
|
||||
#Log data to cdf file htdocs/log.cdf
|
||||
#output_cdf false
|
||||
{
|
||||
my $output_cdf = $bandwidthd{'output_cdf'} || "false";
|
||||
$OUT .= "output_cdf $output_cdf\n"
|
||||
|
||||
}
|
||||
|
||||
#Read back the cdf file on startup
|
||||
#recover_cdf false
|
||||
{
|
||||
my $recover_cdf = $bandwidthd{'recover_cdf'} || "false";
|
||||
$OUT .= "recover_cdf $recover_cdf\n"
|
||||
|
||||
}
|
||||
|
||||
#Libpcap format filter string used to control what bandwidthd see's
|
||||
#Please always include "ip" in the string to avoid strange problems
|
||||
#filter "ip"
|
||||
|
||||
### use a template custom for this one !
|
||||
|
||||
#Draw Graphs - This default to true to graph the traffic bandwidthd is recording
|
||||
#Usually set this to false if you only want cdf output or
|
||||
#you are using the database output option. Bandwidthd will use very little
|
||||
#ram and cpu if this is set to false.
|
||||
#graph true
|
||||
{
|
||||
my $graph = $bandwidthd{'graph'} || "true";
|
||||
$OUT .= "graph $graph\n"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#Set META REFRESH seconds (default 150, use 0 to disable).
|
||||
#meta_refresh 150
|
||||
{
|
||||
my $meta_refresh = $bandwidthd{'meta_refresh'} || "150";
|
||||
$OUT .= "meta_refresh $meta_refresh\n"
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
# Arbitrary sensor name, I recommend the sensors fully qualified domain
|
||||
# name
|
||||
#sensor_id "sensor1"
|
||||
{
|
||||
my $sensorname = "$SystemName.$DomainName";
|
||||
my $sensorid = $bandwidthd{'sensor'} || $sensorname ;
|
||||
$OUT .= "sensor_id \"$sensorid\"\n";
|
||||
}
|
7
root/etc/e-smith/templates/etc/bandwidthd.conf/15DBtype
Normal file
7
root/etc/e-smith/templates/etc/bandwidthd.conf/15DBtype
Normal file
@ -0,0 +1,7 @@
|
||||
# Database type, possible values, pgsql, mysql or none
|
||||
#output_database mysql
|
||||
{
|
||||
my $dbtype = $bandwidthd{'DbType'} || "mysql";
|
||||
$OUT .= "output_database $dbtype\n";
|
||||
|
||||
}
|
15
root/etc/e-smith/templates/etc/bandwidthd.conf/17pgsql
Normal file
15
root/etc/e-smith/templates/etc/bandwidthd.conf/17pgsql
Normal file
@ -0,0 +1,15 @@
|
||||
# PostgreSQL
|
||||
# Standard postgres connect string, just like php, see postgres docs for
|
||||
# details
|
||||
#pgsql_connect_string "user = someuser dbname = mydb host = databaseserver.com"
|
||||
|
||||
{
|
||||
$OUT .="\n";
|
||||
my $dbtype = $bandwidthd{'DbType'} || "mysql";
|
||||
my $dbhost = $bandwidthd{'Dbhost'} || "localhost";
|
||||
|
||||
$OUT .= "pgsql_connect_string \"user = ".$bandwidthd{'DbUser'}." password = ". $bandwidthd{'DbPassword'} ." dbname = ".$bandwidthd{'DbName'}." host = $dbhost\";\n"
|
||||
unless $dbtype eq "mysql";
|
||||
|
||||
}
|
||||
|
12
root/etc/e-smith/templates/etc/bandwidthd.conf/20mysql
Normal file
12
root/etc/e-smith/templates/etc/bandwidthd.conf/20mysql
Normal file
@ -0,0 +1,12 @@
|
||||
# SME Server Settings MYSQL DB
|
||||
# MySQL
|
||||
{
|
||||
my $dbhost = $bandwidthd{'Dbhost'} || "localhost";
|
||||
my $dbport = $bandwidthd{'Dbport'} || "0";
|
||||
$OUT .= "mysql_host \"". $dbhost ."\"\n";
|
||||
$OUT .= "mysql_dbname \"". $bandwidthd{'DbName'} ."\"\n";
|
||||
$OUT .= "mysql_user \"". $bandwidthd{'DbUser'} ."\"\n";
|
||||
$OUT .= "mysql_pass \"". $bandwidthd{'DbPassword'} ."\"\n";
|
||||
$OUT .= "# Port 0 means, that the default port is used\n";
|
||||
$OUT .= "mysql_port ". $dbport ."\n";
|
||||
}
|
21
root/etc/e-smith/templates/etc/e-smith/sql/init/80bandwidthd
Normal file
21
root/etc/e-smith/templates/etc/e-smith/sql/init/80bandwidthd
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
my $db = $bandwidthd{DbName} || 'bandwidthd';
|
||||
my $user = $bandwidthd{DbUser} || 'bandwidthd';
|
||||
my $pass = $bandwidthd{DbPassword} || 'changemebandwidthd';
|
||||
$OUT .= <<END
|
||||
#! /bin/sh
|
||||
if [ -d /var/lib/mysql/$db ]; then
|
||||
exit
|
||||
fi
|
||||
/usr/bin/mysql <<EOF
|
||||
CREATE DATABASE $db DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
use $db;
|
||||
#Insert application specific command to create database structure
|
||||
|
||||
use mysql;
|
||||
GRANT ALL PRIVILEGES ON $db.* TO $user\@localhost
|
||||
IDENTIFIED BY '$pass';
|
||||
flush privileges;
|
||||
EOF
|
||||
END
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
{
|
||||
my $status = $bandwidthd{'status'} || "disabled";
|
||||
return " # bandwidthd is disabled in this VirtualHost"
|
||||
unless $status eq 'enabled';
|
||||
|
||||
$OUT = "";
|
||||
my $pass = 0;
|
||||
my $allow = "ip $localAccess";
|
||||
my $name = $bandwidthd{'Name'} || 'Application bandwidthd Login';
|
||||
my $webinterface = $bandwidthd{'webinterface'} || 'both';
|
||||
$version = "74"; #temp bjr 30nov2020
|
||||
|
||||
for ('exit-if-none')
|
||||
{
|
||||
if ($bandwidthd{'webaccess'})
|
||||
{
|
||||
if ($bandwidthd{'webaccess'} eq 'private')
|
||||
{
|
||||
$allow = "ip $localAccess $externalSSLAccess";
|
||||
$pass = 1;
|
||||
}
|
||||
elsif ($bandwidthd{'webaccess'} eq 'local')
|
||||
{
|
||||
$allow = "ip $localAccess $externalSSLAccess";
|
||||
$pass = 0;
|
||||
}
|
||||
elsif ($bandwidthd{'webaccess'} eq 'public')
|
||||
{
|
||||
$allow = 'all granted';
|
||||
$pass = 1;
|
||||
}
|
||||
elsif ($bandwidthd{'webaccess'} eq 'global')
|
||||
{
|
||||
$allow = 'all granted';
|
||||
$pass = 0;
|
||||
}
|
||||
}
|
||||
if ($webinterface eq "both" || $webinterface eq "html")
|
||||
{
|
||||
$OUT .= "#------------------------------------------------------------\n";
|
||||
$OUT .= "# bandwidthd HTML- $name\n";
|
||||
$OUT .= "#------------------------------------------------------------\n";
|
||||
|
||||
|
||||
if (exists $bandwidthd{'URL'} && $webinterface eq "html")
|
||||
{ $OUT .= "Alias /$bandwidthd{'URL'} /var/www/bandwidthd/htdocs\n"; }
|
||||
|
||||
|
||||
if ( $webinterface eq "html")
|
||||
{
|
||||
$OUT .= "Alias /bandwidthd /var/www/bandwidthd/htdocs\n";
|
||||
}
|
||||
$OUT .= "Alias /bandwidthd-static /var/www/bandwidthd/htdocs\n";
|
||||
|
||||
$OUT .= "\n";
|
||||
$OUT .= "<Directory /var/www/bandwidthd/htdocs>\n";
|
||||
$OUT .= " AddType application/x-httpd-php .php .conf\n";
|
||||
|
||||
$OUT .= "<FilesMatch \.php\$\>\n";
|
||||
$OUT .= "SetHandler \"proxy:unix:/var/run/php-fpm/php$version.sock|fcgi://localhost\"\n";
|
||||
$OUT .= "</FilesMatch>\n";
|
||||
|
||||
$OUT .= " Options None\n";
|
||||
if ($pass)
|
||||
{
|
||||
$OUT .= " AuthName \"$name\"\n";
|
||||
$OUT .= " AuthBasicProvider external\n";
|
||||
$OUT .= " AuthType Basic\n";
|
||||
$OUT .= " AuthExternal pwauth\n";
|
||||
}
|
||||
$OUT .= " <RequireAll>\n";
|
||||
$OUT .= " require user admin\n" if ($pass);
|
||||
$OUT .= " Require $allow\n";
|
||||
$OUT .= " </RequireAll>\n";
|
||||
$OUT .= "</Directory>\n";
|
||||
}
|
||||
|
||||
if ($webinterface eq "both" || $webinterface eq "php")
|
||||
{
|
||||
$OUT .= "#------------------------------------------------------------\n";
|
||||
$OUT .= "# bandwidthd PHP- $name\n";
|
||||
$OUT .= "#------------------------------------------------------------\n";
|
||||
|
||||
|
||||
if (exists $bandwidthd{'URL'} && $webinterface ne "html" )
|
||||
{ $OUT .= "Alias /$bandwidthd{'URL'} /var/www/bandwidthd/phphtdocs\n"; }
|
||||
|
||||
|
||||
$OUT .= "Alias /bandwidthd /var/www/bandwidthd/phphtdocs\n";
|
||||
|
||||
$OUT .= "Alias /bandwidthd-sql /var/www/bandwidthd/phphtdocs\n";
|
||||
|
||||
$OUT .= "\n";
|
||||
$OUT .= "<Directory /var/www/bandwidthd/phphtdocs>\n";
|
||||
|
||||
$OUT .= "<FilesMatch \.php\$\>\n";
|
||||
$OUT .= "SetHandler \"proxy:unix:/var/run/php-fpm/php$version.sock|fcgi://localhost\"\n";
|
||||
$OUT .= "</FilesMatch>\n";
|
||||
|
||||
$OUT .= " SSLRequireSSL\n";
|
||||
$OUT .= " Options None\n";
|
||||
if ($pass)
|
||||
{
|
||||
$OUT .= " AuthName \"$name\"\n";
|
||||
$OUT .= " AuthBasicProvider external\n";
|
||||
$OUT .= " AuthType Basic\n";
|
||||
$OUT .= " AuthExternal pwauth\n";
|
||||
}
|
||||
$OUT .= " <RequireAll>\n";
|
||||
$OUT .= " require user admin\n" if ($pass);
|
||||
$OUT .= " Require $allow\n";
|
||||
$OUT .= " </RequireAll>\n";
|
||||
$OUT .= "</Directory>\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
my $status = $bandwidthd{'status'} || "disabled";
|
||||
return " # bandwidthd is disabled in this VirtualHost"
|
||||
unless $status eq 'enabled';
|
||||
$haveSSL = (exists ${modSSL}{status} and ${modSSL}{status} eq "enabled") ? 'yes' : 'no';
|
||||
|
||||
if (($port ne "443") && ($haveSSL eq 'yes') )
|
||||
{
|
||||
$OUT .= "RewriteEngine on\n";
|
||||
$OUT .= " RewriteRule ^/bandwidthd(/.*|\$) https://%{HTTP_HOST}/bandwidthd\$1 [L,R]\n";
|
||||
$OUT .= " RewriteRule ^/bandwidthd-php(/.*|\$) https://%{HTTP_HOST}/bandwidthd-php\$1 [L,R]\n";
|
||||
$OUT .= " RewriteRule ^/bandwidthd-static(/.*|\$) https://%{HTTP_HOST}/bandwidthd-static\$1 [L,R]\n";
|
||||
if (exists $bandwidthd{'URL'})
|
||||
{ $OUT .= " RewriteRule ^/$bandwidthd{'URL'} https://%{HTTP_HOST}/$bandwidthd{'URL'}\$1 [L,R]\n"; }
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
{ push( @list, 'bandwidthd'); $OUT ="";}
|
@ -0,0 +1,45 @@
|
||||
|
||||
{
|
||||
my $width = $bandwidthd{'width'} || "900";
|
||||
my $height = $bandwidthd{'height'} || "256";
|
||||
my $interval = $bandwidthd{'interval'} || "INT_DAILY";
|
||||
|
||||
$OUT .= "define('DFLT_WIDTH', $width);\n";
|
||||
$OUT .= "define('DFLT_HEIGHT', $height);\n";
|
||||
$OUT .= "define('DFLT_INTERVAL', $interval);\n";
|
||||
|
||||
}
|
||||
|
||||
// Select type of database you are using
|
||||
// Possible values are DB_PGSQL and DB_MYSQL
|
||||
{
|
||||
my $dbtype = $bandwidthd{'DbType'} || "mysql";
|
||||
if ( $dbtype eq "mysql")
|
||||
{$dbtype = "DB_MYSQL";}
|
||||
else
|
||||
{$dbtype = "DB_PGSQL";}
|
||||
|
||||
$OUT .= "\$dbtype = $dbtype;\n";
|
||||
|
||||
}
|
||||
|
||||
// Configuration for PostgreSQL
|
||||
{
|
||||
$OUT .= "\n";
|
||||
my $dbtype = $bandwidthd{'DbType'} || "mysql";
|
||||
my $dbhost = $bandwidthd{'Dbhost'} || "localhost";
|
||||
|
||||
$OUT .= "\$pgsql_connect_string = \"user = ".$bandwidthd{'DbUser'}." password = ". $bandwidthd{'DbPassword'} ." dbname = ".$bandwidthd{'DbName'}." host = $dbhost\";\n"
|
||||
unless $dbtype eq "mysql";
|
||||
|
||||
}
|
||||
// Configuration for MySQL
|
||||
// You can specify port after semicolon, for example "localhost:4067"
|
||||
{
|
||||
my $dbhost = $bandwidthd{'Dbhost'} || "localhost";
|
||||
|
||||
$OUT .= "\$mysql_host = \"$dbhost\";\n";
|
||||
$OUT .= "\$mysql_user = \"".$bandwidthd{'DbUser'}."\";\n";
|
||||
$OUT .= "\$mysql_pass = \"". $bandwidthd{'DbPassword'} ."\";\n";
|
||||
$OUT .= "\$mysql_dbname = \"".$bandwidthd{'DbName'}."\";\n";
|
||||
}
|
31
root/etc/e-smith/web/functions/bandwidthd
Normal file
31
root/etc/e-smith/web/functions/bandwidthd
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/perl
|
||||
#----------------------------------------------------------------------
|
||||
# heading : Administration
|
||||
# description : Bandwidthd
|
||||
# navigation : 4000 4200
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use CGI':all';
|
||||
use CGI::Carp qw(fatalsToBrowser);
|
||||
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$ENV {'PATH'} = '/bin:/usr/bin:/sbin';
|
||||
$ENV {'SHELL'} = '/bin/bash';
|
||||
delete $ENV {'ENV'};
|
||||
}
|
||||
|
||||
|
||||
my $q = new CGI;
|
||||
my $content="0; url=https://".$ENV {'HTTP_X_FORWARDED_HOST'}."/bandwidthd";
|
||||
$q->default_dtd('-//W3C//DTD XHTML 1.0 Transitional//EN');
|
||||
|
||||
print $q->header ('text/html');
|
||||
print $q->start_html (-head=>meta({-http_equiv=>'refresh', -content=>$content}));
|
||||
|
||||
|
||||
|
||||
print $q->end_html;
|
||||
|
@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
After=wan.service
|
||||
After=networking.service
|
||||
[Service]
|
||||
ExecStartPre=-/sbin/e-smith/expand-template /etc/bandwidthd.conf
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
||||
|
127
smeserver-bandwidthd.spec
Normal file
127
smeserver-bandwidthd.spec
Normal file
@ -0,0 +1,127 @@
|
||||
%define name smeserver-bandwidthd
|
||||
%define version 2.0.1.2
|
||||
%define release 19
|
||||
Summary: bandwidthd is a helpdesk system
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
Distribution: SME Server
|
||||
License: GNU GPL version 2
|
||||
Group: SMEserver/addon
|
||||
Source: smeserver-bandwidthd-%{version}.tar.xz
|
||||
|
||||
BuildArchitectures: noarch
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-buildroot
|
||||
BuildRequires: e-smith-devtools
|
||||
Requires: e-smith-release >= 10.0
|
||||
Requires: e-smith-apache >= 2.6.0-19
|
||||
Requires: bandwidthd
|
||||
AutoReqProv: no
|
||||
|
||||
%description
|
||||
bandwidthd is an application adapted as a contrib for SMEserver
|
||||
|
||||
%changelog
|
||||
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 2.0.1.2-19.sme
|
||||
- Roll up patches and move to git repo [SME: 12338]
|
||||
|
||||
* Sat Sep 07 2024 BogusDateBot
|
||||
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||
by assuming the date is correct and changing the weekday.
|
||||
|
||||
* Tue May 28 2024 Jean-Philippe Pialasse <jpp@koozali.org> 2.0.1.2-18.sme
|
||||
- expand config and restart on ip-up event [SME: 12697]
|
||||
also add external Gateway to monitor
|
||||
|
||||
* Tue Dec 27 2022 Jean-Philippe Pialasse <tests@pialasse.com> 2.0.1.2-17.sme
|
||||
- fix Can't modify constant item in scalar assignment [SME: 12292]
|
||||
|
||||
* Fri Dec 02 2022 Jean-Philippe Pialasse <tests@pialasse.com> 2.0.1.2-16.sme
|
||||
- fix preset disabled [SME: 12251]
|
||||
|
||||
* Sat Jul 30 2022 Brian Read <brianr@bjsystems.co.uk> 2.0.1.2-15.sme
|
||||
- Re-build and link to latest devtools [SME: 11997]
|
||||
|
||||
* Mon Jul 25 2022 Jean-Philippe Pialasse <tests@pialasse.com> 2.0.1.2-14.sme
|
||||
- add to core backup [SME: 11046]
|
||||
- access syntax for httpd 2.4 [SME: 12037]
|
||||
|
||||
* Wed Jun 29 2022 Jean-Philippe Pialasse <tests@pialasse.com> 2.0.1.2-13.sme
|
||||
- Re-build and link to latest devtools typo for grapCutofff [SME: 11046]
|
||||
- /etc/bandwidthd.conf to 0664 [SME: 11046]
|
||||
|
||||
* Sun Jun 06 2021 Jean-Philippe Pialasse <tests@pialasse.com> 2.0.1.2-12.sme
|
||||
- add php74-php-fpm reload-or-restart [SME: 11046]
|
||||
|
||||
* Tue Feb 02 2021 Brian Read <brianr@bjsystems.co.uk> 2.0.1.2-11.sme
|
||||
- Update-Creatlinks-with-systemd-stuff [SME: 11046]
|
||||
|
||||
* Tue Feb 02 2021 BogusDateBot
|
||||
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||
by assuming the date is correct and changing the weekday.
|
||||
|
||||
* Mon Nov 30 2020 Brian Read <brianr@bjsystems.co.uk> 2.0.1.2-10.sme
|
||||
- Set $version in httpd.conf [SME: 11046]
|
||||
|
||||
* Fri Nov 27 2020 Brian Read <brianr@bjsystems.co.uk> 2.0.1.2-9.sme
|
||||
- Update createlinks for systemd startup [SME: 11046]
|
||||
- Update httpd with extra loadmodules
|
||||
|
||||
* Tue Oct 20 2020 Brian Read <brianr@bjsystems.co.uk> 2.0.1.2-8.sme
|
||||
- Initial import into SME10 tree- [SME: 11046]
|
||||
- Add in link to createlinks to wrapper for Server Manager panel
|
||||
- Fix up httpd.conf template to call php-fwp
|
||||
|
||||
* Sat Dec 17 2016 Jean-Philipe Pialasse <tests@pialasse.com> 2.0.1.2-7.sme
|
||||
- Re-build and link to latest devtools [SME: 11997]
|
||||
|
||||
* Thu Dec 15 2016 Jean-Philipe Pialasse <tests@pialasse.com> 2.0.1.2-6.sme
|
||||
- Re-build and link to latest devtools one more time too verbose cronjob and unique IP networks [SME: 8536]
|
||||
|
||||
* Tue Nov 10 2015 JP Pialasse <tests@pialasse.com> 2.0.1.2-5.sme
|
||||
Mon Nov 10 2015 --> Mon Nov 09 2015 or Tue Nov 10 2015 or Mon Nov 16 2015 or ....
|
||||
- Re-build and link to latest devtoolsed cron too verbose [SME: 8536]
|
||||
- Re-build and link to latest devtoolsed wont restart with single IP network [SME: 8524]
|
||||
|
||||
* Sat Sep 26 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.0.1.2-2.sme
|
||||
- removed typo [SME: 8116]
|
||||
- Added smeserver-bandwidthd-2.0.1.2.cronmysql.patch
|
||||
|
||||
* Mon Jun 16 2014 JP Pialasse <tests@pialasse.com> 2.0.1.2-1.sme
|
||||
- initial import to SME9 contribs
|
||||
|
||||
* Mon Dec 30 2013 JP Pialasse <tests@pialasse.com> 2.0.1.1-6.sme
|
||||
- add require SSL [SME: 8099]
|
||||
|
||||
* Sun Dec 29 2013 JP Pialasse <tests@pialasse.com> 2.0.1.1-4.sme
|
||||
- Re-build and link to latest devtools missing mysql.init
|
||||
- Re-build and link to latest devtools http auth error
|
||||
|
||||
* Fri Dec 27 2013 JP Pialasse <tests@pialasse.com> 2.0.1.1-2.sme
|
||||
- few enhancement and bug fixing
|
||||
- added link in manager
|
||||
|
||||
* Thu Dec 26 2013 CONTRIB MAKER <tests@pialasse.com> 2.0.1.1-1.sme
|
||||
- initial release
|
||||
- builds from unchanged .tar.gz
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
perl createlinks
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
||||
rm -f %{name}-%{version}-filelist
|
||||
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
||||
> %{name}-%{version}-filelist
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files -f %{name}-%{version}-filelist
|
||||
%defattr(-,root,root)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user