rails_pwnerer 0.5.10 → 0.5.12

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.5.12. Scaffolding sets up sshd for tunneling.
2
+
3
+ v0.5.11. Added check for Rails application root on SVN checkout.
4
+
1
5
  v0.5.10. Fixed bug in nginx reconfiguration on startup.
2
6
 
3
7
  v0.5.9. Better method for locating gems.
data/Manifest CHANGED
@@ -15,6 +15,7 @@ lib/pwnage/base/gems.rb
15
15
  lib/pwnage/base/hostname.rb
16
16
  lib/pwnage/base/packages.rb
17
17
  lib/pwnage/base/process.rb
18
+ lib/pwnage/base/rails.rb
18
19
  lib/pwnage/base/startup.rb
19
20
  lib/pwnage/base.rb
20
21
  lib/pwnage/config/app.rb
@@ -34,6 +35,7 @@ lib/pwnage/scaffolds/hook_dyndns.rb
34
35
  lib/pwnage/scaffolds/mysql_config.rb
35
36
  lib/pwnage/scaffolds/packages.rb
36
37
  lib/pwnage/scaffolds/rubygems.rb
38
+ lib/pwnage/scaffolds/sshd.rb
37
39
  lib/rails_pwnerer.rb
38
40
  LICENSE
39
41
  Manifest
@@ -31,6 +31,7 @@ class RailsPwnage::App::ClusterConfig
31
31
  when :alloc
32
32
  app_config[:port0] = RailsPwnage::Config.alloc_ports app_config[:mongrels]
33
33
  when :free
34
+ return if app_config[:port0] == 0 # do not release if ports have already been released
34
35
  RailsPwnage::Config.free_ports app_config[:port0], app_config[:mongrels]
35
36
  app_config[:port0] = 0
36
37
  end
@@ -16,10 +16,16 @@ module RailsPwnage::App
16
16
  app_name = File.basename svn_path
17
17
  instance_magic(app_name, instance_name) do |app, instance|
18
18
  Config.new.alloc app, instance
19
- Svn.new.checkout svn_path, app, instance
20
- [Config, Svn, Gems, Database, ClusterConfig, NginxConfig].each do |mod|
21
- mod.new.setup app, instance
22
- end
19
+ rails_root = Svn.new.checkout svn_path, app, instance
20
+ if rails_root
21
+ [Config, Svn, Gems, Database, ClusterConfig, NginxConfig].each do |mod|
22
+ mod.new.setup app, instance
23
+ end
24
+ else
25
+ [Svn, Config].each do |mod|
26
+ mod.new.remove app, instance
27
+ end
28
+ end
23
29
  end
24
30
  end
25
31
 
@@ -131,6 +131,10 @@ class RailsPwnage::App::Svn
131
131
  def checkout(svn_path, app_name, instance_name)
132
132
  app_path = RailsPwnage::Config[app_name, instance_name][:app_path]
133
133
  system "svn co #{svn_path} #{app_path}"
134
+ # check that we really checked out a Rails app
135
+ sanity = check_rails_root app_path
136
+ print "You didn't checkout a Rails application. Check your path.\n" unless sanity
137
+ return sanity
134
138
  end
135
139
 
136
140
  def setup(app_name, instance_name)
@@ -0,0 +1,9 @@
1
+ # extends Base with Rails-related functions
2
+
3
+ module RailsPwnage::Base
4
+ # check if the given path is the root of a Rails application
5
+ def check_rails_root(path = '.')
6
+ ['app', 'config', 'db', 'lib', 'log', 'public',
7
+ 'script', 'tmp', 'vendor', 'Rakefile'].all? { |dir| File.exists? File.join(path, dir) }
8
+ end
9
+ end
@@ -1,11 +1,7 @@
1
1
  require 'pp'
2
2
 
3
3
  class RailsPwnage::DevExecutor
4
- # check if we're at the root of a Rails application
5
- def at_app_root()
6
- ['app', 'config', 'db', 'lib', 'log', 'public',
7
- 'script', 'tmp', 'vendor', 'Rakefile'].all? { |dir| File.exists? dir }
8
- end
4
+ include RailsPwnage::Base
9
5
 
10
6
  def read_config(instance)
11
7
  if instance == '*'
@@ -34,7 +30,7 @@ class RailsPwnage::DevExecutor
34
30
 
35
31
  # standalone runner
36
32
  def run(args)
37
- unless at_app_root
33
+ unless check_rails_root '.'
38
34
  print "You need to run this at the root of your Rails application\n"
39
35
  return
40
36
  end
@@ -25,6 +25,8 @@ class RailsPwnage::Executor
25
25
  when 'rubygems'
26
26
  RubyGems.pre_go
27
27
  RubyGems.go
28
+ when 'sshd'
29
+ Sshd.go
28
30
  when 'ddns'
29
31
  if args.length < 5
30
32
  print 'Usage: rpwn scaffold ddns host_name user_name user_password'
@@ -34,6 +36,7 @@ class RailsPwnage::Executor
34
36
  when nil
35
37
  RubyGems.pre_go
36
38
  Packages.go
39
+ Sshd.go
37
40
  RubyGems.go
38
41
  Gems.go
39
42
  Dirs.go
@@ -0,0 +1,19 @@
1
+ # configures sshd for tunneling (Facebook apps anyone?)
2
+
3
+ class RailsPwnage::Scaffolds::Sshd
4
+ include RailsPwnage::Base
5
+
6
+ # runner
7
+ def run
8
+ ['/etc/ssh/sshd_config', '/etc/sshd_config'].each do |fname|
9
+ next unless File.exists? fname
10
+ File.open(fname, 'a') { |f| f.write "GatewayPorts clientspecified\n" }
11
+ control_boot_script('ssh', :reload)
12
+ end
13
+ end
14
+
15
+ # standalone runner
16
+ def self.go
17
+ self.new.run
18
+ end
19
+ end
data/lib/rails_pwnerer.rb CHANGED
@@ -18,6 +18,7 @@ require 'pwnage/base/gems.rb'
18
18
  require 'pwnage/base/hostname.rb'
19
19
  require 'pwnage/base/packages.rb'
20
20
  require 'pwnage/base/process.rb'
21
+ require 'pwnage/base/rails.rb'
21
22
  require 'pwnage/base/startup.rb'
22
23
 
23
24
  require 'pwnage/config/app.rb'
@@ -35,6 +36,7 @@ require 'pwnage/scaffolds/hook_dyndns.rb'
35
36
  require 'pwnage/scaffolds/mysql_config.rb'
36
37
  require 'pwnage/scaffolds/packages.rb'
37
38
  require 'pwnage/scaffolds/rubygems.rb'
39
+ require 'pwnage/scaffolds/sshd.rb'
38
40
 
39
41
  require 'pwnage/app/main.rb'
40
42
  require 'pwnage/app/config.rb'
@@ -1,18 +1,18 @@
1
1
 
2
- # Gem::Specification for Rails_pwnerer-0.5.10
2
+ # Gem::Specification for Rails_pwnerer-0.5.12
3
3
  # Originally generated by Echoe
4
4
 
5
5
  --- !ruby/object:Gem::Specification
6
6
  name: rails_pwnerer
7
7
  version: !ruby/object:Gem::Version
8
- version: 0.5.10
8
+ version: 0.5.12
9
9
  platform: ruby
10
10
  authors:
11
11
  - Victor Costan
12
12
  autorequire:
13
13
  bindir: bin
14
14
 
15
- date: 2008-08-22 00:00:00 -04:00
15
+ date: 2008-08-23 00:00:00 -04:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -51,6 +51,7 @@ extra_rdoc_files:
51
51
  - lib/pwnage/base/hostname.rb
52
52
  - lib/pwnage/base/packages.rb
53
53
  - lib/pwnage/base/process.rb
54
+ - lib/pwnage/base/rails.rb
54
55
  - lib/pwnage/base/startup.rb
55
56
  - lib/pwnage/base.rb
56
57
  - lib/pwnage/config/app.rb
@@ -70,6 +71,7 @@ extra_rdoc_files:
70
71
  - lib/pwnage/scaffolds/mysql_config.rb
71
72
  - lib/pwnage/scaffolds/packages.rb
72
73
  - lib/pwnage/scaffolds/rubygems.rb
74
+ - lib/pwnage/scaffolds/sshd.rb
73
75
  - lib/rails_pwnerer.rb
74
76
  - LICENSE
75
77
  - README
@@ -91,6 +93,7 @@ files:
91
93
  - lib/pwnage/base/hostname.rb
92
94
  - lib/pwnage/base/packages.rb
93
95
  - lib/pwnage/base/process.rb
96
+ - lib/pwnage/base/rails.rb
94
97
  - lib/pwnage/base/startup.rb
95
98
  - lib/pwnage/base.rb
96
99
  - lib/pwnage/config/app.rb
@@ -110,6 +113,7 @@ files:
110
113
  - lib/pwnage/scaffolds/mysql_config.rb
111
114
  - lib/pwnage/scaffolds/packages.rb
112
115
  - lib/pwnage/scaffolds/rubygems.rb
116
+ - lib/pwnage/scaffolds/sshd.rb
113
117
  - lib/rails_pwnerer.rb
114
118
  - LICENSE
115
119
  - Manifest
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.5.10
4
+ version: 0.5.12
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: 2008-08-22 00:00:00 -04:00
12
+ date: 2008-08-23 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -48,6 +48,7 @@ extra_rdoc_files:
48
48
  - lib/pwnage/base/hostname.rb
49
49
  - lib/pwnage/base/packages.rb
50
50
  - lib/pwnage/base/process.rb
51
+ - lib/pwnage/base/rails.rb
51
52
  - lib/pwnage/base/startup.rb
52
53
  - lib/pwnage/base.rb
53
54
  - lib/pwnage/config/app.rb
@@ -67,6 +68,7 @@ extra_rdoc_files:
67
68
  - lib/pwnage/scaffolds/mysql_config.rb
68
69
  - lib/pwnage/scaffolds/packages.rb
69
70
  - lib/pwnage/scaffolds/rubygems.rb
71
+ - lib/pwnage/scaffolds/sshd.rb
70
72
  - lib/rails_pwnerer.rb
71
73
  - LICENSE
72
74
  - README
@@ -88,6 +90,7 @@ files:
88
90
  - lib/pwnage/base/hostname.rb
89
91
  - lib/pwnage/base/packages.rb
90
92
  - lib/pwnage/base/process.rb
93
+ - lib/pwnage/base/rails.rb
91
94
  - lib/pwnage/base/startup.rb
92
95
  - lib/pwnage/base.rb
93
96
  - lib/pwnage/config/app.rb
@@ -107,6 +110,7 @@ files:
107
110
  - lib/pwnage/scaffolds/mysql_config.rb
108
111
  - lib/pwnage/scaffolds/packages.rb
109
112
  - lib/pwnage/scaffolds/rubygems.rb
113
+ - lib/pwnage/scaffolds/sshd.rb
110
114
  - lib/rails_pwnerer.rb
111
115
  - LICENSE
112
116
  - Manifest