Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

nsm_server_clear needs to configure SQueRT #126

Closed
GoogleCodeExporter opened this issue Mar 24, 2015 · 3 comments
Closed

nsm_server_clear needs to configure SQueRT #126

GoogleCodeExporter opened this issue Mar 24, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

mysql -N -B --user=root -e "GRANT SELECT ON securityonion_db.* TO 
'readonly'@'localhost' IDENTIFIED BY 'securityonion';"
mysql -N -B --user=root -e "GRANT ALL PRIVILEGES ON securityonion_db.mappings 
TO 'readonly'@'localhost' IDENTIFIED BY 'securityonion';"
mysql -N -B --user=root -e "GRANT ALL PRIVILEGES ON securityonion_db.ip2c TO 
'readonly'@'localhost';"
cat /var/www/squert/.scripts/db/squert.sql | mysql -uroot -U securityonion_db
cat /var/www/squert/.scripts/db/v0.8.sql | mysql -uroot -U securityonion_db
cd /var/www/squert/.scripts/Ip2c/
./ip2c.tcl &
cd -

Original issue reported on code.google.com by doug.bu...@gmail.com on 23 Sep 2011 at 12:21

@GoogleCodeExporter
Copy link
Author

Modified server_sguil_database_clear() function in 
/usr/local/lib/nsmnow/lib-nsm-server-utils as follows:


GRANT SELECT ON securityonion_db.* TO 'readonly'@'localhost' IDENTIFIED BY 
'securityonion';
GRANT ALL PRIVILEGES ON securityonion_db.mappings TO 'readonly'@'localhost' 
IDENTIFIED BY 'securityonion';
GRANT ALL PRIVILEGES ON securityonion_db.ip2c TO 'readonly'@'localhost';

CREATE TABLE IF NOT EXISTS ip2c
(
  registry  VARCHAR(7),
  cc        VARCHAR(2),
  c_long    VARCHAR(255),
  type      VARCHAR(4),
  start_ip  INT UNSIGNED NOT NULL DEFAULT 0,
  end_ip    INT UNSIGNED NOT NULL DEFAULT 0,
  date      DATETIME,
  status    VARCHAR(25),
  INDEX registry (registry),
  INDEX cc (cc),
  INDEX c_long (c_long),
  INDEX type (type),
  INDEX start_ip (start_ip),
  INDEX end_ip (end_ip)
);  

CREATE TABLE IF NOT EXISTS mappings
(
  registry       VARCHAR(7),
  cc             VARCHAR(2),
  c_long         VARCHAR(255),
  type           VARCHAR(4),
  ip             INT UNSIGNED NOT NULL DEFAULT 0,
  date           DATETIME,
  status         VARCHAR(25),
  age            TIMESTAMP,
  PRIMARY KEY (ip),
  INDEX registry (registry),
  INDEX cc (cc),
  INDEX c_long (c_long),
  INDEX age (age)
);

CREATE TABLE IF NOT EXISTS iprep
(
  id        TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
  list      VARCHAR(255),
  url       VARCHAR(255),
  weight    TINYINT(1) NOT NULL DEFAULT 0,
  user      VARCHAR(255),
  age           TIMESTAMP,      
  PRIMARY KEY (id)
);

ALTER TABLE user_info
ADD email VARCHAR(320) NOT NULL DEFAULT 'none',
ADD type ENUM('ADMIN','USER') NOT NULL DEFAULT 'USER',
ADD timeout SMALLINT UNSIGNED NOT NULL DEFAULT '1200';

EOF_SGUIL_DB

    # execute SQL script
    if [ -z "$MYSQL_NO_PASSWORD" ]
    then
        echo
        echo "Clearing the tables requires the password of the database root user"
        mysql -u root -p < /tmp/clear_sguil_db.sql
    else
        mysql -u root < /tmp/clear_sguil_db.sql
    fi
    RET=$?

    echo
    echo "Creating new database..."
    echo "Populating SQueRT IP-to-country mappings..."
    cd /var/www/squert/.scripts/Ip2c/
    ./ip2c.tcl
    cd ->/dev/null

    # clean up after ourselves
    rm -f /tmp/clear_sguil_db.sql

    return $RET
}

Original comment by doug.bu...@gmail.com on 23 Sep 2011 at 1:06

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Packaged into securityonion-nsmnow-admin-scripts_20110922_i386.deb

Original comment by doug.bu...@gmail.com on 23 Sep 2011 at 1:06

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Published:
http://securityonion.blogspot.com/2011/09/security-onion-20110922-now-available.
html

Original comment by doug.bu...@gmail.com on 23 Sep 2011 at 2:20

  • Changed state: Verified
  • Added labels: ****
  • Removed labels: ****

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant