Skip to content

Commit

Permalink
Merge branch 'master' into openbsd_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
mrash committed Jun 12, 2012
2 parents 3629699 + 99ac4ab commit bb32fda
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CREDITS
Expand Up @@ -471,3 +471,7 @@ Lukas Baxa
- Suggested the ability to have install.pl read answers to queries from a - Suggested the ability to have install.pl read answers to queries from a
file in the filesystem in order to support easy automated installs of file in the filesystem in order to support easy automated installs of
psad. psad.

Kat
- Reported 'Could not resolve sub-var: INSTALL_ROOT to a value' error in
the legacy kmsgsd daemon for psad-2.2.
20 changes: 20 additions & 0 deletions kmsgsd.c
Expand Up @@ -49,6 +49,7 @@ char psadfifo_file[MAX_PATH_LEN];
char fwdata_file[MAX_PATH_LEN]; char fwdata_file[MAX_PATH_LEN];
char fw_search_file[MAX_PATH_LEN]; char fw_search_file[MAX_PATH_LEN];
char snort_sid_str[MAX_PATH_LEN]; char snort_sid_str[MAX_PATH_LEN];
char install_root[MAX_PATH_LEN];
char psad_dir[MAX_PATH_LEN]; char psad_dir[MAX_PATH_LEN];
char psad_fifo_dir[MAX_PATH_LEN]; char psad_fifo_dir[MAX_PATH_LEN];
char psad_run_dir[MAX_PATH_LEN]; char psad_run_dir[MAX_PATH_LEN];
Expand Down Expand Up @@ -307,6 +308,7 @@ static void parse_config(char * file)
if ((*index != '#') && (*index != '\n') && if ((*index != '#') && (*index != '\n') &&
(*index != ';') && (index != NULL)) { (*index != ';') && (index != NULL)) {


find_char_var("INSTALL_ROOT", install_root, index);
find_char_var("PSAD_DIR", psad_dir, index); find_char_var("PSAD_DIR", psad_dir, index);
find_char_var("PSAD_FIFO_DIR", psad_fifo_dir, index); find_char_var("PSAD_FIFO_DIR", psad_fifo_dir, index);
find_char_var("PSAD_RUN_DIR", psad_run_dir, index); find_char_var("PSAD_RUN_DIR", psad_run_dir, index);
Expand Down Expand Up @@ -347,6 +349,12 @@ static void expand_config_vars(void)
} }
found_sub_var = 0; found_sub_var = 0;


if (has_sub_var("INSTALL_ROOT", install_root, sub_var,
pre_str, post_str)) {
find_sub_var_value(install_root, sub_var, pre_str, post_str);
found_sub_var = 1;
}

if (has_sub_var("SNORT_SID_STR", snort_sid_str, sub_var, if (has_sub_var("SNORT_SID_STR", snort_sid_str, sub_var,
pre_str, post_str)) { pre_str, post_str)) {
find_sub_var_value(snort_sid_str, sub_var, pre_str, post_str); find_sub_var_value(snort_sid_str, sub_var, pre_str, post_str);
Expand Down Expand Up @@ -384,6 +392,9 @@ static void find_sub_var_value(char *value, char *sub_var, char *pre_str,
} else if (strncmp(sub_var, "PSAD_FIFO_DIR", MAX_GEN_LEN) == 0) { } else if (strncmp(sub_var, "PSAD_FIFO_DIR", MAX_GEN_LEN) == 0) {
strlcpy(sub_var, psad_fifo_dir, MAX_GEN_LEN); strlcpy(sub_var, psad_fifo_dir, MAX_GEN_LEN);
found_var = 1; found_var = 1;
} else if (strncmp(sub_var, "INSTALL_ROOT", MAX_GEN_LEN) == 0) {
strlcpy(sub_var, install_root, MAX_GEN_LEN);
found_var = 1;
} else if (strncmp(sub_var, "PSAD_RUN_DIR", MAX_GEN_LEN) == 0) { } else if (strncmp(sub_var, "PSAD_RUN_DIR", MAX_GEN_LEN) == 0) {
strlcpy(sub_var, psad_run_dir, MAX_GEN_LEN); strlcpy(sub_var, psad_run_dir, MAX_GEN_LEN);
found_var = 1; found_var = 1;
Expand Down Expand Up @@ -417,7 +428,9 @@ static void find_sub_var_value(char *value, char *sub_var, char *pre_str,
static void dump_config(void) static void dump_config(void)
{ {
fprintf(stderr, "[+] dump_config()\n"); fprintf(stderr, "[+] dump_config()\n");
fprintf(stderr, " INSTALL_ROOT: %s\n", install_root);
fprintf(stderr, " PSAD_DIR: %s\n", psad_dir); fprintf(stderr, " PSAD_DIR: %s\n", psad_dir);
fprintf(stderr, " PSAD_RUN_DIR: %s\n", psad_run_dir);
fprintf(stderr, " PSAD_FIFO_FILE: %s\n", psadfifo_file); fprintf(stderr, " PSAD_FIFO_FILE: %s\n", psadfifo_file);
fprintf(stderr, " FW_DATA_FILE: %s\n", fwdata_file); fprintf(stderr, " FW_DATA_FILE: %s\n", fwdata_file);
fprintf(stderr, " SNORT_SID_STR: %s\n", snort_sid_str); fprintf(stderr, " SNORT_SID_STR: %s\n", snort_sid_str);
Expand All @@ -438,6 +451,12 @@ static void check_config(void)
if (psad_dir[0] == '\0') if (psad_dir[0] == '\0')
fprintf(stderr, "[*] Could not find PSAD_DIR\n"); fprintf(stderr, "[*] Could not find PSAD_DIR\n");


else if (install_root[0] == '\0')
fprintf(stderr, "[*] Could not find INSTALL_ROOT\n");

else if (psad_run_dir[0] == '\0')
fprintf(stderr, "[*] Could not find PSAD_RUN_DIR\n");

else if (psadfifo_file[0] == '\0') else if (psadfifo_file[0] == '\0')
fprintf(stderr, "[*] Could not find PSAD_FIFO_FILE\n"); fprintf(stderr, "[*] Could not find PSAD_FIFO_FILE\n");


Expand Down Expand Up @@ -483,6 +502,7 @@ static void clean_settings (void)


*psad_dir = '\0'; *psad_dir = '\0';
*psad_fifo_dir = '\0'; *psad_fifo_dir = '\0';
*install_root = '\0';
*psad_run_dir = '\0'; *psad_run_dir = '\0';
*psadfifo_file = '\0'; *psadfifo_file = '\0';
*fwdata_file = '\0'; *fwdata_file = '\0';
Expand Down
4 changes: 3 additions & 1 deletion psad.conf
Expand Up @@ -61,7 +61,9 @@ FW_MSG_SEARCH DROP;


### Set the type of syslog daemon that is used. The SYSLOG_DAEMON ### Set the type of syslog daemon that is used. The SYSLOG_DAEMON
### variable accepts four possible values: syslogd, syslog-ng, ulogd, ### variable accepts four possible values: syslogd, syslog-ng, ulogd,
### or metalog. ### or metalog. Note: this variable is only used if ENABLE_SYSLOG_FILE is
### disabled, and this in turn will mean that the legacy kmsgsd daemon will
### collect firewall logs from syslog via the old named pipe mechanism.
SYSLOG_DAEMON syslogd; SYSLOG_DAEMON syslogd;


### What type of interface configuration do you use? Set this variable to ### What type of interface configuration do you use? Set this variable to
Expand Down

0 comments on commit bb32fda

Please sign in to comment.