reedb 0.10.rc1 → 0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -12
- data/Gemfile.lock +17 -11
- data/bin/reedbd +65 -23
- data/lib/reedb/constants.rb +11 -23
- data/lib/reedb/daemon_wrapper.rb +138 -121
- data/lib/reedb/debouncer.rb +129 -0
- data/lib/reedb/errors/daemon_errors.rb +4 -4
- data/lib/reedb/errors/exit_errors.rb +12 -0
- data/lib/reedb/errors/reedb_errors.rb +21 -0
- data/lib/reedb/errors/vault_errors.rb +8 -6
- data/lib/reedb/reevault.rb +84 -72
- data/lib/reedb/security/encryption.rb +1 -5
- data/lib/reedb/security/tokens.rb +21 -0
- data/lib/reedb/utils/logger.rb +5 -5
- data/lib/reedb/utils/uuids.rb +40 -132
- data/lib/reedb.rb +518 -272
- data/reedb.gemspec +32 -24
- data/tests/embeddedc/MyTest/Makefile +238 -0
- data/tests/embeddedc/MyTest/MyTest.c +27 -0
- data/tests/embeddedc/MyTest/MyTest.o +0 -0
- data/tests/embeddedc/MyTest/extconf.rb +11 -0
- data/tests/embeddedc/MyTest/mytest.so +0 -0
- data/tests/embeddedc/mytest.rb +8 -0
- data/tests/http_tester.py +208 -0
- data/tests/play.rb +60 -4
- data/tests/tests.rb +7 -59
- data/tmp/gems/aes-0.5.0.spec +80 -0
- data/tmp/gems/digest-tiger-1.0.2.spec +85 -0
- data/tmp/gems/main.template +118 -0
- data/tmp/gems/twofish-1.0.5.spec +75 -0
- metadata +45 -16
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c1963fd6fa73990571af644539840c3be811404
|
4
|
+
data.tar.gz: 3683b3a01c65b2f5afeccd4b3439700281ea1ad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27ce1d42d5be4b0c9f5dece31791e0ba75a29419a20cb44d6255529c775c42614ebab2482e45b046dd1d50db641baec127e0e161a6d5d8660c63fc25298f6500
|
7
|
+
data.tar.gz: c93e234433ec38740f6f45c5d0519331bb9b6d238ea3bbee1dcafc25e0b09fa1884d5c69afedc19092d38a6a1cc9215cf4b20d0ff9c9b39ff71afc7e49dde9c4
|
data/Gemfile
CHANGED
@@ -1,15 +1,4 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in reedb.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
# Security!
|
7
|
-
gem 'aes', '>=0.5.0'
|
8
|
-
gem 'twofish', '>=1.0.5'
|
9
|
-
gem 'digest-tiger', '~> 1.0.2'
|
10
|
-
|
11
|
-
# Other stuff that's important
|
12
|
-
gem 'json', '~> 1.8.2'
|
13
|
-
gem 'daemons', '~> 1.2.2'
|
14
|
-
gem 'sinatra', '~> 1.4.6'
|
15
|
-
gem 'hashids', '~> 1.0.2'
|
4
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
reedb (0.
|
4
|
+
reedb (0.10.8)
|
5
|
+
aes (~> 0.5)
|
6
|
+
daemons (~> 1.2)
|
7
|
+
digest-tiger (~> 1.0)
|
8
|
+
json (~> 1.8)
|
9
|
+
sinatra (~> 1.4)
|
10
|
+
twofish (~> 1.0)
|
11
|
+
uuid (~> 2.3)
|
5
12
|
|
6
13
|
GEM
|
7
14
|
remote: https://rubygems.org/
|
@@ -9,9 +16,10 @@ GEM
|
|
9
16
|
aes (0.5.0)
|
10
17
|
daemons (1.2.2)
|
11
18
|
digest-tiger (1.0.2)
|
12
|
-
|
13
|
-
|
14
|
-
|
19
|
+
json (1.8.3)
|
20
|
+
macaddr (1.7.1)
|
21
|
+
systemu (~> 2.6.2)
|
22
|
+
rack (1.6.4)
|
15
23
|
rack-protection (1.5.3)
|
16
24
|
rack
|
17
25
|
rake (10.4.2)
|
@@ -19,20 +27,18 @@ GEM
|
|
19
27
|
rack (~> 1.4)
|
20
28
|
rack-protection (~> 1.4)
|
21
29
|
tilt (>= 1.3, < 3)
|
30
|
+
systemu (2.6.5)
|
22
31
|
tilt (2.0.1)
|
23
32
|
twofish (1.0.5)
|
33
|
+
uuid (2.3.8)
|
34
|
+
macaddr (~> 1.0)
|
35
|
+
yard (0.8.7.6)
|
24
36
|
|
25
37
|
PLATFORMS
|
26
38
|
ruby
|
27
39
|
|
28
40
|
DEPENDENCIES
|
29
|
-
aes (>= 0.5.0)
|
30
41
|
bundler (~> 1.7)
|
31
|
-
daemons (~> 1.2.2)
|
32
|
-
digest-tiger (~> 1.0.2)
|
33
|
-
hashids (~> 1.0.2)
|
34
|
-
json (~> 1.8.2)
|
35
42
|
rake (~> 10.0)
|
36
43
|
reedb!
|
37
|
-
|
38
|
-
twofish (>= 1.0.5)
|
44
|
+
yard (~> 0.8)
|
data/bin/reedbd
CHANGED
@@ -9,54 +9,96 @@
|
|
9
9
|
# https://www.gnu.org/licenses/lgpl.html)
|
10
10
|
# ====================================================
|
11
11
|
|
12
|
+
# Checks the ruby version for ruby 2.1! This is the only supported version so far and if you run as something else
|
13
|
+
# then guess what: I ain't gonna care when it breaks, bitch! :)
|
14
|
+
# (Okay, that was unneccesarily ghetto. Sorry.)
|
15
|
+
#
|
16
|
+
rv = RUBY_VERSION
|
17
|
+
unless rv[0..-3] == '2.1'
|
18
|
+
puts 'You are running Reedb with an unsupported Ruby version! Officially only 2.1.* is supported!'
|
19
|
+
puts 'Do you want to take the risk and run Reedb anyways? [y/N] '
|
20
|
+
a = gets.chomp.to_s.upcase
|
21
|
+
if a == 'N' || a == ''
|
22
|
+
exit(0x8)
|
23
|
+
else
|
24
|
+
puts "Don't complain..."
|
25
|
+
sleep(0.25)
|
26
|
+
puts ''
|
27
|
+
end
|
28
|
+
end
|
12
29
|
|
13
|
-
#
|
14
|
-
|
30
|
+
# Only loads the constants section to read the version.
|
31
|
+
spec = nil
|
32
|
+
begin
|
33
|
+
spec = Gem::Specification.find_by_name('reedb')
|
34
|
+
require 'reedb/constants'
|
35
|
+
rescue Gem::LoadError => e
|
36
|
+
begin
|
37
|
+
require_relative '../lib/reedb/constants'
|
38
|
+
rescue
|
39
|
+
puts 'Error: reedb not installed!'
|
40
|
+
exit(0x21)
|
41
|
+
end
|
42
|
+
end
|
15
43
|
|
16
|
-
|
44
|
+
W_NAME = 'reedbd'
|
45
|
+
C_NAME = 'reedb'
|
17
46
|
|
18
|
-
|
47
|
+
# Very simple wrapper script to start the Reedb daemon.
|
48
|
+
if File.basename(__FILE__) == W_NAME
|
19
49
|
if ARGV.include? '--version'
|
20
50
|
puts Reedb::VERSION
|
21
|
-
exit
|
51
|
+
exit(0)
|
22
52
|
end
|
23
53
|
|
24
54
|
if ARGV == []
|
25
|
-
puts
|
26
|
-
puts "Usage: reedb
|
55
|
+
puts '[ERROR]: Invalid application arguments!'
|
56
|
+
puts "Usage: reedb (daemon options) [-- reedb options]
|
27
57
|
|
28
58
|
Available [reedb options]:
|
29
59
|
-l, --pw-length INTEGER Define minimal passphrase length (Default: 12)
|
30
|
-
-p, --port INTEGER Change the listener port. May break your setup!
|
31
|
-
-a, --app-path STRING Change the path for the reedb config files/ logs. (default
|
60
|
+
-p, --port INTEGER Change the listener port. May break your setup! (default: #{Reedb::NET_PORT})
|
61
|
+
-a, --app-path STRING Change the path for the reedb config files/ logs. (default: ~)
|
32
62
|
-v, --verbose Enable verbose logging about the Reedb daemon.
|
33
63
|
-d, --no-daemon Don't run Reedb as a background daemon. Log to STOUT instead of log file.
|
64
|
+
-f, --force Force Reedb to start a new instance in case an old one was locked. (Dangerous!)
|
34
65
|
|
35
66
|
Available [daemon options]:
|
36
|
-
start Start an instance of the #{
|
37
|
-
stop Stop all instances of the #{
|
38
|
-
restart Stop all and restart a new instance of #{
|
39
|
-
status Show status (PID) of #{
|
67
|
+
start Start an instance of the #{C_NAME} daemon
|
68
|
+
stop Stop all instances of the #{C_NAME} daemon
|
69
|
+
restart Stop all and restart a new instance of #{C_NAME} afterwards
|
70
|
+
status Show status (PID) of #{C_NAME} daemon instance
|
40
71
|
|
41
72
|
Common options:
|
42
|
-
--version Show #{
|
73
|
+
--version Show #{C_NAME} version"
|
43
74
|
|
44
75
|
# Then exits the application
|
45
76
|
exit
|
46
77
|
end
|
47
78
|
|
48
79
|
options = {
|
49
|
-
|
50
|
-
|
51
|
-
# :monitor => true,
|
52
|
-
# :ontop => true
|
80
|
+
:app_name => 'reedb',
|
81
|
+
:backtrace => true
|
53
82
|
}
|
54
83
|
|
55
|
-
spec
|
56
|
-
|
57
|
-
|
84
|
+
if spec
|
85
|
+
g_path = (spec.gem_dir) + '/lib/reedb'
|
86
|
+
require 'reedb'
|
87
|
+
|
88
|
+
# puts "Reedb isn't properly installed on your system!
|
89
|
+
# Please make sure Gems can load it before trying to run this daemon again!
|
90
|
+
# Exit code: #{0x9}"
|
91
|
+
#
|
92
|
+
# exit(0x9)
|
93
|
+
else
|
94
|
+
g_path = '../lib/reedb/'
|
95
|
+
require_relative '../lib/reedb'
|
96
|
+
end
|
58
97
|
|
98
|
+
|
99
|
+
# NOW load the required modules to run.
|
59
100
|
require 'daemons'
|
60
|
-
|
61
|
-
|
101
|
+
|
102
|
+
# Then actually start the wrapper.
|
103
|
+
Daemons.run(File.join(g_path, 'daemon_wrapper.rb'), options)
|
62
104
|
end
|
data/lib/reedb/constants.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ====================================================
|
2
2
|
# Copyright 2015 Lonely Robot (see @author)
|
3
|
-
# @author: Katharina Sabel | www.
|
3
|
+
# @author: Katharina Sabel | www.lonelyrobot.io
|
4
4
|
#
|
5
5
|
# Distributed under the GNU Lesser GPL Version 3
|
6
6
|
# (See accompanying LICENSE file or get a copy at
|
@@ -13,30 +13,18 @@ module Reedb
|
|
13
13
|
# The version of reedb. This is actually written into vaults to identify
|
14
14
|
# breaking changes and using an older sub-set of the API to interact with
|
15
15
|
# legacy vaults.
|
16
|
-
VERSION =
|
16
|
+
VERSION = '0.11'
|
17
17
|
NET_PORT = 55736
|
18
|
-
TOKEN_BYTE_SIZE =
|
19
|
-
|
18
|
+
TOKEN_BYTE_SIZE = 8 # in bytes
|
19
|
+
DEFAULT_PATH = '__sysmas__' # Placeholder
|
20
20
|
FILE_CACHE_TIME = 2500 # Time in ms
|
21
|
-
KEY_CACHE_TIME = (15 * 60) * 1000 # (30 minutes in ms)
|
22
21
|
|
22
|
+
# Debounce constants
|
23
|
+
DEBOUNCE_DELTA = 2.5 # 2500 ms
|
24
|
+
KEY_CACHE_TIME = (15 * 60) # (15 minutes in seconds)
|
25
|
+
THREAD_TIMEOUT_TIME = DEBOUNCE_DELTA * 1.0125
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
FILE_MALFORMED_DATA_ERROR = 0x11
|
29
|
-
|
30
|
-
#
|
31
|
-
# VAULT ERROR CODES
|
32
|
-
#
|
33
|
-
VAULT_FILE_NOT_FOUND_ERROR = 0x12
|
34
|
-
|
35
|
-
|
36
|
-
#
|
37
|
-
# RETURN ERROR CODES
|
38
|
-
#
|
39
|
-
DAEMON_UNKNOWN_TOKEN_ERROR = 0x31
|
40
|
-
DAEMON_UNAUTHORISED_TOKEN_ERROR = 0x32
|
41
|
-
DAEMON_INACTIVE_VAULT_ERROR = 0x33
|
27
|
+
# Debouncer markers
|
28
|
+
DEB_ADD = :add
|
29
|
+
DEB_REM = :remove
|
42
30
|
end
|