debian/0000775000000000000000000000000013333326717007200 5ustar debian/monit.docs0000664000000000000000000000002512241677765011206 0ustar README doc/PLATFORMS debian/templates/0000775000000000000000000000000012241677765011207 5ustar debian/templates/rootrc0000664000000000000000000000024012241677765012436 0ustar if changed checksum then alert if failed permission 644 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor debian/templates/rootbin0000664000000000000000000000024412241677765012606 0ustar if failed checksum then unmonitor if failed permission 755 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor debian/templates/rootstrict0000664000000000000000000000024412241677765013346 0ustar if failed checksum then unmonitor if failed permission 600 then unmonitor if failed uid root then unmonitor if failed gid root then unmonitor debian/monit.logrotate0000664000000000000000000000041412241677765012260 0ustar /var/log/monit.log { rotate 4 weekly minsize 1M missingok create 640 root adm notifempty compress delaycompress postrotate invoke-rc.d monit reload > /dev/null endscript } debian/NEWS0000664000000000000000000000125412241677765007712 0ustar monit (1:5.5-2) unstable; urgency=low Support of the "startup" option in /etc/default/monit and setting initial delay with /etc/monit/monit_delay has been removed. Please, use START option to enable/disable monit startup during boot. -- Sergey B Kirpichev Sun, 09 Dec 2012 15:37:35 +0400 monit (1:5.3.1-2) unstable; urgency=low Since version 1:5.3.1-2 of the package monit binary has been installed to /usr/bin/ (instead of /usr/sbin/). This is an upstream default and common for the monit packaging in other systems (e.g. FreeBSD, Gentoo, ALTlinux) as well. -- Sergey B Kirpichev Mon, 19 Dec 2011 13:41:51 +0400 debian/monit.dirs0000664000000000000000000000011612241677765011220 0ustar etc/monit/conf.d etc/monit/monitrc.d etc/monit/templates var/lib/monit/events debian/monit.init0000664000000000000000000000515012241677765011225 0ustar #!/bin/sh ### BEGIN INIT INFO # Provides: monit # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: $all # Should-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: service and resource monitoring daemon # Description: monit is a utility for managing and monitoring # processes, programs, files, directories and filesystems # on a Unix system. Monit conducts automatic maintenance # and repair and can execute meaningful causal actions # in error situations. ### END INIT INFO set -e . /lib/lsb/init-functions DAEMON=/usr/bin/monit CONFIG=/etc/monit/monitrc NAME=monit DESC="daemon monitor" MONIT_OPTS= PID="/run/$NAME.pid" # Check if DAEMON binary exist [ -f $DAEMON ] || exit 0 [ -f "/etc/default/$NAME" ] && . /etc/default/$NAME MONIT_OPTS="-c $CONFIG $MONIT_OPTS" monit_not_configured () { if [ "$1" != "stop" ] then printf "\tplease configure $NAME and then edit /etc/default/$NAME\n" printf "\tand set the \"START\" variable to \"yes\" in order to allow\n" printf "\t$NAME to start\n" fi exit 0 } monit_checks () { # Check if START variable is set to "yes", if not we exit. if [ "$START" != "yes" ] then monit_not_configured $1 fi } case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" monit_checks $1 if start-stop-daemon --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MONIT_OPTS 1>/dev/null then log_end_msg 0 else log_end_msg 1 fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if start-stop-daemon --retry TERM/5/KILL/5 --oknodo --stop --quiet --pidfile $PID 1>/dev/null then log_end_msg 0 else log_end_msg 1 fi ;; reload) log_daemon_msg "Reloading $DESC configuration" "$NAME" if start-stop-daemon --stop --signal HUP --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MONIT_OPTS 1>/dev/null then log_end_msg 0 else log_end_msg 1 fi ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" start-stop-daemon --retry TERM/5/KILL/5 --oknodo --stop --quiet --pidfile $PID 1>/dev/null if start-stop-daemon --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MONIT_OPTS 1>/dev/null then log_end_msg 0 else log_end_msg 1 fi ;; syntax) $DAEMON $MONIT_OPTS -t ;; status) status_of_proc -p $PID $DAEMON $NAME ;; *) log_action_msg "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|syntax|status}" ;; esac exit 0 debian/monit.pam0000664000000000000000000000014412241677765011035 0ustar # # The PAM configuration file for the monit daemon # @include common-auth @include common-account debian/monit.default0000664000000000000000000000031412241677765011703 0ustar # /etc/default/monit # Defaults for monit initscript. This file is sourced by # /bin/sh from /etc/init.d/monit. # Set START to yes to start the monit START=yes # Options to pass to monit #MONIT_OPTS= debian/monitrc.d/0000775000000000000000000000000012241677765011106 5ustar debian/monitrc.d/at0000664000000000000000000000071012241677765011433 0ustar check process atd with pidfile "/var/run/atd.pid" group system group atd start program = "/etc/init.d/atd start" stop program = "/etc/init.d/atd stop" if 5 restarts within 5 cycles then timeout depends on atd_bin depends on atd_rc check file atd_bin with path "/usr/sbin/atd" group atd include /etc/monit/templates/rootbin check file atd_rc with path "/etc/init.d/atd" group atd include /etc/monit/templates/rootbin debian/monitrc.d/apache20000664000000000000000000000117112241677765012334 0ustar check process apache with pidfile /var/run/apache2.pid group www group apache start program = "/etc/init.d/apache2 start" stop program = "/etc/init.d/apache2 stop" if 4 restarts within 20 cycles then timeout if failed host localhost port 80 with protocol http and request "/server-status" with timeout 25 seconds for 4 times within 5 cycles then restart depend apache_bin depend apache_rc check file apache_bin with path /usr/sbin/apache2 group apache include /etc/monit/templates/rootbin check file apache_rc with path /etc/init.d/apache2 group apache include /etc/monit/templates/rootbin debian/monitrc.d/mdadm0000664000000000000000000000113312241677765012111 0ustar check process mdadm with pidfile /var/run/mdadm/monitor.pid group system group mdadm start program = "/etc/init.d/mdadm start" stop program = "/etc/init.d/mdadm stop" if 5 restarts with 5 cycles then timeout depend mdadm_bin depend mdadm_rc depend mdadm_conf check file mdadm_bin with path /sbin/mdadm group mdadm include /etc/monit/templates/rootbin check file mdadm_conf with path /etc/mdadm/mdadm.conf group mdadm include /etc/monit/templates/rootrc check file mdadm_rc with path "/etc/init.d/mdadm" group mdadm include /etc/monit/templates/rootbin debian/monitrc.d/pdns-recursor0000664000000000000000000000125412241677765013641 0ustar check process pdns-recursor with pidfile /var/run/pdns_recursor.pid group system group dns group pdns-recursor start program = "/etc/init.d/pdns-recursor start" stop program = "/etc/init.d/pdns-recursor stop" if failed host 127.0.0.1 port 53 type udp protocol dns for 3 times within 4 cycles then restart if 5 restarts within 20 cycles then timeout depend pdns-recursor_bin depend pdns-recursor_rc check file pdns-recursor_bin with path /usr/sbin/pdns_recursor group pdns-recursor include /etc/monit/templates/rootbin check file pdns-recursor_rc with path /etc/init.d/pdns-recursor group pnds-recursor include /etc/monit/templates/rootbin debian/monitrc.d/cron0000664000000000000000000000126412241677765011775 0ustar check process crond with pidfile /var/run/crond.pid group system group crond start program = "/etc/init.d/cron start" stop program = "/etc/init.d/cron stop" if 5 restarts with 5 cycles then timeout depend cron_bin depend cron_rc depend cron_spool check file cron_bin with path /usr/sbin/cron group crond include /etc/monit/templates/rootbin check file cron_rc with path "/etc/init.d/cron" group crond include /etc/monit/templates/rootbin check directory cron_spool with path /var/spool/cron/crontabs group crond if failed permission 1730 then unmonitor if failed uid root then unmonitor if failed gid crontab then unmonitor debian/monitrc.d/mysql0000664000000000000000000000130012241677765012170 0ustar check process mysqld with pidfile /var/run/mysqld/mysqld.pid group database group mysql start program = "/etc/init.d/mysql start" stop program = "/etc/init.d/mysql stop" if failed host localhost port 3306 protocol mysql with timeout 15 seconds for 3 times within 4 cycles then restart if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 3 times within 4 cycles then restart if 5 restarts with 5 cycles then timeout depend mysql_bin depend mysql_rc check file mysql_bin with path /usr/sbin/mysqld group mysql include /etc/monit/templates/rootbin check file mysql_rc with path /etc/init.d/mysql group mysql include /etc/monit/templates/rootbin debian/monitrc.d/nginx0000664000000000000000000000101212241677765012146 0ustar check process nginx with pidfile /var/run/nginx.pid group www group nginx start program = "/etc/init.d/nginx start" stop program = "/etc/init.d/nginx stop" # if failed port 80 protocol http request "/" then restart if 5 restarts with 5 cycles then timeout depend nginx_bin depend nginx_rc check file nginx_bin with path /usr/sbin/nginx group nginx include /etc/monit/templates/rootbin check file nginx_rc with path /etc/init.d/nginx group nginx include /etc/monit/templates/rootbin debian/monitrc.d/openntpd0000664000000000000000000000073012241677765012660 0ustar check process ntpd with pidfile /var/run/openntpd.pid group system group ntpd start program = "/etc/init.d/openntpd start" stop program = "/etc/init.d/openntpd stop" if 4 restarts within 12 cycles then timeout depend ntpd_bin depend ntpd_rc check file ntpd_bin with path /usr/sbin/ntpd group ntpd include /etc/monit/templates/rootbin check file ntpd_rc with path /etc/init.d/openntpd group ntpd include /etc/monit/templates/rootbin debian/monitrc.d/smartmontools0000664000000000000000000000076612241677765013763 0ustar check process smartd with pidfile /var/run/smartd.pid group system group smartd start program = "/etc/init.d/smartmontools start" stop program = "/etc/init.d/smartmontools stop" if 5 restarts with 5 cycles then timeout depend smartd_bin depend smartd_rc check file smartd_bin with path /usr/sbin/smartd group smartd include /etc/monit/templates/rootbin check file smartd_rc with path "/etc/init.d/smartmontools" group smartd include /etc/monit/templates/rootbin debian/monitrc.d/acpid0000664000000000000000000000074112241677765012113 0ustar check process acpid with pidfile "/var/run/acpid.pid" group system group acpid start program = "/etc/init.d/acpid start" stop program = "/etc/init.d/acpid stop" if 5 restarts within 5 cycles then timeout depends on acpid_bin depends on acpid_rc check file acpid_bin with path "/usr/sbin/acpid" group acpid include /etc/monit/templates/rootbin check file acpid_rc with path "/etc/init.d/acpid" group acpid include /etc/monit/templates/rootbin debian/monitrc.d/rsyslog0000664000000000000000000000141412241677765012533 0ustar check process rsyslogd with pidfile /var/run/rsyslogd.pid group system group rsyslogd start program = "/etc/init.d/rsyslog start" stop program = "/etc/init.d/rsyslog stop" if 5 restarts with 5 cycles then timeout depend on rsyslogd_bin depend on rsyslogd_rc depend on rsyslog_file check file rsyslogd_bin with path /usr/sbin/rsyslogd group rsyslogd include /etc/monit/templates/rootbin check file rsyslogd_rc with path "/etc/init.d/rsyslog" group rsyslogd include /etc/monit/templates/rootbin check file rsyslog_file with path /var/log/messages group rsyslogd if timestamp > 65 minutes then alert if failed permission 640 then unmonitor if failed uid root then unmonitor if failed gid adm then unmonitor debian/monitrc.d/snmpd0000664000000000000000000000046612241677765012160 0ustar check process snmpd with pidfile /var/run/snmpd.pid start program = "/sbin/service snmpd start" stop program = "/sbin/service snmpd stop" if failed host localhost port 161 type udp then restart if failed host localhost port 199 type tcp then restart if 5 restarts within 5 cycles then timeout debian/monitrc.d/openssh-server0000664000000000000000000000166712241677765014026 0ustar check process sshd with pidfile /var/run/sshd.pid group system group sshd start program = "/etc/init.d/ssh start" stop program = "/etc/init.d/ssh stop" if failed host localhost port 22 with proto ssh then restart if 5 restarts with 5 cycles then timeout depend on sshd_bin depend on sftp_bin depend on sshd_rc depend on sshd_rsa_key depend on sshd_dsa_key check file sshd_bin with path /usr/sbin/sshd group sshd include /etc/monit/templates/rootbin check file sftp_bin with path /usr/lib/openssh/sftp-server group sshd include /etc/monit/templates/rootbin check file sshd_rsa_key with path /etc/ssh/ssh_host_rsa_key group sshd include /etc/monit/templates/rootstrict check file sshd_dsa_key with path /etc/ssh/ssh_host_dsa_key group sshd include /etc/monit/templates/rootstrict check file sshd_rc with path /etc/ssh/sshd_config group sshd include /etc/monit/templates/rootrc debian/monitrc.d/postfix0000664000000000000000000000261612241677765012532 0ustar check process postfix with pidfile /var/spool/postfix/pid/master.pid group system group mail group postfix start program = "/etc/init.d/postfix start" stop program = "/etc/init.d/postfix stop" if failed host localhost port 25 with protocol smtp for 2 times within 3 cycles then restart if 5 restarts with 5 cycles then timeout depend master_bin depend postfix_rc depend postdrop_bin depend postqueue_bin depend master_cf depend main_cf check file master_bin with path /usr/lib/postfix/master group postfix include /etc/monit/templates/rootbin check file postdrop_bin with path /usr/sbin/postdrop group postfix if failed checksum then unmonitor if failed permission 2555 then unmonitor if failed uid root then unmonitor if failed gid postdrop then unmonitor check file postqueue_bin with path /usr/sbin/postqueue group postfix if failed checksum then unmonitor if failed permission 2555 then unmonitor if failed uid root then unmonitor if failed gid postdrop then unmonitor check file master_cf with path /etc/postfix/master.cf group postfix include /etc/monit/templates/rootrc check file main_cf with path /etc/postfix/main.cf group postfix include /etc/monit/templates/rootrc check file postfix_rc with path /etc/init.d/postfix group postfix include /etc/monit/templates/rootbin debian/monitrc.d/memcached0000664000000000000000000000123612241677765012741 0ustar check process memcache with pidfile /var/run/memcached.pid group cache group memcached start program = "/etc/init.d/memcached start" stop program = "/etc/init.d/memcached stop" if failed host 127.0.0.1 port 11211 and protocol memcache then restart if cpu > 60% for 2 cycles then alert if cpu > 98% for 5 cycles then restart if 5 restarts within 20 cycles then timeout depend memcache_bin depend memcache_rc check file memcache_bin with path /usr/bin/memcached group memcached include /etc/monit/templates/rootbin check file memcache_rc with path /etc/init.d/memcached group memcached include /etc/monit/templates/rootbin debian/README.Debian0000664000000000000000000000336412241677765011260 0ustar Monit for Debian ================ Configuration ------------- Hope you'll like monit configuration snippets found in /etc/monit/monitrc.d/. These are supposed to be included into /etc/monit/monitrc *and* reviewed accordingly to site configuration and policy, including own file permissions (defaults to 0644, configuration snippets *are* readable by anyone), IP addresses, host names, exact limit values, etc. Generally we try to provide them working out-of-box but it's not always feasible. Please do post bugs against monit package when you have to change any snippet in the way that should be current default (e.g. a binary path has changed in the package). Packagers may drop the default monit config file to: /etc/monit/monitrc.d/ and alternative/optional snippets to: /etc/monit/monitrc.d/- Monitoring of deb packages -------------------------- If you monitor debian packages, you should consider adding the following snippet to your /etc/apt/apt.conf.d/50monit configuration to stop monit during a apt upgrade and start it again once apt finishes. This avoid spurious monit restarts/alerts of services that are stoped/started as part of their debian package postinst. --8<-- DPkg::Pre-Invoke { "[ -x /usr/bin/monit ] && /etc/init.d/monit stop" }; DPkg::Post-Invoke { "[ -x /usr/bin/monit ] && /etc/init.d/monit start" }; --8<-- See also man 5 apt.conf. Startup delay ------------- For some slow-to-start processes monit can, especially at bootup, start to monitor a process before it is fully initialised. This can cause monit to erroneously attempt a restart. To avoid this, you should set the "start delay" option in monitrc. A typical example looks like this: --8<-- set daemon 120 with start delay 240 --8<-- debian/monit.install0000664000000000000000000000014312241677765011725 0ustar monitrc etc/monit/ debian/monitrc.d/* etc/monit/monitrc.d/ debian/templates/* etc/monit/templates/ debian/monit.postinst0000664000000000000000000000116012241677765012142 0ustar #!/bin/sh set -e case "$1" in configure) # Setup logfile permissions: touch /var/log/monit.log chmod 640 /var/log/monit.log chown root:adm /var/log/monit.log # Add monit to /etc/aliases: if [ -f /etc/aliases ] || [ -L /etc/aliases ] then if ! grep -qi '^monit[[:space:]]*:' /etc/aliases then echo "monit: root" >> /etc/aliases test -x /usr/bin/newaliases && newaliases || : fi fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/monit.lintian-overrides0000664000000000000000000000045012241677765013716 0ustar # can contain sensitive information (eq. passwords): monit: non-standard-file-perm etc/monit/monitrc 0600 != 0644 # permissions on eventqueue dir: monit: non-standard-dir-perm var/lib/monit/events/ 0700 != 0755 # XXX, check this: monit: spelling-error-in-binary usr/bin/monit dependant dependent debian/patches/0000775000000000000000000000000013332377044010625 5ustar debian/patches/CVE-2016-7067.patch0000664000000000000000000005553113333326507013262 0ustar From: Jonas Meurer Date: Wed, 30 Nov 2016 15:45:34 +0100 Subject: Fix CSRF vulnerability (CVE-2016-7067). * Backport upstream commit c6ec3820e627f85417053e6336de2987f2d863e3 to monit 5.4 codebase. It implements the double-sumit cookie pattern to protect all POST requests against Cross-Site Request Forgery (CSRF). - Disabling the following http services for GET requests, requiring CSRF protected POST: _doaction, _viewlog (_summary and _report are not implemented in monit 5.4 yet). - The service for "_runtime" and "/" is still available via GET, but only the non-state changing part (read-only) - the actions for "_runtime" (force validate, stop monit http) and "/" require CSRF protected POST too. * The original patch doesn't apply against monit 5.4 as the codebase changed a lot since then. Additional manual backporting was needed: - src/http/cervlet.c doPost(): enable actions _status and _status2 for POST requests. - src/http/processor.h: send_error() in monit 5.4 takes three arguments, change __atribute__ at declaration of send_error() to "(printf, 3, 4)". - src/http/processor.c: - send_error(): add optional additional arguments ("..."). - do_service(): use "Run.httpdssl" instead of "Run.http.flags && Httpd_Ssl" as condition in invokation of set_header(). - is_authenticated(): replace invokation of Socket_getRemoteHost() by old name socket_get_remote_host(); "return FALSE" instead of "return false". - src/http/processor.c, src/util.c: remove superfluous first argument "req" from invokation of send_error(). - src/util.c: include system/Time.h from libmonit, as Util_getToken() uses Time_now() from there. - libmonit/src/util/Str.[ch]: backport Str_compareConstantTime() as it is used in patched is_authenticated() from src/http/processor.c. - src/control.c control_service_daemon(): the patch against _send() at src/http/client.c needs to go here. Origin: upstream, https://bitbucket.org/tildeslash/monit/commits/c6ec382 Origin: upstream, https://bitbucket.org/tildeslash/monit/commits/8144093 --- libmonit/src/util/Str.c | 12 ++++ libmonit/src/util/Str.h | 16 +++++ src/control.c | 8 ++- src/http/cervlet.c | 126 ++++++++++++++++++++++++++++------------ src/http/processor.c | 37 ++++++++++-- src/http/processor.h | 5 +- src/util.c | 30 +++++----- src/util.h | 9 +++ 8 files changed, 187 insertions(+), 56 deletions(-) diff --git a/libmonit/src/util/Str.c b/libmonit/src/util/Str.c index 11a5256..bb95fef 100644 --- a/libmonit/src/util/Str.c +++ b/libmonit/src/util/Str.c @@ -428,3 +428,15 @@ int Str_cmp(const void *x, const void *y) { return strcmp((const char *)x, (const char *)y); } + +int Str_compareConstantTime(const void *x, const void *y) { + // Copy input to zero initialized buffers of fixed size, to prevent string length timing attack (handle NULL input as well). If some string exceeds hardcoded buffer size, error is returned. + char _x[MAX_CONSTANT_TIME_STRING_LENGTH + 1] = {}; + char _y[MAX_CONSTANT_TIME_STRING_LENGTH + 1] = {}; + if (snprintf(_x, sizeof(_x), "%s", x ? (const char *)x : "") > MAX_CONSTANT_TIME_STRING_LENGTH || snprintf(_y, sizeof(_y), "%s", y ? (const char *)y : "") > MAX_CONSTANT_TIME_STRING_LENGTH) + return 1; + int rv = 0; + for (size_t i = 0; i < sizeof(_x); i++) + rv |= _x[i] ^ _y[i]; + return rv; +} diff --git a/libmonit/src/util/Str.h b/libmonit/src/util/Str.h index 95a95ca..bc2a585 100644 --- a/libmonit/src/util/Str.h +++ b/libmonit/src/util/Str.h @@ -37,6 +37,12 @@ */ +/** + * Maximum length of input for Str_compareConstantTime() method. We support + * currently up to 64 characters, which is enough for SHA256 digests. + */ +#define MAX_CONSTANT_TIME_STRING_LENGTH 64 + /** * Test if the given string is defined. That is; not NULL nor the * empty ("") string @@ -419,4 +425,14 @@ unsigned int Str_hash(const void *x); int Str_cmp(const void *x, const void *y); +/** + * Compare case sensitive two strings in constant time. This function + * can be used for timing-attack resistent comparison of credentials. + * @param x A String + * @param y A String + * @return 0 if x and y are equal otherwise a non-zero integer + */ +int Str_compareConstantTime(const void *x, const void *y); + + #endif diff --git a/src/control.c b/src/control.c index c8a4b70..e291290 100644 --- a/src/control.c +++ b/src/control.c @@ -116,16 +116,22 @@ int control_service_daemon(const char *S, const char *action) { /* Send request */ auth = Util_getBasicAuthHeaderMonit(); + MD_T token; + Util_getToken(token); if (socket_print(socket, "POST /%s HTTP/1.0\r\n" "Content-Type: application/x-www-form-urlencoded\r\n" + "Cookie: securitytoken=%s\r\n" "Content-Length: %d\r\n" "%s" "\r\n" - "action=%s", + "securitytoken=%s&action=%s", S, + token, + strlen("securitytoken=") + strlen(token) + 1 + strlen("action=") + strlen(action), auth ? auth : "", + token, action) < 0) { LogError("%s: Cannot send the command '%s' to the monit daemon -- %s", prog, action ? action : "null", STRERROR); diff --git a/src/http/cervlet.c b/src/http/cervlet.c index 2df0185..0d9cc51 100644 --- a/src/http/cervlet.c +++ b/src/http/cervlet.c @@ -87,7 +87,7 @@ #define GETID "/_getid" #define STATUS "/_status" #define STATUS2 "/_status2" -#define RUN "/_runtime" +#define RUNTIME "/_runtime" #define VIEWLOG "/_viewlog" #define DOACTION "/_doaction" #define FAVICON "/favicon.ico" @@ -113,9 +113,11 @@ static void do_ping(HttpRequest, HttpResponse); static void do_getid(HttpRequest, HttpResponse); static void do_runtime(HttpRequest, HttpResponse); static void do_viewlog(HttpRequest, HttpResponse); -static void handle_action(HttpRequest, HttpResponse); -static void handle_do_action(HttpRequest, HttpResponse); -static void handle_run(HttpRequest, HttpResponse); +static void handle_service(HttpRequest, HttpResponse); +static void handle_service_action(HttpRequest, HttpResponse); +static void handle_doaction(HttpRequest, HttpResponse); +static void handle_runtime(HttpRequest, HttpResponse); +static void handle_runtime_action(HttpRequest, HttpResponse); static void is_monit_running(HttpRequest, HttpResponse); static void do_service(HttpRequest, HttpResponse, Service_T); static void print_alerts(HttpResponse, Mail_T); @@ -189,12 +191,18 @@ static void doPost(HttpRequest req, HttpResponse res) { set_content_type(res, "text/html"); - if(ACTION(RUN)) { - handle_run(req, res); + if(ACTION(RUNTIME)) { + handle_runtime_action(req, res); + } else if(ACTION(VIEWLOG)) { + do_viewlog(req, res); + } else if(ACTION(STATUS)) { + print_status(req, res, 1); + } else if(ACTION(STATUS2)) { + print_status(req, res, 2); } else if(ACTION(DOACTION)) { - handle_do_action(req, res); + handle_doaction(req, res); } else { - handle_action(req, res); + handle_service_action(req, res); } } @@ -212,12 +220,10 @@ static void doGet(HttpRequest req, HttpResponse res) { LOCK(Run.mutex) do_home(req, res); END_LOCK; - } else if(ACTION(RUN)) { - handle_run(req, res); + } else if(ACTION(RUNTIME)) { + handle_runtime(req, res); } else if(ACTION(TEST)) { is_monit_running(req, res); - } else if(ACTION(VIEWLOG)) { - do_viewlog(req, res); } else if(ACTION(ABOUT)) { do_about(req, res); } else if(ACTION(FAVICON)) { @@ -230,10 +236,8 @@ static void doGet(HttpRequest req, HttpResponse res) { print_status(req, res, 1); } else if(ACTION(STATUS2)) { print_status(req, res, 2); - } else if(ACTION(DOACTION)) { - handle_do_action(req, res); } else { - handle_action(req, res); + handle_service(req, res); } } @@ -551,15 +555,33 @@ static void do_runtime(HttpRequest req, HttpResponse res) { StringBuffer_append(res->outputbuffer, ""); StringBuffer_append(res->outputbuffer, - ""); + "", + res->token); StringBuffer_append(res->outputbuffer, - ""); + "", + res->token); if(Run.dolog && !Run.use_syslog) { StringBuffer_append(res->outputbuffer, - ""); + "", + res->token); } StringBuffer_append(res->outputbuffer, "
Stop Monit http server? " - "
" + "
Stop Monit http server? " + "" + "" + "" + "
" + "
Force validate now? " - "
" + "
Force validate now? " + "" + "" + "" + "
" + "
View Monit logfile?
" + "
View Monit logfile? " + "" + "" + "
" + "
"); @@ -625,7 +647,18 @@ static void do_viewlog(HttpRequest req, HttpResponse res) { } -static void handle_action(HttpRequest req, HttpResponse res) { +static void handle_service(HttpRequest req, HttpResponse res) { + char *name = req->url; + Service_T s = Util_getService(++name); + if (! s) { + send_error(res, SC_NOT_FOUND, "There is no service named \"%s\"", name ? name : ""); + return; + } + do_service(req, res, s); +} + + +static void handle_service_action(HttpRequest req, HttpResponse res) { int doaction; char *name = req->url; const char *action; @@ -665,12 +698,11 @@ static void handle_action(HttpRequest req, HttpResponse res) { } -static void handle_do_action(HttpRequest req, HttpResponse res) { +static void handle_doaction(HttpRequest req, HttpResponse res) { Service_T s; int doaction = ACTION_IGNORE; const char *action = get_parameter(req, "action"); const char *token = get_parameter(req, "token"); - if(action) { HttpParameter p; @@ -719,7 +751,14 @@ static void handle_do_action(HttpRequest req, HttpResponse res) { } -static void handle_run(HttpRequest req, HttpResponse res) { +static void handle_runtime(HttpRequest req, HttpResponse res) { + LOCK(Run.mutex) + do_runtime(req, res); + END_LOCK; +} + + +static void handle_runtime_action(HttpRequest req, HttpResponse res) { const char *action= get_parameter(req, "action"); @@ -740,10 +779,7 @@ static void handle_run(HttpRequest req, HttpResponse res) { return; } } - - LOCK(Run.mutex) - do_runtime(req, res); - END_LOCK; + handle_runtime(req, res); } @@ -1536,29 +1572,47 @@ static void print_buttons(HttpRequest req, HttpResponse res, Service_T s) { /* Start program */ if(s->start) StringBuffer_append(res->outputbuffer, - "
" + "" + "" + "" "" - "
", s->name); + "" + "" + "", s->name, res->token); /* Stop program */ if(s->stop) StringBuffer_append(res->outputbuffer, - "
" + "" + "" + "" "" - "
", s->name); + "" + "" + "", s->name, res->token); /* Restart program */ if(s->start && s->stop) StringBuffer_append(res->outputbuffer, - "
" + "" + "" + "" "" - "
", s->name); + "" + "" + "", s->name, res->token); /* (un)monitor */ StringBuffer_append(res->outputbuffer, - "
" + "" + "" + "" "" - "
", + "" + "" + "", s->name, + res->token, s->monitor ? "unmonitor" : "monitor", s->monitor ? "Disable monitoring" : "Enable monitoring"); + StringBuffer_append(res->outputbuffer, ""); } diff --git a/src/http/processor.c b/src/http/processor.c index 3966106..1d2b2fe 100644 --- a/src/http/processor.c +++ b/src/http/processor.c @@ -171,7 +171,7 @@ void add_Impl(void(*doGet)(HttpRequest, HttpResponse), void(*doPost)(HttpRequest * @param code Error Code to lookup and send * @param msg Optional error message (may be NULL) */ -void send_error(HttpResponse res, int code, const char *msg) { +void send_error(HttpResponse res, int code, const char *msg, ...) { char server[STRLEN]; const char *err= get_status_string(code); @@ -198,7 +198,7 @@ void send_error(HttpResponse res, int code, const char *msg) { * @param name Header key name * @param value Header key value */ -void set_header(HttpResponse res, const char *name, const char *value) { +void set_header(HttpResponse res, const char *name, const char *value, ...) { HttpHeader h= NULL; ASSERT(res); @@ -206,7 +206,10 @@ void set_header(HttpResponse res, const char *name, const char *value) { NEW(h); h->name= Str_dup(name); - h->value= Str_dup(value); + va_list ap; + va_start(ap, value); + h->value = Str_vcat(value, ap); + va_end(ap); if(res->headers) { HttpHeader n, p; for( n= p= res->headers; p; n= p, p= p->next) { @@ -242,7 +245,7 @@ void set_status(HttpResponse res, int code) { * @param mime Mime content type, e.g. text/html */ void set_content_type(HttpResponse res, const char *mime) { - set_header(res, "Content-Type", mime); + set_header(res, "Content-Type", "%s", mime); } @@ -409,6 +412,7 @@ static void do_service(Socket_T s) { if(res && req) { if(is_authenticated(req, res)) { + set_header(res, "Set-Cookie", "securitytoken=%s; Max-Age=600; HttpOnly; SameSite=strict%s", res->token, Run.httpdssl ? "; Secure" : ""); if(IS(req->method, METHOD_GET)) { Impl.doGet(req, res); } else if(IS(req->method, METHOD_POST)) { @@ -534,6 +538,7 @@ static HttpResponse create_HttpResponse(Socket_T S) { res->is_committed= FALSE; res->protocol= SERVER_PROTOCOL; res->status_msg= get_status_string(SC_OK); + Util_getToken(res->token); return res; } @@ -701,6 +706,30 @@ static int is_authenticated(HttpRequest req, HttpResponse res) { return FALSE; } } + if (IS(req->method, METHOD_POST)) { + // Check CSRF double-submit cookie (https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Double_Submit_Cookie) + const char *cookie = get_header(req, "Cookie"); + const char *token = get_parameter(req, "securitytoken"); + if (! cookie) { + LogError("HttpRequest: access denied -- client [%s]: missing CSRF token cookie\n", NVLSTR(socket_get_remote_host(req->S))); + send_error(res, SC_FORBIDDEN, "Invalid CSRF Token"); + return FALSE; + } + if (! token) { + LogError("HttpRequest: access denied -- client [%s]: CSRF token mismatch\n", NVLSTR(socket_get_remote_host(req->S))); + send_error(res, SC_FORBIDDEN, "Invalid CSRF Token"); + return FALSE; + } + if (! Str_startsWith(cookie, "securitytoken=")) { + LogError("HttpRequest: access denied -- client [%s]: no CSRF token in cookie\n", NVLSTR(socket_get_remote_host(req->S))); + send_error(res, SC_FORBIDDEN, "Invalid CSRF Token"); + return FALSE; + } + if (Str_compareConstantTime(cookie + 14, token)) { + LogError("HttpRequest: access denied -- client [%s]: CSRF token mismatch\n", NVLSTR(socket_get_remote_host(req->S))); + send_error(res, SC_FORBIDDEN, "Invalid CSRF Token"); + } + } return TRUE; } diff --git a/src/http/processor.h b/src/http/processor.h index ea0864f..55eedb7 100644 --- a/src/http/processor.h +++ b/src/http/processor.h @@ -88,6 +88,7 @@ typedef struct response { ssl_connection *ssl; const char *status_msg; StringBuffer_T outputbuffer; + MD_T token; } *HttpResponse; @@ -112,8 +113,8 @@ const char *get_status_string(int status_code); void add_Impl(void(*doGet)(HttpRequest, HttpResponse), void(*doPost)(HttpRequest, HttpResponse)); void set_content_type(HttpResponse res, const char *mime); const char *get_header(HttpRequest req, const char *header_name); -void send_error(HttpResponse, int status, const char *message); +void send_error(HttpResponse, int status, const char *message, ...) __attribute__((format (printf, 3, 4))); const char *get_parameter(HttpRequest req, const char *parameter_name); -void set_header(HttpResponse res, const char *name, const char *value); +void set_header(HttpResponse res, const char *name, const char *value, ...) __attribute__((format (printf, 3, 4))); #endif diff --git a/src/util.c b/src/util.c index 1f79dfa..9c990aa 100644 --- a/src/util.c +++ b/src/util.c @@ -129,6 +129,7 @@ #include "process.h" #include "event.h" +#include "system/Time.h" struct ad_user { const char *login; @@ -1323,15 +1324,24 @@ void Util_printServiceList() { } -char *Util_monitId(char *idfile) { - FILE *file = NULL; +char *Util_getToken(MD_T token) { + md5_context_t ctx; + char buf[STRLEN]; + MD_T digest; + snprintf(buf, STRLEN, "%lu%d%lu", (unsigned long)Time_now(), getpid(), random()); + md5_init(&ctx); + md5_append(&ctx, (const md5_byte_t *)buf, STRLEN - 1); + md5_finish(&ctx, (md5_byte_t *)digest); + Util_digest2Bytes((unsigned char *)digest, 16, token); + return token; +} - ASSERT(idfile); +char *Util_monitId(char *idfile) { + ASSERT(idfile); + FILE *file = NULL; if (! file_exist(idfile)) { - md5_context_t ctx; - char buf[STRLEN]; - MD_T digest; + // Generate the unique id mode_t mask = umask(PRIVATEMASK); file = fopen(idfile, "w"); umask(mask); @@ -1339,13 +1349,7 @@ char *Util_monitId(char *idfile) { LogError("%s: Error opening the idfile '%s' -- %s\n", prog, idfile, STRERROR); return NULL; } - /* Generate the unique id */ - snprintf(buf, STRLEN, "%lu%d%lu", (unsigned long)time(NULL), getpid(), random()); - md5_init(&ctx); - md5_append(&ctx, (const md5_byte_t *)buf, (int)strlen(buf)); - md5_finish(&ctx, (md5_byte_t *)digest); - Util_digest2Bytes((unsigned char *)digest, 16, Run.id); - fprintf(file, "%s", Run.id); + fprintf(file, "%s", Util_getToken(Run.id)); LogInfo("%s: generated unique Monit id %s and stored to '%s'\n", prog, Run.id, idfile); } else { if (! file_isFile(idfile)) { diff --git a/src/util.h b/src/util.h index e247bf0..c06fe3f 100644 --- a/src/util.h +++ b/src/util.h @@ -77,6 +77,7 @@ int Util_handle0Escapes(char *buf); * @param digest buffer containing a MD digest * @param mdlen digest length * @param result buffer to write the result to. Must be at least 41 bytes long. + * @return pointer to result buffer */ char *Util_digest2Bytes(unsigned char *digest, int mdlen, MD_T result); @@ -165,6 +166,14 @@ void Util_printService(Service_T s); void Util_printServiceList(); +/** + * Get a random token + * @param token buffer to store the MD digest + * @return pointer to token buffer + */ +char *Util_getToken(MD_T token); + + /** * Open and read the id from the given idfile. If the idfile doesn't exist, * generate new id and store it in the id file. -- 2.17.1 debian/patches/06_contrib.patch0000664000000000000000000000163512241677765013633 0ustar Description: Fix binary path in monit.upstart and monit.service examples. Author: Sergey B Kirpichev Forwarded: not-needed --- contrib/monit.service | 6 +++--- contrib/monit.upstart | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) --- a/contrib/monit.upstart +++ b/contrib/monit.upstart @@ -27,7 +27,7 @@ expect daemon respawn -exec /usr/local/bin/monit -c /etc/monitrc +exec /usr/bin/monit -c /etc/monit/monitrc -pre-stop exec /usr/local/bin/monit -c /etc/monitrc quit +pre-stop exec /usr/bin/monit -c /etc/monit/monitrc quit --- a/contrib/monit.service +++ b/contrib/monit.service @@ -20,9 +20,9 @@ [Service] Type=simple -ExecStart=/usr/local/bin/monit -I -ExecStop=/usr/local/bin/monit quit -ExecReload=/usr/local/bin/monit reload +ExecStart=/usr/bin/monit -I +ExecStop=/usr/bin/monit quit +ExecReload=/usr/bin/monit reload [Install] WantedBy=multi-user.target debian/patches/10_ssl_multiarch.patch0000664000000000000000000000251712241677765015037 0ustar Description: Fix FTBFS for i386 and kfreebsd-i386: add $libdir to SSL library search path. Author: Sergey B Kirpichev Forwarded: yes, accepted --- configure | 3 +-- configure.ac | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) --- a/configure +++ b/configure @@ -14292,8 +14292,7 @@ $maindir/lib64/openssl \ $maindir/lib64/ssl \ $maindir/ssl/lib64 \ - $maindir/lib/${build} \ - $maindir/lib/${build_alias}; do + `eval echo $libdir`; do checkssllibdirdynamic $dir && break 2 done done --- a/configure.ac +++ b/configure.ac @@ -781,8 +781,7 @@ $maindir/lib64/openssl \ $maindir/lib64/ssl \ $maindir/ssl/lib64 \ - $maindir/lib/${build} \ - $maindir/lib/${build_alias}; do + `eval echo $libdir`; do checkssllibdirdynamic $dir && break 2 done done debian/patches/09_pid_in_rundir.patch0000664000000000000000000000260112241677765015015 0ustar Description: ./configure script should check first /run directory for pidfile placement. Author: Sergey B Kirpichev Forwarded: http://lists.nongnu.org/archive/html/monit-dev/2012-12/msg00002.html --- configure | 5 ++++- configure.ac | 6 ++++-- monit.1 | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) --- a/configure +++ b/configure @@ -13542,7 +13542,10 @@ # Find the right directory to put the root-mode PID file in { $as_echo "$as_me:${as_lineno-$LINENO}: checking pid file location" >&5 $as_echo_n "checking pid file location... " >&6; } -if test -d "/var/run" +if test -d "/run" +then + piddir="/run" +elif test -d "/var/run" then piddir="/var/run" elif test -d "/etc" --- a/configure.ac +++ b/configure.ac @@ -404,9 +404,11 @@ # Find the right directory to put the root-mode PID file in AC_MSG_CHECKING([pid file location]) -if test -d "/var/run" +if test -d "/run" then - piddir="/var/run" + piddir="/run" +elif test -d "/var/run" + piddir="/var/run" elif test -d "/etc" then piddir="/etc" --- a/monit.1 +++ b/monit.1 @@ -4025,6 +4025,10 @@ Lock file to help prevent concurrent runs (non-root mode). .PP +\&\fI/run/monit.pid\fR + Lock file to help prevent concurrent runs (root mode, + Linux systems). +.PP \&\fI/var/run/monit.pid\fR Lock file to help prevent concurrent runs (root mode, Linux systems). debian/patches/11_enable_hurd.patch0000664000000000000000000005327212241677765014443 0ustar Description: Support for GNU/Hurd Author: Sergey B Kirpichev Forwarded: http://lists.nongnu.org/archive/html/monit-dev/2012-12/msg00004.html 1. Enable building for GNU/Hurd in configure.ac 2. Fix MAX_PATH use cases, see: http://www.gnu.org/software/hurd/hurd/porting/guidelines.html#PATH_MAX_tt_MAX_PATH_tt_MAXPATHL 3. Implement src/device/sysdep_HURD.c src/process/sysdep_HURD.c --- configure | 6 configure.ac | 5 libmonit/configure | 4 libmonit/configure.ac | 4 libmonit/test/FileTest.c | 10 + src/device/sysdep_HURD.c | 135 +++++++++++++ src/process/sysdep_HURD.c | 456 ++++++++++++++++++++++++++++++++++++++++++++++ src/validate.c | 10 - 8 files changed, 628 insertions(+), 2 deletions(-) --- a/configure +++ b/configure @@ -13664,7 +13664,11 @@ LIBS="$LIBS -lperfstat" $as_echo "#define HAVE_CPU_WAIT 1" >>confdefs.h - +elif test "$architecture" = "GNU" +then + ARCH="HURD" + CFLAGS="$CFLAGS -D _REENTRANT" + LDFLAGS="$LDFLAGS -rdynamic" else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Architecture not supported: ${architecture}" >&5 $as_echo "$as_me: WARNING: Architecture not supported: ${architecture}" >&2;} --- a/configure.ac +++ b/configure.ac @@ -510,6 +510,11 @@ # AIX v. 5.3 LIBS="$LIBS -lperfstat" AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.]) +elif test "$architecture" = "GNU" +then + ARCH="HURD" + CFLAGS="$CFLAGS -D _REENTRANT" + LDFLAGS="$LDFLAGS -rdynamic" else AC_MSG_WARN([Architecture not supported: ${architecture}]) CFLAGS="$CFLAGS -D _REENTRANT" --- a/libmonit/configure +++ b/libmonit/configure @@ -11767,7 +11767,11 @@ CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT" $as_echo "#define AIX 1" >>confdefs.h +elif test "$architecture" = "GNU" +then + CFLAGS="$CFLAGS -D _REENTRANT" +$as_echo "#define HURD 1" >>confdefs.h else as_fn_error $? "Architecture not supported: ${architecture}" "$LINENO" 5 fi --- a/libmonit/configure.ac +++ b/libmonit/configure.ac @@ -169,6 +169,10 @@ then CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT" AC_DEFINE([AIX], 1, [Define to 1 if the system is AIX]) +elif test "$architecture" = "GNU" +then + CFLAGS="$CFLAGS -D _REENTRANT" + AC_DEFINE([HURD], 1, [Define to 1 if the system is Hurd]) else AC_MSG_ERROR([Architecture not supported: ${architecture}]) fi --- a/libmonit/test/FileTest.c +++ b/libmonit/test/FileTest.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "Bootstrap.h" #include "Str.h" @@ -130,14 +131,23 @@ printf("=> Test7: normalize path\n"); { +#ifdef PATH_MAX char s[PATH_MAX]; assert(File_getRealPath("/././tmp/../tmp", s) != NULL); +#else + char *s = realpath("/././tmp/../tmp", NULL); + assert(s != NULL); +#endif #ifdef DARWIN /* On Darwin /tmp is a link to /private/tmp */ assert(Str_isEqual(s, "/private/tmp")); #else assert(Str_isEqual(s, "/tmp")); #endif + +#ifndef PATH_MAX + free(s); +#endif } printf("=> Test7: OK\n\n"); --- a/src/validate.c +++ b/src/validate.c @@ -231,7 +231,11 @@ */ int check_filesystem(Service_T s) { char *p; +#ifdef PATH_MAX char path_buf[PATH_MAX+1]; +#else + char *path_buf = NULL; +#endif Filesystem_T td; struct stat stat_buf; @@ -245,7 +249,8 @@ return FALSE; } if (S_ISLNK(stat_buf.st_mode)) { - if (! realpath(s->path, path_buf)) { + p = realpath(s->path, path_buf); + if (! p) { Event_post(s, Event_Nonexist, STATE_FAILED, s->action_NONEXIST, "filesystem symbolic link error -- %s", STRERROR); return FALSE; } @@ -266,6 +271,9 @@ Event_post(s, Event_Data, STATE_FAILED, s->action_DATA, "unable to read filesystem %s state", p); return FALSE; } +#ifndef PATH_MAX + free(path_buf); +#endif s->inf->priv.filesystem.inode_percent = s->inf->priv.filesystem.f_files > 0 ? (int)((1000.0 * (s->inf->priv.filesystem.f_files - s->inf->priv.filesystem.f_filesfree)) / (float)s->inf->priv.filesystem.f_files) : 0; s->inf->priv.filesystem.space_percent = s->inf->priv.filesystem.f_blocks > 0 ? (int)((1000.0 * (s->inf->priv.filesystem.f_blocks - s->inf->priv.filesystem.f_blocksfree)) / (float)s->inf->priv.filesystem.f_blocks) : 0; s->inf->priv.filesystem.inode_total = s->inf->priv.filesystem.f_files - s->inf->priv.filesystem.f_filesfree; --- /dev/null +++ b/src/device/sysdep_HURD.c @@ -0,0 +1,135 @@ +/* + * Copyright (C) Tildeslash Ltd. All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations + * including the two. + * + * You must obey the GNU Affero General Public License in all respects + * for all of the code used other than OpenSSL. + */ + +/* + + HURD note. + + The code below was copy-pasted from sysdep_LINUX.c + + PATH_MAX fix + + /etc/mtab was changed to /etc/fstab, see: + http://www.gnu.org/software/hurd/community/gsoc/project_ideas/mtab.html + + */ + +/** + * System dependent filesystem methods. + * + * @file + */ + +#include "config.h" + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_ERRNO_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_SYS_STATVFS_H +# include +#endif + +#ifdef HAVE_MNTENT_H +#include +#endif + +#include "monit.h" +#include "device_sysdep.h" + + +/** + * Linux special block device mountpoint method. Filesystem must be mounted. + * In the case of success, mountpoint is stored in filesystem information + * structure for later use. + * + * @param inf Information structure where resulting data will be stored + * @param blockdev Identifies block special device + * @return NULL in the case of failure otherwise mountpoint + */ +char *device_mountpoint_sysdep(Info_T inf, char *blockdev) { + FILE *mntfd; + struct mntent *mnt; + + ASSERT(inf); + ASSERT(blockdev); + + if ((mntfd = setmntent("/etc/fstab", "r")) == NULL) { + LogError("%s: Cannot open /etc/fstab file\n", prog); + return NULL; + } + while ((mnt = getmntent(mntfd)) != NULL) { + char *realpathbuf = realpath(mnt->mnt_fsname, NULL); + /* Try to compare the the filesystem as is, if failed, try to use the symbolic link target */ + if (IS(blockdev, mnt->mnt_fsname) || (realpathbuf && ! strcasecmp(blockdev, realpathbuf))) { + free(realpathbuf); + endmntent(mntfd); + inf->priv.filesystem.mntpath = Str_dup(mnt->mnt_dir); + return inf->priv.filesystem.mntpath; + } + free(realpathbuf); + } + endmntent(mntfd); + LogError("Device %s not found in /etc/fstab\n", blockdev); + return NULL; +} + + +/** + * Linux filesystem usage statistics. In the case of success result is stored in + * given information structure. + * + * @param inf Information structure where resulting data will be stored + * @return TRUE if informations were succesfully read otherwise FALSE + */ +int filesystem_usage_sysdep(Info_T inf) { + struct statvfs usage; + + ASSERT(inf); + + if (statvfs(inf->priv.filesystem.mntpath, &usage) != 0) { + LogError("%s: Error getting usage statistics for filesystem '%s' -- %s\n", prog, inf->priv.filesystem.mntpath, STRERROR); + return FALSE; + } + inf->priv.filesystem.f_bsize = usage.f_bsize; + inf->priv.filesystem.f_blocks = usage.f_blocks; + inf->priv.filesystem.f_blocksfree = usage.f_bavail; + inf->priv.filesystem.f_blocksfreetotal = usage.f_bfree; + inf->priv.filesystem.f_files = usage.f_files; + inf->priv.filesystem.f_filesfree = usage.f_ffree; + inf->priv.filesystem.flags = usage.f_flag; + return TRUE; +} + --- /dev/null +++ b/src/process/sysdep_HURD.c @@ -0,0 +1,456 @@ +/* + * Copyright (C) Tildeslash Ltd. All rights reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations + * including the two. + * + * You must obey the GNU Affero General Public License in all respects + * for all of the code used other than OpenSSL. + */ + +/* + HURD note. + + The code below was copy-pasted from sysdep_LINUX.c + with only hack for HZ #define. +*/ + +#include "config.h" + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_ERRNO_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_FCNTL_H +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef TIME_WITH_SYS_TIME +#include + +#ifdef HAVE_SYS_TIME_H +#include +#endif +#else +#include +#endif + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_ASM_PARAM_H +#include +#endif + +#ifdef HAVE_GLOB_H +#include +#endif + +/* + + On GNU/Hurd procps usually launched with -c (linux-compatibility switch): + http://lists.debian.org/debian-hurd/2012/10/msg00070.html + so, sysconf(_SC_CLK_TCK_) is useless here right now... + + */ + +#ifndef HZ +# ifndef HURD +# define HZ sysconf(_SC_CLK_TCK) +# else +# define HZ 100 +# endif +#endif + +#include "monit.h" +#include "process.h" +#include "process_sysdep.h" + + +/** + * System dependent resource gathering code for Linux. + * + * @file + */ + + +/* ----------------------------------------------------------------- Private */ + + +#define MEMTOTAL "MemTotal:" +#define MEMFREE "MemFree:" +#define MEMBUF "Buffers:" +#define MEMCACHE "Cached:" +#define SWAPTOTAL "SwapTotal:" +#define SWAPFREE "SwapFree:" + +#define NSEC_PER_SEC 1000000000L + +static unsigned long long old_cpu_user = 0; +static unsigned long long old_cpu_syst = 0; +static unsigned long long old_cpu_wait = 0; +static unsigned long long old_cpu_total = 0; +static int page_shift_to_kb = 0; + + +/** + * Get system start time + * @return seconds since unix epoch + */ +static time_t get_starttime() { + char buf[1024]; + double up = 0; + + if (! read_proc_file(buf, 1024, "uptime", -1, NULL)) { + LogError("system statistic error -- cannot get system uptime\n"); + return 0; + } + + if (sscanf(buf, "%lf", &up) != 1) { + LogError("system statistic error -- invalid uptime\n"); + return 0; + } + + return time(NULL) - (time_t)up; +} + + +/* ------------------------------------------------------------------ Public */ + + +int init_process_info_sysdep(void) { + char *ptr; + char buf[1024]; + long page_size; + int page_shift; + + if (! read_proc_file(buf, sizeof(buf), "meminfo", -1, NULL)) + return FALSE; + if (! (ptr = strstr(buf, MEMTOTAL))) { + DEBUG("system statistic error -- cannot get real memory amount\n"); + return FALSE; + } + if (sscanf(ptr+strlen(MEMTOTAL), "%ld", &systeminfo.mem_kbyte_max) != 1) { + DEBUG("system statistic error -- cannot get real memory amount\n"); + return FALSE; + } + + if ((systeminfo.cpus = sysconf(_SC_NPROCESSORS_CONF)) < 0) { + DEBUG("system statistic error -- cannot get cpu count: %s\n", STRERROR); + return FALSE; + } else if (systeminfo.cpus == 0) { + DEBUG("system reports cpu count 0, setting dummy cpu count 1\n"); + systeminfo.cpus = 1; + } + + if ((page_size = sysconf(_SC_PAGESIZE)) <= 0) { + DEBUG("system statistic error -- cannot get page size: %s\n", STRERROR); + return FALSE; + } + + for (page_shift = 0; page_size != 1; page_size >>= 1, page_shift++); + page_shift_to_kb = page_shift - 10; + + return TRUE; +} + + +/** + * Read all processes of the proc files system to initialize + * the process tree (sysdep version... but should work for + * all procfs based unices) + * @param reference reference of ProcessTree + * @return treesize>0 if succeeded otherwise =0. + */ +int initprocesstree_sysdep(ProcessTree_T ** reference) { + int i = 0, j; + int rv, bytes = 0; + int treesize = 0; + int stat_ppid = 0; + char *tmp = NULL; + char procname[STRLEN]; + char buf[1024]; + char stat_item_state; + long stat_item_cutime = 0; + long stat_item_cstime = 0; + long stat_item_rss = 0; + glob_t globbuf; + unsigned long stat_item_utime = 0; + unsigned long stat_item_stime = 0; + unsigned long long stat_item_starttime = 0ULL; + ProcessTree_T *pt = NULL; + + ASSERT(reference); + + /* Find all processes in the /proc directory */ + if ((rv = glob("/proc/[0-9]*", GLOB_ONLYDIR, NULL, &globbuf))) { + LogError("system statistic error -- glob failed: %d (%s)\n", rv, STRERROR); + return FALSE; + } + + treesize = globbuf.gl_pathc; + + pt = CALLOC(sizeof(ProcessTree_T), treesize); + + /* Insert data from /proc directory */ + for (i = 0; i < treesize; i++) { + + pt[i].pid = atoi(globbuf.gl_pathv[i] + strlen("/proc/")); + + if (!read_proc_file(buf, sizeof(buf), "stat", pt[i].pid, NULL)) { + DEBUG("system statistic error -- cannot read /proc/%d/stat\n", pt[i].pid); + continue; + } + + pt[i].time = get_float_time(); + + if (!(tmp = strrchr(buf, ')'))) { + DEBUG("system statistic error -- file /proc/%d/stat parse error\n", pt[i].pid); + continue; + } + *tmp = 0; + if (sscanf(buf, "%*d (%256s", procname) != 1) { + DEBUG("system statistic error -- file /proc/%d/stat process name parse error\n", pt[i].pid); + continue; + } + + tmp += 2; + + /* This implementation is done by using fs/procfs/array.c as a basis + * it is also worth looking into the source of the procps utils */ + if (sscanf(tmp, + "%c %d %*d %*d %*d %*d %*u %*u" + "%*u %*u %*u %lu %lu %ld %ld %*d %*d %*d " + "%*u %llu %*u %ld %*u %*u %*u %*u %*u " + "%*u %*u %*u %*u %*u %*u %*u %*u %*d %*d\n", + &stat_item_state, + &stat_ppid, + &stat_item_utime, + &stat_item_stime, + &stat_item_cutime, + &stat_item_cstime, + &stat_item_starttime, + &stat_item_rss) != 8) { + DEBUG("system statistic error -- file /proc/%d/stat parse error\n", pt[i].pid); + continue; + } + + pt[i].ppid = stat_ppid; + pt[i].starttime = get_starttime() + (time_t)(stat_item_starttime / HZ); + + /* jiffies -> seconds = 1 / HZ + * HZ is defined in "asm/param.h" and it is usually 1/100s but on + * alpha system it is 1/1024s */ + pt[i].cputime = ((float)(stat_item_utime + stat_item_stime) * 10.0) / HZ; + pt[i].cpu_percent = 0; + + /* State is Zombie -> then we are a Zombie ... clear or? (-: */ + if (stat_item_state == 'Z') + pt[i].status_flag |= PROCESS_ZOMBIE; + + if (page_shift_to_kb < 0) + pt[i].mem_kbyte = (stat_item_rss >> abs(page_shift_to_kb)); + else + pt[i].mem_kbyte = (stat_item_rss << abs(page_shift_to_kb)); + + if (! read_proc_file(buf, sizeof(buf), "cmdline", pt[i].pid, &bytes)) { + DEBUG("system statistic error -- cannot read /proc/%d/cmdline\n", pt[i].pid); + continue; + } + /* The cmdline file contains argv elements/strings terminated separated by '\0' => join the string: */ + for (j = 0; j < (bytes - 1); j++) + if (buf[j] == 0) + buf[j] = ' '; + pt[i].cmdline = *buf ? Str_dup(buf) : Str_dup(procname); + } + + *reference = pt; + globfree(&globbuf); + + return treesize; +} + + +/** + * This routine returns 'nelem' double precision floats containing + * the load averages in 'loadv'; at most 3 values will be returned. + * @param loadv destination of the load averages + * @param nelem number of averages + * @return: 0 if successful, -1 if failed (and all load averages are 0). + */ +int getloadavg_sysdep(double *loadv, int nelem) { +#ifdef HAVE_GETLOADAVG + return getloadavg(loadv, nelem); +#else + char buf[STRLEN]; + double load[3]; + if (! read_proc_file(buf, sizeof(buf), "loadavg", -1, NULL)) + return -1; + if (sscanf(buf, "%lf %lf %lf", &load[0], &load[1], &load[2]) != 3) { + DEBUG("system statistic error -- cannot get load average\n"); + return -1; + } + for (int i = 0; i < nelem; i++) + loadv[i] = load[i]; + return 0; +#endif +} + + +/** + * This routine returns kbyte of real memory in use. + * @return: TRUE if successful, FALSE if failed + */ +int used_system_memory_sysdep(SystemInfo_T *si) { + char *ptr; + char buf[1024]; + unsigned long mem_free = 0UL; + unsigned long buffers = 0UL; + unsigned long cached = 0UL; + unsigned long swap_total = 0UL; + unsigned long swap_free = 0UL; + + if (! read_proc_file(buf, 1024, "meminfo", -1, NULL)) { + LogError("system statistic error -- cannot get real memory free amount\n"); + goto error; + } + + /* Memory */ + if (! (ptr = strstr(buf, MEMFREE)) || sscanf(ptr + strlen(MEMFREE), "%ld", &mem_free) != 1) { + LogError("system statistic error -- cannot get real memory free amount\n"); + goto error; + } + if (! (ptr = strstr(buf, MEMBUF)) || sscanf(ptr + strlen(MEMBUF), "%ld", &buffers) != 1) + DEBUG("system statistic error -- cannot get real memory buffers amount\n"); + if (! (ptr = strstr(buf, MEMCACHE)) || sscanf(ptr + strlen(MEMCACHE), "%ld", &cached) != 1) + DEBUG("system statistic error -- cannot get real memory cache amount\n"); + si->total_mem_kbyte = systeminfo.mem_kbyte_max - mem_free - buffers - cached; + + /* Swap */ + if (! (ptr = strstr(buf, SWAPTOTAL)) || sscanf(ptr + strlen(SWAPTOTAL), "%ld", &swap_total) != 1) { + LogError("system statistic error -- cannot get swap total amount\n"); + goto error; + } + if (! (ptr = strstr(buf, SWAPFREE)) || sscanf(ptr + strlen(SWAPFREE), "%ld", &swap_free) != 1) { + LogError("system statistic error -- cannot get swap free amount\n"); + goto error; + } + si->swap_kbyte_max = swap_total; + si->total_swap_kbyte = swap_total - swap_free; + + return TRUE; + + error: + si->total_mem_kbyte = 0; + si->swap_kbyte_max = 0; + return FALSE; +} + + +/** + * This routine returns system/user CPU time in use. + * @return: TRUE if successful, FALSE if failed (or not available) + */ +int used_system_cpu_sysdep(SystemInfo_T *si) { + int rv; + unsigned long long cpu_total; + unsigned long long cpu_user; + unsigned long long cpu_nice; + unsigned long long cpu_syst; + unsigned long long cpu_idle; + unsigned long long cpu_wait; + unsigned long long cpu_irq; + unsigned long long cpu_softirq; + char buf[1024]; + + if (!read_proc_file(buf, 1024, "stat", -1, NULL)) { + LogError("system statistic error -- cannot read /proc/stat\n"); + goto error; + } + + rv = sscanf(buf, "cpu %llu %llu %llu %llu %llu %llu %llu", + &cpu_user, + &cpu_nice, + &cpu_syst, + &cpu_idle, + &cpu_wait, + &cpu_irq, + &cpu_softirq); + if (rv < 4) { + LogError("system statistic error -- cannot read cpu usage\n"); + goto error; + } else if (rv == 4) { + /* linux 2.4.x doesn't support these values */ + cpu_wait = 0; + cpu_irq = 0; + cpu_softirq = 0; + } + + cpu_total = cpu_user + cpu_nice + cpu_syst + cpu_idle + cpu_wait + cpu_irq + cpu_softirq; + cpu_user = cpu_user + cpu_nice; + + if (old_cpu_total == 0) { + si->total_cpu_user_percent = -10; + si->total_cpu_syst_percent = -10; + si->total_cpu_wait_percent = -10; + } else { + unsigned long long delta = cpu_total - old_cpu_total; + + si->total_cpu_user_percent = (int)(1000 * (double)(cpu_user - old_cpu_user) / delta); + si->total_cpu_syst_percent = (int)(1000 * (double)(cpu_syst - old_cpu_syst) / delta); + si->total_cpu_wait_percent = (int)(1000 * (double)(cpu_wait - old_cpu_wait) / delta); + } + + old_cpu_user = cpu_user; + old_cpu_syst = cpu_syst; + old_cpu_wait = cpu_wait; + old_cpu_total = cpu_total; + return TRUE; + + error: + si->total_cpu_user_percent = 0; + si->total_cpu_syst_percent = 0; + si->total_cpu_wait_percent = 0; + return FALSE; +} + + debian/patches/series0000664000000000000000000000017613332653002012035 0ustar 05_monitrc.patch 06_contrib.patch 09_pid_in_rundir.patch #10_ssl_multiarch.patch 11_enable_hurd.patch CVE-2016-7067.patch debian/patches/05_monitrc.patch0000664000000000000000000000675712241677765013657 0ustar Description: setup default minimal monitrc file to allow monit daemon start after install. Bug-Debian: http://bugs.debian.org/583132 Author: Sergey B Kirpichev Forwarded: not-needed --- monitrc | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) --- a/monitrc +++ b/monitrc @@ -16,7 +16,7 @@ ## ## Start Monit in the background (run as a daemon): # -set daemon 60 # check services at 1-minute intervals + set daemon 120 # check services at 2-minute intervals # with start delay 240 # optional: delay the first check by 4-minutes (by # # default Monit check immediately after Monit start) # @@ -26,6 +26,7 @@ ## a standalone log file instead, specify the full path to the log file # # set logfile syslog facility log_daemon + set logfile /var/log/monit.log # # ## Set the location of the Monit id file which stores the unique id for the @@ -33,6 +34,7 @@ ## default the file is placed in $HOME/.monit.id. # # set idfile /var/.monit.id + set idfile /var/lib/monit/id # ## Set the location of the Monit state file which saves monitoring states ## on each cycle. By default the file is placed in $HOME/.monit.state. If @@ -40,7 +42,7 @@ ## the monitoring state across reboots. If it is on temporary filesystem, the ## state will be lost on reboot which may be convenient in some situations. # -# set statefile /var/.monit.state + set statefile /var/lib/monit/state # ## Set the list of mail servers for alert delivery. Multiple servers may be ## specified using a comma separator. If the first mail server fails, Monit @@ -59,9 +61,9 @@ ## size using the SLOTS option (if omitted, the queue is limited by space ## available in the back end filesystem). # -# set eventqueue -# basedir /var/monit # set the base directory where events will be stored -# slots 100 # optionally limit the queue size + set eventqueue + basedir /var/lib/monit/events # set the base directory where events will be stored + slots 100 # optionally limit the queue size # # ## Send status and events to M/Monit (for more informations about M/Monit @@ -113,13 +115,13 @@ ## services monitored and manage services from a web interface. See the ## Monit Wiki if you want to enable SSL for the web server. # -set httpd port 2812 and - use address localhost # only accept connection from localhost - allow localhost # allow localhost to connect to the server and - allow admin:monit # require user 'admin' with password 'monit' - allow @monit # allow users of group 'monit' to connect (rw) - allow @users readonly # allow users of group 'users' to connect readonly - +# set httpd port 2812 and +# use address localhost # only accept connection from localhost +# allow localhost # allow localhost to connect to the server and +# allow admin:monit # require user 'admin' with password 'monit' +# allow @monit # allow users of group 'monit' to connect (rw) +# allow @users readonly # allow users of group 'users' to connect readonly +# ############################################################################### ## Services ############################################################################### @@ -242,5 +244,5 @@ ## It is possible to include additional configuration parts from other files or ## directories. # -# include /etc/monit.d/* + include /etc/monit/conf.d/* # debian/copyright0000664000000000000000000010753312241677765011155 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Monit Upstream-Contact: http://mmonit.com/monit/ Source: http://mmonit.com/monit/download/ Files: * Copyright: Tildeslash Ltd. All rights reserved. License: AGPL-3+ with OpenSSL exception GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 . Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. . Preamble . The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. . The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. . When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. . Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. . A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. . The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. . An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. . The precise terms and conditions for copying, distribution and modification follow. . TERMS AND CONDITIONS . 0. Definitions. . "This License" refers to version 3 of the GNU Affero General Public License. . "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. . "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. . To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. . A "covered work" means either the unmodified Program or a work based on the Program. . To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. . To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. . An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. . 1. Source Code. . The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. . A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. . The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. . The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. . The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. . The Corresponding Source for a work in source code form is that same work. . 2. Basic Permissions. . All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. . You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. . Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. . 3. Protecting Users' Legal Rights From Anti-Circumvention Law. . No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. . When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. . 4. Conveying Verbatim Copies. . You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. . You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. . 5. Conveying Modified Source Versions. . You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: . a) The work must carry prominent notices stating that you modified it, and giving a relevant date. . b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". . c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. . d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. . A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. . 6. Conveying Non-Source Forms. . You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: . a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. . b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. . c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. . d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. . e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. . A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. . A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. . "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. . If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). . The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. . Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. . 7. Additional Terms. . "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. . When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. . Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: . a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or . b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or . c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or . d) Limiting the use for publicity purposes of names of licensors or authors of the material; or . e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or . f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. . All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. . If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. . Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. . 8. Termination. . You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). . However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. . Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. . Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. . 9. Acceptance Not Required for Having Copies. . You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. . 10. Automatic Licensing of Downstream Recipients. . Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. . An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. . You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. . 11. Patents. . A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". . A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. . Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. . In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. . If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. . If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. . A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. . Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. . 12. No Surrender of Others' Freedom. . If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. . 13. Remote Network Interaction; Use with the GNU General Public License. . Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. . Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. . 14. Revised Versions of this License. . The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. . Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. . If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. . Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. . 15. Disclaimer of Warranty. . THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. . 16. Limitation of Liability. . IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. . 17. Interpretation of Sections 15 and 16. . If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. . END OF TERMS AND CONDITIONS . How to Apply These Terms to Your New Programs . If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. . To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. . Copyright (C) . This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. . You should have received a copy of the GNU Affero General Public License along with this program. If not, see . . Also add information on how to contact you by electronic and paper mail. . If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. . You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . . License Exception . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. . You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. Files: debian/* Copyright: 2002-2004, Fredrik Steen 2005-2010, Stefan Alfredsson 2011-2012, Sergey B Kirpichev License: GPL-3+ On Debian GNU/Linux systems, the complete text of the GNU General Public License (GPL) version 3 can be found at /usr/share/common-licenses/GPL-3. debian/source/0000775000000000000000000000000012241677765010511 5ustar debian/source/format0000664000000000000000000000001412241677765011717 0ustar 3.0 (quilt) debian/changelog0000664000000000000000000005560713333326523011062 0ustar monit (1:5.6-2ubuntu0.1) trusty-security; urgency=medium * SECURITY UPDATE: CSRF vulnerability - debian/patches/CVE-2016-7067.patch: The following http services are no longer implemented for GET method and require CSRF protected POST: _doaction, _viewlog - CVE-2016-7067 -- Eduardo Barretto Fri, 10 Aug 2018 12:20:45 -0300 monit (1:5.6-2) unstable; urgency=low * disable ssl patch for now & reformat patches/series * Refresh 06_contrib.patch * Document apt's configuration to enable monit's restart while upgrade (Closes: #726658). Thanks to Michael Vogt. * Fix lintian error: vcs-field-not-canonical -- Sergey B Kirpichev Tue, 08 Oct 2013 15:47:02 +0400 monit (1:5.6-1) unstable; urgency=low * Imported Upstream version 5.6 -- Sergey B Kirpichev Thu, 05 Sep 2013 17:03:07 +0400 monit (1:5.5.1-1) unstable; urgency=low * Imported Upstream version 5.5.1 * Refresh patches, drop unused -- Sergey B Kirpichev Sun, 16 Jun 2013 13:54:38 +0400 monit (1:5.5-6) unstable; urgency=low * Include stdlib.h to fix blhc E: pointer-trouble-at-implicit in FileTest.c * Drop DMUA, fix lintian warning * Bump up Standards-Version (to 3.9.4) * Use autotools-dev helpers to update config.guess/config.sub (fix lintian warning: outdated-autotools-helper-file) -- Sergey B Kirpichev Thu, 27 Dec 2012 14:11:12 +0400 monit (1:5.5-5) unstable; urgency=low * Fix FTBFS on ia64, a second attempt * Revert back -c option in monit.init * Implement sysdep_HURD.c * Correct description for patch 11 * Add missing DEP3 "Forwarded" headers -- Sergey B Kirpichev Thu, 13 Dec 2012 17:01:58 +0400 monit (1:5.5-4) unstable; urgency=low * Fix (I think) FTBFS on ia64 due to installed automake * Update patch 11: fix PATH_MAX issues for Hurd -- Sergey B Kirpichev Wed, 12 Dec 2012 22:52:55 +0400 monit (1:5.5-3) unstable; urgency=low * Fix FTBFS for i386 and kfreebsd-i386: patch 10 * Enable building on Hurd: patch 11 -- Sergey B Kirpichev Tue, 11 Dec 2012 16:06:27 +0400 monit (1:5.5-2) unstable; urgency=low * Show error while doing an attempt to stop daemon as non-root user (LP: #877667) * Use /run as pidfile location, patch 09 was added * Drop support for "startup" option and /etc/monit/monit_delay * Update patch 08 from upstream * Drop monit_check_config (monitrc now non-empty by default) * Cleanup restart target in monit.init * Drop -c $CONFIG argument from monit options in monit.init * Drop multiarch workarround for libssl in debian/rules -- Sergey B Kirpichev Sun, 09 Dec 2012 17:42:20 +0400 monit (1:5.5-1) unstable; urgency=low * Bunch of config snippets (debian/monitrc.d/*) * Imported Upstream version 5.5 * Unfuzz patches * Add Forwarded: dep3 headers -- Sergey B Kirpichev Mon, 10 Sep 2012 14:20:52 +0400 monit (1:5.4-2) unstable; urgency=low * Chande dh compat to 9, enable hardening support * Provide debian/monit.bug-script (Closes: #654450) * Remove README.Debian from monit.docs (this file is automatically installed if present) * Install example config of systemd's service * Refresh 07_spelling.patch * Install optional configuration snippets to /etc/monit/monitrc.d/ -- Sergey B Kirpichev Fri, 01 Jun 2012 14:49:58 +0400 monit (1:5.4-1) unstable; urgency=low * Reformat debian/copyright according to accepted DEP5 spec * Bump up Standards-Version to 3.9.3 (no changes) * Imported Upstream version 5.4 -- Sergey B Kirpichev Sun, 13 May 2012 19:34:12 +0400 monit (1:5.3.2-2) unstable; urgency=low * Drop TODO.Debian * Fix bashism in monit.init (Closes: #654449) * Removed example.monitrc * Cleanup of dirs file -- Sergey B Kirpichev Thu, 05 Jan 2012 16:04:39 +0400 monit (1:5.3.2-1) unstable; urgency=low * Imported Upstream version 5.3.2 (Closes: #652715) -- Sergey B Kirpichev Wed, 21 Dec 2011 03:20:22 +0400 monit (1:5.3.1-3) unstable; urgency=low * Revert "Drop --with-ssl-lib-dir switch from ./configure arguments" - Couple arch's (hurd-i386, i386, kfreebsd-i386) still needs this workarround to prevent FTBS. -- Sergey B Kirpichev Tue, 20 Dec 2011 13:14:13 +0400 monit (1:5.3.1-2) unstable; urgency=low * Install monit binary to /usr/bin instead of /usr/sbin * Don't install contrib/packages/* in docs * Added LSB Description to init-script * Removed override_dh_auto_install * Install upstart conf in doc/package/examples * Apply 07_spelling.patch * Added override for lintian spelling-error-in-binary usr/bin/monit * Droped --with-ssl-lib-dir switch from ./configure arguments * Added missing legacy debian/* copyrights * Apply 08_hide_low_priority_info_from_stderr.patch: Hide from stderr output from LogInfo and LogDebug. * Removed the state and id files on purge * Cleanup for init script * Introduce NEWS.Debian file, document binary path transition * Removed deprecated stuff about /etc/monit/monit_delay from README.Debian * Fixed upstream license information in debian/copyright -- Sergey B Kirpichev Tue, 20 Dec 2011 00:50:07 +0400 monit (1:5.3.1-1) unstable; urgency=low * Imported Upstream version 5.3.1 * Drop debian/patches/06_kfreebsd.patch, debian/patches/07_bootstrap.patch (and autogenerated debian/patches/99_autoreconf.patch), applied upstream -- Sergey B Kirpichev Sat, 29 Oct 2011 01:22:47 +0400 monit (1:5.3-3) unstable; urgency=low * Added deps for libkvm-dev on kFreeBSD * 06_kfreebsd.patch: fix FTBFS for kFreeBSD (Closes: #643019) * 07_bootstrap.patch: Add -c option for libtoolize in bootstrap scripts * 99_autoreconf.patch: Run ./bootstrap -- Sergey B Kirpichev Thu, 29 Sep 2011 16:45:26 +0400 monit (1:5.3-2) unstable; urgency=low * Set --sysconfdir to /etc/monit and drop patches for relocation of default /etc/monitrc path to /etc/monit/monitrc * Properly use $(DEB_HOST_MULTIARCH) for --with-ssl-lib-dir (fix for FTBFS in a couple of arch's) -- Sergey B Kirpichev Wed, 28 Sep 2011 20:57:23 +0400 monit (1:5.3-1) unstable; urgency=low * Bump up Standards-Version (to 3.9.2) * Add minsize clause for logrotate script * Imported Upstream version 5.3 * Fix patches for 5.3 version and drop 06_Fix_FTBFS_after_ssv2_removal.patch * Exclude obsoleted docs (README.SSL, etc) and include doc/PLATFORMS * Drop obsoleted automake1.9 deps * Drop deps for byacc & flex (unneeded for monit 5.3) * Set --with-ssl-lib-dir as a workarround * Fix lintian warning: obsoleted field Format-Specification in debian/copyright -- Sergey B Kirpichev Thu, 15 Sep 2011 03:03:30 +0400 monit (1:5.2.5-2) unstable; urgency=low * Fix FTBFS (undefined reference to `SSLv2_client_method') after ssv2 removal (Closes: #621047). -- Sergey B Kirpichev Wed, 06 Apr 2011 15:08:19 +0400 monit (1:5.2.5-1) unstable; urgency=low * Imported Upstream version 5.2.5 (Closes: #617259) * Removed patches, applied by upstream * Unfuzz patches -- Sergey B Kirpichev Wed, 06 Apr 2011 03:19:27 +0400 monit (1:5.2.4-4) unstable; urgency=low * Use tiny debian/rules, bump up debhelper compat level * Removed CHANGES.txt from monit.docs (this is a changelog already) * Override init.d start/stop defaults * Cleanup debian/monit.dirs * Remove /var/log/monit.log in postrm script * Add references to BTS in TODO.Debian * Override dh_auto_configure - added argument --bindir=/usr/sbin * Don't set initail delay for monit startup * Quote dh_installinit params * Set default $HOST to FQDN hostname (Closes: #613768) * Add monit alias to /etc/aliases * Add Forwarded: headers in debian/patches/ -- Sergey B Kirpichev Mon, 21 Mar 2011 15:50:39 +0300 monit (1:5.2.4-3) unstable; urgency=low * Refresh patches with --diffstat * Upstream fix for SMTP protocol (original test issues both EHLO and HELO, regardless of server reply). Closes: #614984. * Use @include common-* stanzas for monit PAM configuration (Thanks to Paulo Ricardo Bruck) -- Sergey B Kirpichev Wed, 16 Mar 2011 23:55:26 +0300 monit (1:5.2.4-2) unstable; urgency=low * Drop Build-Depends on quilt (not needed due to package format) * Do set -e in postinst script explicitly (not in sha-bang) to make lintian happy * Cleanup description (thanks to lintian: description-synopsis-starts- with-an-article) * Update copyright year for upstream -- Sergey B Kirpichev Fri, 04 Mar 2011 16:44:28 +0300 monit (1:5.2.4-1) unstable; urgency=low * Create & rotate /var/log/monit.log with root:adm owner and group (Closes: #613764) * Adopt DEP5 (Machine-readable debian/copyright format) * Suggest MTA (exim4, postfix, etc) * Cleanup patch 05_monitrc.patch: disable "set alert root@localhost" and "set mailserver localhost" * Cleanup logrotate script * Add eventqueue basedir * New upstream release (5.2.4). Closes: #613770. * Unfuzz 02_monit.1_debian_path.patch * Added "DM-Upload-Allowed: yes" control field -- Sergey B Kirpichev Fri, 04 Mar 2011 14:21:01 +0300 monit (1:5.2.3-2) unstable; urgency=low [ Sergey B Kirpichev ] * Fix monit_not_configured () message text (see Ubuntu bug #666268) * Add Vcs-* fields to debian/control * Fix initscript dependencies to start after and stop before other services (Closes: #606731, thanks to Joey Parrish ) * Add patch 04_LOGMASK.patch: set strict file mode creation mask for logfile * Allow monit to start by default, provide minimal monitrc file (Closes: #583132, thanks to Thomas Clavier ) * Use logging to file, instead of syslog by default, add logrotate script * Handle MONIT_OPTS configuration variable in initscript to pass command line arguments at startup, eg. -d 180 (Closes: #589895) * Cleanup /etc/default/monit file (Closes: #612767) * Rewrote initscript using lsb-helpers, add depends on lsb-base [ Jeremiah C. Foster ] * Minor typo correction for debian/copyright [ Sergey B Kirpichev ] * Create TODO.Debian file, add item * Fix some spelling errors (added patch 06) * Merge monitrc patches * Drop patch/unpatch logic from debian/rules -- Sergey B Kirpichev Mon, 14 Feb 2011 16:59:02 +0300 monit (1:5.2.3-1) unstable; urgency=low * New maintainer (Closes: #593941) * change patch system: dpatch -> quilt * Switch to dpkg-source 3.0 (quilt) format * New upstream release (5.2.3) * Include ${misc:Depends} in depends section of debian/control * Bump up Standards-Version (to 3.9.1) * Add lintian override for permissions of etc/monit/monitrc * Bump up debhelper compatibility version (to 5) * Declare versioned dependency on debhelper * move direct source tree changes in monitrc to 03_monitrc.patch * add Homepage header to debian/control * minor fix for debian/copyright: refer to new maintainer, new homepage and GPL-3 -- Sergey B Kirpichev Mon, 17 Jan 2011 16:12:19 +0300 monit (1:5.2.1-1) unstable; urgency=low * New upstream release -- Stefan Alfredsson Sat, 25 Sep 2010 22:03:04 +0200 monit (1:5.2-1) unstable; urgency=low * New upstream release -- Stefan Alfredsson Thu, 23 Sep 2010 22:47:48 +0200 monit (1:5.1.1-1) unstable; urgency=low * New upstream release (Closes: #573777) * Added configurable statefile in /etc/default/monit (Closes: #569616) * Verbose info when syntax errors are detected at start (Closes: #427922) * Sample configuration adjustments (Closes: #427924) * Removed pam_securityserver in pam config (Closes: #574120) * An include-directory is supplied (Closes: #249933) -- Stefan Alfredsson Fri, 19 Mar 2010 22:40:11 +0100 monit (1:5.1-1) unstable; urgency=low * New upstream release -- Stefan Alfredsson Sun, 21 Feb 2010 11:06:34 +0100 monit (1:5.0.3-3) unstable; urgency=low * Daemon poll interval moved to rc-file instead of defaults (Closes: #541425) * Package upgraded (Closes: 453248) * Configuration snippets are included from /etc/monit/conf.d/* (Closes: #296479) -- Stefan Alfredsson Tue, 18 Aug 2009 22:49:13 +0200 monit (1:5.0.3-2) unstable; urgency=low * inet6 and getaddr() fix (Thanks to Michael Stapelberg!) (Closes: #541139) -- Stefan Alfredsson Wed, 12 Aug 2009 07:46:19 +0200 monit (1:5.0.3-1) unstable; urgency=low * New upstream release * CPU-count fix in upstream release (Closes: #517816) * Full eventqueue bug fixed in upstream release (Closes: #514709) * Non-md5sum password bug fix by upstream (Closes: #474009) * Uses unique message id's (Closes: #498346) * Typo in "monit status" fixed (Closes: #506923) * New format of debian watch file (Closes: #529128) * Enabled PAM functionality -- Stefan Alfredsson Sat, 08 Aug 2009 10:21:37 +0200 monit (1:4.10.1-4) unstable; urgency=low * Patch for config file location was not applied (Closes: #479357) (thanks to DVZ-Team ) * The relocation patch created an unneccessary "file.c.orig", this was removed from the patch. -- Stefan Alfredsson Sun, 24 Aug 2008 23:44:46 +0000 monit (1:4.10.1-3) unstable; urgency=low * SSL enabled as upstream provided GPL/OpenSSL license exception (Closes: #466821) -- Stefan Alfredsson Fri, 22 Feb 2008 07:25:01 +0100 monit (1:4.10.1-2) unstable; urgency=low * Added build-dependency on dpatch (Closes: #463469) -- Stefan Alfredsson Thu, 31 Jan 2008 22:22:59 +0100 monit (1:4.10.1-1) unstable; urgency=low * New upstream release (Closes: #453248) * Upstream has fixed pid testing since v4.8 (Closes: #364844) * Event queue segfault problem patched by upstream (Closes: #399027) * HTTP segfault patched by upstream (Closes: #433164) * Added LSB formatted dependency to init-script (Closes: #460299) * Removed bashism echo -e in init-script (Closes: #411886) -- Stefan Alfredsson Tue, 29 Jan 2008 21:36:33 +0100 monit (1:4.9-1) unstable; urgency=low * New upstream release * Updated init-script to use printf instead of echo -e (Closes: #411886) * Removed LFS patch because its integrated by upstream -- Stefan Alfredsson Wed, 25 Jul 2007 00:05:35 +0200 monit (1:4.8.1-2.1) unstable; urgency=medium * Non-maintainer upload. * monit-lfs.patch: Add LFS support; patch adapted from upstream CVS by Michael Mende. (Closes: #395164) * Build-depend on automake and set some magical cdbs option to enable re-automaking, as monit-lfs.patch touches configure.ac. -- Steinar H. Gunderson Mon, 13 Nov 2006 13:38:47 +0100 monit (1:4.8.1-2) unstable; urgency=low * Wait for daemon to stop before restart (Closes: #368700) -- Stefan Alfredsson Wed, 24 May 2006 14:47:01 +0200 monit (1:4.8.1-1) unstable; urgency=low * New upstream release * AMD64 bugfix integrated in upstream (Closes: #367341) -- however there may be additional issues with starting scripts. Please open a new bug if this is the case. -- Stefan Alfredsson Wed, 17 May 2006 23:50:46 +0200 monit (1:4.8-2) unstable; urgency=low * Applied patch for AMD64 bug (hopefully solving Bug#367341) -- Stefan Alfredsson Tue, 16 May 2006 07:04:58 +0200 monit (1:4.8-1) unstable; urgency=low * New upstream release (Closes: #366860) * Priority logging implemented by upstream (Closes: #353758) -- Stefan Alfredsson Fri, 12 May 2006 07:30:58 +0200 monit (1:4.7-1) unstable; urgency=low * New upstream release * Applied NTP leap indicator patch (Closes: #352065) - should be removed for next upstream release as they've embraced it. -- Stefan Alfredsson Mon, 27 Feb 2006 23:35:16 +0100 monit (1:4.6-1) unstable; urgency=low * New upstream release (Closes: #306259, #308369, #315638) -- Stefan Alfredsson Fri, 11 Nov 2005 21:04:32 +0100 monit (1:4.5-1) unstable; urgency=low * New upstream release (Closes: #303100) * File 'files.c' renamed, causing a patch to fail. Patch patched to use the new name 'file.c' -- Stefan Alfredsson Tue, 5 Apr 2005 16:38:16 +0200 monit (1:4.4-4) unstable; urgency=low * Updated to new standards-version -- Stefan Alfredsson Sun, 27 Mar 2005 23:30:01 +0200 monit (1:4.4-3) unstable; urgency=low * Handles race condition for slow-to-start processes, see README.Debian (Contributed by David Greaves ) -- Stefan Alfredsson Mon, 14 Mar 2005 18:24:22 +0100 monit (1:4.4-2) unstable; urgency=low * Moved from priority extra to optional * Removed coreutils dependency since its part of base and required (and is thus installed). * Removed stat dependency alltogether, sets correct perms instead * init-script now references $CONFIG instead of /etc/monit/monitrc in various places. * Now configures with --without-accurate-mem-calcs (Closes: #298045) -- Stefan Alfredsson Tue, 1 Mar 2005 12:23:36 +0100 monit (1:4.4-1) unstable; urgency=low * New maintainer (Stefan Alfredsson, adoption agreed on IRC channel #kuf) * New upstream release * AMD64 compiles are fixed by upstream (please verify) (Closes: #287659) * Added dependency on 'coreutils' because of stat-usage (Closes: #247226) * Syntax checking from initscript, thanks to admin@cs.montana.edu (Closes: #258148) * Fixed spelling (Closes: #268530, #277252) * buildd logs indicate good arm/ppc/s390 builds (Closes: #169439) -- Stefan Alfredsson Mon, 28 Feb 2005 12:26:38 +0100 monit (1:4.2.1-2) unstable; urgency=low * Changed defunct location of state file to /var/lib/monit (Closes:#231140) * Removed old example monitrc * Added examples from upstream * Added README.SSL * Added UPGRADE.txt * Added doc/monit.html manual * Changed /etc/monitrc references to /etc/monit/monitrc (Closes:#244646) -- Fredrik Steen Tue, 10 Aug 2004 12:39:29 +0200 monit (1:4.2.1-1) unstable; urgency=high * New upstream release with security fix (Closes:#242515) -- Fredrik Steen Tue, 13 Apr 2004 15:34:54 +0200 monit (1:4.1.1-1) unstable; urgency=low * New upstream release Closes:#222303 * Security update: There exists security vulnerabilites in the 4.0 version of monit HTTP interface. This release fixes this. * Some changes to init.d script to not exit with 1 when permissions on monitrc is wrong. (breaks when removing the package) * Fixed installation permissions on configuration file. Closes:#173348 * Added CHECK_INTERVAL configurable variable to /etc/default/monit * This upload makes it easier to backport to woody because of change of "stat" syntax. Closes:#198130 -- Fredrik Steen Wed, 26 Nov 2003 13:12:08 +0100 monit (1:4.0-2) experimental; urgency=low * Updated monit package to use cdbs -- Fredrik Steen Tue, 21 Oct 2003 13:34:31 +0200 monit (1:4.0-1) experimental; urgency=low * New upstream release * Patched original source for new location of monitrc (in /etc/monit/monitrc) * Added stat line in init.d script making it easier for backports of monit to woody. (Closes:#198130) * Now compiled with SSL-support (LICENSE now permits linking with OpenSSL) * The startup is now denied via /etc/default/monit configuration. -- Fredrik Steen Wed, 24 Sep 2003 15:46:31 +0200 monit (1:3.2-1) unstable; urgency=low * New upstream release * Now changing permission on configfile when installing/configuring - (Closes:#173348) * This relase has a new license which grant linking with OpenSSL. - Message-ID: -- Fredrik Steen Tue, 22 Apr 2003 10:14:19 +0200 monit (1:3.1-1) unstable; urgency=low * New upstream release * Disabled beta SSL support. (Need to check the legal stuff) -- Fredrik Steen Wed, 15 Jan 2003 10:26:12 +0100 monit (1:3.0-2) unstable; urgency=low * Check implemented in /etc/init.d/monit for checking permissions on configfile /etc/monit/monitrc, Upstream will probably make all error messages go to syslog and this is not needed anymore. Unfortunately the startup messages of monit is too chatty until that is fixed upstream the need to redirect stderr,stdout to devnull from init-script is still needed. (Closes:#173348) * /etc/init.d/monit is now a conffile. * No need for conffiles file when using debhelper 3 or greater. -- Fredrik Steen Tue, 17 Dec 2002 13:09:02 +0100 monit (1:3.0-1) unstable; urgency=low * New upstream release (Closes:#166058) * Changed permission on configfile /etc/monit/monitrc -- Fredrik Steen Tue, 29 Oct 2002 16:09:44 +0100 monit (1:2.5.1-3) unstable; urgency=low * Fixes the old bug wich made monit start/stop to early/late (#158388) -- Fredrik Steen Wed, 16 Oct 2002 12:14:21 +0200 monit (1:2.5.1-2) unstable; urgency=low * Fixed dumb package bug changed clean target config to do a distclean instead of clean Closes:#159295 * Changed example monitrc -- Fredrik Steen Mon, 2 Sep 2002 15:51:05 +0200 monit (1:2.5.1-1) unstable; urgency=low * New upstram release * Upstream now do correct rfc 821 envelopes Closes:#153520 * Controlfiles updated so monit will start late and stop early in the init-process Closes:#158388, thanks to Mark Ferlatte. * Updated Standards-Version. * Fixed the "restart" target in monit init.d script. -- Fredrik Steen Tue, 27 Aug 2002 18:59:23 +0200 monit (2.5-2) unstable; urgency=low * Spelling error in init-script fixed. -- Fredrik Steen Fri, 16 Aug 2002 15:05:40 +0200 monit (2.5-1) unstable; urgency=low * New upstream release * TODO removed from upstream * Spelling -- Fredrik Steen Thu, 18 Jul 2002 18:05:15 +0200 monit (2.4-1) unstable; urgency=low * New upstream release * FAQ changed to FAQ.txt upstream * Upload to Debian Closes:#147642 -- Fredrik Steen Wed, 29 May 2002 09:04:50 +0200 monit (2.3-2) unstable; urgency=low * fixed /etc/init.d/monit * Added example monitrc * Addedd missing build-dep on flex and byacc -- Fredrik Steen Tue, 21 May 2002 13:48:18 +0200 monit (2.3-1) unstable; urgency=low * Initial Release. -- Fredrik Steen Tue, 21 May 2002 09:52:55 +0200 debian/control0000664000000000000000000000405313332624550010600 0ustar Source: monit Section: admin Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Sergey B Kirpichev Build-Depends: debhelper (>= 9), libssl-dev, libpam-dev, libkvm-dev [kfreebsd-any], autotools-dev # this strange things was installed only on ia64 buildd: Build-Conflicts: automake, autoconf Standards-Version: 3.9.4 Homepage: http://mmonit.com/monit/ Vcs-Git: git://anonscm.debian.org/collab-maint/monit.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/monit.git;a=summary Package: monit Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.2-13) Suggests: exim4 | postfix | mail-transport-agent Description: utility for monitoring and managing daemons or similar programs monit is a utility for monitoring and managing daemons or similar programs running on a Unix system. It will start specified programs if they are not running and restart programs not responding. . monit supports: * Daemon mode - poll programs at a specified interval * Monitoring modes - active, passive or manual * Start, stop and restart of programs * Group and manage groups of programs * Process dependency definition * Logging to syslog or own logfile * Configuration - comprehensive controlfile * Runtime and TCP/IP port checking (tcp and udp) * SSL support for port checking * Unix domain socket checking * Process status and process timeout * Process cpu usage * Process memory usage * Process zombie check * Check the systems load average * Check a file or directory timestamp * Alert, stop or restart a process based on its characteristics * MD5 checksum for programs started and stopped by monit * Alert notification for program timeout, restart, checksum, stop resource and timestamp error * Flexible and customizable email alert messages * Protocol verification. HTTP, FTP, SMTP, POP, IMAP, NNTP, SSH, DWP, LDAPv2 and LDAPv3 * An http interface with optional SSL support to make monit accessible from a webbrowser debian/monit.bug-script0000664000000000000000000000060212241677765012336 0ustar #!/bin/sh mconf=/etc/monit/monitrc if [ ! -r $mconf ] then cat >&3 <&3 /bin/ls -lR /etc/monit >&3 2>&1 printf "\n" >&3 exit 0 debian/rules0000775000000000000000000000052112241677765010267 0ustar #!/usr/bin/make -f %: dh $@ --with autotools_dev override_dh_auto_configure: dh_auto_configure -- \ --sysconfdir=/etc/monit override_dh_installinit: dh_installinit -- "start 99 2 3 4 5 . stop 01 0 1 6 ." override_dh_fixperms: dh_fixperms chmod 600 debian/monit/etc/monit/monitrc chmod 0700 debian/monit/var/lib/monit/events debian/watch0000664000000000000000000000007612241677765010245 0ustar version=3 http://mmonit.com/monit/dist/monit-([\d\.]*).tar.gz debian/compat0000664000000000000000000000000212241677765010407 0ustar 9 debian/monit.examples0000664000000000000000000000005412241677765012076 0ustar contrib/monit.upstart contrib/monit.service debian/monit.postrm0000664000000000000000000000125012241677765011603 0ustar #!/bin/sh set -e case "$1" in upgrade|failed-upgrade|abort-install|abort-upgrade|remove|disappear) ;; purge) # Remove logfile: rm -f /var/log/monit.log # Remove the state and id files (default location): rm -f /var/lib/monit/state /var/lib/monit/id # Remove monit from /etc/aliases: if [ -f /etc/aliases ] || [ -L /etc/aliases ] then if grep -qi "^monit[[:space:]]*:" /etc/aliases then sed -i '/^monit[[:space:]]*:.*$/d' /etc/aliases test -x /usr/bin/newaliases && newaliases || : fi fi ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0