rails_pwnerer 0.6.14 → 0.6.15

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.6.15. Running hooks ending in _su as super-user. Fixed base bug that didn't reload nginx configs.
2
+
1
3
  v0.6.14. Cheating to get rpwn on the system path even on restrictive Debians.
2
4
 
3
5
  v0.6.12. Added hooks into the database reset operation.
data/README CHANGED
@@ -163,6 +163,11 @@ have an "install.rb", so you can use your favorite language extension.
163
163
  You cannot have both an "install.rb" and an "install.sh" executing at
164
164
  the same time.
165
165
 
166
+ If the script ends in _su or _su.extension (e.g. _su.ruby), it will be
167
+ run as the super-user (root). Otherwise it will be run as the
168
+ application's user. For instance, post_reset_su.rb wil be run as the
169
+ super-user, whereas post_reset.sh will not.
170
+
166
171
  Writing your lifecycle scripts in Ruby? You can use the +rails_pwnerer+
167
172
  gem to commonly-used chunks of functionality . RailsPwnage::Util
168
173
  (including RailsPwnage::Base) is likely to be useful.
@@ -14,6 +14,8 @@ class RailsPwnage::App::Scripts
14
14
  Dir.chdir app_path do
15
15
  script_file = Dir.glob(File.join('script/rails_pwnerer', script_name + '*')).first
16
16
  return if script_file.nil?
17
+ # run as super-user if the script ends in _su or in _su.extension (e.g. _su.rb)
18
+ su_mode = (script_file =~ /\_su$/) || (script_file =~ /\_su\.[^.]*$/)
17
19
  # make sure the script is executable
18
20
  mode = File.stat(script_file).mode
19
21
  File.chmod((mode | 0100) & 0777, script_file)
@@ -21,10 +23,12 @@ class RailsPwnage::App::Scripts
21
23
 
22
24
  # run the script under the app's user
23
25
  pid = Process.fork do
24
- Process.uid = pwnerer_uid
25
- Process.gid = pwnerer_gid
26
- Process.egid = pwnerer_gid
27
- Process.euid = pwnerer_uid
26
+ unless su_mode
27
+ Process.uid = pwnerer_uid
28
+ Process.gid = pwnerer_gid
29
+ Process.egid = pwnerer_gid
30
+ Process.euid = pwnerer_uid
31
+ end
28
32
  Dir.chdir app_path do
29
33
  script_prefix = (script_file[0] == ?/) ? '' : './'
30
34
  Kernel.system %Q|#{script_prefix}#{script_file} "#{app_name}" "#{instance_name}"|
@@ -35,6 +35,8 @@ module RailsPwnage::Base
35
35
  system "#{path_to_script} start"
36
36
  when :restart
37
37
  system "#{path_to_script} restart"
38
+ when :reload
39
+ system "#{path_to_script} reload"
38
40
  end
39
41
  end
40
42
  end
@@ -1,18 +1,18 @@
1
1
 
2
- # Gem::Specification for Rails_pwnerer-0.6.14
2
+ # Gem::Specification for Rails_pwnerer-0.6.15
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.6.14
8
+ version: 0.6.15
9
9
  platform: ruby
10
10
  authors:
11
11
  - Victor Costan
12
12
  autorequire:
13
13
  bindir: bin
14
14
 
15
- date: 2008-10-02 00:00:00 -04:00
15
+ date: 2008-10-03 00:00:00 -04:00
16
16
  default_executable: bin/rpwn
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
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.14
4
+ version: 0.6.15
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-10-02 00:00:00 -04:00
12
+ date: 2008-10-03 00:00:00 -04:00
13
13
  default_executable: bin/rpwn
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency