From b5dad381f8dbfc3e0df5d3f4ac4dc907065927c2 Mon Sep 17 00:00:00 2001 From: topper727 Date: Thu, 31 Oct 2013 17:29:41 -0400 Subject: CrystalFontz packet driver 4 status LED fix Fixed 4 status LED's on left side of CrystalFontz 735 display (635 compat) To show correct. Only the Gateway seems to not function for me. --- config/lcdproc-dev/lcdproc_client.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/config/lcdproc-dev/lcdproc_client.php b/config/lcdproc-dev/lcdproc_client.php index 22713b98..3337052c 100644 --- a/config/lcdproc-dev/lcdproc_client.php +++ b/config/lcdproc-dev/lcdproc_client.php @@ -468,6 +468,8 @@ { if ($value && $lcdproc_config['driver'] == "CFontz633") {return true;} + else if ($value && $lcdproc_config['driver'] == "CFontzPacket") + {return true;} else {return false;} } @@ -773,31 +775,35 @@ $led_output_value = 0; /* LED 1: Interface status */ if (substr_count(get_interfaces_stats(), "Down") > 0 ) - {$led_output_value = $led_output_value + pow(2, 0);} - else {$led_output_value = $led_output_value + pow(2, 4);} + else + {$led_output_value = $led_output_value + pow(2, 0);} /* LED 2: CARP status */ switch (outputled_carp()) { case -1:/* CARP disabled */ + break; case 0: /* CARP on Backup */ - {$led_output_value = $led_output_value + pow(2, 1);} + $led_output_value = $led_output_value + pow(2, 1); + break; case 1: /* CARP on Master */ - {$led_output_value = $led_output_value + pow(2, 5);} + $led_output_value = $led_output_value + pow(2, 5); } /* LED 3: CPU Usage */ if (cpu_usage() > 50) - {$led_output_value = $led_output_value + pow(2, 2);} - else {$led_output_value = $led_output_value + pow(2, 6);} + else + {$led_output_value = $led_output_value + pow(2, 2);} /* LED 4: Gateway status */ switch (outputled_gateway()) { case -1:/* Gateways not configured */ + break; case 0: /* Gateway down or with issues */ - {$led_output_value = $led_output_value + 2 ^ 3;} + $led_output_value = $led_output_value + pow(2, 7); + break; case 1: /* All Gateways up */ - {$led_output_value = $led_output_value + 2 ^ 7;} + $led_output_value = $led_output_value + pow(2, 3); } /* Sends the command to the panel */ $lcd_cmds[] = "output {$led_output_value}"; @@ -922,4 +928,4 @@ { lcdproc_warn("Too many errors, the client ends."); } -?> \ No newline at end of file +?> -- cgit v1.2.3 From 901c4c7a85e3056c5e86a0b19cfdccc1003f00ca Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Wed, 18 Dec 2013 20:01:19 -0200 Subject: mailscanner - fix/disable pyzor check and change mailscanner bin from perl version to a perl_mailscanner alias. --- config/mailscanner/mailscanner.inc | 46 ++++++++++++++++------------- config/mailscanner/mailscanner.xml | 2 +- config/mailscanner/mailscanner_antispam.xml | 2 +- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/config/mailscanner/mailscanner.inc b/config/mailscanner/mailscanner.inc index f15f7c61..9f5fd11d 100644 --- a/config/mailscanner/mailscanner.inc +++ b/config/mailscanner/mailscanner.inc @@ -442,15 +442,21 @@ Country Sub-Domains List = %etc-dir%/country.domains.conf } if (preg_match('/use_pyzor/',$antispam['safeatures'])){ $pattern[]='/#pyzor_path/'; + $pattern[]="/\S+yzor_disabled/"; $pattern[]='/usr.bin.pyzor/'; - $pattern[]='/\nuse_pyzor\s+0/'; + $pattern[]='/use_pyzor/'; + $pattern[]="/\S+o_not_use_pyzor/"; + $replacement[]="pyzor_path"; $replacement[]="pyzor_path"; $replacement[]="usr/local/bin/pyzor"; - $replacement[]="\n".'# use_pyzor 0'; + $replacement[]="use_pyzor"; + $replacement[]="use_pyzor"; } else{ - $pattern[]='/\n#\s+use_pyzor\s+0/'; - $replacement[]="\n".'# use_pyzor 0'; + $pattern[]='/use_pyzor/'; + $pattern[]='/pyzor_path/'; + $replacement[]="#do_not_use_pyzor"; + $replacement[]="#pyzor_disabled"; } if (preg_match('/use_auto_learn_bayes/',$antispam['safeatures'])){ $pattern[]='/\nbayes_auto_learn\s+0/'; @@ -677,23 +683,23 @@ Country Sub-Domains List = %etc-dir%/country.domains.conf #fix MIME::ToolUtils deprecated function and usecure dependency calls in /usr/local/sbin/mailscanner $cconf=MAILSCANNER_LOCALBASE. "/sbin/mailscanner"; if (file_exists($cconf)){ - #check perl's version - $perl_bin="perl"; - $perl_version_file=MAILSCANNER_LOCALBASE . '/etc/perl5_version'; - if (file_exists($perl_version_file)) { - $perl_version = trim(`/usr/bin/grep 'PERL_VERSION=' $perl_version_file | /usr/bin/cut -f2 -d'='`); - $perl_bin .= $perl_version; + + $perl_bin="perl_mailscanner"; + if(file_exists(MAILSCANNER_LOCALBASE . '/bin/perl') && !file_exists(MAILSCANNER_LOCALBASE . "/bin/{$perl_bin}")){ + link(MAILSCANNER_LOCALBASE . '/bin/perl',MAILSCANNER_LOCALBASE . '/bin/perl_mailscanner'); } - - $cconf_file=file_get_contents($cconf); - $pattern2[0]='@#!/usr\S+bin/perl.*I@'; - $pattern2[1]='/\smy .current = config MIME::ToolUtils/'; - $replacement2[0]='#!'.MAILSCANNER_LOCALBASE. "/bin/{$perl_bin} -U -I"; - $replacement2[1]=' #my $current = config MIME::ToolUtils'; - if (preg_match('@#!/usr\S+bin/perl.*I@',$cconf_file)){ - $cconf_file=preg_replace($pattern2,$replacement2,$cconf_file); - file_put_contents($cconf, $cconf_file, LOCK_EX); - } + if (file_exists(MAILSCANNER_LOCALBASE . "/bin/{$perl_bin}")){ + $cconf_file=file_get_contents($cconf); + $pattern2[0]='@#!/usr\S+bin/perl.*I@'; + //$pattern2[1]='/\smy .current = config MIME::ToolUtils/'; + $replacement2[0]='#!'.MAILSCANNER_LOCALBASE. "/bin/{$perl_bin} -U -I"; + //$replacement2[1]=' #my $current = config MIME::ToolUtils'; + if (preg_match('@#!/usr\S+bin/perl.*I@',$cconf_file)){ + $cconf_file=preg_replace($pattern2,$replacement2,$cconf_file); + file_put_contents($cconf, $cconf_file, LOCK_EX); + } + } + } #check spam assassin rules diff --git a/config/mailscanner/mailscanner.xml b/config/mailscanner/mailscanner.xml index 87be2421..2f97fcec 100644 --- a/config/mailscanner/mailscanner.xml +++ b/config/mailscanner/mailscanner.xml @@ -54,7 +54,7 @@ mailscanner mailscanner - perl5.16.3 + perl_mailscanner MailScanner diff --git a/config/mailscanner/mailscanner_antispam.xml b/config/mailscanner/mailscanner_antispam.xml index 7f989765..26295059 100644 --- a/config/mailscanner/mailscanner_antispam.xml +++ b/config/mailscanner/mailscanner_antispam.xml @@ -169,7 +169,7 @@ - + -- cgit v1.2.3 From af6e4bec14ca958e0c85c0819e4509b000f64e05 Mon Sep 17 00:00:00 2001 From: "Danilo G. Baio (dbaio)" Date: Thu, 26 Dec 2013 16:44:39 -0200 Subject: New package Apcupsd. A daemon for controlling APC UPSes. --- config/apcupsd/apcupsd.conf.php | 362 ++++++++++++++++++++++++++++++++++++++ config/apcupsd/apcupsd.inc | 191 ++++++++++++++++++++ config/apcupsd/apcupsd.xml | 333 +++++++++++++++++++++++++++++++++++ config/apcupsd/apcupsd_status.php | 118 +++++++++++++ pkg_config.8.xml | 20 +++ pkg_config.8.xml.amd64 | 20 +++ 6 files changed, 1044 insertions(+) create mode 100644 config/apcupsd/apcupsd.conf.php create mode 100644 config/apcupsd/apcupsd.inc create mode 100644 config/apcupsd/apcupsd.xml create mode 100755 config/apcupsd/apcupsd_status.php diff --git a/config/apcupsd/apcupsd.conf.php b/config/apcupsd/apcupsd.conf.php new file mode 100644 index 00000000..6a19b915 --- /dev/null +++ b/config/apcupsd/apcupsd.conf.php @@ -0,0 +1,362 @@ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*/ + +// create apcupsd.conf +$apcupsdconf=<< +# Defines the type of cable connecting the UPS to your computer. +# +# Possible generic choices for are: +# simple, smart, ether, usb +# +# Or a specific cable model number may be used: +# 940-0119A, 940-0127A, 940-0128A, 940-0020B, +# 940-0020C, 940-0023A, 940-0024B, 940-0024C, +# 940-1524C, 940-0024G, 940-0095A, 940-0095B, +# 940-0095C, M-04-02-2000 +# +UPSCABLE {$upscable} + +# To get apcupsd to work, in addition to defining the cable +# above, you must also define a UPSTYPE, which corresponds to +# the type of UPS you have (see the Description for more details). +# You must also specify a DEVICE, sometimes referred to as a port. +# For USB UPSes, please leave the DEVICE directive blank. For +# other UPS types, you must specify an appropriate port or address. +# +# UPSTYPE DEVICE Description +# apcsmart /dev/tty** Newer serial character device, appropriate for +# SmartUPS models using a serial cable (not USB). +# +# usb Most new UPSes are USB. A blank DEVICE +# setting enables autodetection, which is +# the best choice for most installations. +# +# net hostname:port Network link to a master apcupsd through apcupsd's +# Network Information Server. This is used if the +# UPS powering your computer is connected to a +# different computer for monitoring. +# +# snmp hostname:port:vendor:community +# SNMP network link to an SNMP-enabled UPS device. +# Hostname is the ip address or hostname of the UPS +# on the network. Vendor can be can be "APC" or +# "APC_NOTRAP". "APC_NOTRAP" will disable SNMP trap +# catching; you usually want "APC". Port is usually +# 161. Community is usually "private". +# +# netsnmp hostname:port:vendor:community +# OBSOLETE +# Same as SNMP above but requires use of the +# net-snmp library. Unless you have a specific need +# for this old driver, you should use 'snmp' instead. +# +# dumb /dev/tty** Old serial character device for use with +# simple-signaling UPSes. +# +# pcnet ipaddr:username:passphrase:port +# PowerChute Network Shutdown protocol which can be +# used as an alternative to SNMP with the AP9617 +# family of smart slot cards. ipaddr is the IP +# address of the UPS management card. username and +# passphrase are the credentials for which the card +# has been configured. port is the port number on +# which to listen for messages from the UPS, normally +# 3052. If this parameter is empty or missing, the +# default of 3052 will be used. +# +UPSTYPE {$upstype} + +# POLLTIME +# Interval (in seconds) at which apcupsd polls the UPS for status. This +# setting applies both to directly-attached UPSes (UPSTYPE apcsmart, usb, +# dumb) and networked UPSes (UPSTYPE net, snmp). Lowering this setting +# will improve apcupsd's responsiveness to certain events at the cost of +# higher CPU utilization. The default of 60 is appropriate for most +# situations. +POLLTIME {$polltime} + +# LOCKFILE +# Path for device lock file. Not used on Win32. +LOCKFILE /var/spool/lock + +# SCRIPTDIR +# Directory in which apccontrol and event scripts are located. +SCRIPTDIR /usr/local/etc/apcupsd + +# PWRFAILDIR +# Directory in which to write the powerfail flag file. This file +# is created when apcupsd initiates a system shutdown and is +# checked in the OS halt scripts to determine if a killpower +# (turning off UPS output power) is required. +PWRFAILDIR /var/run + +# NOLOGINDIR +# Directory in which to write the nologin file. The existence +# of this flag file tells the OS to disallow new logins. +NOLOGINDIR /var/run + + +# +# ======== Configuration parameters used during power failures ========== +# + +# The ONBATTERYDELAY is the time in seconds from when a power failure +# is detected until we react to it with an onbattery event. +# +# This means that, apccontrol will be called with the powerout argument +# immediately when a power failure is detected. However, the +# onbattery argument is passed to apccontrol only after the +# ONBATTERYDELAY time. If you don't want to be annoyed by short +# powerfailures, make sure that apccontrol powerout does nothing +# i.e. comment out the wall. +ONBATTERYDELAY {$onbatterydelay} + +# +# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so +# the first that occurs will cause the initation of a shutdown. +# + +# If during a power failure, the remaining battery percentage +# (as reported by the UPS) is below or equal to BATTERYLEVEL, +# apcupsd will initiate a system shutdown. +BATTERYLEVEL {$batterylevel} + +# If during a power failure, the remaining runtime in minutes +# (as calculated internally by the UPS) is below or equal to MINUTES, +# apcupsd, will initiate a system shutdown. +MINUTES {$minutes} + +# If during a power failure, the UPS has run on batteries for TIMEOUT +# many seconds or longer, apcupsd will initiate a system shutdown. +# A value of 0 disables this timer. +# +# Note, if you have a Smart UPS, you will most likely want to disable +# this timer by setting it to zero. That way, you UPS will continue +# on batteries until either the % charge remaing drops to or below BATTERYLEVEL, +# or the remaining battery runtime drops to or below MINUTES. Of course, +# if you are testing, setting this to 60 causes a quick system shutdown +# if you pull the power plug. +# If you have an older dumb UPS, you will want to set this to less than +# the time you know you can run on batteries. +TIMEOUT {$timeout} + +# Time in seconds between annoying users to signoff prior to +# system shutdown. 0 disables. +ANNOY {$annoy} + +# Initial delay after power failure before warning users to get +# off the system. +ANNOYDELAY {$annoydelay} + +# The condition which determines when users are prevented from +# logging in during a power failure. +# NOLOGON [ disable | timeout | percent | minutes | always ] +NOLOGON disable + +# If KILLDELAY is non-zero, apcupsd will continue running after a +# shutdown has been requested, and after the specified time in +# seconds attempt to kill the power. This is for use on systems +# where apcupsd cannot regain control after a shutdown. +# KILLDELAY 0 disables +KILLDELAY {$killdelay} + +# +# ==== Configuration statements for Network Information Server ==== +# + +# NETSERVER [ on | off ] on enables, off disables the network +# information server. If netstatus is on, a network information +# server process will be started for serving the STATUS and +# EVENT data over the network (used by CGI programs). +NETSERVER {$netserver} + +# NISIP +# IP address on which NIS server will listen for incoming connections. +# This is useful if your server is multi-homed (has more than one +# network interface and IP address). Default value is 0.0.0.0 which +# means any incoming request will be serviced. Alternatively, you can +# configure this setting to any specific IP address of your server and +# NIS will listen for connections only on that interface. Use the +# loopback address (127.0.0.1) to accept connections only from the +# local machine. +NISIP ${nisip} + +# NISPORT default is 3551 as registered with the IANA +# port to use for sending STATUS and EVENTS data over the network. +# It is not used unless NETSERVER is on. If you change this port, +# you will need to change the corresponding value in the cgi directory +# and rebuild the cgi programs. +NISPORT ${nisport} + +# If you want the last few EVENTS to be available over the network +# by the network information server, you must define an EVENTSFILE. +EVENTSFILE /var/log/apcupsd.events + +# EVENTSFILEMAX +# By default, the size of the EVENTSFILE will be not be allowed to exceed +# 10 kilobytes. When the file grows beyond this limit, older EVENTS will +# be removed from the beginning of the file (first in first out). The +# parameter EVENTSFILEMAX can be set to a different kilobyte value, or set +# to zero to allow the EVENTSFILE to grow without limit. +EVENTSFILEMAX 10 + +# +# ========== Configuration statements used if sharing ============= +# a UPS with more than one machine + +# +# Remaining items are for ShareUPS (APC expansion card) ONLY +# + +# UPSCLASS [ standalone | shareslave | sharemaster ] +# Normally standalone unless you share an UPS using an APC ShareUPS +# card. +UPSCLASS {$upsclass} + +# UPSMODE [ disable | share ] +# Normally disable unless you share an UPS using an APC ShareUPS card. +UPSMODE {$upsmode} + +# +# ===== Configuration statements to control apcupsd system logging ======== +# + +# Time interval in seconds between writing the STATUS file; 0 disables +STATTIME 0 + +# Location of STATUS file (written to only if STATTIME is non-zero) +STATFILE /var/log/apcupsd.status + +# LOGSTATS [ on | off ] on enables, off disables +# Note! This generates a lot of output, so if +# you turn this on, be sure that the +# file defined in syslog.conf for LOG_NOTICE is a named pipe. +# You probably do not want this on. +LOGSTATS off + +# Time interval in seconds between writing the DATA records to +# the log file. 0 disables. +DATATIME 0 + +# FACILITY defines the logging facility (class) for logging to syslog. +# If not specified, it defaults to "daemon". This is useful +# if you want to separate the data logged by apcupsd from other +# programs. +#FACILITY DAEMON + +# +# ========== Configuration statements used in updating the UPS EPROM ========= +# + +# +# These statements are used only by apctest when choosing "Set EEPROM with conf +# file values" from the EEPROM menu. THESE STATEMENTS HAVE NO EFFECT ON APCUPSD. +# + +# UPS name, max 8 characters +#UPSNAME UPS_IDEN + +# Battery date - 8 characters +#BATTDATE mm/dd/yy + +# Sensitivity to line voltage quality (H cause faster transfer to batteries) +# SENSITIVITY H M L (default = H) +#SENSITIVITY H + +# UPS delay after power return (seconds) +# WAKEUP 000 060 180 300 (default = 0) +#WAKEUP 60 + +# UPS Grace period after request to power off (seconds) +# SLEEP 020 180 300 600 (default = 20) +#SLEEP 180 + +# Low line voltage causing transfer to batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 106 103 100 097 +# M 177 172 168 182 +# A 092 090 088 086 +# I 208 204 200 196 (default = 0 => not valid) +#LOTRANSFER 208 + +# High line voltage causing transfer to batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 127 130 133 136 +# M 229 234 239 224 +# A 108 110 112 114 +# I 253 257 261 265 (default = 0 => not valid) +#HITRANSFER 253 + +# Battery charge needed to restore power +# RETURNCHARGE 00 15 50 90 (default = 15) +#RETURNCHARGE 15 + +# Alarm delay +# 0 = zero delay after pwr fail, T = power fail + 30 sec, L = low battery, N = never +# BEEPSTATE 0 T L N (default = 0) +#BEEPSTATE T + +# Low battery warning delay in minutes +# LOWBATT 02 05 07 10 (default = 02) +#LOWBATT 2 + +# UPS Output voltage when running on batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 115 +# M 208 +# A 100 +# I 230 240 220 225 (default = 0 => not valid) +#OUTPUTVOLTS 230 + +# Self test interval in hours 336=2 weeks, 168=1 week, ON=at power on +# SELFTEST 336 168 ON OFF (default = 336) +#SELFTEST 336 +EOF; +?> diff --git a/config/apcupsd/apcupsd.inc b/config/apcupsd/apcupsd.inc new file mode 100644 index 00000000..9abc23ba --- /dev/null +++ b/config/apcupsd/apcupsd.inc @@ -0,0 +1,191 @@ + + + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ +require_once("util.inc"); +require_once("functions.inc"); +require_once("pkg-utils.inc"); +require_once("globals.inc"); + +function php_install_apcupsd(){ + sync_package_apcupsd(); +} + +function php_deinstall_apcupsd(){ + global $config, $g; + + conf_mount_rw(); + $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); + if ($pfs_version > 2.0){ + define('APCUPSD_BASE', '/usr/pbi/apcupsd-' . php_uname("m")); + } else { + define('APCUPSD_BASE', '/usr/local'); + } + + exec("/usr/bin/killall apcupsd"); + unlink_if_exists(APCUPSD_BASE . "/etc/rc.d/apcupsd.sh"); + unlink_if_exists(APCUPSD_BASE . "/etc/apcupsd/apcupsd.conf"); + unlink_if_exists("/var/log/apcupsd/apcupsd.log"); + unlink_if_exists("/var/run/apcupsd/apcupsd.pid"); + + if (is_dir("/var/log/apcupsd")) + exec("/bin/rm -r /var/log/apcupsd/"); + if (is_dir("/var/run/apcupsd")) + exec("/bin/rm -r /var/run/apcupsd/"); + + conf_mount_ro(); +} + +function validate_input_apcupsd($post,&$input_errors){ + + if (isset($post['apcupsdenabled'])){ + + if ($post['polltime'] != '' && !is_numericint($post['polltime'])) { + $input_errors[]='Poll Time is not numeric.'; + } + + if ($post['onbatterydelay'] != '' && !is_numericint($post['onbatterydelay'])) { + $input_errors[]='OnBattery Delay is not numeric.'; + } + + if ($post['batterylevel'] != '' && !is_numericint($post['batterylevel'])) { + $input_errors[]='Battery Level is not numeric.'; + } + + if ($post['minutes'] != '' && !is_numericint($post['minutes'])) { + $input_errors[]='Minutes is not numeric.'; + } + + if ($post['timeout'] != '' && !is_numericint($post['timeout'])) { + $input_errors[]='Timeout is not numeric.'; + } + + if ($post['annoy'] != '' && !is_numericint($post['annoy'])) { + $input_errors[]='Annoy is not numeric.'; + } + + if ($post['annoydelay'] != '' && !is_numericint($post['annoydelay'])) { + $input_errors[]='Annoy Delay is not numeric.'; + } + + if ($post['killdelay'] != '' && !is_numericint($post['killdelay'])) { + $input_errors[]='Kill Delay is not numeric.'; + } + + if ($post['nisip'] != '') { + if (!is_ipaddr_configured($post['nisip']) && !preg_match("/(127.0.0.1|0.0.0.0)/",$post['nisip'])) { + $input_errors[]='NIS Ip is not a configured IP address.'; + } + } + + if ($post['nisport'] != '') { + if (!preg_match("/^\d+$/", $post['nisport'])) { + $input_errors[]='NIS Port is not numeric.'; + } + } + + } // apcupsdenabled +} + +function sync_package_apcupsd(){ + global $config, $g; + + conf_mount_rw(); + + // check pfsense version + $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); + if ($pfs_version > 2.0){ + define('APCUPSD_BASE', '/usr/pbi/apcupsd-' . php_uname("m")); + } + else { + define('APCUPSD_BASE', '/usr/local'); + } + + // check apcupsd settings + if (is_array($config['installedpackages']['apcupsd'])){ + $apcupsd_config = $config['installedpackages']['apcupsd']['config'][0]; + if ($apcupsd_config['apcupsdenabled']=="on"){ + $upsname=$apcupsd_config['upsname']; + $upscable=$apcupsd_config['upscable']; + $upstype=$apcupsd_config['upstype']; + $polltime=($apcupsd_config['polltime'] != ''? $apcupsd_config['polltime'] : "60"); + $onbatterydelay=($apcupsd_config['onbatterydelay'] != ''? $apcupsd_config['onbatterydelay'] : "6"); + $batterylevel=($apcupsd_config['batterylevel'] != ''? $apcupsd_config['batterylevel'] : "5"); + $minutes=($apcupsd_config['minutes'] != ''? $apcupsd_config['minutes'] : "3"); + $timeout=($apcupsd_config['timeout'] != ''? $apcupsd_config['timeout'] : "0"); + $annoy=($apcupsd_config['annoy'] != ''? $apcupsd_config['annoy'] : "300"); + $annoydelay=($apcupsd_config['annoydelay'] != ''? $apcupsd_config['annoydelay'] : "60"); + $killdelay=($apcupsd_config['killdelay'] != ''? $apcupsd_config['killdelay'] : "0"); + $netserver=$apcupsd_config['netserver']; + $nisip=($apcupsd_config['nisip'] != ''? $apcupsd_config['nisip'] : "0.0.0.0"); + $nisport=($apcupsd_config['nisport'] != ''? $apcupsd_config['nisport'] : "3551"); + $upsclass=$apcupsd_config['upsclass']; + $upsmode=$apcupsd_config['upsmode']; + + include("/usr/local/pkg/apcupsd.conf.php"); + file_put_contents(APCUPSD_BASE . "/etc/apcupsd/apcupsd.conf", $apcupsdconf, LOCK_EX); + } + } + + // RC FILE + $apcupsd_rcfile="/usr/local/etc/rc.d/apcupsd.sh"; + if (is_array($apcupsd_config) && $apcupsd_config['apcupsdenabled']=="on"){ + $apcupsd_start = "echo \"Starting APC UPS Daemon...\"\n"; + if ($apcupsd_config['killonpowerfail']=="on"){ + $apcupsd_start .= " " . APCUPSD_BASE . "/sbin/apcupsd --kill-on-powerfail"; + }else{ + $apcupsd_start .= " " . APCUPSD_BASE . "/sbin/apcupsd"; + } + + $apcupsd_stop = "echo \"Stopping APC UPS Daemon...\"\n"; + $apcupsd_stop .= " /usr/bin/killall apcupsd\n"; + $apcupsd_stop .= " /bin/sleep 5"; + + /* write out rc.d start/stop file */ + write_rcfile(array( + "file" => "apcupsd.sh", + "start" => "$apcupsd_start", + "stop" => "$apcupsd_stop" + ) + ); + mwexec("{$apcupsd_rcfile} restart"); + }else{ + if (file_exists($apcupsd_rcfile)){ + mwexec("{$apcupsd_rcfile} stop"); + unlink($apcupsd_rcfile); + } + } + + conf_mount_ro(); +} +?> diff --git a/config/apcupsd/apcupsd.xml b/config/apcupsd/apcupsd.xml new file mode 100644 index 00000000..8674af61 --- /dev/null +++ b/config/apcupsd/apcupsd.xml @@ -0,0 +1,333 @@ + + + + + + All rights reserved. + */ +/* ========================================================================== */ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ +/* ========================================================================== */ + ]]> + + Apcupsd + Services: Apcupsd (General) + Monitoring + 0.1 + /usr/local/pkg/apcupsd.inc + Apcupsd has been created/modified. + Apcupsd has been deleted. + /usr/local/etc/rc.d/apcupsd.sh restart + + http://www.pfsense.org/packages/config/apcupsd/apcupsd.inc + /usr/local/pkg/ + 0755 + + + http://www.pfsense.org/packages/config/apcupsd/apcupsd_status.php + /usr/local/www/ + 0755 + + + http://www.pfsense.org/packages/config/apcupsd/apcupsd.conf.php + /usr/local/pkg/ + 0755 + + + Apcupsd + Setup Apcupsd specific settings +
Services
+ /pkg_edit.php?xml=apcupsd.xml&id=0 +
+ + apcupsd + apcupsd.sh + apcupsd + Apcupsd a daemon for controlling APC UPSes + + + + General + /pkg_edit.php?xml=apcupsd.xml&id=0 + + + + Status + apcupsd_status.php + + + + + General configuration parameters + listtopic + + + Enable + apcupsdenabled + Enable APC UPS Daemon service + checkbox + + + UPS Name + upsname + Use this to give your UPS a name in log files and such + input + 60 + true + + + UPS Cable + upscable + +
+Possible generic choices for are:
+ simple, smart, ether, usb
+
+Or a specific cable model number may be used:
+ 940-0119A, 940-0127A, 940-0128A, 940-0020B,
+ 940-0020C, 940-0023A, 940-0024B, 940-0024C,
+ 940-1524C, 940-0024G, 940-0095A, 940-0095B,
+ 940-0095C, M-04-02-2000 + ]]>
+ input + 60 + true +
+ + UPS Type / Device + upstype + +
+UPSTYPE DEVICE Description
+
+apcsmart /dev/tty** Newer serial character device, appropriate for + SmartUPS models using a serial cable (not USB).
+
+usb BLANK Most new UPSes are USB. A blank DEVICE + setting enables autodetection, which is + the best choice for most installations.
+
+net hostname:port Network link to a master apcupsd through apcupsd's + Network Information Server. This is used if the + UPS powering your computer is connected to a + different computer for monitoring.
+
+snmp hostname:port:vendor:community + SNMP network link to an SNMP-enabled UPS device. + Hostname is the ip address or hostname of the UPS + on the network. Vendor can be can be "APC" or + "APC_NOTRAP". "APC_NOTRAP" will disable SNMP trap + catching; you usually want "APC". Port is usually + 161. Community is usually "private".
+
+netsnmp hostname:port:vendor:community + OBSOLETE + Same as SNMP above but requires use of the + net-snmp library. Unless you have a specific need + for this old driver, you should use 'snmp' instead.
+
+dumb /dev/tty** Old serial character device for use with + simple-signaling UPSes.
+
+pcnet ipaddr:username:passphrase:port + PowerChute Network Shutdown protocol which can be + used as an alternative to SNMP with the AP9617 + family of smart slot cards. ipaddr is the IP + address of the UPS management card. username and + passphrase are the credentials for which the card + has been configured. port is the port number on + which to listen for messages from the UPS, normally + 3052. If this parameter is empty or missing, the + default of 3052 will be used.
+
+ ]]>
+ input + 60 + true +
+ + Poll Time + polltime + Interval (in seconds) at which apcupsd polls the UPS for status. Default is 60 + input + 10 + 60 + + + Kill on Power Fail + killonpowerfail + Hibernate UPS on powerfail + checkbox + + + Configuration parameters used during power failures + listtopic + + + OnBattery Delay + onbatterydelay + Time in seconds from when a power failure is detected until we react to it with an onbattery event. Default is 6 + input + 10 + 6 + + + Battery Level + batterylevel + If during a power failure, the remaining battery percentage (as reported by the UPS) is + below or equal to BATTERYLEVEL, apcupsd will initiate a system shutdown. Default is 5 + input + 10 + 5 + + + Minutes + minutes + If during a power failure, the remaining runtime in minutes (as calculated internally + by the UPS) is below or equal to MINUTES, apcupsd, will initiate a system shutdown. Default is 3 + input + 10 + 3 + + + Timeout + timeout + If during a power failure, the UPS has run on batteries for TIMEOUT many seconds + or longer, apcupsd will initiate a system shutdown. A value of 0 (default) disables this timer + input + 10 + 0 + + + Annoy + annoy + Time in seconds between annoying users to signoff prior to system shutdown. 0 disables. Default is 300 + input + 10 + 300 + + + Annoy Delay + annoydelay + Initial delay after power failure before warning users to get off the system. Default is 60 + input + 10 + 60 + + + Kill Delay + killdelay + If KILLDELAY is non-zero, apcupsd will continue running after a shutdown has been + requested, and after the specified time in seconds attempt to kill the power. This is for use + on systems where apcupsd cannot regain control after a shutdown. 0 disables (default) + input + 10 + 0 + + + Configuration statements for Network Information Server + listtopic + + + Net Server + netserver + If netstatus is on, a network information server process will be started for serving + the STATUS and EVENT data over the network (used by CGI programs) + select + on + + + + + + + NIS Ip + nisip + IP address on which NIS server will listen for incoming connections. Default value is + 0.0.0.0 which means any incoming request will be serviced. Alternatively, you can configure this + setting to any specific IP address of your server and NIS will listen for connections only on that + interface. Use the loopback address (127.0.0.1) to accept connections only from the local machine + input + 10 + 0.0.0.0 + + + NIS Port + nisport + Port to use for sending STATUS and EVENTS data over the network. + It is not used unless NETSERVER is on. If you change this port, + you will need to change the corresponding value in the cgi directory + and rebuild the cgi programs. Default is 3551 as registered with the IANA + input + 10 + 3551 + + + Configuration statements used if sharing + listtopic + + + UPS Class + upsclass + Normally standalone unless you share an UPS using an APC ShareUPS card + select + standalone + + + + + + + + UPS Mode + upsmode + Normally disable unless you share an UPS using an APC ShareUPS card + select + disable + + + + + +
+ sync_package_apcupsd(); + + + + validate_input_apcupsd($_POST, &$input_errors); + + sync_package_apcupsd(); + php_deinstall_apcupsd(); +
diff --git a/config/apcupsd/apcupsd_status.php b/config/apcupsd/apcupsd_status.php new file mode 100755 index 00000000..e465f62c --- /dev/null +++ b/config/apcupsd/apcupsd_status.php @@ -0,0 +1,118 @@ + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); + +$pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); + +if(strstr($pfSversion, "1.2")) + $one_two = true; + +$pgtitle = "Services: Apcupsd (Status)"; +include("head.inc"); + +function puts( $arg ) { echo "$arg\n"; } + +?> + + + + + + + + +

+ + + +
+ + +
+ +
+
+ +
+ + +
+"); + putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"); + $ph = popen('apcaccess 2>&1', "r" ); + while ($line = fgets($ph)) echo htmlspecialchars($line); + pclose($ph); + puts(""); +?> +
+
+ + + diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 35c6495b..88fb6a3b 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -2016,5 +2016,25 @@ net-mgmt/softflowd + + Apcupsd + Set of programs for controlling APC UPS. + Services + http://www.pfsense.org/packages/config/apcupsd/apcupsd.xml + apcupsd-3.14.10_1 pkg v0.1 + BETA + 2.0 + apcupsd.xml + dbaio@bsd.com.br + /usr/ports/sysutils/apcupsd + + apcupsd + sysutils/apcupsd + + OPTIONS_SET+= APCSMART_DRV APCDUMB_DRV PCNET_DRV USB TCP_WRAPPERS;OPTIONS_UNSET+= CLIENT_ONLY CGI SNMP_DRV SNMP_DRV_OLD TEST_DRV GAPCMON DOCS + http://files.pfsense.org/packages/8/All/ + apcupsd-3.14.10_1.tbz + apcupsd-3.14.10_1-i386.pbi + diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index a9ccd72c..481c70dd 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -2003,5 +2003,25 @@ net-mgmt/softflowd + + Apcupsd + Set of programs for controlling APC UPS. + Services + http://www.pfsense.org/packages/config/apcupsd/apcupsd.xml + apcupsd-3.14.10_1 pkg v0.1 + BETA + 2.0 + apcupsd.xml + dbaio@bsd.com.br + /usr/ports/sysutils/apcupsd + + apcupsd + sysutils/apcupsd + + OPTIONS_SET+= APCSMART_DRV APCDUMB_DRV PCNET_DRV USB TCP_WRAPPERS;OPTIONS_UNSET+= CLIENT_ONLY CGI SNMP_DRV SNMP_DRV_OLD TEST_DRV GAPCMON DOCS + http://files.pfsense.org/packages/amd64/8/All/ + apcupsd-3.14.10_1.tbz + apcupsd-3.14.10_1-amd64.pbi + -- cgit v1.2.3 From 5190060ce8c4bdd44a4086bac9149531a7733666 Mon Sep 17 00:00:00 2001 From: "Danilo G. Baio (dbaio)" Date: Fri, 27 Dec 2013 17:02:16 -0200 Subject: zabbix2 - update packages to 2.2.1 - first step --- pkg_config.8.xml | 12 ++++++------ pkg_config.8.xml.amd64 | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 88fb6a3b..c68700fa 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1920,10 +1920,10 @@ 2.0 zabbix2-agent.xml dbaio@bsd.com.br - /usr/ports/net-mgmt/zabbix2-agent + /usr/ports/net-mgmt/zabbix22-agent - zabbix2-agent - net-mgmt/zabbix2-agent + zabbix22-agent + net-mgmt/zabbix22-agent http://files.pfsense.org/packages/8/All/ zabbix2-agent-2.0.8.tbz @@ -1939,10 +1939,10 @@ 2.0 zabbix2-proxy.xml dbaio@bsd.com.br - /usr/ports/net-mgmt/zabbix2-proxy + /usr/ports/net-mgmt/zabbix22-proxy - zabbix2-proxy - net-mgmt/zabbix2-proxy + zabbix22-proxy + net-mgmt/zabbix22-proxy OPTIONS_SET+= SQLITE IPV6;OPTIONS_UNSET+= MYSQL JABBER GSSAPI http://files.pfsense.org/packages/8/All/ diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 481c70dd..96d7ef99 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1907,10 +1907,10 @@ 2.0 zabbix2-agent.xml dbaio@bsd.com.br - /usr/ports/net-mgmt/zabbix2-agent + /usr/ports/net-mgmt/zabbix22-agent - zabbix2-agent - net-mgmt/zabbix2-agent + zabbix22-agent + net-mgmt/zabbix22-agent http://files.pfsense.org/packages/amd64/8/All/ zabbix2-agent-2.0.8.tbz @@ -1926,10 +1926,10 @@ 2.0 zabbix2-proxy.xml dbaio@bsd.com.br - /usr/ports/net-mgmt/zabbix2-proxy + /usr/ports/net-mgmt/zabbix22-proxy - zabbix2-proxy - net-mgmt/zabbix2-proxy + zabbix22-proxy + net-mgmt/zabbix22-proxy OPTIONS_SET+= SQLITE IPV6;OPTIONS_UNSET+= MYSQL JABBER GSSAPI http://files.pfsense.org/packages/amd64/8/All/ -- cgit v1.2.3 From b26ce563a1a51ea59fb39a099f74706759336b9c Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 27 Dec 2013 15:59:32 -0500 Subject: Convert zabbix build options to optionsng, Clean up zabbix options so they only list non-default choices. --- pkg_config.8.xml | 4 ++-- pkg_config.8.xml.amd64 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg_config.8.xml b/pkg_config.8.xml index c68700fa..3ca0321a 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1437,7 +1437,7 @@ zabbix-agent net-mgmt/zabbix-agent - WITHOUT_CARES=true;WITHOUT_CURL_DEBUG=true;WITHOUT_DEBUGGING=true;WITHOUT_DMALLOC=true;WITHOUT_ETCSYMLINK=true;WITHOUT_EXTRA_PATCHES=true;WITHOUT_GDBM=true;WITHOUT_GNUTLS=true;WITHOUT_IODBC=true;WITHOUT_IPMI=true;WITHOUT_KERBEROS4=true;WITHOUT_LDAP=true;WITHOUT_LDAPS=true;WITHOUT_LIBIDN=true;WITHOUT_LIBSIGSEGV=true;WITHOUT_LIBSSH2=true;WITHOUT_MFD_REWRITES=true;WITHOUT_MULTIPLICITY=true;WITHOUT_MYSQL=true;WITHOUT_NTLM=true;WITHOUT_PERL_MALLOC=true;WITHOUT_PGSQL=true;WITHOUT_RTMP=true;WITHOUT_SITECUSTOMIZE=true;WITHOUT_SSH=true;WITHOUT_SUIDPERL=true;WITHOUT_THREADS=true;WITHOUT_TKMIB=true;WITHOUT_TRACKMEMORY=true;WITHOUT_UNIXODBC=true;WITH_CA_BUNDLE=true;WITH_CURL=true;WITH_DUMMY=true;WITH_EXTRA_ENCODINGS=true;WITH_FETCH=true;WITH_FPING=true;WITH_IPV6=true;WITH_JABBER=true;WITH_LDAP=true;WITH_OPENSSL=true;WITH_PERL=true;WITH_PERL_64BITINT=true;WITH_PERL_EMBEDDED=true;WITH_PROXY=true;WITH_SASL=true;WITH_SQLITE=true;WITH_USE_PERL=true;WITH_WERROR=true + ca_root_nss_UNSET=ETCSYMLINK;zabbix22_SET=LDAP SSH SQLITE;zabbix22_UNSET=MYSQL http://files.pfsense.org/packages/8/All/ zabbix-agent-1.8.10,2.tbz zabbix-agent-1.8.13-i386.pbi @@ -1457,7 +1457,7 @@ zabbix-proxy net-mgmt/zabbix-proxy - WITHOUT_CARES=true;WITHOUT_CURL_DEBUG=true;WITHOUT_DEBUGGING=true;WITHOUT_DMALLOC=true;WITHOUT_ETCSYMLINK=true;WITHOUT_EXTRA_PATCHES=true;WITHOUT_GDBM=true;WITHOUT_GNUTLS=true;WITHOUT_IODBC=true;WITHOUT_IPMI=true;WITHOUT_KERBEROS4=true;WITHOUT_LDAP=true;WITHOUT_LDAPS=true;WITHOUT_LIBIDN=true;WITHOUT_LIBSIGSEGV=true;WITHOUT_LIBSSH2=true;WITHOUT_MFD_REWRITES=true;WITHOUT_MULTIPLICITY=true;WITHOUT_MYSQL=true;WITHOUT_NTLM=true;WITHOUT_PERL_MALLOC=true;WITHOUT_PGSQL=true;WITHOUT_RTMP=true;WITHOUT_SITECUSTOMIZE=true;WITHOUT_SSH=true;WITHOUT_SUIDPERL=true;WITHOUT_THREADS=true;WITHOUT_TKMIB=true;WITHOUT_TRACKMEMORY=true;WITHOUT_UNIXODBC=true;WITH_CA_BUNDLE=true;WITH_CURL=true;WITH_DUMMY=true;WITH_EXTRA_ENCODINGS=true;WITH_FETCH=true;WITH_FPING=true;WITH_IPV6=true;WITH_JABBER=true;WITH_LDAP=true;WITH_OPENSSL=true;WITH_PERL=true;WITH_PERL_64BITINT=true;WITH_PERL_EMBEDDED=true;WITH_PROXY=true;WITH_SASL=true;WITH_SQLITE=true;WITH_USE_PERL=true;WITH_WERROR=true + ca_root_nss_UNSET=ETCSYMLINK;zabbix22_SET=LDAP SSH SQLITE;zabbix22_UNSET=MYSQL http://files.pfsense.org/packages/8/All/ zabbix-proxy-1.8.8,2.tbz zabbix-proxy-1.8.13-i386.pbi diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 96d7ef99..cb65f8e4 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1424,7 +1424,7 @@ zabbix-agent net-mgmt/zabbix-agent - WITHOUT_CARES=true;WITHOUT_CURL_DEBUG=true;WITHOUT_DEBUGGING=true;WITHOUT_DMALLOC=true;WITHOUT_ETCSYMLINK=true;WITHOUT_EXTRA_PATCHES=true;WITHOUT_GDBM=true;WITHOUT_GNUTLS=true;WITHOUT_IODBC=true;WITHOUT_IPMI=true;WITHOUT_KERBEROS4=true;WITHOUT_LDAP=true;WITHOUT_LDAPS=true;WITHOUT_LIBIDN=true;WITHOUT_LIBSIGSEGV=true;WITHOUT_LIBSSH2=true;WITHOUT_MFD_REWRITES=true;WITHOUT_MULTIPLICITY=true;WITHOUT_MYSQL=true;WITHOUT_NTLM=true;WITHOUT_PERL_MALLOC=true;WITHOUT_PGSQL=true;WITHOUT_RTMP=true;WITHOUT_SITECUSTOMIZE=true;WITHOUT_SSH=true;WITHOUT_SUIDPERL=true;WITHOUT_THREADS=true;WITHOUT_TKMIB=true;WITHOUT_TRACKMEMORY=true;WITHOUT_UNIXODBC=true;WITH_CA_BUNDLE=true;WITH_CURL=true;WITH_DUMMY=true;WITH_EXTRA_ENCODINGS=true;WITH_FETCH=true;WITH_FPING=true;WITH_IPV6=true;WITH_JABBER=true;WITH_LDAP=true;WITH_OPENSSL=true;WITH_PERL=true;WITH_PERL_64BITINT=true;WITH_PERL_EMBEDDED=true;WITH_PROXY=true;WITH_SASL=true;WITH_SQLITE=true;WITH_USE_PERL=true;WITH_WERROR=true + ca_root_nss_UNSET=ETCSYMLINK;zabbix22_SET=LDAP SSH SQLITE;zabbix22_UNSET=MYSQL http://files.pfsense.org/packages/amd64/8/All/ zabbix-agent-1.8.10,2.tbz zabbix-agent-1.8.13-amd64.pbi @@ -1444,7 +1444,7 @@ zabbix-proxy net-mgmt/zabbix-proxy - WITHOUT_CARES=true;WITHOUT_CURL_DEBUG=true;WITHOUT_DEBUGGING=true;WITHOUT_DMALLOC=true;WITHOUT_ETCSYMLINK=true;WITHOUT_EXTRA_PATCHES=true;WITHOUT_GDBM=true;WITHOUT_GNUTLS=true;WITHOUT_IODBC=true;WITHOUT_IPMI=true;WITHOUT_KERBEROS4=true;WITHOUT_LDAP=true;WITHOUT_LDAPS=true;WITHOUT_LIBIDN=true;WITHOUT_LIBSIGSEGV=true;WITHOUT_LIBSSH2=true;WITHOUT_MFD_REWRITES=true;WITHOUT_MULTIPLICITY=true;WITHOUT_MYSQL=true;WITHOUT_NTLM=true;WITHOUT_PERL_MALLOC=true;WITHOUT_PGSQL=true;WITHOUT_RTMP=true;WITHOUT_SITECUSTOMIZE=true;WITHOUT_SSH=true;WITHOUT_SUIDPERL=true;WITHOUT_THREADS=true;WITHOUT_TKMIB=true;WITHOUT_TRACKMEMORY=true;WITHOUT_UNIXODBC=true;WITH_CA_BUNDLE=true;WITH_CURL=true;WITH_DUMMY=true;WITH_EXTRA_ENCODINGS=true;WITH_FETCH=true;WITH_FPING=true;WITH_IPV6=true;WITH_JABBER=true;WITH_LDAP=true;WITH_OPENSSL=true;WITH_PERL=true;WITH_PERL_64BITINT=true;WITH_PERL_EMBEDDED=true;WITH_PROXY=true;WITH_SASL=true;WITH_SQLITE=true;WITH_USE_PERL=true;WITH_WERROR=true + ca_root_nss_UNSET=ETCSYMLINK;zabbix22_SET=LDAP SSH SQLITE;zabbix22_UNSET=MYSQL http://files.pfsense.org/packages/amd64/8/All/ zabbix-proxy-1.8.8,2.tbz zabbix-proxy-1.8.13-amd64.pbi -- cgit v1.2.3 From 93f0a31c1b9db3c4e8d6a10cc91e04980075baf6 Mon Sep 17 00:00:00 2001 From: "Danilo G. Baio (dbaio)" Date: Fri, 27 Dec 2013 19:43:56 -0200 Subject: zabbix2 - update packages to 2.2.1 - second step --- config/zabbix2/zabbix2-agent.xml | 2 +- config/zabbix2/zabbix2-proxy.xml | 2 +- config/zabbix2/zabbix2.inc | 12 ++++++------ pkg_config.8.xml | 12 ++++++------ pkg_config.8.xml.amd64 | 12 ++++++------ 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/config/zabbix2/zabbix2-agent.xml b/config/zabbix2/zabbix2-agent.xml index 0169e11f..3f8e84db 100644 --- a/config/zabbix2/zabbix2-agent.xml +++ b/config/zabbix2/zabbix2-agent.xml @@ -41,7 +41,7 @@ zabbixagent Services: Zabbix-2 Agent Monitoring - 0.7_1 + 0.8_0 /usr/local/pkg/zabbix2.inc Zabbix Agent has been created/modified. Zabbix Agent has been deleted. diff --git a/config/zabbix2/zabbix2-proxy.xml b/config/zabbix2/zabbix2-proxy.xml index c687c5ba..c857bec1 100644 --- a/config/zabbix2/zabbix2-proxy.xml +++ b/config/zabbix2/zabbix2-proxy.xml @@ -41,7 +41,7 @@ zabbixproxy Services: Zabbix-2 Proxy Monitoring - 0.7_1 + 0.8_0 /usr/local/pkg/zabbix2.inc Zabbix Proxy has been created/modified. Zabbix Proxy has been deleted. diff --git a/config/zabbix2/zabbix2.inc b/config/zabbix2/zabbix2.inc index 0a1c12be..3a4b5840 100644 --- a/config/zabbix2/zabbix2.inc +++ b/config/zabbix2/zabbix2.inc @@ -55,7 +55,7 @@ function php_deinstall_zabbix2_agent(){ exec("/usr/bin/killall zabbix_agentd"); unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/rc.d/zabbix2_agentd.sh"); - unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/zabbix2/zabbix_agentd.conf"); + unlink_if_exists(ZABBIX_AGENT_BASE . "/etc/zabbix22/zabbix_agentd.conf"); unlink_if_exists("/var/log/zabbix2/zabbix2_agentd.log"); unlink_if_exists("/var/run/zabbix2/zabbix2_agentd.pid"); @@ -82,7 +82,7 @@ function php_deinstall_zabbix2_proxy(){ exec("/usr/bin/killall zabbix_proxy"); unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/rc.d/zabbix2_proxy.sh"); - unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/zabbix2/zabbix_proxy.conf"); + unlink_if_exists(ZABBIX_PROXY_BASE . "/etc/zabbix22/zabbix_proxy.conf"); unlink_if_exists("/var/log/zabbix2/zabbix_proxy.log"); unlink_if_exists("/var/run/zabbix2/zabbix2_proxy.pid"); @@ -208,7 +208,7 @@ Fping6Location=/usr/local/sbin/fping6 ProxyMode={$Mode} EOF; - file_put_contents(ZABBIX_PROXY_BASE . "/etc/zabbix2/zabbix_proxy.conf", strtr($zbproxy_conf_file, array("\r" => ""))); + file_put_contents(ZABBIX_PROXY_BASE . "/etc/zabbix22/zabbix_proxy.conf", strtr($zbproxy_conf_file, array("\r" => ""))); } } /* check zabbix agent settings*/ @@ -242,7 +242,7 @@ StartAgents={$StartAgents} {$UserParams} EOF; - file_put_contents(ZABBIX_AGENT_BASE . "/etc/zabbix2/zabbix_agentd.conf", strtr($zbagent_conf_file, array("\r" => ""))); + file_put_contents(ZABBIX_AGENT_BASE . "/etc/zabbix22/zabbix_agentd.conf", strtr($zbagent_conf_file, array("\r" => ""))); } } $want_sysctls = array( @@ -291,8 +291,8 @@ EOF; /*check startup script files*/ /* create a few directories and ensure the sample files are in place */ - if (!is_dir(ZABBIX_PROXY_BASE . "/etc/zabbix2")) - exec("/bin/mkdir -p " . ZABBIX_PROXY_BASE . "/etc/zabbix2"); + if (!is_dir(ZABBIX_PROXY_BASE . "/etc/zabbix22")) + exec("/bin/mkdir -p " . ZABBIX_PROXY_BASE . "/etc/zabbix22"); $dir_checks = <<< EOF if [ ! -d /var/log/zabbix2 ] diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 3ca0321a..27d6f21f 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1915,7 +1915,7 @@ Monitoring agent. Services http://www.pfsense.org/packages/config/zabbix2/zabbix2-agent.xml - zabbix2-agent-2.0.8 pkg v0.7_1 + zabbix2-agent-2.2.1 pkg v0.8_0 BETA 2.0 zabbix2-agent.xml @@ -1926,15 +1926,15 @@ net-mgmt/zabbix22-agent http://files.pfsense.org/packages/8/All/ - zabbix2-agent-2.0.8.tbz - zabbix2-agent-2.0.8-i386.pbi + zabbix22-agent-2.2.1.tbz + zabbix22-agent-2.2.1-i386.pbi Zabbix-2 Proxy Monitoring agent proxy. Services http://www.pfsense.org/packages/config/zabbix2/zabbix2-proxy.xml - zabbix2-proxy-2.0.8 pkg v0.7_1 + zabbix2-proxy-2.2.1 pkg v0.8_0 BETA 2.0 zabbix2-proxy.xml @@ -1946,8 +1946,8 @@ OPTIONS_SET+= SQLITE IPV6;OPTIONS_UNSET+= MYSQL JABBER GSSAPI http://files.pfsense.org/packages/8/All/ - zabbix2-proxy-2.0.8.tbz - zabbix2-proxy-2.0.8-i386.pbi + zabbix22-proxy-2.2.1.tbz + zabbix22-proxy-2.2.1-i386.pbi diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index cb65f8e4..1f43a074 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1902,7 +1902,7 @@ Monitoring agent. Services http://www.pfsense.org/packages/config/zabbix2/zabbix2-agent.xml - zabbix2-agent-2.0.8 pkg v0.7_1 + zabbix2-agent-2.2.1 pkg v0.8_0 BETA 2.0 zabbix2-agent.xml @@ -1913,15 +1913,15 @@ net-mgmt/zabbix22-agent http://files.pfsense.org/packages/amd64/8/All/ - zabbix2-agent-2.0.8.tbz - zabbix2-agent-2.0.8-amd64.pbi + zabbix22-agent-2.2.1.tbz + zabbix22-agent-2.2.1-amd64.pbi Zabbix-2 Proxy Monitoring agent proxy. Services http://www.pfsense.org/packages/config/zabbix2/zabbix2-proxy.xml - zabbix2-proxy-2.0.8 pkg v0.7_1 + zabbix2-proxy-2.2.1 pkg v0.8_0 BETA 2.0 zabbix2-proxy.xml @@ -1933,8 +1933,8 @@ OPTIONS_SET+= SQLITE IPV6;OPTIONS_UNSET+= MYSQL JABBER GSSAPI http://files.pfsense.org/packages/amd64/8/All/ - zabbix2-proxy-2.0.8.tbz - zabbix2-proxy-2.0.8-amd64.pbi + zabbix22-proxy-2.2.1.tbz + zabbix22-proxy-2.2.1-amd64.pbi -- cgit v1.2.3 From f93a0b871d5795513b7c9625cb94269f369d287e Mon Sep 17 00:00:00 2001 From: "Danilo G. Baio (dbaio)" Date: Fri, 27 Dec 2013 19:58:03 -0200 Subject: zabbix2 - fix pbi path --- config/zabbix2/zabbix2.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/zabbix2/zabbix2.inc b/config/zabbix2/zabbix2.inc index 3a4b5840..92aad309 100644 --- a/config/zabbix2/zabbix2.inc +++ b/config/zabbix2/zabbix2.inc @@ -48,7 +48,7 @@ function php_deinstall_zabbix2_agent(){ conf_mount_rw(); $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); if ($pfs_version > 2.0){ - define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix2-agent-' . php_uname("m")); + define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix22-agent-' . php_uname("m")); } else { define('ZABBIX_AGENT_BASE', '/usr/local'); } @@ -75,7 +75,7 @@ function php_deinstall_zabbix2_proxy(){ conf_mount_rw(); $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); if ($pfs_version > 2.0){ - define('ZABBIX_PROXY_BASE', '/usr/pbi/zabbix2-proxy-' . php_uname("m")); + define('ZABBIX_PROXY_BASE', '/usr/pbi/zabbix22-proxy-' . php_uname("m")); } else { define('ZABBIX_PROXY_BASE', '/usr/local'); } @@ -180,8 +180,8 @@ function sync_package_zabbix2(){ #check pfsense version $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); if ($pfs_version > 2.0){ - define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix2-agent-' . php_uname("m")); - define('ZABBIX_PROXY_BASE', '/usr/pbi/zabbix2-proxy-' . php_uname("m")); + define('ZABBIX_AGENT_BASE', '/usr/pbi/zabbix22-agent-' . php_uname("m")); + define('ZABBIX_PROXY_BASE', '/usr/pbi/zabbix22-proxy-' . php_uname("m")); } else { define('ZABBIX_AGENT_BASE', '/usr/local'); -- cgit v1.2.3 From 736c7763fbdab29c8727003704dfbd0c51aa0a99 Mon Sep 17 00:00:00 2001 From: topper727 Date: Sat, 28 Dec 2013 07:41:56 -0500 Subject: Fixes for lcdproc-0.5.6 pkg v. 0.9.7 --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..1a682095 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +pfsense-packages +================ +lcdproc-0.5.6 pkg v. 0.9.7 + +Patch to fix the 4 status LEDs + +This is in the pages for this Package +Enable Output LEDs +Enable the Output LEDs present on some LCD panels. This feature is currently supported by the CFontz633 driver only. +Each LED can be off or show two colors: RED (alarm) or GREEN (everything ok) and shows: +LED1: NICs status (green: ok, red: at least one nic down); +LED2: CARP status (green: master, red: backup, off: CARP not implemented); +LED3: CPU status (green < 50, red > 50%); +LED4: Gateway status (green: ok, red: at least one gateway not responding, off: no gateway configured). + +This does not work on CFonts Displays properly. I have fixed it to make this work. There is one thing that I don't +know if I got going and that is LED1. + + +pfSense packages repository -- cgit v1.2.3 From 5206b9ec2ee7b35120ab8b695ec80f7ba68dda84 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sun, 29 Dec 2013 01:36:09 +0100 Subject: haproxy-devel, use new 1.5dev21 binaries. --- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg_config.8.xml b/pkg_config.8.xml index b5b52746..e9730a33 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -199,7 +199,7 @@ haproxy.xml http://files.pfsense.org/packages/8/All/ haproxy-1.4.21.tbz - haproxy-devel-1.5-dev19-i386.pbi + haproxy-devel-1.5-dev21-i386.pbi /usr/ports/net/haproxy-devel security/openssl diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 61488709..7d309670 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -186,7 +186,7 @@ haproxy.xml http://files.pfsense.org/packages/amd64/8/All/ haproxy-1.4.21.tbz - haproxy-devel-1.5-dev19-amd64.pbi + haproxy-devel-1.5-dev21-amd64.pbi /usr/ports/net/haproxy-devel security/openssl -- cgit v1.2.3 From 375b270c9f5ddc5c488f8f79b61130c1913f0e2d Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sun, 29 Dec 2013 01:49:32 +0100 Subject: haproxy-devel, -ability to NOT have a default_backend (if all frontends in a group use acl's) -allow selecting multiple certificates for a single frontend -support for configuring new 'agent-check' -refactoring of html row_helper(), javascript table editing, field definition -create 'valid' HTML (closing tags/javascript blocks/styles in head) --- config/haproxy-devel/haproxy.inc | 213 +++++---- config/haproxy-devel/haproxy.widget.php | 1 + config/haproxy-devel/haproxy_global.php | 73 ++-- config/haproxy-devel/haproxy_htmllist.inc | 246 +++++++++++ config/haproxy-devel/haproxy_listeners.php | 44 +- config/haproxy-devel/haproxy_listeners_edit.php | 472 +++++++------------- config/haproxy-devel/haproxy_pool_edit.php | 500 +++++++--------------- config/haproxy-devel/haproxy_pools.php | 17 +- config/haproxy-devel/haproxy_socketinfo.inc | 1 + config/haproxy-devel/haproxy_utils.inc | 141 +++++- config/haproxy-devel/haproxy_xmlrpcsyncclient.inc | 1 + 11 files changed, 887 insertions(+), 822 deletions(-) create mode 100644 config/haproxy-devel/haproxy_htmllist.inc diff --git a/config/haproxy-devel/haproxy.inc b/config/haproxy-devel/haproxy.inc index f768ef01..8531d95a 100644 --- a/config/haproxy-devel/haproxy.inc +++ b/config/haproxy-devel/haproxy.inc @@ -1,6 +1,7 @@ Copyright (C) 2008 Remco Hoef All rights reserved. @@ -35,45 +36,48 @@ require_once("haproxy_utils.inc"); require_once("haproxy_xmlrpcsyncclient.inc"); $d_haproxyconfdirty_path = $g['varrun_path'] . "/haproxy.conf.dirty"; +$haproxy_confpath = "{$g['varetc_path']}/haproxy"; $a_acltypes = array(); -$a_acltypes[] = array('name' => 'host_starts_with', 'descr' => 'Host starts with', +$a_acltypes["host_starts_with"] = array('name' => 'Host starts with', 'mode' => 'http', 'syntax' => 'hdr_beg(host) -i %1$s'); -$a_acltypes[] = array('name' => 'host_ends_with', 'descr' => 'Host ends with', +$a_acltypes["host_ends_with"] = array('name' => 'Host ends with', 'mode' =>'http', 'syntax' => 'hdr_end(host) -i %1$s'); -$a_acltypes[] = array('name' => 'host_matches', 'descr' => 'Host matches', +$a_acltypes["host_matches"] = array('name' => 'Host matches', 'mode' =>'http', 'syntax' => 'hdr(host) -i %1$s'); -$a_acltypes[] = array('name' => 'host_regex', 'descr' => 'Host regex', +$a_acltypes["host_regex"] = array('name' => 'Host regex', 'mode' =>'http', 'syntax' => 'hdr_reg(host) -i %1$s'); -$a_acltypes[] = array('name' => 'host_contains', 'descr' => 'Host contains', +$a_acltypes["host_contains"] = array('name' => 'Host contains', 'mode' => 'http', 'syntax' => 'hdr_dir(host) -i %1$s'); -$a_acltypes[] = array('name' => 'path_starts_with', 'descr' => 'Path starts with', +$a_acltypes["path_starts_with"] = array('name' => 'Path starts with', 'mode' => 'http', 'syntax' => 'path_beg -i %1$s'); -$a_acltypes[] = array('name' => 'path_ends_with', 'descr' => 'Path ends with', +$a_acltypes["path_ends_with"] = array('name' => 'Path ends with', 'mode' => 'http', 'syntax' => 'path_end -i %1$s'); -$a_acltypes[] = array('name' => 'path_matches', 'descr' => 'Path matches', +$a_acltypes["path_matches"] = array('name' => 'Path matches', 'mode' => 'http', 'syntax' => 'path -i %1$s'); -$a_acltypes[] = array('name' => 'path_regex', 'descr' => 'Path regex', +$a_acltypes["path_regex"] = array('name' => 'Path regex', 'mode' => 'http', 'syntax' => 'path_reg -i %1$s'); -$a_acltypes[] = array('name' => 'path_contains', 'descr' => 'Path contains', +$a_acltypes["path_contains"] = array('name' => 'Path contains', 'mode' => 'http', 'syntax' => 'path_dir -i %1$s'); -$a_acltypes[] = array('name' => 'source_ip', 'descr' => 'Source IP', +$a_acltypes["source_ip"] = array('name' => 'Source IP', 'mode' => '', 'syntax' => 'src %1$s'); -$a_acltypes[] = array('name' => 'backendservercount', 'descr' => 'Minimum count usable servers', +$a_acltypes["backendservercount"] = array('name' => 'Minimum count usable servers', 'mode' => '', 'syntax' => 'nbsrv(%2$s) ge %1$d', 'parameters' => 'value,backendname'); // 'ssl_sni_matches' was added in HAProxy1.5dev17 -$a_acltypes[] = array('name' => 'ssl_sni_matches', 'descr' => 'Server Name Indication TLS extension matches', +$a_acltypes["ssl_sni_matches"] = array('name' => 'Server Name Indication TLS extension matches', 'mode' => 'https', 'syntax' => 'req_ssl_sni -i %1$s', 'advancedoptions' => "tcp-request inspect-delay 5s\n\ttcp-request content accept if { req_ssl_hello_type 1 }"); +$a_checktypes = array(); $a_checktypes['none'] = array('name' => 'none', 'syntax' => '', 'descr' => 'No health checks will be performed.'); $a_checktypes['Basic'] = array('name' => 'Basic', 'syntax' => '', 'descr' => 'Basic socket connection check'); $a_checktypes['HTTP'] = array('name' => 'HTTP', 'syntax' => 'httpchk', 'descr' => 'HTTP protocol to check on the servers health, can also be used for HTTPS servers(requirs checking the SSL box for the servers).', 'parameters' => "uri,method,version"); -// 'Agent' was added in HAProxy1.5dev18 +// 'Agent' was added in HAProxy1.5dev18, and removed in 1.5dev20, in favor of the seperate agent-check option. $a_checktypes['Agent'] = array('name' => 'Agent', 'syntax' => 'lb-agent-chk', 'usedifferenport' => 'yes', - 'descr' => 'Use a TCP connection to read an ASCII string of the form 100%,75%,drain,down (others in haproxy manual)'); + 'descr' => 'Use a TCP connection to read an ASCII string of the form 100%,75%,drain,down (others in haproxy manual)', + deprecated => true); $a_checktypes['LDAP'] = array('name' => 'LDAP', 'syntax' => 'ldap-check', 'descr' => 'Use LDAPv3 health checks for server testing'); $a_checktypes['MySQL'] = array('name' => 'MySQL', 'syntax' => 'mysql-check', @@ -89,6 +93,7 @@ $a_checktypes['ESMTP'] = array('name' => 'ESMTP', 'syntax' => 'smtpchk EHLO', $a_checktypes['SSL'] = array('name' => 'SSL', 'syntax' => 'ssl-hello-chk', 'descr' => 'Use SSLv3 client hello health checks for server testing.'); +$a_httpcheck_method = array(); $a_httpcheck_method['OPTIONS'] = array('name' => 'OPTIONS', 'syntax' => 'OPTIONS'); $a_httpcheck_method['HEAD'] = array('name' => 'HEAD', 'syntax' => 'HEAD'); $a_httpcheck_method['GET'] = array('name' => 'GET', 'syntax' => 'GET'); @@ -97,6 +102,7 @@ $a_httpcheck_method['PUT'] = array('name' => 'PUT', 'syntax' => 'PUT'); $a_httpcheck_method['DELETE'] = array('name' => 'DELETE', 'syntax' => 'DELETE'); $a_httpcheck_method['TRACE'] = array('name' => 'TRACE', 'syntax' => 'TRACE'); +$a_closetypes = array(); $a_closetypes['none'] = array('name' => 'none', 'syntax' => '', 'descr' => 'No close headers will be changed.'); $a_closetypes['httpclose'] = array('name' => 'httpclose', 'syntax' => 'httpclose', @@ -105,6 +111,14 @@ $a_closetypes['http-server-close'] = array('name' => 'http-server-close', 'synta 'descr' => 'By default, when a client communicates with a server, HAProxy will only analyze, log, and process the first request of each connection. Setting "option http-server-close" enables HTTP connection-close mode on the server side while keeping the ability to support HTTP keep-alive and pipelining on the client side. This provides the lowest latency on the client side (slow network) and the fastest session reuse on the server side to save server resources.'); $a_closetypes['forceclose'] = array('name' => 'forceclose', 'syntax' => 'forceclose', 'descr' => 'Some HTTP servers do not necessarily close the connections when they receive the "Connection: close" set by "option httpclose", and if the client does not close either, then the connection remains open till the timeout expires. This causes high number of simultaneous connections on the servers and shows high global session times in the logs. Note that this option also enables the parsing of the full request and response, which means we can close the connection to the server very quickly, releasing some resources earlier than with httpclose.'); +$a_closetypes['http-keep-alive'] = array('name' => 'http-keep-alive', 'syntax' => 'http-keep-alive', + 'descr' => 'By default, when a client communicates with a server, HAProxy will only analyze, log, and process the first request of each connection. Setting "option http-keep-alive" enables HTTP keep-alive mode on the client- and server- sides. This provides the lowest latency on the client side (slow network) and the fastest session reuse on the server side at the expense of maintaining idle connections to the servers. In general, it is possible with this option to achieve approximately twice the request rate that the "http-server-close" option achieves on small objects. There are mainly two situations where this option may be useful : - when the server is non-HTTP compliant and authenticates the connection instead of requests (eg: NTLM authentication) - when the cost of establishing the connection to the server is significant compared to the cost of retrieving the associated object from the server.'); + +$a_servermodes = array(); +$a_servermodes["active"]['name'] = "active"; +$a_servermodes["backup"]['name'] = "backup"; +$a_servermodes["disabled"]['name'] = "disabled"; +$a_servermodes["inactive"]['name'] = "inactive"; function haproxy_custom_php_deinstall_command() { exec("cd /var/db/pkg && pkg_delete `ls | grep haproxy`"); @@ -351,8 +365,8 @@ function haproxy_install_cron($should_install) { function haproxy_find_acl($name) { global $a_acltypes; if($a_acltypes) { - foreach ($a_acltypes as $acl) { - if ($acl['name'] == $name) + foreach ($a_acltypes as $key => $acl) { + if ($key == $name) return $acl; } } @@ -486,6 +500,10 @@ function write_backend($fd, $name, $pool, $frontend) { else $checkinter = "check inter 1000"; } + + //agent-check requires at least haproxy v1.5dev20 + if ($pool['agent_check']) + $agentcheck = " agent-check agent-inter {$pool['agent_inter']} agent-port {$pool['agent_port']}"; if (is_array($a_servers)) { @@ -505,22 +523,22 @@ function write_backend($fd, $name, $pool, $frontend) { { $ssl = $backend_type == "http" ? ' ssl' : ' check-ssl'; } - fwrite ($fd, "\tserver\t\t\t" . $be['name'] . " " . $be['address'].":" . $be['port'] . "$ssl $cookie $checkinter$checkport $isbackup weight " . $be['weight'] . "{$advanced_txt} {$be['advanced']}\n"); + fwrite ($fd, "\tserver\t\t\t" . $be['name'] . " " . $be['address'].":" . $be['port'] . "$ssl $cookie $checkinter$checkport$agentcheck $isbackup weight " . $be['weight'] . "{$advanced_txt} {$be['advanced']}\n"); } } fwrite ($fd, "\n"); } function haproxy_configure() { - global $g; + global $g, $haproxy_confpath; // reload haproxy - haproxy_writeconf("{$g['varetc_path']}/haproxy.cfg"); + haproxy_writeconf("{$haproxy_confpath}/haproxy.cfg"); return haproxy_check_run(1); } function haproxy_check_and_run(&$messages, $reload) { - global $g; - $configname = "{$g['varetc_path']}/haproxy.cfg"; + global $g, $haproxy_confpath; + $configname = "{$haproxy_confpath}/haproxy.cfg"; haproxy_writeconf("$configname.new"); $retval = exec("haproxy -c -V -f $configname.new 2>&1", $output, $err); $messages = ""; @@ -543,19 +561,37 @@ function haproxy_check_and_run(&$messages, $reload) { } return $ok; } +function haproxy_write_certificate_file($filename, $certid) { + $cert = lookup_cert($certid); + + $certcontent = base64_decode($cert['crt']); + $certcontent .= "\r\n".base64_decode($cert['prv']); + + $certchaincontent = ca_chain($cert); + if ($certchaincontent != "") { + $certcontent .= "\r\n" . $certchaincontent; + } + unset($certchaincontent); + file_put_contents($filename, $certcontent); + unset($certcontent); + unset($cert); +} function haproxy_writeconf($configfile) { - global $config; + global $config, $haproxy_confpath; - $a_global = &$config['installedpackages']['haproxy']; - $a_backends = &$config['installedpackages']['haproxy']['ha_backends']['item']; - $a_pools = &$config['installedpackages']['haproxy']['ha_pools']['item']; + rmdir_recursive($haproxy_confpath); + make_dirs($haproxy_confpath); + $a_global = &$config['installedpackages']['haproxy']; + $a_frontends = &$config['installedpackages']['haproxy']['ha_backends']['item']; + $a_backends = &$config['installedpackages']['haproxy']['ha_pools']['item']; + $fd = fopen($configfile, "w"); - if(is_array($a_global)) { fwrite ($fd, "global\n"); - fwrite ($fd, "\tmaxconn\t\t\t".$a_global['maxconn']."\n"); + if ($a_global['maxconn']) + fwrite ($fd, "\tmaxconn\t\t\t".$a_global['maxconn']."\n"); if($a_global['remotesyslog']) fwrite ($fd, "\tlog\t\t\t{$a_global['remotesyslog']}\t{$a_global['logfacility']}\t{$a_global['loglevel']}\n"); fwrite ($fd, "\tstats socket /tmp/haproxy.socket level admin\n"); @@ -586,46 +622,48 @@ function haproxy_writeconf($configfile) { // Try and get a unique array for address:port as frontends can duplicate $a_bind = array(); - if(is_array($a_backends)) { - foreach ($a_backends as $backend) { - if($backend['status'] != 'active') + if(is_array($a_frontends)) { + foreach ($a_frontends as $frontend) { + if($frontend['status'] != 'active') { - unlink_if_exists("var/etc/{$backend['name']}.{$backend['port']}.crt"); + unlink_if_exists("var/etc/{$frontend['name']}.{$frontend['port']}.crt"); continue; } - if(!$backend['backend_serverpool']) + if(!$frontend['backend_serverpool']) { - unlink_if_exists("var/etc/{$backend['name']}.{$backend['port']}.crt"); + unlink_if_exists("var/etc/{$frontend['name']}.{$frontend['port']}.crt"); continue; } + + $bname = get_frontend_ipport($frontend); //check ssl info - if (strtolower($backend['type']) == "http" && $backend['ssloffload']){ + if (strtolower($frontend['type']) == "http" && $frontend['ssloffload']){ //ssl crt ./server.pem ca-file ./ca.crt verify optional crt-ignore-err all crl-file ./ca_crl.pem - $ssl_crt=" crt /var/etc/{$backend['name']}.{$backend['port']}.crt"; - $cert = lookup_cert($backend['ssloffloadcert']); - $certcontent = base64_decode($cert['crt'])."\r\n".base64_decode($cert['prv']); - - $certchaincontent = ca_chain($cert); - if ($certchaincontent != "") { - $certcontent .= "\r\n" . $certchaincontent; + $filename = "$haproxy_confpath/{$frontend['name']}.{$frontend['port']}.pem"; + $ssl_crt = " crt $filename"; + haproxy_write_certificate_file($filename, $frontend['ssloffloadcert']); + $subfolder = "$haproxy_confpath/{$frontend['name']}.{$frontend['port']}"; + $certs = $frontend['ha_certificates']['item']; + if (is_array($certs)){ + if (count($certs) > 0){ + make_dirs($subfolder); + foreach($certs as $cert){ + haproxy_write_certificate_file("$subfolder/{$cert['ssl_certificate']}.pem", $cert['ssl_certificate']); + } + $ssl_crt .= " crt $subfolder"; + } } - unset($certchaincontent); - - file_put_contents("/var/etc/{$backend['name']}.{$backend['port']}.crt", $certcontent); - unset($certcontent); }else{ $ssl_crt=""; - unlink_if_exists("var/etc/{$backend['name']}.{$backend['port']}.crt"); + unlink_if_exists("var/etc/{$frontend['name']}.{$frontend['port']}.crt"); } - - $bname = get_frontend_ipport($backend); if (!is_array($a_bind[$bname])) { $a_bind[$bname] = array(); $a_bind[$bname]['config'] = array(); // Settings which are used only from the primary frontend - $primaryfrontend = get_primaryfrontend($backend); + $primaryfrontend = get_primaryfrontend($frontend); $a_bind[$bname]['name'] = $primaryfrontend['name']; $a_bind[$bname]['extaddr'] = $primaryfrontend['extaddr']; $a_bind[$bname]['port'] = $primaryfrontend['port']; @@ -640,19 +678,19 @@ function haproxy_writeconf($configfile) { } $b = &$a_bind[$bname]; - if (($backend['secondary'] != 'yes') && ($backend['name'] != $b['name'])) { + if (($frontend['secondary'] != 'yes') && ($frontend['name'] != $b['name'])) { // only 1 frontend can be the primary for a set of frontends that share 1 address:port. $input_errors[] = "Multiple primary frondends for $bname"; } if ($ssl_crt != "") { if ($b['ssl_info'] == "") - $b['ssl_info'] = "ssl {$backend['dcertadv']}"; + $b['ssl_info'] = "ssl {$frontend['dcertadv']}"; $b['ssl_info'] .= $ssl_crt; } - // pointer to each backend - $b['config'][] = $backend; + // pointer to each frontend + $b['config'][] = $frontend; } } @@ -736,32 +774,51 @@ function haproxy_writeconf($configfile) { // Combine the rest of the frontend configs $default_backend = ""; $i = 0; - foreach ($bind['config'] as $bconfig) { - $a_acl=&$bconfig['ha_acls']['item']; + foreach ($bind['config'] as $frontend) { + $a_acl=&$frontend['ha_acls']['item']; if(!is_array($a_acl)) $a_acl=array(); - $poolname = $bconfig['backend_serverpool'] . "_" . strtolower($bconfig['type']); + $poolname = $frontend['backend_serverpool'] . "_" . strtolower($frontend['type']); // Create different pools if the svrport is set - if ($bconfig['svrport'] > 0) - $poolname .= "_" . $bconfig['svrport']; - - // Write this out once, and must be before any backend config text - if ($default_backend == "" || $bconfig['secondary'] != 'yes') { - $default_backend = $poolname; - } + if ($frontend['svrport'] > 0) + $poolname .= "_" . $frontend['svrport']; if (!isset($a_pendingpl[$poolname])) { $a_pendingpl[$poolname] = array(); $a_pendingpl[$poolname]['name'] = $poolname; - $a_pendingpl[$poolname]['frontend'] = $bconfig; + $a_pendingpl[$poolname]['frontend'] = $frontend; } - if (strtolower($bind['type']) == "http" && $bconfig['ssloffload'] && $bconfig['ssloffloadacl']) { + if (strtolower($bind['type']) == "http" && $frontend['ssloffload']) { $aclname = "SNI_" . $poolname; - $cert_cn = cert_get_cn($bconfig['ssloffloadcert'] ,true); - $a_acl[] = array('name' => $aclname,'expression' => 'host_matches', 'value' => $cert_cn); + if ($frontend['ssloffloadacl']){ + $cert = lookup_cert($frontend['ssloffloadcert']); + $cert_cn = cert_get_cn($cert['crt']); + $descr = haproxy_escape_acl_name($cert['descr']); + $a_acl[] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_matches', 'value' => $cert_cn); + unset($cert); + } + if ($frontend['ssloffloadacladditional']){ + $certs = $frontend['ha_certificates']['item']; + if (is_array($certs)){ + if (count($certs) > 0){ + foreach($certs as $certref){ + $cert = lookup_cert($certref['ssl_certificate']); + $cert_cn = cert_get_cn($cert['crt']); + $descr = haproxy_escape_acl_name($cert['descr']); + $a_acl[] = array('name' => "{$aclname}_{$descr}",'expression' => 'host_matches', 'value' => $cert_cn); + unset($cert); + } + } + } + } + } + + // Write this out once, and must be before any backend config text + if (($default_backend == "" || $frontend['secondary'] != 'yes') && count($a_acl) == 0 ) { + $default_backend = $poolname; } // combine acl's with same name to allow for 'combined checks' to check for example hostname and fileextension together.. @@ -795,7 +852,8 @@ function haproxy_writeconf($configfile) { fwrite ($fd, "\tuse_backend\t\t" . $poolname . " if " . $aclnames . "\n"); } } - fwrite ($fd, "\tdefault_backend\t\t" . $default_backend . "\n"); + if ($default_backend) + fwrite ($fd, "\tdefault_backend\t\t" . $default_backend . "\n"); foreach($advancedextra as $extra) fwrite ($fd, "\t".$extra."\n"); @@ -803,9 +861,9 @@ function haproxy_writeconf($configfile) { } } // Construct and write out configuration for each "backend" - if (is_array($a_pendingpl) && is_array($a_pools)) { + if (is_array($a_pendingpl) && is_array($a_backends)) { foreach ($a_pendingpl as $pending) { - foreach ($a_pools as $pool) { + foreach ($a_backends as $pool) { if ($pending['frontend']['backend_serverpool'] == $pool['name']) { write_backend($fd, $pending['name'], $pool, $pending['frontend']); } @@ -845,7 +903,6 @@ function haproxy_is_running() { return $running; } - function haproxy_load_modules() { // On FreeBSD 8 ipfw is needed to allow 'transparent' proxying (getting reply's to a non-local ip to pass back to the client-socket).. // On FreeBSD 9 it is probably possible to do the same with the pf option "divert-reply" @@ -929,7 +986,7 @@ function load_ipfw_rules() { } function haproxy_check_run($reload) { - global $config, $g, $haproxy_run_message; + global $config, $g, $haproxy_confpath, $haproxy_run_message; $a_global = &$config['installedpackages']['haproxy']; @@ -963,9 +1020,9 @@ function haproxy_check_run($reload) { $sf_st = "-st";//terminate old process as soon as the new process is listening else $sf_st = "-sf";//finish serving existing connections exit when done, and the new process is listening - exec("/usr/local/sbin/haproxy -f /var/etc/haproxy.cfg -p /var/run/haproxy.pid $sf_st `cat /var/run/haproxy.pid` 2>&1", $output, $errcode); + exec("/usr/local/sbin/haproxy -f {$haproxy_confpath}/haproxy.cfg -p /var/run/haproxy.pid $sf_st `cat /var/run/haproxy.pid` 2>&1", $output, $errcode); } else { - exec("/usr/local/sbin/haproxy -f /var/etc/haproxy.cfg -p /var/run/haproxy.pid -D 2>&1", $output, $errcode); + exec("/usr/local/sbin/haproxy -f {$haproxy_confpath}/haproxy.cfg -p /var/run/haproxy.pid -D 2>&1", $output, $errcode); } foreach($output as $line) $haproxy_run_message .= "
" . htmlspecialchars($line) . "\n"; @@ -1127,7 +1184,7 @@ function get_frontend_acls($frontend) { continue; $acl_item = array(); - $acl_item['descr'] = $acl['descr'] . ": " . $entry['value']; + $acl_item['descr'] = $acl['name'] . ": " . $entry['value']; $acl_item['ref'] = $entry; $result[] = $acl_item; @@ -1153,4 +1210,8 @@ function haproxy_escapestring($configurationsting) { return str_replace('#', '\\#', $result); } +function haproxy_escape_acl_name($aclname) { + return preg_replace_callback('([^A-Za-z0-9\._\-\:])', function($match){return "_".dechex(ord($match[0]));}, $aclname); +} + ?> diff --git a/config/haproxy-devel/haproxy.widget.php b/config/haproxy-devel/haproxy.widget.php index abc5d935..7954e404 100644 --- a/config/haproxy-devel/haproxy.widget.php +++ b/config/haproxy-devel/haproxy.widget.php @@ -1,5 +1,6 @@ Copyright (C) 2008 Remco Hoef All rights reserved. @@ -52,15 +53,15 @@ if ($_POST) { if ($result) unlink_if_exists($d_haproxyconfdirty_path); } else { - if ($_POST['enable']) { - $reqdfields = explode(" ", "maxconn"); - $reqdfieldsn = explode(",", "Maximum connections"); - } + //if ($_POST['enable']) { + // $reqdfields = explode(" ", "maxconn"); + // $reqdfieldsn = explode(",", "Maximum connections"); + //} if ($_POST['carpdev'] == "disabled") unset($_POST['carpdev']); - do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + //do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); if ($_POST['maxconn'] && (!is_numeric($_POST['maxconn']))) $input_errors[] = "The maximum number of connections should be numeric."; @@ -126,7 +127,7 @@ include("head.inc"); -