rails_pwnerer 0.6.49 → 0.6.50
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/README +15 -0
- data/lib/pwnage/app/config.rb +10 -1
- data/lib/pwnage/app/nginx_config.rb +5 -1
- data/lib/pwnage/app/vcs/svn.rb +1 -1
- data/lib/pwnage/base/rails.rb +3 -3
- data/rails_pwnerer.gemspec +2 -2
- metadata +2 -2
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -147,6 +147,21 @@ underscores (_) instead. You can use dots in application names,
|
|
147
147
|
though.
|
148
148
|
|
149
149
|
|
150
|
+
SSL servers with +rails_pwnerer+:
|
151
|
+
|
152
|
+
1) Generate a server key:
|
153
|
+
openssl req -new -newkey rsa:2048 -keyout config/rails_pwnerer/instance.pem -out instance.csr -nodes
|
154
|
+
|
155
|
+
2) Be sure to set the CN (Common Name) to your server's DNS address. Send the
|
156
|
+
CSR file to your CA: cat instance.csr
|
157
|
+
|
158
|
+
3) Copy the certificate into the +rails_pwnerer+ configuration directory:
|
159
|
+
cat > config/rails_pwnerer/instance.cer
|
160
|
+
|
161
|
+
4) Clean up: rm instance.csr
|
162
|
+
|
163
|
+
5) Update the application in production: sudo rpwn update
|
164
|
+
|
150
165
|
Hooked on +rails_pwnerer+:
|
151
166
|
|
152
167
|
You're growing to complex applications which need daemons outside
|
data/lib/pwnage/app/config.rb
CHANGED
@@ -74,13 +74,22 @@ class RailsPwnage::App::Config
|
|
74
74
|
|
75
75
|
populate_defaults app_name, instance_name, app_config
|
76
76
|
Dir.chdir app_config[:app_path] do
|
77
|
+
# Populate the default SSL configuration if the right files exist.
|
78
|
+
ssl_cert = File.expand_path "config/rails_pwnerer/#{instance_name}.cer"
|
79
|
+
ssl_key = File.expand_path "config/rails_pwnerer/#{instance_name}.pem"
|
80
|
+
if File.exists?(ssl_cert) and File.exists?(ssl_key)
|
81
|
+
app_config[:ssl_cert] = ssl_cert
|
82
|
+
app_config[:ssl_key] = ssl_key
|
83
|
+
app_config[:port] = 443
|
84
|
+
end
|
85
|
+
|
77
86
|
["config/rails_pwnerer/.yml", "config/rails_pwnerer/#{instance_name}.yml"].each do |fname|
|
78
87
|
next unless File.exists? fname
|
79
88
|
config_update = File.open(fname, 'r') { |f| YAML.load f }
|
80
89
|
config_update.each do |key, value|
|
81
90
|
app_config[key] = value
|
82
91
|
end
|
83
|
-
end
|
92
|
+
end
|
84
93
|
end
|
85
94
|
|
86
95
|
# TODO: if database settings changed, the database should be moved (re-created or re-keyed)
|
@@ -15,7 +15,8 @@ class RailsPwnage::App::NginxConfig
|
|
15
15
|
dns_names = app_config[:dns_name]
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
default_app_port = app_config[:ssl_key] ? 443 : 80
|
19
|
+
app_port = app_config[:port] || default_app_port
|
19
20
|
|
20
21
|
nginx_config = File.join(RailsPwnage::Config.path_to(:nginx_configs),
|
21
22
|
app_name + '.' + instance_name)
|
@@ -31,6 +32,9 @@ class RailsPwnage::App::NginxConfig
|
|
31
32
|
f << <<NGINX_CONFIG
|
32
33
|
server {
|
33
34
|
listen #{app_port};
|
35
|
+
#{app_config[:ssl_key] ? 'ssl on;' : ''}
|
36
|
+
#{app_config[:ssl_key] ? "ssl_certificate #{app_config[:ssl_cert]};" : ''}
|
37
|
+
#{app_config[:ssl_key] ? "ssl_certificate_key #{app_config[:ssl_key]};" : ''}
|
34
38
|
#{(dns_names.empty? ? '' : "server_name " + dns_names.join(' ') + ";")}
|
35
39
|
root #{app_config[:app_path]}/public;
|
36
40
|
client_max_body_size #{app_config[:max_request_mb]}M;
|
data/lib/pwnage/app/vcs/svn.rb
CHANGED
@@ -59,7 +59,7 @@ class RailsPwnage::App::Svn
|
|
59
59
|
|
60
60
|
def checkout(remote_path, app_name, instance_name)
|
61
61
|
app_path = RailsPwnage::Config[app_name, instance_name][:app_path]
|
62
|
-
return :next unless remote_path =~ /svn.*\:\/\//
|
62
|
+
return :next unless remote_path =~ /svn.*\:\/\// or remote_path =~ /http.*\:\/\/.*svn/
|
63
63
|
|
64
64
|
print "Doing SVN checkout, please enter your password if prompted...\n"
|
65
65
|
system "svn co #{remote_path} #{app_path}"
|
data/lib/pwnage/base/rails.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module RailsPwnage::Base
|
4
4
|
# check if the given path is the root of a Rails application
|
5
5
|
def check_rails_root(path = '.')
|
6
|
-
['app', 'config', 'db', '
|
7
|
-
|
6
|
+
['app', 'config', 'db', 'public', 'script', 'vendor',
|
7
|
+
'Rakefile'].all? { |dir| File.exists? File.join(path, dir) }
|
8
8
|
end
|
9
|
-
end
|
9
|
+
end
|
data/rails_pwnerer.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rails_pwnerer}
|
5
|
-
s.version = "0.6.
|
5
|
+
s.version = "0.6.50"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Victor Costan"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2010-02-03}
|
10
10
|
s.default_executable = %q{bin/rpwn}
|
11
11
|
s.description = %q{Rails deployment tool/hack.}
|
12
12
|
s.email = %q{victor@costan.us}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_pwnerer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.50
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Costan
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-03 00:00:00 -05:00
|
13
13
|
default_executable: bin/rpwn
|
14
14
|
dependencies: []
|
15
15
|
|