Changeset 5735dda in nscp for modules/NRPEClient


Ignore:
Timestamp:
06/13/10 22:02:07 (3 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
f0607c4
Parents:
5cd6bcf (diff), f1d6990 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged back all (some?) of the new changes from 0.3.8

Location:
modules/NRPEClient
Files:
1 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • modules/NRPEClient/NRPEClient.h

    rcad08fb r5735dda  
    110110  std::wstring getModuleDescription() { 
    111111    return _T("A simple client for checking remote NRPE servers (think proxy).\n") 
     112#ifndef USE_BOOST 
     113    _T("BOOST support is missing (this is probably very bad)!\n") 
     114#endif 
    112115#ifndef USE_SSL 
    113116    _T("SSL support is missing (so you cant use encryption)!") 
  • modules/NRPEClient/NRPEClient.cpp

    r689bf4a rcad08fb  
    2525#include <config.h> 
    2626#include <msvc_wrappers.h> 
    27 #include <execute_process.hpp> 
    28 #ifdef USE_BOOST 
    29 #include <program_options_ex.hpp> 
    30 #endif 
     27//#include <execute_process.hpp> 
    3128#include <strEx.h> 
     29#include <boost/filesystem.hpp> 
     30#include <strEx.h> 
     31#include <nrpe/nrpe_socket.hpp> 
     32 
    3233 
    3334NRPEClient gNRPEClient; 
    3435 
    35 BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved) 
    36 { 
    37   NSCModuleWrapper::wrapDllMain(hModule, ul_reason_for_call); 
    38   return TRUE; 
    39 } 
    40  
    41 NRPEClient::NRPEClient() : buffer_length_(0), bInitSSL(false) { 
     36NRPEClient::NRPEClient() : buffer_length_(0) { 
    4237} 
    4338 
     
    4540} 
    4641 
    47 bool NRPEClient::loadModule() { 
    48   buffer_length_ = NSCModuleHelper::getSettingsInt(NRPE_SECTION_TITLE, NRPE_SETTINGS_STRLEN, NRPE_SETTINGS_STRLEN_DEFAULT); 
    49  
    50   std::list<std::wstring> commands = NSCModuleHelper::getSettingsSection(NRPE_CLIENT_HANDLER_SECTION_TITLE); 
    51   NSC_DEBUG_MSG_STD(_T("humm...")); 
     42bool NRPEClient::loadModule(NSCAPI::moduleLoadMode mode) { 
     43  std::list<std::wstring> commands; 
     44  buffer_length_ = SETTINGS_GET_INT(nrpe::PAYLOAD_LENGTH); 
     45  try { 
     46    SETTINGS_REG_PATH(nrpe::CH_SECTION); 
     47    commands = GET_CORE()->getSettingsSection(setting_keys::nrpe::CH_SECTION_PATH); 
     48  } catch (nscapi::nscapi_exception &e) { 
     49    NSC_LOG_ERROR_STD(_T("Failed to register command: ") + e.msg_); 
     50  } catch (...) { 
     51    NSC_LOG_ERROR_STD(_T("Failed to register command.")); 
     52  } 
     53 
     54  boost::filesystem::wpath p = GET_CORE()->getBasePath() + std::wstring(_T("security/nrpe_dh_512.pem")); 
     55  cert_ = p.string(); 
     56  if (boost::filesystem::is_regular(p)) { 
     57    NSC_DEBUG_MSG_STD(_T("Using certificate: ") + cert_); 
     58  } else { 
     59    NSC_LOG_ERROR_STD(_T("Certificate not found: ") + cert_); 
     60  } 
     61 
     62 
    5263  for (std::list<std::wstring>::const_iterator it = commands.begin(); it != commands.end(); ++it) { 
    5364    NSC_DEBUG_MSG_STD(*it); 
    54     std::wstring s = NSCModuleHelper::getSettingsString(NRPE_CLIENT_HANDLER_SECTION_TITLE, (*it), _T("")); 
     65    std::wstring s = GET_CORE()->getSettingsString(setting_keys::nrpe::CH_SECTION_PATH, (*it), _T("")); 
    5566    if (s.empty()) { 
    5667      NSC_LOG_ERROR_STD(_T("Invalid NRPE-client entry: ") + (*it)); 
     
    6172  return true; 
    6273} 
    63 void NRPEClient::initSSL() { 
    64   if (bInitSSL) 
    65     return; 
    66 #ifdef USE_SSL 
    67   simpleSSL::SSL_init(); 
    68 #endif 
    69   bInitSSL = true; 
    70 } 
     74 
     75void NRPEClient::add_options(po::options_description &desc, nrpe_connection_data &command_data) { 
     76  desc.add_options() 
     77    ("help,h", "Show this help message.") 
     78    ("host,H", po::wvalue<std::wstring>(&command_data.host), "The address of the host running the NRPE daemon") 
     79    ("port,p", po::value<int>(&command_data.port), "The port on which the daemon is running (default=5666)") 
     80    ("command,c", po::wvalue<std::wstring>(&command_data.command), "The name of the command that the remote daemon should run") 
     81    ("timeout,t", po::value<int>(&command_data.timeout), "Number of seconds before connection times out (default=10)") 
     82    ("buffer-length,l", po::value<unsigned int>(&command_data.buffer_length), std::string("Length of payload (has to be same as on the server (default=" + to_string(buffer_length_) + ")").c_str()) 
     83    ("no-ssl,n", po::value<bool>(&command_data.no_ssl)->zero_tokens()->default_value(false), "Do not initial an ssl handshake with the server, talk in plaintext.") 
     84    ("arguments,a", po::wvalue<std::vector<std::wstring> >(&command_data.argument_vector), "list of arguments") 
     85    ; 
     86} 
     87 
    7188 
    7289void NRPEClient::addCommand(strEx::blindstr key, std::wstring args) { 
     
    7592#else 
    7693  try { 
    77     boost::program_options::options_description desc = get_optionDesc(); 
    78     boost::program_options::positional_options_description p = get_optionsPositional(); 
    79  
     94 
     95    NRPEClient::nrpe_connection_data command_data; 
    8096    boost::program_options::variables_map vm; 
    81     boost::program_options::store( 
    82       basic_command_line_parser_ex<TCHAR>(args).options(desc).positional(p).run() 
    83       , vm); 
    84     boost::program_options::notify(vm);  
    85     nrpe_connection_data cd = get_ConectionData(vm); 
    86     NSC_DEBUG_MSG_STD(_T("Added NRPE Client: ") + key.c_str() + _T(" = ") + cd.toString()); 
    87     commands[key] = cd; 
     97 
     98    po::options_description desc("Allowed options"); 
     99    buffer_length_ = SETTINGS_GET_INT(nrpe::PAYLOAD_LENGTH); 
     100    add_options(desc, command_data); 
     101 
     102    po::positional_options_description p; 
     103    p.add("arguments", -1); 
     104 
     105    std::vector<std::wstring> list; 
     106    //explicit escaped_list_separator(Char e = '\\', Char c = ',',Char q = '\"') 
     107    boost::escaped_list_separator<wchar_t> sep(L'\\', L' ', L'\"'); 
     108    typedef boost::tokenizer<boost::escaped_list_separator<wchar_t>,std::wstring::const_iterator, std::wstring > tokenizer_t; 
     109    tokenizer_t tok(args, sep); 
     110    for(tokenizer_t::iterator beg=tok.begin(); beg!=tok.end();++beg){ 
     111      list.push_back(*beg); 
     112    } 
     113 
     114    po::wparsed_options parsed = po::basic_command_line_parser<wchar_t>(list).options(desc).positional(p).run(); 
     115    po::store(parsed, vm); 
     116    po::notify(vm); 
     117    command_data.parse_arguments(); 
     118 
     119    NSC_DEBUG_MSG_STD(_T("Added NRPE Client: ") + key.c_str() + _T(" = ") + command_data.toString()); 
     120    commands[key] = command_data; 
     121 
     122    NSCModuleHelper::registerCommand(key.c_str(), command_data.toString()); 
     123 
    88124  } catch (boost::program_options::validation_error &e) { 
    89125    NSC_LOG_ERROR_STD(_T("Could not parse: ") + key.c_str() + strEx::string_to_wstring(e.what())); 
     
    104140  return false; 
    105141} 
    106 NSCAPI::nagiosReturn NRPEClient::handleCommand(const strEx::blindstr command, const unsigned int argLen, TCHAR **char_args, std::wstring &message, std::wstring &perf) 
     142NSCAPI::nagiosReturn NRPEClient::handleCommand(const std::wstring command, std::list<std::wstring> arguments, std::wstring &message, std::wstring &perf) 
    107143{ 
    108   command_list::const_iterator cit = commands.find(command); 
     144  command_list::const_iterator cit = commands.find(strEx::blindstr(command.c_str())); 
    109145  if (cit == commands.end()) 
    110146    return NSCAPI::returnIgnored; 
    111147 
    112148  std::wstring args = (*cit).second.arguments; 
    113   if (NSCModuleHelper::getSettingsInt(NRPE_SECTION_TITLE, NRPE_SETTINGS_ALLOW_ARGUMENTS, NRPE_SETTINGS_ALLOW_ARGUMENTS_DEFAULT) == 1) { 
    114     arrayBuffer::arrayList arr = arrayBuffer::arrayBuffer2list(argLen, char_args); 
    115     arrayBuffer::arrayList::const_iterator cit2 = arr.begin(); 
     149  if (SETTINGS_GET_BOOL(nrpe::ALLOW_ARGS) == 1) { 
    116150    int i=1; 
    117  
    118     for (;cit2!=arr.end();cit2++,i++) { 
    119       if (NSCModuleHelper::getSettingsInt(NRPE_SECTION_TITLE, NRPE_SETTINGS_ALLOW_NASTY_META, NRPE_SETTINGS_ALLOW_NASTY_META_DEFAULT) == 0) { 
    120         if ((*cit2).find_first_of(NASTY_METACHARS) != std::wstring::npos) { 
     151    BOOST_FOREACH(std::wstring arg, arguments) 
     152    { 
     153      if (SETTINGS_GET_INT(nrpe::ALLOW_NASTY) == 0) { 
     154        if (arg.find_first_of(NASTY_METACHARS) != std::wstring::npos) { 
    121155          NSC_LOG_ERROR(_T("Request string contained illegal metachars!")); 
    122156          return NSCAPI::returnIgnored; 
    123157        } 
    124158      } 
    125       strEx::replace(args, _T("$ARG") + strEx::itos(i) + _T("$"), (*cit2)); 
     159      strEx::replace(args, _T("$ARG") + strEx::itos(i++) + _T("$"), arg); 
    126160    } 
    127161  } 
     
    133167} 
    134168 
    135 #ifdef USE_BOOST 
    136 boost::program_options::options_description NRPEClient::get_optionDesc() { 
    137   boost::program_options::options_description desc("Allowed options"); 
    138   buffer_length_ = NSCModuleHelper::getSettingsInt(NRPE_SECTION_TITLE, NRPE_SETTINGS_STRLEN, NRPE_SETTINGS_STRLEN_DEFAULT); 
    139   desc.add_options() 
    140     ("help,h", "Show this help message.") 
    141     ("host,H", boost::program_options::wvalue<std::wstring>(), "The address of the host running the NRPE daemon") 
    142     ("port,p", boost::program_options::value<int>(), "The port on which the daemon is running (default=5666)") 
    143     ("command,c", boost::program_options::wvalue<std::wstring>(), "The name of the command that the remote daemon should run") 
    144     ("timeout,t", boost::program_options::value<int>(), "Number of seconds before connection times out (default=10)") 
    145     ("buffer-length,l", boost::program_options::value<int>(), std::string("Length of payload (has to be same as on the server (default=" + strEx::s::itos(buffer_length_) + ")").c_str()) 
    146     ("no-ssl,n", "Do not initial an ssl handshake with the server, talk in plaintext.") 
    147     ("arguments,a", boost::program_options::wvalue<std::vector<std::wstring>>(), "list of arguments") 
    148     ; 
    149   return desc; 
    150 } 
    151 boost::program_options::positional_options_description NRPEClient::get_optionsPositional() { 
    152   boost::program_options::positional_options_description p; 
    153   p.add("arguments", -1); 
    154   return p; 
    155 } 
    156 NRPEClient::nrpe_connection_data NRPEClient::get_ConectionData(boost::program_options::variables_map &vm) { 
    157   nrpe_connection_data ret(buffer_length_); 
    158   if (vm.count("host")) 
    159     ret.host = vm["host"].as<std::wstring>(); 
    160   if (vm.count("port")) 
    161     ret.port = vm["port"].as<int>(); 
    162   if (vm.count("timeout")) 
    163     ret.timeout = vm["timeout"].as<int>(); 
    164   if (vm.count("buffer-length")) 
    165     ret.buffer_length = vm["buffer-length"].as<int>(); 
    166   if (vm.count("command")) 
    167     ret.command = vm["command"].as<std::wstring>(); 
    168   if (vm.count("arguments")) { 
    169     std::vector<std::wstring> v = vm["arguments"].as<std::vector<std::wstring>>(); 
    170     for (std::vector<std::wstring>::const_iterator cit = v.begin(); cit != v.end(); ++cit) { 
    171       if (!ret.arguments.empty()) 
    172         ret.arguments += _T("!"); 
    173       ret.arguments += *cit; 
    174     } 
    175   } 
    176   if (vm.count("no-ssl")) 
    177     ret.ssl = false; 
    178   return ret; 
    179 } 
    180 #endif 
    181 int NRPEClient::commandLineExec(const TCHAR* command, const unsigned int argLen, TCHAR** args) { 
    182 #ifndef USE_BOOST 
    183   NSC_LOG_ERROR_STD(_T("Could not execute ") + std::wstring(command) + _T(" boost not avalible!")); 
    184   return NSCAPI::returnUNKNOWN; 
    185 #else 
    186   try { 
    187     boost::program_options::options_description desc = get_optionDesc(); 
    188     boost::program_options::positional_options_description p = get_optionsPositional(); 
    189      
     169int NRPEClient::commandLineExec(const unsigned int argLen, TCHAR** args) { 
     170  try { 
     171 
     172    NRPEClient::nrpe_connection_data command_data; 
    190173    boost::program_options::variables_map vm; 
    191     boost::program_options::store( 
    192       basic_command_line_parser_ex<TCHAR>(command, argLen, args).options(desc).positional(p).run() 
    193       , vm); 
    194     boost::program_options::notify(vm);     
     174 
     175    po::options_description desc("Allowed options"); 
     176    buffer_length_ = SETTINGS_GET_INT(nrpe::PAYLOAD_LENGTH); 
     177    add_options(desc, command_data); 
     178 
     179    po::positional_options_description p; 
     180    p.add("arguments", -1); 
     181    po::wparsed_options parsed = basic_command_line_parser_ex<wchar_t>(argLen, args).options(desc).positional(p).run(); 
     182    po::store(parsed, vm); 
     183    po::notify(vm); 
     184    command_data.parse_arguments(); 
    195185 
    196186    if (vm.count("help")) { 
     
    198188      return 1; 
    199189    } 
    200  
    201     NRPEClient::nrpe_connection_data command = get_ConectionData(vm); 
    202     nrpe_result_data result = execute_nrpe_command(command, command.arguments); 
     190    nrpe_result_data result = execute_nrpe_command(command_data, command_data.arguments); 
    203191    std::wcout << result.text << std::endl; 
    204192    return result.result; 
     
    209197  } 
    210198  return NSCAPI::returnUNKNOWN; 
    211 #endif 
    212199} 
    213200NRPEClient::nrpe_result_data NRPEClient::execute_nrpe_command(nrpe_connection_data con, std::wstring arguments) { 
    214201  try { 
    215     NRPEPacket packet; 
    216     if (con.ssl) { 
     202    nrpe::packet packet; 
     203    if (!con.no_ssl) { 
    217204#ifdef USE_SSL 
    218       packet = send_ssl(con.host, con.port, con.timeout, NRPEPacket::make_request(con.get_cli(arguments), con.buffer_length)); 
     205      packet = send_ssl(con.host, con.port, con.timeout, nrpe::packet::make_request(con.get_cli(arguments), con.buffer_length)); 
    219206#else 
    220207      return nrpe_result_data(NSCAPI::returnUNKNOWN, _T("SSL support not available (compiled without USE_SSL)!")); 
    221208#endif 
    222209    } else 
    223       packet = send_nossl(con.host, con.port, con.timeout, NRPEPacket::make_request(con.get_cli(arguments), con.buffer_length)); 
     210      packet = send_nossl(con.host, con.port, con.timeout, nrpe::packet::make_request(con.get_cli(arguments), con.buffer_length)); 
    224211    return nrpe_result_data(packet.getResult(), packet.getPayload()); 
    225   } catch (NRPEPacket::NRPEPacketException &e) { 
     212  } catch (nrpe::nrpe_packet_exception &e) { 
    226213    return nrpe_result_data(NSCAPI::returnUNKNOWN, _T("NRPE Packet errro: ") + e.getMessage()); 
    227   } catch (simpleSocket::SocketException &e) { 
    228     return nrpe_result_data(NSCAPI::returnUNKNOWN, _T("Socket error: ") + e.getMessage()); 
     214  } catch (std::runtime_error &e) { 
     215    return nrpe_result_data(NSCAPI::returnUNKNOWN, _T("Socket error: ") + boost::lexical_cast<std::wstring>(e.what())); 
     216  } catch (...) { 
     217    return nrpe_result_data(NSCAPI::returnUNKNOWN, _T("Unknown error -- REPORT THIS!")); 
     218  } 
     219} 
     220 
     221 
    229222#ifdef USE_SSL 
    230   } catch (simpleSSL::SSLException &e) { 
    231     return nrpe_result_data(NSCAPI::returnUNKNOWN, _T("SSL Socket error: ") + e.getMessage()); 
     223nrpe::packet NRPEClient::send_ssl(std::wstring host, int port, int timeout, nrpe::packet packet) { 
     224  boost::asio::io_service io_service; 
     225  boost::asio::ssl::context ctx(io_service, boost::asio::ssl::context::sslv23); 
     226  SSL_CTX_set_cipher_list(ctx.impl(), "ADH"); 
     227  ctx.use_tmp_dh_file(to_string(cert_)); 
     228  ctx.set_verify_mode(boost::asio::ssl::context::verify_none); 
     229  nrpe::ssl_socket socket(io_service, ctx, host, port); 
     230  socket.send(packet, boost::posix_time::seconds(timeout)); 
     231  return socket.recv(packet, boost::posix_time::seconds(timeout)); 
     232} 
    232233#endif 
    233   } catch (...) { 
    234     return nrpe_result_data(NSCAPI::returnUNKNOWN, _T("Unknown error -- REPORT THIS!")); 
    235   } 
    236 } 
    237 NRPEPacket NRPEClient::send_ssl(std::wstring host, int port, int timeout, NRPEPacket packet) 
    238 { 
    239 #ifndef USE_SSL 
    240   return send_nossl(host, port, timeout, packet); 
    241 #else 
    242   initSSL(); 
    243   simpleSSL::Socket socket(true); 
    244   socket.connect(host, port); 
    245   NSC_DEBUG_MSG_STD(_T(">>>length: ") + strEx::itos(packet.getBufferLength())); 
    246   socket.sendAll(packet.getBuffer(), packet.getBufferLength()); 
    247   simpleSocket::DataBuffer buffer; 
    248   socket.readAll(buffer, packet.getBufferLength()); 
    249   NSC_DEBUG_MSG_STD(_T("<<<length: ") + strEx::itos(buffer.getLength())); 
    250   packet.readFrom(buffer.getBuffer(), buffer.getLength()); 
    251   return packet; 
    252 #endif 
    253 } 
     234 
     235nrpe::packet NRPEClient::send_nossl(std::wstring host, int port, int timeout, nrpe::packet packet) { 
     236  boost::asio::io_service io_service; 
     237  nrpe::socket socket(io_service, host, port); 
     238  socket.send(packet, boost::posix_time::seconds(timeout)); 
     239  return socket.recv(packet, boost::posix_time::seconds(timeout)); 
     240} 
     241 
     242/* 
    254243NRPEPacket NRPEClient::send_nossl(std::wstring host, int port, int timeout, NRPEPacket packet) 
    255244{ 
    256   simpleSocket::Socket socket(true); 
    257   socket.connect(host, port); 
    258   socket.sendAll(packet.getBuffer(), packet.getBufferLength()); 
    259   simpleSocket::DataBuffer buffer; 
    260   socket.readAll(buffer); 
    261   packet.readFrom(buffer.getBuffer(), buffer.getLength()); 
    262   return packet; 
    263 } 
    264  
    265  
    266  
    267  
    268  
    269  
     245  unsigned char dh512_p[] = { 
     246    0xCF, 0xFF, 0x65, 0xC2, 0xC8, 0xB4, 0xD2, 0x68, 0x8C, 0xC1, 0x80, 0xB1, 
     247    0x7B, 0xD6, 0xE8, 0xB3, 0x62, 0x59, 0x62, 0xED, 0xA7, 0x45, 0x6A, 0xF8, 
     248    0xE9, 0xD8, 0xBE, 0x3F, 0x38, 0x42, 0x5F, 0xB2, 0xA5, 0x36, 0x03, 0xD3, 
     249    0x06, 0x27, 0x81, 0xC8, 0x9B, 0x88, 0x50, 0x3B, 0x82, 0x3D, 0x31, 0x45, 
     250    0x2C, 0xB4, 0xC5, 0xA5, 0xBE, 0x6A, 0xE3, 0x2E, 0xA6, 0x86, 0xFD, 0x6A, 
     251    0x7E, 0x1E, 0x6A, 0x73, 
     252  }; 
     253  unsigned char dh512_g[] = { 0x02, }; 
     254 
     255  DH *dh_2 = DH_new(); 
     256  dh_2->p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL); 
     257  dh_2->g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL); 
     258 
     259  FILE *outfile = fopen("d:\\nrpe_512.pem", "w"); 
     260  PEM_write_DHparams(outfile, dh_2); 
     261  PEM_write_DHparams(stdout, dh_2); 
     262  fclose(outfile); 
     263 
     264  nrpe_socket socket(host, port); 
     265  socket.send(packet, boost::posix_time::seconds(timeout)); 
     266  return socket.recv(packet, boost::posix_time::seconds(timeout)); 
     267} 
     268*/ 
     269 
     270 
     271 
     272 
     273 
     274NSC_WRAP_DLL(); 
    270275NSC_WRAPPERS_MAIN_DEF(gNRPEClient); 
    271276NSC_WRAPPERS_IGNORE_MSG_DEF(); 
    272277NSC_WRAPPERS_HANDLE_CMD_DEF(gNRPEClient); 
    273 NSC_WRAPPERS_HANDLE_CONFIGURATION(gNRPEClient); 
    274278NSC_WRAPPERS_CLI_DEF(gNRPEClient); 
    275279 
    276  
    277 MODULE_SETTINGS_START(NRPEClient, _T("NRPE Listener configuration"), _T("..."))  
    278  
    279 PAGE(_T("NRPE Listsner configuration"))  
    280  
    281 ITEM_EDIT_TEXT(_T("port"), _T("This is the port the NRPEClient.dll will listen to."))  
    282 ITEM_MAP_TO(_T("basic_ini_text_mapper"))  
    283 OPTION(_T("section"), _T("NRPE"))  
    284 OPTION(_T("key"), _T("port"))  
    285 OPTION(_T("default"), _T("5666"))  
    286 ITEM_END() 
    287  
    288 ITEM_CHECK_BOOL(_T("allow_arguments"), _T("This option determines whether or not the NRPE daemon will allow clients to specify arguments to commands that are executed."))  
    289 ITEM_MAP_TO(_T("basic_ini_bool_mapper"))  
    290 OPTION(_T("section"), _T("NRPE"))  
    291 OPTION(_T("key"), _T("allow_arguments"))  
    292 OPTION(_T("default"), _T("false"))  
    293 OPTION(_T("true_value"), _T("1"))  
    294 OPTION(_T("false_value"), _T("0"))  
    295 ITEM_END() 
    296  
    297 ITEM_CHECK_BOOL(_T("allow_nasty_meta_chars"), _T("This might have security implications (depending on what you do with the options)"))  
    298 ITEM_MAP_TO(_T("basic_ini_bool_mapper"))  
    299 OPTION(_T("section"), _T("NRPE"))  
    300 OPTION(_T("key"), _T("allow_nasty_meta_chars"))  
    301 OPTION(_T("default"), _T("false"))  
    302 OPTION(_T("true_value"), _T("1"))  
    303 OPTION(_T("false_value"), _T("0"))  
    304 ITEM_END() 
    305  
    306 ITEM_CHECK_BOOL(_T("use_ssl"), _T("This option will enable SSL encryption on the NRPE data socket (this increases security somwhat."))  
    307 ITEM_MAP_TO(_T("basic_ini_bool_mapper"))  
    308 OPTION(_T("section"), _T("NRPE"))  
    309 OPTION(_T("key"), _T("use_ssl"))  
    310 OPTION(_T("default"), _T("true"))  
    311 OPTION(_T("true_value"), _T("1"))  
    312 OPTION(_T("false_value"), _T("0"))  
    313 ITEM_END() 
    314  
    315 PAGE_END() 
    316 ADVANCED_PAGE(_T("Access configuration"))  
    317  
    318 ITEM_EDIT_OPTIONAL_LIST(_T("Allow connection from:"), _T("This is the hosts that will be allowed to poll performance data from the NRPE server."))  
    319 OPTION(_T("disabledCaption"), _T("Use global settings (defined previously)"))  
    320 OPTION(_T("enabledCaption"), _T("Specify hosts for NRPE server"))  
    321 OPTION(_T("listCaption"), _T("Add all IP addresses (not hosts) which should be able to connect:"))  
    322 OPTION(_T("separator"), _T(","))  
    323 OPTION(_T("disabled"), _T(""))  
    324 ITEM_MAP_TO(_T("basic_ini_text_mapper"))  
    325 OPTION(_T("section"), _T("NRPE"))  
    326 OPTION(_T("key"), _T("allowed_hosts"))  
    327 OPTION(_T("default"), _T(""))  
    328 ITEM_END() 
    329  
    330 PAGE_END() 
    331 MODULE_SETTINGS_END() 
  • modules/NRPEClient/NRPEClient.def

    r394f7a1 rcad08fb  
    1111  NSHandleCommand 
    1212  NSUnloadModule 
    13   NSGetConfigurationMeta 
    1413  NSGetModuleDescription 
    1514  NSCommandLineExec 
     15  NSDeleteBuffer 
  • modules/NRPEClient/stdafx.h

    r394f7a1 rcad08fb  
    2121#pragma once 
    2222 
    23 #define WIN32_LEAN_AND_MEAN   // Exclude rarely-used stuff from Windows headers 
    24 // Windows Header Files: 
    25 #include <windows.h> 
    26  
    2723#include <string> 
    2824#include <functional> 
    2925 
     26#include <boost/array.hpp> 
     27#include <boost/optional.hpp> 
     28#include <boost/bind.hpp> 
     29#include <program_options_ex.hpp> 
     30 
     31#include <boost/asio.hpp> 
     32#ifdef USE_SSL 
     33#include <boost/asio/ssl.hpp> 
     34#endif 
     35 
     36 
    3037#include <config.h> 
    3138#include <utils.h> 
     39#include <types.hpp> 
    3240 
    3341#include <NSCAPI.h> 
    34 #include <NSCHelper.h> 
     42#include <nscapi/plugin.hpp> 
     43namespace po = boost::program_options; 
    3544 
    36 #ifdef MEMCHECK 
    37 #include <vld.h> 
    38 #endif 
     45 
Note: See TracChangeset for help on using the changeset viewer.