1 /* Copyright (C) 2009 Trend Micro Inc.
4 * This program is a free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General Public
6 * License (version 2) as published by the FSF - Free Software
11 #include "active-response.h"
13 /* Active response commands */
14 static OSList *ar_commands;
15 OSList *active_responses;
17 /* Initialize active response */
20 ar_commands = OSList_Create();
21 active_responses = OSList_Create();
24 if (!ar_commands || !active_responses) {
25 ErrorExit(LIST_ERROR, ARGV0);
29 /* Read active response configuration and write it
30 * to the appropriate lists.
32 int AR_ReadConfig(const char *cfgfile)
40 fp = fopen(DEFAULTARPATH, "w");
42 merror(FOPEN_ERROR, ARGV0, DEFAULTARPATH, errno, strerror(errno));
45 fprintf(fp, "restart-ossec0 - restart-ossec.sh - 0\n");
46 fprintf(fp, "restart-ossec0 - restart-ossec.cmd - 0\n");
49 /* Set right permission */
50 if (chmod(DEFAULTARPATH, 0440) == -1) {
51 merror(CHMOD_ERROR, ARGV0, DEFAULTARPATH, errno, strerror(errno));
55 /* Read configuration */
56 if (ReadConfig(modules, cfgfile, ar_commands, active_responses) < 0) {