runshare 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
metadata ADDED
@@ -0,0 +1,231 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: runshare
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Prisyazhnyy
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-11-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake-compiler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: |
70
+ # ruby unshare (runshare)
71
+
72
+ This tool allows to unshare Linux namespaces.
73
+ The implementation is similar to the unshare(1) tool.
74
+
75
+ ## Installation
76
+
77
+ Add this line to your application's Gemfile:
78
+
79
+ ```ruby
80
+ gem 'runshare'
81
+ ```
82
+
83
+ And then execute:
84
+
85
+ $ bundle
86
+
87
+ Or install it yourself as:
88
+
89
+ $ gem install runshare
90
+
91
+ ## Usage
92
+
93
+ > require "runshare"
94
+ > RUnshare::unshare
95
+
96
+ For example:
97
+
98
+ cat > test.rb
99
+
100
+ require "runshare"
101
+
102
+ pid = RUnshare::unshare(
103
+ :clone_newpid => true,
104
+ :clone_newns => true,
105
+ :clone_newcgroup => true,
106
+ :clone_newipc => true,
107
+ :clone_newuts => true,
108
+ :clone_newnet => true,
109
+ :clone_newtime => true,
110
+ :fork => true,
111
+ :mount_proc => "/proc",
112
+ # docker export $(docker create hello-world) | tar -xf - -C rootfs
113
+ :root => "/tmp/rootfs"
114
+ )
115
+
116
+ if pid == 0
117
+ # child
118
+ puts "--- #{Process.pid}"
119
+ if system("/hello") != true
120
+ raise "bad"
121
+ end
122
+ puts "--- done"
123
+ else
124
+ # parent
125
+ puts "-- unshare=#{pid}, pid=#{Process.pid}"
126
+ puts "-- exit=#{Process.waitpid(pid)}"
127
+ end
128
+
129
+ ^D
130
+
131
+ sudo ruby -I ./lib ./test.rb
132
+
133
+ ## Quick start
134
+
135
+ $ rake compile && echo 'require "runshare"; RUnshare::unshare(:clone_newuts => true)' | irb
136
+ install -c tmp/x86_64-linux/runshare/2.4.10/runshare.so lib/runshare/runshare.so
137
+ cp tmp/x86_64-linux/runshare/2.4.10/runshare.so tmp/x86_64-linux/stage/lib/runshare/runshare.so
138
+ Switch to inspect mode.
139
+ require "runshare"; RUnshare::unshare
140
+
141
+ ## Ruby <2.5
142
+
143
+ If your app is single threaded and you are observing:
144
+
145
+ eval:1: warning: pthread_create failed for timer: Invalid argument, scheduling broken
146
+
147
+ Just ignore it with some degree of bravity. You also
148
+ can silence it by setting:
149
+
150
+ $VERBOSE = nil
151
+
152
+ ## Development
153
+
154
+ After checking out the repo, run `bin/setup` to install dependencies.
155
+ Then, run `rake spec` to run the tests.
156
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
157
+
158
+ To install this gem onto your local machine, run `bundle exec rake install`.
159
+ To release a new version, update the version number in `version.rb`,
160
+ and then run `bundle exec rake release`, which will create a git tag
161
+ for the version, push git commits and tags, and push the `.gem` file
162
+ to [rubygems.org](https://rubygems.org).
163
+
164
+ ## Contributing
165
+
166
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sitano/runshare.
167
+ This project is intended to be a safe, welcoming space for collaboration,
168
+ and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
169
+
170
+ ## License
171
+
172
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
173
+ email:
174
+ - john.koepi@gmail.com
175
+ executables: []
176
+ extensions:
177
+ - ext/runshare/extconf.rb
178
+ extra_rdoc_files: []
179
+ files:
180
+ - ".gitignore"
181
+ - ".rspec"
182
+ - ".travis.yml"
183
+ - Gemfile
184
+ - Gemfile.lock
185
+ - LICENSE.txt
186
+ - README.md
187
+ - Rakefile
188
+ - bin/console
189
+ - bin/setup
190
+ - ext/runshare/extconf.rb
191
+ - ext/runshare/include/all-io.h
192
+ - ext/runshare/include/c.h
193
+ - ext/runshare/include/caputils.h
194
+ - ext/runshare/include/namespace.h
195
+ - ext/runshare/include/pathnames.h
196
+ - ext/runshare/include/pwdutils.h
197
+ - ext/runshare/include/signames.h
198
+ - ext/runshare/include/strutils.h
199
+ - ext/runshare/runshare.c
200
+ - ext/runshare/unshare.c
201
+ - ext/runshare/unshare.h
202
+ - lib/runshare.rb
203
+ - lib/runshare/version.rb
204
+ - runshare.gemspec
205
+ homepage: https://github.com/sitano/runshare
206
+ licenses:
207
+ - MIT
208
+ metadata:
209
+ homepage_uri: https://github.com/sitano/runshare
210
+ source_code_uri: https://github.com/sitano/runshare
211
+ post_install_message:
212
+ rdoc_options: []
213
+ require_paths:
214
+ - lib
215
+ required_ruby_version: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ version: '0'
220
+ required_rubygems_version: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: '0'
225
+ requirements: []
226
+ rubyforge_project:
227
+ rubygems_version: 2.6.14.4
228
+ signing_key:
229
+ specification_version: 4
230
+ summary: This tool allows to unshare Linux namespaces.
231
+ test_files: []