adding postgres support for msf
git-svn-id: https://beef.googlecode.com/svn/trunk@1061 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9
This commit is contained in:
30
README.databases
Normal file
30
README.databases
Normal file
@@ -0,0 +1,30 @@
|
||||
MySQL Notes:
|
||||
* It's recommended to install MySQL >= 5.5.x
|
||||
* Your system will require MySQL, MySQL-Server, MySQL-Devel and Ruby's MySQL libraries installed
|
||||
* You will also need to "sudo gem install dm-mysql-adapter"
|
||||
|
||||
* UTF8 notes. Update/Add in my.cnf (or my.ini on Win) the following. Then save and reboot MySQL.
|
||||
- Read more here: http://cameronyule.com/2008/07/configuring-mysql-to-use-utf-8
|
||||
[mysql]
|
||||
default-character-set=utf8
|
||||
[mysqld]
|
||||
character-set-server=utf8
|
||||
collation-server=utf8_general_ci
|
||||
init-connect='SET NAMES utf8'
|
||||
[client]
|
||||
default-character-set=utf8
|
||||
|
||||
* Please note that the db must exists. Schema will be created automatically.
|
||||
mysql> CREATE DATABASE beef CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
mysql> grant all privileges on beef.* to 'beef'@'localhost' identified by 'beef123';
|
||||
|
||||
|
||||
|
||||
Postgres Notes
|
||||
* You will need to install the postgresql package as well as the libpq-dev package
|
||||
* You will need to "sudo gem install dm-postgres-adapter"
|
||||
* As the postgres user:
|
||||
- createuser -P beef
|
||||
- createdb --owner=beef beef
|
||||
* you may also need to change the pg_hba.conf file in /etc/postgresql so that the local all all optionis labeled as either trust or md5
|
||||
|
||||
18
beef
18
beef
@@ -45,20 +45,20 @@ BeEF::Modules.load
|
||||
Socket.do_not_reverse_lookup = true
|
||||
|
||||
# setup database
|
||||
case config.get("beef.database.default")
|
||||
case config.get("beef.database.driver")
|
||||
when "sqlite"
|
||||
DataMapper.setup(:default, "sqlite3://#{$root_dir}/#{config.get("beef.database.sqlite.db_name")}")
|
||||
when "mysql"
|
||||
DataMapper.setup(:default, "sqlite3://#{$root_dir}/#{config.get("beef.database.db_file")}")
|
||||
when "mysql","postgres"
|
||||
# === Remove comment of next line for logging queries (very verbose) ===
|
||||
# DataMapper::Logger.new($stdout, :debug)
|
||||
#
|
||||
DataMapper.setup(:default,
|
||||
:adapter => 'mysql',
|
||||
:host => config.get("beef.database.mysql.db_host"),
|
||||
:username => config.get("beef.database.mysql.db_user"),
|
||||
:password => config.get("beef.database.mysql.db_passwd"),
|
||||
:database => config.get("beef.database.mysql.db_name"),
|
||||
:encoding => config.get("beef.database.mysql.db_encoding")
|
||||
:adapter => config.get("beef.database.driver"),
|
||||
:host => config.get("beef.database.db_host"),
|
||||
:username => config.get("beef.database.db_user"),
|
||||
:password => config.get("beef.database.db_passwd"),
|
||||
:database => config.get("beef.database.db_name"),
|
||||
:encoding => config.get("beef.database.db_encoding")
|
||||
)
|
||||
else
|
||||
print_error 'No default database selected. Please add one in config.yaml'
|
||||
|
||||
46
config.yaml
46
config.yaml
@@ -39,39 +39,21 @@ beef:
|
||||
session_cookie_name: "BEEFSESSION"
|
||||
|
||||
database:
|
||||
#supported DBs: sqlite, mysql
|
||||
|
||||
default: "sqlite"
|
||||
# MySQL Notes:
|
||||
# It's recommended to install MySQL >= 5.5.x
|
||||
# Your system will require MySQL, MySQL-Server, MySQL-Devel and Ruby's MySQL libraries installed
|
||||
# You will also need to "sudo gem install dm-mysql-adapter"
|
||||
#
|
||||
# UTF8 notes. Update/Add in my.cnf (or my.ini on Win) the following. Then save and reboot MySQL.
|
||||
# Read more here: http://cameronyule.com/2008/07/configuring-mysql-to-use-utf-8
|
||||
# [mysql]
|
||||
# default-character-set=utf8
|
||||
# [mysqld]
|
||||
# character-set-server=utf8
|
||||
# collation-server=utf8_general_ci
|
||||
# init-connect='SET NAMES utf8'
|
||||
# [client]
|
||||
# default-character-set=utf8
|
||||
#
|
||||
# Please note that the db must exists. Schema will be created automatically.
|
||||
# mysql> CREATE DATABASE beef CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
# mysql> grant all privileges on beef.* to 'beef'@'localhost' identified by 'beef123';
|
||||
#
|
||||
|
||||
mysql:
|
||||
db_host: "localhost"
|
||||
db_name: "beef"
|
||||
db_user: "beef"
|
||||
db_passwd: "beef123"
|
||||
db_encoding: "UTF-8"
|
||||
# For information on using other databases please read the
|
||||
# README.databases file
|
||||
|
||||
sqlite:
|
||||
db_name: "beef.db"
|
||||
# supported DBs: sqlite, mysql, postgres
|
||||
driver: "sqlite"
|
||||
|
||||
# db_file is only used for sqlite
|
||||
db_file: "beef.db"
|
||||
|
||||
# db connection information is only used for mysql/postgres
|
||||
db_host: "localhost"
|
||||
db_name: "beef"
|
||||
db_user: "beef"
|
||||
db_passwd: "beef123"
|
||||
db_encoding: "UTF-8"
|
||||
|
||||
crypto_default_value_length: 80
|
||||
|
||||
|
||||
Reference in New Issue
Block a user