Skip to content

Fixed some PostgreSQL issues #770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ Install()

# Binary install will use the previous generated code.
if [ "X${USER_BINARYINSTALL}" = "X" ]; then
${MAKEBIN} PREFIX=${INSTALLDIR} TARGET=${INSTYPE} build
# Add DATABASE=pgsql or DATABASE=mysql to add support for database
# alert entry
${MAKEBIN} PREFIX=${INSTALLDIR} TARGET=${INSTYPE} build
if [ $? != 0 ]; then
cd ../
catError "0x5-build"
Expand All @@ -113,7 +115,7 @@ Install()
UpdateStopOSSEC
fi

${MAKEBIN} PREFIX=${INSTALLDIR} TARGET=${INSTYPE} install
${MAKEBIN} PREFIX=${INSTALLDIR} TARGET=${INSTYPE} install

cd ../

Expand Down
3 changes: 1 addition & 2 deletions src/os_dbd/alert.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ int OS_Alert_InsertDB(const alert_data *al_data, DBConfig *db_config)
/* Generate final SQL */
snprintf(sql_query, OS_SIZE_8192,
"INSERT INTO "
"alert(server_id,rule_id,level,timestamp,location_id,src_ip,src_port,dst_ip,dst_port,alertid,user,full_log) "
"alert(server_id,rule_id,level,timestamp,location_id,src_ip,src_port,dst_ip,dst_port,alertid,\"user\",full_log) "
"VALUES ('%u', '%u','%u','%u', '%u', '%s', '%u', '%s', '%u', '%s', '%s', '%s')",
db_config->server_id, al_data->rule,
al_data->level,
Expand All @@ -180,4 +180,3 @@ int OS_Alert_InsertDB(const alert_data *al_data, DBConfig *db_config)
db_config->alert_id++;
return (1);
}

14 changes: 7 additions & 7 deletions src/os_dbd/postgresql.schema
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ CREATE TABLE signature
description VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);
CREATE INDEX level ON signature (level);
CREATE INDEX rule_id ON signature (rule_id);
CREATE INDEX signature_level ON signature (level);
CREATE INDEX signature_rule_id ON signature (rule_id);

CREATE TABLE signature_category_mapping
(
Expand Down Expand Up @@ -82,21 +82,21 @@ CREATE TABLE alert
level INT2,
timestamp INT8 NOT NULL,
location_id INT4 NOT NULL,
src_ip VARCHAR(46) NOT NULL,
dst_ip VARCHAR(46) NOT NULL,
src_ip VARCHAR(46),
dst_ip VARCHAR(46),
src_port INT4,
dst_port INT4,
alertid TEXT DEFAULT NULL,
"user" TEXT NOT NULL,
"user" TEXT,
full_log TEXT NOT NULL,
is_hidden INT2 NOT NULL DEFAULT '0',
tld VARCHAR(32) NOT NULL DEFAULT '',
PRIMARY KEY (id, server_id)
);
CREATE INDEX alertid on alert(alertid);
CREATE INDEX level on alert(level);
CREATE INDEX alert_level on alert(level);
CREATE INDEX timestamp on alert(timestamp);
CREATE INDEX rule_id on alert(rule_id);
CREATE INDEX alert_rule_id on alert(rule_id);
CREATE INDEX src_ip on alert(src_ip);
CREATE INDEX tld on alert(tld);

Expand Down