cortex-reaver 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +55 -25
- data/bin/cortex_reaver +31 -9
- data/lib/cortex_reaver.rb +220 -30
- data/lib/cortex_reaver/config.rb +53 -7
- data/lib/cortex_reaver/public/css/main.css +1 -1
- data/lib/cortex_reaver/version.rb +1 -1
- data/lib/cortex_reaver/view/text_layout.rhtml +1 -1
- data/lib/proto/cortex_reaver.yaml +31 -11
- metadata +1 -1
data/README
CHANGED
@@ -1,44 +1,74 @@
|
|
1
1
|
CORTEX REAVER - A dangerous Ruby blog engine, with a photographic memory.
|
2
|
+
=========================================================================
|
2
3
|
|
3
|
-
Cortex Reaver is a
|
4
|
-
|
5
|
-
attachments. Features canonically named URLs (/journals/show/a-post-title) with
|
6
|
-
conflict resolution, useful formatting modules for content (HTML sanitizing,
|
7
|
-
attachment references, BlueCloth, etc), and custom pages.
|
4
|
+
Cortex Reaver is a terrifying machine which stalks the corridors of Citadel
|
5
|
+
Station, searching for humans to assimilate into Shodan's perfection.
|
8
6
|
|
9
|
-
|
7
|
+
Cortex Reaver is also a blog engine for textual journals, photographs, and
|
8
|
+
projects; written using Ramaze and Sequel. It supports tags, comments, and
|
9
|
+
simple attachments. Features include canonically named URLs
|
10
|
+
(/journals/show/a-post-title) with conflict resolution, useful formatting
|
11
|
+
modules for content (HTML sanitizing, attachment references, BlueCloth, etc),
|
12
|
+
and custom pages.
|
10
13
|
|
11
|
-
|
14
|
+
Getting Started
|
15
|
+
---------------
|
12
16
|
|
13
|
-
|
17
|
+
mkdir cortex_reaver # Create an empty directory for Cortex Reaver to lurk in.
|
18
|
+
cd cortex_reaver
|
19
|
+
cortex_reaver --migrate # Initialize an SQLite database.
|
20
|
+
cortex_reaver --start # Start the daemon.
|
14
21
|
|
15
|
-
|
16
|
-
|
17
|
-
|
22
|
+
Then point your web browser at localhost:7000, hit control-x, and log in with
|
23
|
+
username "shodan", password "shodan".
|
24
|
+
|
25
|
+
You can check Cortex Reaver's status with --status, and when you're done, shut
|
26
|
+
it down with --stop.
|
27
|
+
|
28
|
+
Configuration
|
29
|
+
-------------
|
18
30
|
|
19
31
|
You'll need a YAML configuration file to define Cortex Reaver's configuration.
|
20
32
|
See proto/cortex_reaver.yaml. If no config file is specified on the command
|
21
|
-
line, Cortex Reaver assumes you mean cortex_reaver.yaml in the
|
22
|
-
directory. Copy lib/proto/cortex_reaver.yaml to
|
33
|
+
line with --config, Cortex Reaver assumes you mean cortex_reaver.yaml in the
|
34
|
+
working directory. Copy lib/proto/cortex_reaver.yaml to get started.
|
35
|
+
|
36
|
+
Databases
|
37
|
+
---------
|
23
38
|
|
24
|
-
|
39
|
+
Cortex Reaver uses Sequel (http://sequel.rubyforge.org/), so you can (in
|
40
|
+
theory) use any database Sequel supports. By default, Cortex Reaver builds an
|
41
|
+
SQLite database in the working directory, but you can set a different database
|
42
|
+
in the config file, either as a Sequel string or with hash of options.
|
43
|
+
|
44
|
+
For MySQL:
|
45
|
+
|
46
|
+
create database cortex_reaver;
|
47
|
+
grant all privileges on cortex_reaver.* to 'cortex_reaver'@'localhost'
|
48
|
+
identified by 'some-password' with grant option;
|
25
49
|
|
26
|
-
|
50
|
+
When you've set up a new database, run cortex_reaver --migrate to update it to
|
51
|
+
the latest version. If you need to wipe your database and start over, use
|
52
|
+
cortex_reaver --blank to drop the schema and rebuild it.
|
27
53
|
|
28
|
-
|
54
|
+
Customization
|
55
|
+
-------------
|
29
56
|
|
30
|
-
|
31
|
-
|
57
|
+
You may find development mode useful: it reloads source files when they're
|
58
|
+
changed, displays traces for errors instead of 404 and 500 responses, logs
|
59
|
+
more, and runs in the console instead of detaching by default. Just set :mode
|
60
|
+
=> :development in your configuration.
|
32
61
|
|
33
|
-
|
34
|
-
|
35
|
-
|
62
|
+
Requests for static objects (images, css, javascript, etc.) is pulled from
|
63
|
+
public/, which can be specified in your configuration or defaults to
|
64
|
+
`cwd`/public. If a request for a file can't be found there, it's retrieved from
|
65
|
+
Cortex Reaver's own public directory in lib/public.
|
36
66
|
|
37
|
-
|
38
|
-
|
39
|
-
Anything in that directory overrides Cortex Reaver's default public files.
|
67
|
+
You can also set up your own view templates: copy lib/view to some other
|
68
|
+
directory, and specify :view_root in your configuration.
|
40
69
|
|
41
|
-
|
70
|
+
Credits
|
71
|
+
-------
|
42
72
|
|
43
73
|
I am indebted to the good folks of #sequel and #ramaze for their many
|
44
74
|
suggestions in writing Cortex Reaver, and also to Ryan Grove
|
data/bin/cortex_reaver
CHANGED
@@ -25,7 +25,7 @@ module CortexReaver
|
|
25
25
|
@values = {}
|
26
26
|
parser = OptionParser.new do |o|
|
27
27
|
o.on '-c', '--config file', 'Configuration file' do |file|
|
28
|
-
|
28
|
+
self.config_file = file
|
29
29
|
end
|
30
30
|
|
31
31
|
o.on '-f', '--force', 'Just do it' do
|
@@ -47,23 +47,40 @@ module CortexReaver
|
|
47
47
|
@values[:schema_version] = version ? version.to_i : nil
|
48
48
|
end
|
49
49
|
|
50
|
-
o.on '-
|
50
|
+
o.on '-b', '--blank',
|
51
51
|
'Wipes the database and sets up a clean copy of the latest version.' do
|
52
|
-
@action = :
|
52
|
+
@action = :blank
|
53
|
+
end
|
54
|
+
|
55
|
+
o.on '-r', '--restart', 'Restart CortexReaver' do
|
56
|
+
@action = :restart
|
57
|
+
end
|
58
|
+
|
59
|
+
o.on '-k', '--stop', 'Stop CortexReaver' do
|
60
|
+
@action = :stop
|
61
|
+
end
|
62
|
+
|
63
|
+
o.on '--status', 'Check CortexReaver status.' do
|
64
|
+
@action = :status
|
53
65
|
end
|
54
66
|
end
|
55
67
|
|
56
68
|
parser.parse! ARGV
|
57
69
|
|
70
|
+
|
58
71
|
# Main
|
59
72
|
case @action
|
73
|
+
when :status
|
74
|
+
# Make a quick HTTP request to see how we're doing.
|
75
|
+
require 'open-uri'
|
76
|
+
reload_config
|
77
|
+
response = open("http://#{config[:host] || 'localhost'}:#{config[:port]}/")
|
78
|
+
puts response.status.join(' ');
|
60
79
|
when :migrate
|
61
80
|
version = @values[:schema_version]
|
62
81
|
|
63
|
-
|
64
|
-
|
65
|
-
self.setup_db
|
66
|
-
|
82
|
+
reload_config
|
83
|
+
setup_db false
|
67
84
|
puts "Using database #{config[:database][:host]}/#{config[:database][:database]}."
|
68
85
|
|
69
86
|
current_version = Sequel::Migrator.get_current_migration_version(db)
|
@@ -93,17 +110,22 @@ module CortexReaver
|
|
93
110
|
exit
|
94
111
|
end
|
95
112
|
|
96
|
-
when :
|
113
|
+
when :blank
|
97
114
|
if confirm "Are you sure you wish to wipe the database?"
|
98
115
|
# Strangely, calling Migrator.apply to go down and then up doesn't seem to work. :-/
|
99
116
|
system($0, '-f', '-m', '0')
|
100
117
|
system($0, '-f', '-m')
|
101
118
|
end
|
102
119
|
|
120
|
+
when :restart
|
121
|
+
restart
|
122
|
+
|
103
123
|
when :start
|
104
|
-
self.config_file = @values[:config_file]
|
105
124
|
start
|
106
125
|
|
126
|
+
when :stop
|
127
|
+
stop
|
128
|
+
|
107
129
|
else
|
108
130
|
abort("Unknown action: #{@action}")
|
109
131
|
end
|
data/lib/cortex_reaver.rb
CHANGED
@@ -5,6 +5,7 @@ begin
|
|
5
5
|
require 'ramaze'
|
6
6
|
require 'sequel'
|
7
7
|
require 'yaml'
|
8
|
+
require 'socket'
|
8
9
|
rescue LoadError => e
|
9
10
|
puts e
|
10
11
|
puts "You probably need to install some packages Cortex Reaver needs. Try:
|
@@ -16,6 +17,7 @@ end
|
|
16
17
|
module CortexReaver
|
17
18
|
ROOT = File.expand_path(__DIR__/'..')
|
18
19
|
LIB_DIR = ROOT/:lib/:cortex_reaver
|
20
|
+
HOME_DIR = Dir.pwd
|
19
21
|
|
20
22
|
# We need the configuration class before everything.
|
21
23
|
require LIB_DIR/:config
|
@@ -33,24 +35,77 @@ module CortexReaver
|
|
33
35
|
@config_file = file
|
34
36
|
end
|
35
37
|
|
36
|
-
# Sets the configuration file and reloads
|
37
|
-
def self.configure(file = nil)
|
38
|
-
if file
|
39
|
-
self.config_file = file
|
40
|
-
end
|
41
|
-
reload_config
|
42
|
-
end
|
43
|
-
|
44
38
|
def self.db
|
45
39
|
@db
|
46
40
|
end
|
47
41
|
|
48
|
-
#
|
49
|
-
def self.
|
50
|
-
#
|
42
|
+
# Prepare Ramaze, create directories, etc.
|
43
|
+
def self.init
|
44
|
+
# Tell Ramaze where to find public files and views
|
51
45
|
Ramaze::Global.public_root = LIB_DIR/:public
|
52
46
|
Ramaze::Global.view_root = config[:view_root]
|
53
47
|
|
48
|
+
# Check directories
|
49
|
+
if config[:public_root] and not File.directory? config[:public_root]
|
50
|
+
# Try to create a public directory
|
51
|
+
begin
|
52
|
+
FileUtils.mkdir_p config[:public_root]
|
53
|
+
rescue => e
|
54
|
+
Ramaze::Log.warn "Unable to create a public directory at #{config[:public_root]}: #{e}."
|
55
|
+
end
|
56
|
+
end
|
57
|
+
if config[:log_root] and not File.directory? config[:log_root]
|
58
|
+
# Try to create a log directory
|
59
|
+
begin
|
60
|
+
FileUtils.mkdir_p config[:log_root]
|
61
|
+
File.chmod 0750, config[:log_root]
|
62
|
+
rescue => e
|
63
|
+
Ramaze::Log.warn "Unable to create a log directory at #{config[:log_root]}: #{e}. File logging disabled."
|
64
|
+
# Disable logging
|
65
|
+
config[:log_root] = nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Clear loggers
|
70
|
+
Ramaze::Log.loggers.clear
|
71
|
+
|
72
|
+
unless config[:daemon]
|
73
|
+
# Log to console
|
74
|
+
Ramaze::Log.loggers << Ramaze::Logger::Informer.new
|
75
|
+
end
|
76
|
+
|
77
|
+
case config[:mode]
|
78
|
+
when :production
|
79
|
+
if config[:log_root]
|
80
|
+
# Log to file
|
81
|
+
Ramaze::Log.loggers << Ramaze::Logger::Informer.new(
|
82
|
+
File.join(config[:log_root], 'production.log'),
|
83
|
+
[:error, :info, :notice]
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Don't reload source code
|
88
|
+
Ramaze::Global.sourcereload = false
|
89
|
+
|
90
|
+
# Don't expose errors
|
91
|
+
Ramaze::Dispatcher::Error::HANDLE_ERROR.update({
|
92
|
+
ArgumentError => [404, 'error_404'],
|
93
|
+
Exception => [500, 'error_500']
|
94
|
+
})
|
95
|
+
when :development
|
96
|
+
if config[:log_root]
|
97
|
+
# Log to file
|
98
|
+
Ramaze::Log.loggers << Ramaze::Logger::Informer.new(
|
99
|
+
File.join(config[:log_root], 'development.log')
|
100
|
+
)
|
101
|
+
end
|
102
|
+
else
|
103
|
+
raise ArgumentError.new("unknown Cortex Reaver mode #{config[:mode].inspect}. Expected one of [:production, :development].")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Load libraries
|
108
|
+
def self.load
|
54
109
|
# Load controllers and models
|
55
110
|
acquire LIB_DIR/:snippets/'**'/'*'
|
56
111
|
acquire LIB_DIR/:support/'*'
|
@@ -65,45 +120,74 @@ module CortexReaver
|
|
65
120
|
@config = CortexReaver::Config.new(config_file)
|
66
121
|
end
|
67
122
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
123
|
+
# Restart Cortex Reaver
|
124
|
+
def self.restart
|
125
|
+
begin
|
126
|
+
stop
|
127
|
+
sleep 5
|
128
|
+
ensure
|
129
|
+
start
|
130
|
+
end
|
131
|
+
end
|
74
132
|
|
75
|
-
|
76
|
-
|
133
|
+
# Once environment is prepared, run Ramaze
|
134
|
+
def self.run
|
135
|
+
# Shutdown callback
|
136
|
+
at_exit do
|
137
|
+
FileUtils.rm(config[:pidfile]) if File.exist? config[:pidfile]
|
138
|
+
end
|
77
139
|
|
78
|
-
#
|
79
|
-
Ramaze.start :adapter => config[:adapter], :port => config[:port]
|
80
|
-
end
|
140
|
+
Ramaze::Log.info "Cortex Reaver #{Process.pid} stalking victims."
|
81
141
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
142
|
+
# Run Ramaze
|
143
|
+
Ramaze.startup(
|
144
|
+
:adapter => config[:adapter],
|
145
|
+
:host => config[:host],
|
146
|
+
:port => config[:port]
|
147
|
+
)
|
148
|
+
|
149
|
+
puts "Cortex Reaver finished."
|
150
|
+
end
|
87
151
|
|
152
|
+
# Load Cortex Reaver environment; do everything except start Ramaze
|
153
|
+
def self.setup
|
88
154
|
# Connect to DB
|
89
155
|
setup_db
|
90
156
|
|
157
|
+
# Prepare Ramaze, check directories, etc.
|
158
|
+
init
|
159
|
+
|
91
160
|
# Load library
|
92
161
|
self.load
|
93
162
|
end
|
94
163
|
|
95
|
-
# Connect to DB
|
96
|
-
|
164
|
+
# Connect to DB. If check_schema is false, doesn't check to see that the schema
|
165
|
+
# version is up to date.
|
166
|
+
def self.setup_db(check_schema = true)
|
97
167
|
unless config
|
98
168
|
raise RuntimeError.new("no configuration available!")
|
99
169
|
end
|
100
170
|
|
171
|
+
# Build Sequel connection string
|
101
172
|
unless (string = config[:database]).is_a? String
|
102
173
|
d = config[:database]
|
103
174
|
string = "#{d[:driver]}://#{d[:user]}:#{d[:password]}@#{d[:host]}/#{d[:database]}"
|
104
175
|
end
|
105
176
|
|
106
|
-
|
177
|
+
begin
|
178
|
+
@db = Sequel.connect(string)
|
179
|
+
rescue => e
|
180
|
+
Ramaze::Log.error("Unable to connect to database: #{e}.")
|
181
|
+
abort
|
182
|
+
end
|
183
|
+
|
184
|
+
# Check schema
|
185
|
+
if check_schema and
|
186
|
+
Sequel::Migrator.get_current_migration_version(@db) !=
|
187
|
+
Sequel::Migrator.latest_migration_version(LIB_DIR/:migrations)
|
188
|
+
|
189
|
+
raise RuntimeError.new("database schema missing or out of date. Please run `cortex_reaver --migrate`.")
|
190
|
+
end
|
107
191
|
end
|
108
192
|
|
109
193
|
# Disconnect from DB
|
@@ -111,4 +195,110 @@ module CortexReaver
|
|
111
195
|
@db.disconnect
|
112
196
|
@db = nil
|
113
197
|
end
|
198
|
+
|
199
|
+
def self.start
|
200
|
+
reload_config
|
201
|
+
|
202
|
+
# Check PID
|
203
|
+
if File.file? config[:pidfile]
|
204
|
+
pid = File.read(config[:pidfile], 20).strip
|
205
|
+
abort "Cortex Reaver already running? (#{pid})"
|
206
|
+
end
|
207
|
+
|
208
|
+
puts "Activating Cortex Reaver."
|
209
|
+
setup
|
210
|
+
|
211
|
+
# Check port availability
|
212
|
+
begin
|
213
|
+
socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
|
214
|
+
sockaddr = Socket.pack_sockaddr_in(*[config[:port], config[:host]])
|
215
|
+
socket.bind(sockaddr)
|
216
|
+
socket.close
|
217
|
+
rescue => e
|
218
|
+
abort "Unable to bind to port #{config[:host]}:#{config[:port]} (#{e})"
|
219
|
+
end
|
220
|
+
|
221
|
+
if config[:daemon]
|
222
|
+
fork do
|
223
|
+
# Drop console, create new session
|
224
|
+
Process.setsid
|
225
|
+
exit if fork
|
226
|
+
|
227
|
+
# Write pidfile
|
228
|
+
File.open(config[:pidfile], 'w') do |file|
|
229
|
+
file << Process.pid
|
230
|
+
end
|
231
|
+
|
232
|
+
# Move to homedir; drop creation mask
|
233
|
+
Dir.chdir HOME_DIR
|
234
|
+
File.umask 0000
|
235
|
+
|
236
|
+
# Drop stream handles
|
237
|
+
STDIN.reopen('/dev/null')
|
238
|
+
STDOUT.reopen('/dev/null', 'a')
|
239
|
+
STDERR.reopen(STDOUT)
|
240
|
+
|
241
|
+
# Go!
|
242
|
+
run
|
243
|
+
end
|
244
|
+
else
|
245
|
+
# Run in foreground.
|
246
|
+
run
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
def self.stop
|
251
|
+
reload_config
|
252
|
+
|
253
|
+
unless config[:pidfile]
|
254
|
+
abort "No pidfile to stop."
|
255
|
+
end
|
256
|
+
|
257
|
+
unless File.file? config[:pidfile]
|
258
|
+
abort "Cortex Reaver not running? (check #{config[:pidfile]})"
|
259
|
+
end
|
260
|
+
|
261
|
+
# Get PID
|
262
|
+
pid = File.read(config[:pidfile], 20).strip
|
263
|
+
unless (pid = pid.to_i) != 0
|
264
|
+
abort "Invalid process ID in pidfile (#{pid})."
|
265
|
+
end
|
266
|
+
|
267
|
+
puts "Shutting down Cortex Reaver #{pid}..."
|
268
|
+
|
269
|
+
# Attempt to end Ramaze nicely.
|
270
|
+
begin
|
271
|
+
# Try to shut down Ramaze nicely.
|
272
|
+
Process.kill('INT', pid)
|
273
|
+
puts "Shut down."
|
274
|
+
killed = true
|
275
|
+
rescue Errno::ESRCH
|
276
|
+
# The process doesn't exist.
|
277
|
+
puts "No Cortex Reaver with pid #{pid}."
|
278
|
+
killed = true
|
279
|
+
rescue => e
|
280
|
+
begin
|
281
|
+
# Try to end the process forcibly.
|
282
|
+
puts "Cortex Reaver #{pid} has gone rogue (#{e}); forcibly terminating..."
|
283
|
+
Process.kill('KILL', pid)
|
284
|
+
puts "Killed."
|
285
|
+
killed = true
|
286
|
+
rescue => e2
|
287
|
+
# That failed, too.
|
288
|
+
puts "Unable to terminate Cortex Reaver: #{e2}."
|
289
|
+
killed = false
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
# Remove pidfile if killed.
|
294
|
+
if killed
|
295
|
+
begin
|
296
|
+
FileUtils.rm(config[:pidfile])
|
297
|
+
rescue Errno::ENOENT
|
298
|
+
# Pidfile gone
|
299
|
+
rescue => e
|
300
|
+
puts "Unable to remove pidfile #{config[:pidfile]}: #{e}."
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
114
304
|
end
|
data/lib/cortex_reaver/config.rb
CHANGED
@@ -2,20 +2,66 @@ module CortexReaver
|
|
2
2
|
# Contains site-specific configuration information for a CortexReaver site.
|
3
3
|
class Config < Hash
|
4
4
|
# Pass a YAML file with configuration options. At a minimum, it should specify
|
5
|
-
# database = {:proto, :username, :pasword, :host, :database}
|
6
|
-
# or database = "sequel_connect_string"
|
5
|
+
# :database = {:proto, :username, :pasword, :host, :database}
|
6
|
+
# or :database = "sequel_connect_string"
|
7
|
+
#
|
8
|
+
# :public_root - The directory public files are hosted from. Defaults to
|
9
|
+
# HOME_DIR/public.
|
10
|
+
# :view_root - The directory containing erubis view templates. Defaults to
|
11
|
+
# Cortex Reaver's builtin templates.
|
12
|
+
# :log_root - The directory that Cortex Reaver should log to. Defaults to
|
13
|
+
# HOME_DIR/log. If nil, file logging disabled.
|
14
|
+
# :mode - Cortex Reaver mode: either :development or :production
|
15
|
+
# :daemon - Whether to daemonize or not. Defaults to :true if :mode
|
16
|
+
# is :production, otherwise nil.
|
17
|
+
# :adapter - The Ramaze adapter name (default 'mongrel')
|
18
|
+
# :host - Host to bind to
|
19
|
+
# :port - Port to bind to (default 7000)
|
20
|
+
# :pidfile - Process ID file for this server. Defaults to
|
21
|
+
# HOME_DIR/cortex_reaver_<host>_<port>.pid
|
22
|
+
#
|
23
|
+
# Site configuration options
|
24
|
+
# :site = {
|
25
|
+
# :name - The name of the site
|
26
|
+
# :author - The site author's name
|
27
|
+
# :keywords - Keywords describing the site
|
28
|
+
# :description - A short description of the site.
|
29
|
+
# }
|
7
30
|
def initialize(file)
|
8
31
|
# Defaults
|
9
|
-
self[:
|
32
|
+
self[:database] = 'sqlite:////' + File.join(
|
33
|
+
File.expand_path(CortexReaver::HOME_DIR),
|
34
|
+
'cortex_reaver.db'
|
35
|
+
)
|
36
|
+
self[:public_root] = File.join(CortexReaver::HOME_DIR, 'public')
|
10
37
|
self[:view_root] = File.join(CortexReaver::LIB_DIR, 'view')
|
38
|
+
self[:log_root] = File.join(CortexReaver::HOME_DIR, 'log')
|
39
|
+
self[:mode] = :production
|
11
40
|
self[:adapter] = 'mongrel'
|
41
|
+
self[:host] = nil
|
12
42
|
self[:port] = 7000
|
13
43
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
44
|
+
self[:site] = {
|
45
|
+
:name => 'Cortex Reaver',
|
46
|
+
:description => "Stalks the dark corridors of this station, converting humans to Shodan's perfection.",
|
47
|
+
:keywords => 'Cortex Reaver, blog',
|
48
|
+
:author => 'Shodan'
|
49
|
+
}
|
50
|
+
|
51
|
+
# Load from file
|
52
|
+
if File.exists? file
|
53
|
+
begin
|
54
|
+
self.merge!(YAML.load(File.read(file)))
|
55
|
+
rescue => e
|
56
|
+
raise RuntimeError.new("unable to load local configuration file #{file}: (#{e.message})")
|
57
|
+
end
|
18
58
|
end
|
59
|
+
|
60
|
+
# Pidfile
|
61
|
+
self[:pidfile] ||= File.join(CortexReaver::HOME_DIR, "cortex_reaver_#{self[:host] ? self[:host].to_s + '_' : ''}#{self[:port]}.pid")
|
62
|
+
|
63
|
+
# Daemon mode
|
64
|
+
self[:daemon] ||= true if self[:mode] == :production
|
19
65
|
end
|
20
66
|
end
|
21
67
|
end
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<meta http-equiv="Content-Style-Type" content="text/css" />
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
10
10
|
<meta http-equiv="expires" content="0" />
|
11
|
-
<meta name="description" content="<%=attr_h CortexReaver.config[:site][:description] %>" />
|
11
|
+
<meta name="description" content="<%= attr_h CortexReaver.config[:site][:description] %>" />
|
12
12
|
<meta name="generator" content="Cortex Reaver <%= CortexReaver::APP_VERSION %>" />
|
13
13
|
<meta name="keywords" content="<%= attr_h CortexReaver.config[:site][:keywords] %>" />
|
14
14
|
<meta name="author" content="<%= attr_h CortexReaver.config[:site][:author] %>" />
|
@@ -1,11 +1,14 @@
|
|
1
1
|
---
|
2
2
|
# Database connection. You can also just use a Sequel connect() string.
|
3
|
-
:database:
|
4
|
-
:driver: 'mysql'
|
5
|
-
:host: 'localhost'
|
6
|
-
:user: 'cortex_reaver'
|
7
|
-
:password: 'some-password'
|
8
|
-
:database: 'cortex_reaver'
|
3
|
+
# :database:
|
4
|
+
# :driver: 'mysql'
|
5
|
+
# :host: 'localhost'
|
6
|
+
# :user: 'cortex_reaver'
|
7
|
+
# :password: 'some-password'
|
8
|
+
# :database: 'cortex_reaver'
|
9
|
+
#
|
10
|
+
# Or something like...
|
11
|
+
# :database: 'sqlite:////tmp/cortex_reaver.db'
|
9
12
|
|
10
13
|
# Site-specific configuration parameters
|
11
14
|
:site:
|
@@ -14,15 +17,32 @@
|
|
14
17
|
:keywords: 'Cortex Reaver, Citadel Station'
|
15
18
|
:author: 'Shodan'
|
16
19
|
|
17
|
-
# Ramaze port and adapter
|
18
|
-
# :adapter: 'ramaze'
|
19
|
-
# :port: 7000
|
20
|
-
|
21
20
|
# The static files overlay of your site. You need to own this directory if you
|
22
|
-
# want to use attachments.
|
21
|
+
# want to use attachments. It will be created for you, if it does not exist.
|
23
22
|
# :public_root: '/var/www/public'
|
24
23
|
|
25
24
|
# The directory that contains Cortex Reaver templates. You can copy this from
|
26
25
|
# the lib/cortex_reaver directory and customize to your liking, then reference
|
27
26
|
# that directory here.
|
28
27
|
# :view_root: '/var/www/view'
|
28
|
+
|
29
|
+
# The directory for CortexReaver log files. Defaults to HOME_DIR/log.
|
30
|
+
# :log_root: '/var/www/log'
|
31
|
+
|
32
|
+
# Cortex Reaver has two modes: production and development. Production disables debugging
|
33
|
+
# error messages (returning 404 and 500 errors instead), daemonizes by default, and logs
|
34
|
+
# less.
|
35
|
+
# :mode: :production
|
36
|
+
|
37
|
+
# Whether to daemonize (detach from console and lurk silently, awaiting innocent hackers).
|
38
|
+
# Defaults to true in production mode, false in development mode.
|
39
|
+
# :daemon: true
|
40
|
+
|
41
|
+
# Ramaze host, port, and adapter. Defaults to nil (listens on all interfaces), mongrel,
|
42
|
+
# and port 7000.
|
43
|
+
# :host: 127.0.0.1
|
44
|
+
# :adapter: 'mongrel'
|
45
|
+
# :port: 7000
|
46
|
+
|
47
|
+
# Process ID file: stores each Cortex Reaver's process ID, so you can control it later.
|
48
|
+
# :pidfile: /var/www/cortex_reaver.pid
|