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
10 #include "setup-shared.h"
11 #include "os_xml/os_xml.h"
13 #define OSSEC_CONFIG_TMP ".tmp.ossec.conf"
17 int main(int argc, char **argv)
20 const char *(xml_syscheck_status[]) = {"ossec_config", "syscheck", "disabled", NULL};
23 printf("%s: Invalid syntax.\n", argv[0]);
24 printf("Try: '%s <dir> [enable|disable]'\n\n", argv[0]);
28 /* Check for directory */
29 if (chdir(argv[1]) != 0) {
30 printf("%s: Invalid directory: '%s'.\n", argv[0], argv[1]);
34 /* Check if OSSEC-HIDS was installed already */
35 if (!fileexist(OSSECCONF)) {
36 printf("%s: OSSEC not installed yet. Exiting.\n", argv[0]);
41 if (strcmp(argv[2], "enable") == 0) {
47 /* Write to the config file */
48 if (OS_WriteXML(OSSECCONF, OSSEC_CONFIG_TMP, xml_syscheck_status,
50 printf("%s: Error writing to the Config file. Exiting.\n", argv[0]);
54 /* Rename config files */
56 rename(OSSECCONF, OSSECLAST);
57 rename(OSSEC_CONFIG_TMP, OSSECCONF);