sentry 0.2.9 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/README +16 -10
- data/RUNNING_UNIT_TESTS +11 -10
- data/lib/sentry/asymmetric_sentry.rb +5 -3
- data/test/abstract_unit.rb +16 -8
- data/test/database.yml +18 -0
- data/test/debug.log +86 -0
- data/test/schema.rb +10 -0
- data/test/{fixtures/activerecord_sentry.sqlite → sentry_plugin.sqlite.db} +0 -0
- metadata +6 -26
- data/test/connections/native_db2/connection.rb +0 -14
- data/test/connections/native_mysql/connection.rb +0 -14
- data/test/connections/native_oci/connection.rb +0 -15
- data/test/connections/native_postgresql/connection.rb +0 -14
- data/test/connections/native_sqlite/connection.rb +0 -34
- data/test/connections/native_sqlite3/connection.rb +0 -33
- data/test/connections/native_sqlserver/connection.rb +0 -14
- data/test/connections/native_sqlserver_odbc/connection.rb +0 -15
- data/test/fixtures/activerecord_sentry.sqlite3 +0 -0
- data/test/fixtures/db_definitions/postgresql.drop.sql +0 -1
- data/test/fixtures/db_definitions/postgresql.sql +0 -8
- data/test/fixtures/db_definitions/sqlite.drop.sql +0 -1
- data/test/fixtures/db_definitions/sqlite.sql +0 -7
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -3,21 +3,27 @@
|
|
3
3
|
Sentry is a simple wrapper around the mostly undocumented OpenSSL encryption classes.
|
4
4
|
For now, look at the pseudo test cases in sentry.rb until I can get more examples written out.
|
5
5
|
|
6
|
-
==
|
6
|
+
== Resources
|
7
7
|
|
8
|
-
|
8
|
+
Install
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
* gem install sentry
|
11
|
+
|
12
|
+
Rubyforge project
|
13
|
+
|
14
|
+
* http://rubyforge.org/projects/sentry
|
15
|
+
|
16
|
+
RDocs
|
17
|
+
|
18
|
+
* http://sentry.rubyforge.org
|
13
19
|
|
14
|
-
|
20
|
+
Subversion
|
15
21
|
|
16
|
-
|
22
|
+
* http://techno-weenie.net/svn/projects/sentry
|
17
23
|
|
18
|
-
|
24
|
+
Collaboa
|
19
25
|
|
20
|
-
|
26
|
+
* http://collaboa.techno-weenie.net/repository/browse/sentry
|
21
27
|
|
22
28
|
== Using with ActiveRecord
|
23
29
|
|
@@ -45,7 +51,7 @@ This is a shortcut for using an asymmetrical algorithm with a private/public key
|
|
45
51
|
private key with Sentry::AsymmetricalSentry.save_random_rsa_key(private_key_file, public_key_file). If you want to encrypt the
|
46
52
|
private key file with a symmetrical algorithm, pass a secret key (neither the key nor the decrypted value will be stored).
|
47
53
|
|
48
|
-
Sentry::
|
54
|
+
Sentry::AsymmetricSentry.save_random_rsa_key(private_key_file, public_key_file, :key => 'secret_password')
|
49
55
|
|
50
56
|
What that does, is requires you to pass in that same secret password when accesing the method.
|
51
57
|
|
data/RUNNING_UNIT_TESTS
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
== Creating the test database
|
2
2
|
|
3
|
-
The default name for the test databases is "
|
3
|
+
The default name for the test databases is "sentry_plugin_test". If you
|
4
4
|
want to use another database name then be sure to update the connection
|
5
|
-
adapter setups you want to test with in test/
|
6
|
-
When you have the database online, you can import the fixture tables with
|
7
|
-
the test/fixtures/db_definitions/*.sql files.
|
5
|
+
adapter setups you want to test with in test/database.yml.
|
8
6
|
|
9
7
|
Make sure that you create database objects with the same user that you specified in i
|
10
|
-
|
8
|
+
database.yml otherwise (on Postgres, at least) tests for default values will fail.
|
11
9
|
|
12
10
|
== Running with Rake
|
13
11
|
|
14
12
|
The easiest way to run the unit tests is through Rake. The default task runs
|
15
|
-
the entire test suite for
|
16
|
-
one adapter by
|
17
|
-
|
13
|
+
the entire test suite for the sqlite adapter. You can also run the suite on just
|
14
|
+
one adapter by passing the DB environment variable.
|
15
|
+
|
16
|
+
rake test DB=mysql
|
17
|
+
|
18
|
+
For more information, checkout the full array of rake tasks with "rake -T"
|
18
19
|
|
19
20
|
Rake can be found at http://rake.rubyforge.org
|
20
21
|
|
@@ -23,9 +24,9 @@ Rake can be found at http://rake.rubyforge.org
|
|
23
24
|
Unit tests are located in test directory. If you only want to run a single test suite,
|
24
25
|
or don't want to bother with Rake, you can do so with something like:
|
25
26
|
|
26
|
-
|
27
|
+
cd test; DB=mysql ruby base_test.rb
|
27
28
|
|
28
|
-
That'll run the base suite using the MySQL
|
29
|
+
That'll run the base suite using the MySQL adapter. Change the adapter
|
29
30
|
and test suite name as needed.
|
30
31
|
|
31
32
|
== Faster tests
|
@@ -60,9 +60,11 @@ module Sentry
|
|
60
60
|
def save_random_rsa_key(private_key_file, public_key_file, options = {})
|
61
61
|
rsa = OpenSSL::PKey::RSA.new(512)
|
62
62
|
public_key = rsa.public_key
|
63
|
-
private_key = options[:key] ?
|
64
|
-
|
65
|
-
rsa.to_s
|
63
|
+
private_key = options[:key].to_s.empty? ?
|
64
|
+
rsa.to_s :
|
65
|
+
SymmetricSentry.new(:algorithm => options[:symmetric_algorithm]).encrypt_to_base64(rsa.to_s, options[:key])
|
66
|
+
require 'breakpoint'
|
67
|
+
breakpoint
|
66
68
|
File.open(public_key_file, 'w') { |f| f.write(public_key) }
|
67
69
|
File.open(private_key_file, 'w') { |f| f.write(private_key) }
|
68
70
|
end
|
data/test/abstract_unit.rb
CHANGED
@@ -6,20 +6,28 @@ require 'active_record'
|
|
6
6
|
require 'active_record/fixtures'
|
7
7
|
require 'active_support/binding_of_caller'
|
8
8
|
require 'active_support/breakpoint'
|
9
|
-
require
|
10
|
-
|
9
|
+
require "#{File.dirname(__FILE__)}/../lib/sentry"
|
10
|
+
|
11
|
+
config_location = File.dirname(__FILE__) + '/database.yml'
|
12
|
+
|
13
|
+
config = YAML::load(IO.read(config_location))
|
14
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
15
|
+
ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite'])
|
16
|
+
|
17
|
+
load(File.dirname(__FILE__) + "/schema.rb")
|
18
|
+
|
19
|
+
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
|
20
|
+
Test::Unit::TestCase.use_instantiated_fixtures = false
|
21
|
+
Test::Unit::TestCase.use_transactional_fixtures = (ENV['AR_TX_FIXTURES'] == "yes")
|
22
|
+
$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
|
11
23
|
|
12
24
|
class Test::Unit::TestCase #:nodoc:
|
13
25
|
def create_fixtures(*table_names)
|
14
26
|
if block_given?
|
15
|
-
Fixtures.create_fixtures(
|
27
|
+
Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
|
16
28
|
else
|
17
|
-
Fixtures.create_fixtures(
|
29
|
+
Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
|
18
30
|
end
|
19
31
|
end
|
20
32
|
end
|
21
33
|
|
22
|
-
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
|
23
|
-
Test::Unit::TestCase.use_instantiated_fixtures = false
|
24
|
-
Test::Unit::TestCase.use_transactional_fixtures = (ENV['AR_TX_FIXTURES'] == "yes")
|
25
|
-
|
data/test/database.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
sqlite:
|
2
|
+
:adapter: sqlite
|
3
|
+
:dbfile: sentry_plugin.sqlite.db
|
4
|
+
sqlite3:
|
5
|
+
:adapter: sqlite3
|
6
|
+
:dbfile: sentry_plugin.sqlite3.db
|
7
|
+
postgresql:
|
8
|
+
:adapter: postgresql
|
9
|
+
:username: postgres
|
10
|
+
:password: postgres
|
11
|
+
:database: sentry_plugin_test
|
12
|
+
:min_messages: ERROR
|
13
|
+
mysql:
|
14
|
+
:adapter: mysql
|
15
|
+
:host: localhost
|
16
|
+
:username: rails
|
17
|
+
:password:
|
18
|
+
:database: sentry_plugin_test
|
data/test/debug.log
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Logfile created on Sat Oct 29 09:08:51 CDT 2005 by logger.rb/1.5.2.4
|
2
|
+
[4;36;1mSQL (0.191909)[0m [0;1mDROP TABLE users[0m
|
3
|
+
[4;35;1mSQL (0.002950)[0m [0mCREATE TABLE users (id INTEGER PRIMARY KEY NOT NULL, crypted_password varchar(255), crypted_creditcard varchar(255), login varchar(50), type varchar(20)) [0m
|
4
|
+
[4;36;1mSQL (0.000000)[0m [0;1mtable schema_info already exists: CREATE TABLE schema_info (version integer)[0m
|
5
|
+
[4;35;1mSQL (0.000688)[0m [0mPRAGMA table_info(schema_info)[0m
|
6
|
+
[4;36;1mSQL (0.003226)[0m [0;1mUPDATE schema_info SET version = 1[0m
|
7
|
+
[4;35;1mUser Load (0.001195)[0m [0mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
8
|
+
[4;36;1mSQL (0.001331)[0m [0;1mPRAGMA table_info(users)[0m
|
9
|
+
[4;35;1mUser Load (0.001179)[0m [0mSELECT * FROM users WHERE (users.id = 2) LIMIT 1[0m
|
10
|
+
[4;36;1mSQL (0.001179)[0m [0;1mPRAGMA table_info(users)[0m
|
11
|
+
[4;35;1mSQL (0.000573)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES(NULL, NULL, NULL, 'jones')[0m
|
12
|
+
[4;36;1mUser Update (0.001806)[0m [0;1mUPDATE users SET 'login' = 'jones', 'type' = NULL, 'crypted_password' = NULL, 'crypted_creditcard' = 'KUOKbSP2XPiYKSzxcopQBLnJD+IyhHycAAerMdzDahbg3u99l4YpuYfezO8C
|
13
|
+
DQOvyxZ45VjD/7L1rvHcXlkyYw==
|
14
|
+
' WHERE id = 3[0m
|
15
|
+
[4;35;1mSQL (0.000540)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES(NULL, NULL, NULL, 'jones')[0m
|
16
|
+
[4;36;1mUser Update (0.001746)[0m [0;1mUPDATE users SET 'login' = 'jones', 'type' = NULL, 'crypted_password' = NULL, 'crypted_creditcard' = 'B5cvT3e38Mf2Ck44ld3ZGpaM8ubnzLuri+zHqaPQUmEU9SkD4/Ff9idx7LJF
|
17
|
+
5Zv9wchYUzG7vh0++25TU3e7cg==
|
18
|
+
' WHERE id = 3[0m
|
19
|
+
[4;35;1mUser Load (0.001146)[0m [0mSELECT * FROM users WHERE (users.id = 2) LIMIT 1[0m
|
20
|
+
[4;36;1mUser Load (0.001099)[0m [0;1mSELECT * FROM users WHERE (users.id = 2) LIMIT 1[0m
|
21
|
+
[4;35;1mUser Load (0.001175)[0m [0mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
22
|
+
[4;36;1mSQL (0.001334)[0m [0;1mPRAGMA table_info(users)[0m
|
23
|
+
[4;35;1mSQL (0.000558)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'ShaUser', NULL, 'bob')[0m
|
24
|
+
[4;36;1mSQL (0.001294)[0m [0;1mPRAGMA table_info(users)[0m
|
25
|
+
[4;35;1mSQL (0.000570)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'DangerousUser', NULL, 'bob')[0m
|
26
|
+
[4;36;1mUser Load (0.001139)[0m [0;1mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
27
|
+
[4;35;1mSQL (0.000537)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('0XlmUuNpE2k=
|
28
|
+
', 'SymmetricUser', NULL, 'bob')[0m
|
29
|
+
[4;36;1mUser Load (0.001262)[0m [0;1mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
30
|
+
[4;35;1mUser Load (0.001121)[0m [0mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
31
|
+
[4;36;1mSQL (0.119978)[0m [0;1mDROP TABLE users[0m
|
32
|
+
[4;35;1mSQL (0.026073)[0m [0mCREATE TABLE users (id INTEGER PRIMARY KEY NOT NULL, crypted_password varchar(255), crypted_creditcard varchar(255), login varchar(50), type varchar(20)) [0m
|
33
|
+
[4;36;1mSQL (0.000000)[0m [0;1mtable schema_info already exists: CREATE TABLE schema_info (version integer)[0m
|
34
|
+
[4;35;1mSQL (0.000674)[0m [0mPRAGMA table_info(schema_info)[0m
|
35
|
+
[4;36;1mSQL (0.004633)[0m [0;1mUPDATE schema_info SET version = 1[0m
|
36
|
+
[4;35;1mUser Load (0.001196)[0m [0mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
37
|
+
[4;36;1mSQL (0.001339)[0m [0;1mPRAGMA table_info(users)[0m
|
38
|
+
[4;35;1mUser Load (0.001147)[0m [0mSELECT * FROM users WHERE (users.id = 2) LIMIT 1[0m
|
39
|
+
[4;36;1mSQL (0.001198)[0m [0;1mPRAGMA table_info(users)[0m
|
40
|
+
[4;35;1mSQL (0.000582)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES(NULL, NULL, NULL, 'jones')[0m
|
41
|
+
[4;36;1mUser Update (0.001720)[0m [0;1mUPDATE users SET 'login' = 'jones', 'type' = NULL, 'crypted_password' = NULL, 'crypted_creditcard' = 'DLIh4equrhSTs6yK2f+w82K4xt7bROoHbkYXp+eynjF0FD9WRv4Ont5bOSDZ
|
42
|
+
QjyBWLYsekOqbR+EbIkEmNcHeA==
|
43
|
+
' WHERE id = 3[0m
|
44
|
+
[4;35;1mSQL (0.000573)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES(NULL, NULL, NULL, 'jones')[0m
|
45
|
+
[4;36;1mUser Update (0.001698)[0m [0;1mUPDATE users SET 'login' = 'jones', 'type' = NULL, 'crypted_password' = NULL, 'crypted_creditcard' = 'eQOiEbqm6S9YylKEIY/uKIamJoNWmb0x2Zth+N8LCEoZRh66bQFfyh4H1k5r
|
46
|
+
p5HUIZpNnol1bMhVtqWG31lWjw==
|
47
|
+
' WHERE id = 3[0m
|
48
|
+
[4;35;1mUser Load (0.001134)[0m [0mSELECT * FROM users WHERE (users.id = 2) LIMIT 1[0m
|
49
|
+
[4;36;1mUser Load (0.001122)[0m [0;1mSELECT * FROM users WHERE (users.id = 2) LIMIT 1[0m
|
50
|
+
[4;35;1mUser Load (0.001154)[0m [0mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
51
|
+
[4;36;1mSQL (0.001791)[0m [0;1mPRAGMA table_info(users)[0m
|
52
|
+
[4;35;1mSQL (0.000602)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'ShaUser', NULL, 'bob')[0m
|
53
|
+
[4;36;1mSQL (0.001591)[0m [0;1mPRAGMA table_info(users)[0m
|
54
|
+
[4;35;1mSQL (0.000550)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'DangerousUser', NULL, 'bob')[0m
|
55
|
+
[4;36;1mUser Load (0.003733)[0m [0;1mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
56
|
+
[4;35;1mSQL (0.000532)[0m [0mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('0XlmUuNpE2k=
|
57
|
+
', 'SymmetricUser', NULL, 'bob')[0m
|
58
|
+
[4;36;1mUser Load (0.001268)[0m [0;1mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
59
|
+
[4;35;1mUser Load (0.001492)[0m [0mSELECT * FROM users WHERE (users.id = 1) LIMIT 1[0m
|
60
|
+
[4;36;1mSQL (0.208598)[0m [0;1mDROP TABLE users[0m
|
61
|
+
[4;35;1mSQL (0.003186)[0m [0mCREATE TABLE users (id INTEGER PRIMARY KEY NOT NULL, crypted_password varchar(255), crypted_creditcard varchar(255), login varchar(50), type varchar(20)) [0m
|
62
|
+
[4;36;1mSQL (0.000000)[0m [0;1mtable schema_info already exists: CREATE TABLE schema_info (version integer)[0m
|
63
|
+
[4;35;1mSQL (0.000686)[0m [0mPRAGMA table_info(schema_info)[0m
|
64
|
+
[4;36;1mSQL (0.003169)[0m [0;1mUPDATE schema_info SET version = 1[0m
|
65
|
+
[4;35;1mSQL (0.001369)[0m [0mPRAGMA table_info(users)[0m
|
66
|
+
[4;36;1mSQL (0.000543)[0m [0;1mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'ShaUser', NULL, 'bob')[0m
|
67
|
+
[4;35;1mSQL (0.001211)[0m [0mPRAGMA table_info(users)[0m
|
68
|
+
[4;36;1mSQL (0.000614)[0m [0;1mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'DangerousUser', NULL, 'bob')[0m
|
69
|
+
[4;36;1mSQL (0.208579)[0m [0;1mDROP TABLE users[0m
|
70
|
+
[4;35;1mSQL (0.003693)[0m [0mCREATE TABLE users (id INTEGER PRIMARY KEY NOT NULL, crypted_password varchar(255), crypted_creditcard varchar(255), login varchar(50), type varchar(20)) [0m
|
71
|
+
[4;36;1mSQL (0.000000)[0m [0;1mtable schema_info already exists: CREATE TABLE schema_info (version integer)[0m
|
72
|
+
[4;35;1mSQL (0.000644)[0m [0mPRAGMA table_info(schema_info)[0m
|
73
|
+
[4;36;1mSQL (0.003024)[0m [0;1mUPDATE schema_info SET version = 1[0m
|
74
|
+
[4;35;1mSQL (0.002309)[0m [0mPRAGMA table_info(users)[0m
|
75
|
+
[4;36;1mSQL (0.000523)[0m [0;1mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'ShaUser', NULL, 'bob')[0m
|
76
|
+
[4;35;1mSQL (0.001247)[0m [0mPRAGMA table_info(users)[0m
|
77
|
+
[4;36;1mSQL (0.000551)[0m [0;1mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'DangerousUser', NULL, 'bob')[0m
|
78
|
+
[4;36;1mSQL (0.004938)[0m [0;1mDROP TABLE users[0m
|
79
|
+
[4;35;1mSQL (0.003801)[0m [0mCREATE TABLE users (id INTEGER PRIMARY KEY NOT NULL, crypted_password varchar(255), crypted_creditcard varchar(255), login varchar(50), type varchar(20)) [0m
|
80
|
+
[4;36;1mSQL (0.000000)[0m [0;1mtable schema_info already exists: CREATE TABLE schema_info (version integer)[0m
|
81
|
+
[4;35;1mSQL (0.000648)[0m [0mPRAGMA table_info(schema_info)[0m
|
82
|
+
[4;36;1mSQL (0.003591)[0m [0;1mUPDATE schema_info SET version = 1[0m
|
83
|
+
[4;35;1mSQL (0.001882)[0m [0mPRAGMA table_info(users)[0m
|
84
|
+
[4;36;1mSQL (0.000592)[0m [0;1mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'ShaUser', NULL, 'bob')[0m
|
85
|
+
[4;35;1mSQL (0.001319)[0m [0mPRAGMA table_info(users)[0m
|
86
|
+
[4;36;1mSQL (0.000643)[0m [0;1mINSERT INTO users ('crypted_password', 'type', 'crypted_creditcard', 'login') VALUES('f438229716cab43569496f3a3630b3727524b81b', 'DangerousUser', NULL, 'bob')[0m
|
data/test/schema.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 1) do
|
2
|
+
|
3
|
+
create_table "users", :force => true do |t|
|
4
|
+
t.column :crypted_password, :string, :limit => 255
|
5
|
+
t.column :crypted_creditcard, :string, :limit => 255
|
6
|
+
t.column :login, :string, :limit => 50
|
7
|
+
t.column :type, :string, :limit => 20
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: sentry
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2005-
|
6
|
+
version: "0.3"
|
7
|
+
date: 2005-10-29
|
8
8
|
summary: Sentry provides painless encryption services with a wrapper around some OpenSSL classes
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -39,38 +39,18 @@ files:
|
|
39
39
|
- test/abstract_unit.rb
|
40
40
|
- test/asymmetric_sentry_callback_test.rb
|
41
41
|
- test/asymmetric_sentry_test.rb
|
42
|
-
- test/
|
42
|
+
- test/database.yml
|
43
|
+
- test/debug.log
|
43
44
|
- test/fixtures
|
44
45
|
- test/keys
|
46
|
+
- test/schema.rb
|
47
|
+
- test/sentry_plugin.sqlite.db
|
45
48
|
- test/sha_sentry_test.rb
|
46
49
|
- test/symmetric_sentry_callback_test.rb
|
47
50
|
- test/symmetric_sentry_test.rb
|
48
51
|
- test/tests.rb
|
49
|
-
- test/connections/native_db2
|
50
|
-
- test/connections/native_mysql
|
51
|
-
- test/connections/native_oci
|
52
|
-
- test/connections/native_postgresql
|
53
|
-
- test/connections/native_sqlite
|
54
|
-
- test/connections/native_sqlite3
|
55
|
-
- test/connections/native_sqlserver
|
56
|
-
- test/connections/native_sqlserver_odbc
|
57
|
-
- test/connections/native_db2/connection.rb
|
58
|
-
- test/connections/native_mysql/connection.rb
|
59
|
-
- test/connections/native_oci/connection.rb
|
60
|
-
- test/connections/native_postgresql/connection.rb
|
61
|
-
- test/connections/native_sqlite/connection.rb
|
62
|
-
- test/connections/native_sqlite3/connection.rb
|
63
|
-
- test/connections/native_sqlserver/connection.rb
|
64
|
-
- test/connections/native_sqlserver_odbc/connection.rb
|
65
|
-
- test/fixtures/activerecord_sentry.sqlite
|
66
|
-
- test/fixtures/activerecord_sentry.sqlite3
|
67
|
-
- test/fixtures/db_definitions
|
68
52
|
- test/fixtures/user.rb
|
69
53
|
- test/fixtures/users.yml
|
70
|
-
- test/fixtures/db_definitions/postgresql.drop.sql
|
71
|
-
- test/fixtures/db_definitions/postgresql.sql
|
72
|
-
- test/fixtures/db_definitions/sqlite.drop.sql
|
73
|
-
- test/fixtures/db_definitions/sqlite.sql
|
74
54
|
- test/keys/encrypted_private
|
75
55
|
- test/keys/encrypted_public
|
76
56
|
- test/keys/private
|
@@ -1,14 +0,0 @@
|
|
1
|
-
print "Using native DB2\n"
|
2
|
-
require 'logger'
|
3
|
-
|
4
|
-
ActiveRecord::Base.logger = Logger.new("debug.log")
|
5
|
-
|
6
|
-
db1 = 'arsentry'
|
7
|
-
|
8
|
-
ActiveRecord::Base.establish_connection(
|
9
|
-
:adapter => "db2",
|
10
|
-
:host => "localhost",
|
11
|
-
:username => "arunit",
|
12
|
-
:password => "arunit",
|
13
|
-
:database => db1
|
14
|
-
)
|
@@ -1,14 +0,0 @@
|
|
1
|
-
print "Using native MySQL\n"
|
2
|
-
require 'logger'
|
3
|
-
|
4
|
-
ActiveRecord::Base.logger = Logger.new("debug.log")
|
5
|
-
|
6
|
-
db1 = 'activerecord_sentry'
|
7
|
-
|
8
|
-
ActiveRecord::Base.establish_connection(
|
9
|
-
:adapter => "mysql",
|
10
|
-
:host => "localhost",
|
11
|
-
:username => "rails",
|
12
|
-
:password => "",
|
13
|
-
:database => db1
|
14
|
-
)
|
@@ -1,15 +0,0 @@
|
|
1
|
-
print "Using OCI Oracle\n"
|
2
|
-
require 'logger'
|
3
|
-
|
4
|
-
ActiveRecord::Base.logger = Logger.new STDOUT
|
5
|
-
ActiveRecord::Base.logger.level = Logger::WARN
|
6
|
-
|
7
|
-
db1 = 'activerecord_sentry'
|
8
|
-
|
9
|
-
ActiveRecord::Base.establish_connection(
|
10
|
-
:adapter => 'oci',
|
11
|
-
:host => '', # can use an oracle SID
|
12
|
-
:username => 'arunit',
|
13
|
-
:password => 'arunit',
|
14
|
-
:database => db1
|
15
|
-
)
|
@@ -1,14 +0,0 @@
|
|
1
|
-
print "Using native PostgreSQL\n"
|
2
|
-
require 'logger'
|
3
|
-
|
4
|
-
ActiveRecord::Base.logger = Logger.new("debug.log")
|
5
|
-
|
6
|
-
db1 = 'activerecord_sentry'
|
7
|
-
|
8
|
-
ActiveRecord::Base.establish_connection(
|
9
|
-
:adapter => "postgresql",
|
10
|
-
:host => nil,
|
11
|
-
:username => "postgres",
|
12
|
-
:password => "postgres",
|
13
|
-
:database => db1
|
14
|
-
)
|
@@ -1,34 +0,0 @@
|
|
1
|
-
print "Using native SQlite\n"
|
2
|
-
require 'logger'
|
3
|
-
ActiveRecord::Base.logger = Logger.new("debug.log")
|
4
|
-
|
5
|
-
class SqliteError < StandardError
|
6
|
-
end
|
7
|
-
|
8
|
-
BASE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../fixtures')
|
9
|
-
sqlite_test_db = "#{BASE_DIR}/activerecord_sentry.sqlite"
|
10
|
-
|
11
|
-
def make_connection(clazz, db_file, db_definitions_file)
|
12
|
-
unless File.exist?(db_file)
|
13
|
-
puts "SQLite database not found at #{db_file}. Rebuilding it."
|
14
|
-
sqlite_command = %Q{sqlite #{db_file} "create table a (a integer); drop table a;"}
|
15
|
-
puts "Executing '#{sqlite_command}'"
|
16
|
-
raise SqliteError.new("Seems that there is no sqlite executable available") unless system(sqlite_command)
|
17
|
-
clazz.establish_connection(
|
18
|
-
:adapter => "sqlite",
|
19
|
-
:dbfile => db_file)
|
20
|
-
script = File.read("#{BASE_DIR}/db_definitions/#{db_definitions_file}")
|
21
|
-
# SQLite-Ruby has problems with semi-colon separated commands, so split and execute one at a time
|
22
|
-
script.split(';').each do
|
23
|
-
|command|
|
24
|
-
clazz.connection.execute(command) unless command.strip.empty?
|
25
|
-
end
|
26
|
-
else
|
27
|
-
clazz.establish_connection(
|
28
|
-
:adapter => "sqlite",
|
29
|
-
:dbfile => db_file)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
make_connection(ActiveRecord::Base, sqlite_test_db, 'sqlite.sql')
|
34
|
-
|
@@ -1,33 +0,0 @@
|
|
1
|
-
print "Using native SQLite3\n"
|
2
|
-
require 'logger'
|
3
|
-
ActiveRecord::Base.logger = Logger.new("debug.log")
|
4
|
-
|
5
|
-
class SqliteError < StandardError
|
6
|
-
end
|
7
|
-
|
8
|
-
BASE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../fixtures')
|
9
|
-
sqlite_test_db = "#{BASE_DIR}/activerecord_sentry.sqlite3"
|
10
|
-
|
11
|
-
def make_connection(clazz, db_file, db_definitions_file)
|
12
|
-
unless File.exist?(db_file)
|
13
|
-
puts "SQLite3 database not found at #{db_file}. Rebuilding it."
|
14
|
-
sqlite_command = %Q{sqlite3 #{db_file} "create table a (a integer); drop table a;"}
|
15
|
-
puts "Executing '#{sqlite_command}'"
|
16
|
-
raise SqliteError.new("Seems that there is no sqlite3 executable available") unless system(sqlite_command)
|
17
|
-
clazz.establish_connection(
|
18
|
-
:adapter => "sqlite3",
|
19
|
-
:dbfile => db_file)
|
20
|
-
script = File.read("#{BASE_DIR}/db_definitions/#{db_definitions_file}")
|
21
|
-
# SQLite-Ruby has problems with semi-colon separated commands, so split and execute one at a time
|
22
|
-
script.split(';').each do
|
23
|
-
|command|
|
24
|
-
clazz.connection.execute(command) unless command.strip.empty?
|
25
|
-
end
|
26
|
-
else
|
27
|
-
clazz.establish_connection(
|
28
|
-
:adapter => "sqlite3",
|
29
|
-
:dbfile => db_file)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
make_connection(ActiveRecord::Base, sqlite_test_db, 'sqlite.sql')
|
@@ -1,14 +0,0 @@
|
|
1
|
-
print "Using native SQLServer\n"
|
2
|
-
require 'logger'
|
3
|
-
|
4
|
-
ActiveRecord::Base.logger = Logger.new("debug.log")
|
5
|
-
|
6
|
-
db1 = 'activerecord_sentry'
|
7
|
-
|
8
|
-
ActiveRecord::Base.establish_connection(
|
9
|
-
:adapter => "sqlserver",
|
10
|
-
:host => "localhost",
|
11
|
-
:username => "sa",
|
12
|
-
:password => "",
|
13
|
-
:database => db1
|
14
|
-
)
|
@@ -1,15 +0,0 @@
|
|
1
|
-
print "Using native SQLServer via ODBC\n"
|
2
|
-
require 'logger'
|
3
|
-
|
4
|
-
ActiveRecord::Base.logger = Logger.new("debug.log")
|
5
|
-
|
6
|
-
dsn1 = 'activerecord_sentry'
|
7
|
-
|
8
|
-
ActiveRecord::Base.establish_connection(
|
9
|
-
:adapter => "sqlserver",
|
10
|
-
:mode => "ODBC",
|
11
|
-
:host => "localhost",
|
12
|
-
:username => "sa",
|
13
|
-
:password => "",
|
14
|
-
:dsn => dsn1
|
15
|
-
)
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
drop table users;
|
@@ -1 +0,0 @@
|
|
1
|
-
DROP TABLE 'pages';
|