diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-03-24 16:34:39 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-03-24 16:34:39 +0000 |
commit | 66065be0e68fdb1e20cef3f142e90efb1a1f5952 (patch) | |
tree | 01f7d6d6f5685f9feb4789cbd393841a25774c70 | |
parent | 4a98cbb6eecb52025e23ff85e05d87a46ec2bdf3 (diff) | |
download | zabbix-66065be0e68fdb1e20cef3f142e90efb1a1f5952.tar.gz zabbix-66065be0e68fdb1e20cef3f142e90efb1a1f5952.tar.xz zabbix-66065be0e68fdb1e20cef3f142e90efb1a1f5952.zip |
- added "EnableRemoteCommands" option in to configuration file (Eugene)
- BY DEFAULT REMOTE COMMANDS DISABLED
git-svn-id: svn://svn.zabbix.com/trunk@2710 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | configure.in | 2 | ||||
-rwxr-xr-x | do | 12 | ||||
-rw-r--r-- | include/sysinfo.h | 2 | ||||
-rw-r--r-- | misc/conf/zabbix_agentd.conf | 4 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/common/common.c | 8 | ||||
-rw-r--r-- | src/zabbix_agent/zabbix_agent.c | 1 | ||||
-rw-r--r-- | src/zabbix_agent/zabbix_agentd.c | 2 | ||||
-rwxr-xr-x | src/zabbix_agent_win32/Debug/ZabbixW32.exe | bin | 360517 -> 360517 bytes | |||
-rwxr-xr-x | src/zabbix_agent_win32/Release/ZabbixW32.exe | bin | 114688 -> 114688 bytes | |||
-rw-r--r-- | src/zabbix_agent_win32/config.cpp | 6 | ||||
-rw-r--r-- | src/zabbix_agent_win32/execute.cpp | 6 | ||||
-rw-r--r-- | src/zabbix_agent_win32/main.cpp | 1 | ||||
-rw-r--r-- | src/zabbix_agent_win32/zabbixw32.h | 1 | ||||
-rw-r--r-- | src/zabbix_server/server.c | 1 |
14 files changed, 42 insertions, 4 deletions
diff --git a/configure.in b/configure.in index e4148eb6..f7789f51 100644 --- a/configure.in +++ b/configure.in @@ -19,7 +19,7 @@ dnl dnl Process this file with autoconf to produce a configure script. AC_INIT(src/zabbix_server/server.c) -AM_INIT_AUTOMAKE([zabbix],[1.1beta6]) +AM_INIT_AUTOMAKE([zabbix],[1.1beta8]) AC_MSG_NOTICE([Configuring $PACKAGE_NAME $PACKAGE_VERSION]) @@ -1,5 +1,12 @@ #!/bin/sh +# +# Description: +# ZABBIX compilateion script +# Author: +# Eugene Grigorjev +# + premake="no" copy="no" tgz="no" @@ -11,6 +18,7 @@ cleanwarnings="no" docat="yes" help="no" noparam=0; +def="--with-ldap --enable-agent --enable-server --with-mysql --with-net-snmp" for cmd do @@ -27,7 +35,7 @@ do tar ) tgz="yes"; noparam=1;; nocat ) docat="no"; noparam=1;; cat ) docat="yes"; noparam=1;; - def ) config_param="$config_param --with-ldap --enable-agent --enable-server --with-mysql --with-net-snmp";; + def ) config_param="$config_param $def";; --enable-* ) config_param="$config_param $cmd";; --with-* ) config_param="$config_param $cmd";; --prefix=* ) config_param="$config_param $cmd";; @@ -44,6 +52,8 @@ then echo "Usage:" echo " $0 [copy|cpy] [premake|pre] [configure|config|conf] [def] [make] [test] [tar] [cat] [nocat] [--enable-*] [--with-*]" echo + echo " def = $def" + echo echo "Examples:" echo " $0 conf def make test - compyle, test, and sow report" echo " $0 cpy tar nocat - make archive .tar.gz and don't show report" diff --git a/include/sysinfo.h b/include/sysinfo.h index 6787e3be..d3c8d865 100644 --- a/include/sysinfo.h +++ b/include/sysinfo.h @@ -21,6 +21,8 @@ #ifndef ZABBIX_SYSINFO_H #define ZABBIX_SYSINFO_H +extern int CONFIG_ENABLE_REMOTE_COMMANDS; + /* #define TEST_PARAMETERS */ #define SYSINFO_RET_OK 0 diff --git a/misc/conf/zabbix_agentd.conf b/misc/conf/zabbix_agentd.conf index 152e07b9..86ca1e80 100644 --- a/misc/conf/zabbix_agentd.conf +++ b/misc/conf/zabbix_agentd.conf @@ -41,6 +41,10 @@ StartAgents=5 #DisableActive=1 +# Enable remote commands for ZABBIX agent. By default remote commands disabled. + +#EnableRemoteCommands=1 + # Specifies debug level # 0 - debug is not created # 1 - critical information diff --git a/src/libs/zbxsysinfo/common/common.c b/src/libs/zbxsysinfo/common/common.c index 1a58a433..ad08b079 100644 --- a/src/libs/zbxsysinfo/common/common.c +++ b/src/libs/zbxsysinfo/common/common.c @@ -39,7 +39,7 @@ ZBX_METRIC parameters_common[]= {"vfs.file.size", CF_USEUPARAM, VFS_FILE_SIZE, 0, "/etc/passwd"}, {"vfs.file.regexp", CF_USEUPARAM, VFS_FILE_REGEXP, 0, "/etc/passwd,root"}, {"vfs.file.regmatch", CF_USEUPARAM, VFS_FILE_REGMATCH, 0, "/etc/passwd,root"}, - {"system.run", CF_USEUPARAM, RUN_COMMAND, 0, "echo -n"}, + {"system.run", CF_USEUPARAM, RUN_COMMAND, 0, "echo test"}, {0} }; @@ -1225,6 +1225,12 @@ int RUN_COMMAND(const char *cmd, const char *param, unsigned flags, AGENT_RESULT init_result(result); + if(CONFIG_ENABLE_REMOTE_COMMANDS != 1) + { + SET_MSG_RESULT(result, strdup("ZBX_NOTSUPPORTED")); + return SYSINFO_RET_FAIL; + } + if(num_param(param) > 1) { return SYSINFO_RET_FAIL; diff --git a/src/zabbix_agent/zabbix_agent.c b/src/zabbix_agent/zabbix_agent.c index 6e18f8f0..8aa7f3e3 100644 --- a/src/zabbix_agent/zabbix_agent.c +++ b/src/zabbix_agent/zabbix_agent.c @@ -28,6 +28,7 @@ static char *CONFIG_HOSTS_ALLOWED = NULL; static int CONFIG_TIMEOUT = AGENT_TIMEOUT; +int CONFIG_ENABLE_REMOTE_COMMANDS = 0; void signal_handler( int sig ) { diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c index 23260e30..5123c260 100644 --- a/src/zabbix_agent/zabbix_agentd.c +++ b/src/zabbix_agent/zabbix_agentd.c @@ -74,6 +74,7 @@ char *CONFIG_LOG_FILE = NULL; int CONFIG_AGENTD_FORKS = AGENTD_FORKS; int CONFIG_NOTIMEWAIT = 0; int CONFIG_DISABLE_ACTIVE = 0; +int CONFIG_ENABLE_REMOTE_COMMANDS = 0; int CONFIG_TIMEOUT = AGENT_TIMEOUT; int CONFIG_LISTEN_PORT = 10050; int CONFIG_SERVER_PORT = 10051; @@ -241,6 +242,7 @@ void init_config(void) {"LogFile",&CONFIG_LOG_FILE,0,TYPE_STRING,PARM_OPT,0,0}, /* {"StatFile",&CONFIG_STAT_FILE,0,TYPE_STRING,PARM_OPT,0,0},*/ {"DisableActive",&CONFIG_DISABLE_ACTIVE,0,TYPE_INT,PARM_OPT,0,1}, + {"EnableRemoteCommands",&CONFIG_ENABLE_REMOTE_COMMANDS,0,TYPE_INT,PARM_OPT,0,1}, {"Timeout",&CONFIG_TIMEOUT,0,TYPE_INT,PARM_OPT,1,30}, {"NoTimeWait",&CONFIG_NOTIMEWAIT,0,TYPE_INT,PARM_OPT,0,1}, {"ListenPort",&CONFIG_LISTEN_PORT,0,TYPE_INT,PARM_OPT,1024,32767}, diff --git a/src/zabbix_agent_win32/Debug/ZabbixW32.exe b/src/zabbix_agent_win32/Debug/ZabbixW32.exe Binary files differindex b90ee202..66b6b4c7 100755 --- a/src/zabbix_agent_win32/Debug/ZabbixW32.exe +++ b/src/zabbix_agent_win32/Debug/ZabbixW32.exe diff --git a/src/zabbix_agent_win32/Release/ZabbixW32.exe b/src/zabbix_agent_win32/Release/ZabbixW32.exe Binary files differindex 94c63665..063b44a3 100755 --- a/src/zabbix_agent_win32/Release/ZabbixW32.exe +++ b/src/zabbix_agent_win32/Release/ZabbixW32.exe diff --git a/src/zabbix_agent_win32/config.cpp b/src/zabbix_agent_win32/config.cpp index 2bf0ab8d..63447d14 100644 --- a/src/zabbix_agent_win32/config.cpp +++ b/src/zabbix_agent_win32/config.cpp @@ -408,7 +408,11 @@ CHECK_MEMORY(main, "ReadConfig", "fopen==NULL"); } else if (!stricmp(buffer,"LogLevel")) { - g_dwLogLevel = strtoul(buffer, NULL, 0); + g_dwLogLevel = strtoul(ptr, NULL, 0); + } + else if (!stricmp(buffer,"EnableRemoteCommands")) + { + confEnableRemoteCommands = strtoul(ptr, NULL, 0); } else if (!stricmp(buffer,"PerfCounter")) { diff --git a/src/zabbix_agent_win32/execute.cpp b/src/zabbix_agent_win32/execute.cpp index 518354d3..93bdd6c9 100644 --- a/src/zabbix_agent_win32/execute.cpp +++ b/src/zabbix_agent_win32/execute.cpp @@ -101,6 +101,12 @@ LONG H_RunCommand(char *cmd,char *arg,double *value) char *ptr1,*ptr2; char command[MAX_ZABBIX_CMD_LEN]; + if(confEnableRemoteCommands != 1) + { + *value = 0; + return SYSINFO_RC_NOTSUPPORTED; + } + ZeroMemory(&si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi) ); diff --git a/src/zabbix_agent_win32/main.cpp b/src/zabbix_agent_win32/main.cpp index af36a4a3..42db8efa 100644 --- a/src/zabbix_agent_win32/main.cpp +++ b/src/zabbix_agent_win32/main.cpp @@ -43,6 +43,7 @@ DWORD confServerAddr[MAX_SERVERS]; DWORD confServerCount=0; DWORD confTimeout=3000; // 3 seconds default timeout DWORD confMaxProcTime=1000; // 1000 milliseconds is default acceptable collector sample processing time +DWORD confEnableRemoteCommands=0; // by default disabled DWORD g_dwLogLevel = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; SUBAGENT *subagentList; // List of loaded subagents diff --git a/src/zabbix_agent_win32/zabbixw32.h b/src/zabbix_agent_win32/zabbixw32.h index a2dff86a..1ad748b6 100644 --- a/src/zabbix_agent_win32/zabbixw32.h +++ b/src/zabbix_agent_win32/zabbixw32.h @@ -244,6 +244,7 @@ extern WORD confListenPort; extern WORD confServerPort; extern DWORD confTimeout; extern DWORD confMaxProcTime; +extern DWORD confEnableRemoteCommands; extern USER_COUNTER *userCounterList; void FreeUserCounterList(void); diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c index 0d17a36f..2c592832 100644 --- a/src/zabbix_server/server.c +++ b/src/zabbix_server/server.c @@ -92,6 +92,7 @@ char *CONFIG_DBUSER = NULL; char *CONFIG_DBPASSWORD = NULL; char *CONFIG_DBSOCKET = NULL; int CONFIG_DBPORT = 3306; +int CONFIG_ENABLE_REMOTE_COMMANDS = 0; /* From table config */ int CONFIG_REFRESH_UNSUPPORTED = 0; |