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 +2 -0
- data/README +5 -0
- data/lib/pwnage/app/scripts.rb +8 -4
- data/lib/pwnage/base/startup.rb +2 -0
- data/rails_pwnerer.gemspec +3 -3
- metadata +2 -2
data/CHANGELOG
CHANGED
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.
|
data/lib/pwnage/app/scripts.rb
CHANGED
@@ -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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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}"|
|
data/lib/pwnage/base/startup.rb
CHANGED
data/rails_pwnerer.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Rails_pwnerer-0.6.
|
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.
|
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-
|
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.
|
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-
|
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
|