[asterisk-commits] kpfleming: trunk r187269 - in /trunk: apps/ configs/ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 8 21:44:33 CDT 2009


Author: kpfleming
Date: Wed Apr  8 21:44:27 2009
New Revision: 187269

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=187269
Log:
add a dedicated log channel for modules to be able report security-related events, so that they can be fed into external processes for analysis and possible mitigation efforts

(inspired by this evening's Toronto Asterisk Users Group meeting and previous dicussions amongst various community members)


Modified:
    trunk/apps/app_verbose.c
    trunk/configs/logger.conf.sample
    trunk/include/asterisk/logger.h
    trunk/main/logger.c

Modified: trunk/apps/app_verbose.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/apps/app_verbose.c?view=diff&rev=187269&r1=187268&r2=187269
==============================================================================
--- trunk/apps/app_verbose.c (original)
+++ trunk/apps/app_verbose.c Wed Apr  8 21:44:27 2009
@@ -59,7 +59,7 @@
 		<syntax>
 			<parameter name="level">
 				<para>Level must be one of <literal>ERROR</literal>, <literal>WARNING</literal>, <literal>NOTICE</literal>,
-				<literal>DEBUG</literal>, <literal>VERBOSE</literal> or <literal>DTMF</literal>.</para>	
+				<literal>DEBUG</literal>, <literal>VERBOSE</literal>, <literal>DTMF</literal> or <literal>SECURITY</literal>.</para>	
 			</parameter>
 			<parameter name="message" required="true">
 				<para>Output text message.</para>
@@ -146,6 +146,8 @@
 		lnum = __LOG_VERBOSE;
 	} else if (!strcasecmp(args.level, "DTMF")) {
 		lnum = __LOG_DTMF;
+	} else if (!strcasecmp(args.level, "SECURITY")) {
+		lnum = __LOG_SECURITY;
 	} else if (!strcasecmp(args.level, "EVENT")) {
 		lnum = __LOG_EVENT;
 	} else {

Modified: trunk/configs/logger.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/trunk/configs/logger.conf.sample?view=diff&rev=187269&r1=187268&r2=187269
==============================================================================
--- trunk/configs/logger.conf.sample (original)
+++ trunk/configs/logger.conf.sample Wed Apr  8 21:44:27 2009
@@ -70,6 +70,7 @@
 ;    error
 ;    verbose
 ;    dtmf
+;    security
 ;
 ; Special filename "console" represents the system console
 ;
@@ -89,6 +90,7 @@
 ;console => notice,warning,error,debug
 messages => notice,warning,error
 ;full => notice,warning,error,debug,verbose
+security => security
 
 ;syslog keyword : This special keyword logs to syslog facility 
 ;

Modified: trunk/include/asterisk/logger.h
URL: http://svn.digium.com/svn-view/asterisk/trunk/include/asterisk/logger.h?view=diff&rev=187269&r1=187268&r2=187269
==============================================================================
--- trunk/include/asterisk/logger.h (original)
+++ trunk/include/asterisk/logger.h Wed Apr  8 21:44:27 2009
@@ -189,7 +189,18 @@
 #endif
 #define AST_LOG_DTMF    __LOG_DTMF, _A_
 
-#define NUMLOGLEVELS 6
+#ifdef LOG_SECURITY
+#undef LOG_SECURITY
+#endif
+#define __LOG_SECURITY  7
+#define LOG_SECURITY    __LOG_SECURITY, _A_
+
+#ifdef AST_LOG_SECURITY
+#undef AST_LOG_SECURITY
+#endif
+#define AST_LOG_SECURITY    __LOG_SECURITY, _A_
+
+#define NUMLOGLEVELS 7
 
 /*!
  * \brief Get the debug level for a file

Modified: trunk/main/logger.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/logger.c?view=diff&rev=187269&r1=187268&r2=187269
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Wed Apr  8 21:44:27 2009
@@ -162,7 +162,8 @@
 	"WARNING",
 	"ERROR",
 	"VERBOSE",
-	"DTMF"
+	"DTMF",
+	"SECURITY",
 };
 
 /*! \brief Colors used in the console for logging */
@@ -204,6 +205,8 @@
 			res |= (1 << __LOG_VERBOSE);
 		else if (!strcasecmp(w, "dtmf"))
 			res |= (1 << __LOG_DTMF);
+		else if (!strcasecmp(w, "security"))
+			res |= (1 << __LOG_SECURITY);
 		else {
 			fprintf(stderr, "Logfile Warning: Unknown keyword '%s' at line %d of logger.conf\n", w, lineno);
 		}
@@ -356,7 +359,7 @@
 		if (!(chan = ast_calloc(1, sizeof(*chan))))
 			return;
 		chan->type = LOGTYPE_CONSOLE;
-		chan->logmask = 28; /*warning,notice,error */
+		chan->logmask = (1 << __LOG_WARNING) | (1 << __LOG_NOTICE) | (1 << __LOG_ERROR);
 		if (!locked)
 			AST_RWLIST_WRLOCK(&logchannels);
 		AST_RWLIST_INSERT_HEAD(&logchannels, chan, list);
@@ -802,6 +805,8 @@
 			ast_cli(a->fd, "Debug ");
 		if (chan->logmask & (1 << __LOG_DTMF)) 
 			ast_cli(a->fd, "DTMF ");
+		if (chan->logmask & (1 << __LOG_SECURITY)) 
+			ast_cli(a->fd, "Security ");
 		if (chan->logmask & (1 << __LOG_VERBOSE)) 
 			ast_cli(a->fd, "Verbose ");
 		if (chan->logmask & (1 << __LOG_WARNING)) 




More information about the asterisk-commits mailing list