vagrant-qubes 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +10 -16
- data/lib/vagrant-qubes/action/createvm.rb +1 -1
- data/lib/vagrant-qubes/action/openfirewall.rb +48 -0
- data/lib/vagrant-qubes/action.rb +18 -2
- data/lib/vagrant-qubes/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c705377c5a04ced31e884fb0e70dd403b28ec8533808eef7c554b4455768d4a2
|
4
|
+
data.tar.gz: 62c911e38e6c2d74b895dcae2587b0a87d7038f821b24a50354a5cf9c89f36a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09261b413e0971e92dd441e96579a50dbe124f3743c637a434d213a7a854e67664ad2efb5afc6ceb47cfb380f48a0563749ea10bdce39be3b66892e59bb2a749'
|
7
|
+
data.tar.gz: 6e4accb9bf2e3aec656f9e1c9b976b227417b08b69841085c3535aa0e00e8582341067c4963e7d42e0eb01081a7b9301fec8f5763882908707ce2919766a0f07
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -12,9 +12,9 @@ Right now, this should be considered alpha at best, basic "up" and "destroy" wor
|
|
12
12
|
|
13
13
|
```
|
14
14
|
vms = {
|
15
|
-
"test1" => ["AppVM","red","fedora-33", 2, 2048, "
|
16
|
-
"test2" => ["AppVM","red","fedora-33", 2, 2048, "
|
17
|
-
"test3" => ["AppVM","red","fedora-33", 2, 2048, "
|
15
|
+
"test1" => ["AppVM","red","fedora-33", 2, 2048, "vagrant"],
|
16
|
+
"test2" => ["AppVM","red","fedora-33", 2, 2048, "vagrant"],
|
17
|
+
"test3" => ["AppVM","red","fedora-33", 2, 2048, "vagrant"],
|
18
18
|
}
|
19
19
|
|
20
20
|
Vagrant.configure("2") do |config|
|
@@ -43,23 +43,17 @@ This is not fully thought through or fully secured, use it at your own risk!
|
|
43
43
|
|
44
44
|
## Installation
|
45
45
|
|
46
|
-
|
46
|
+
Run this in your AppVM
|
47
47
|
|
48
|
-
```
|
49
|
-
|
48
|
+
```
|
49
|
+
vagrant plugin install vagrant-qubes
|
50
50
|
```
|
51
51
|
|
52
|
-
|
52
|
+
## TODO
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
$ gem install vagrant-qubes
|
59
|
-
|
60
|
-
## Usage
|
61
|
-
|
62
|
-
TODO: Write usage instructions here
|
54
|
+
There is a lot to do, in no particular order:
|
55
|
+
- Extend to support Standalone VMs/HVMs
|
56
|
+
- Sort out networking, and therefore provisioning
|
63
57
|
|
64
58
|
## Contributing
|
65
59
|
|
@@ -45,7 +45,7 @@ module VagrantPlugins
|
|
45
45
|
+ ' ' + config.guest_numvcpus.to_s\
|
46
46
|
+ ' ' + config.guest_memsize.to_s\
|
47
47
|
+ ' ' + config.guest_netvm\
|
48
|
-
+ '"| qrexec-client-vm dom0 vagrant_create+' + env[:machine].config.vm.hostname
|
48
|
+
+ '" | qrexec-client-vm dom0 vagrant_create+' + env[:machine].config.vm.hostname
|
49
49
|
stdout, stderr, status = Open3.capture3(command)
|
50
50
|
if status != 0
|
51
51
|
raise Errors::QRExecError,
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
require 'open3'
|
3
|
+
require 'socket'
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module Qubes
|
7
|
+
module Action
|
8
|
+
class OpenFirewall
|
9
|
+
def initialize(app, _env)
|
10
|
+
@app = app
|
11
|
+
@logger = Log4r::Logger.new('vagrant_qubes::action::openfirewall')
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
openfirewall(env)
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
|
19
|
+
def openfirewall(env)
|
20
|
+
@logger.info('vagrant-qubes, openfirewall: start...')
|
21
|
+
|
22
|
+
# Get config
|
23
|
+
machine = env[:machine]
|
24
|
+
config = env[:machine].provider_config
|
25
|
+
|
26
|
+
if env[:machine_state].to_s == 'running'
|
27
|
+
vagrant_ip = Socket.ip_address_list.find {|a| a.ipv4? ? !(a.ipv4_loopback?) : !(a.ipv6_loopback?) }
|
28
|
+
|
29
|
+
env[:ui].info I18n.t('vagrant_qubes.vagrant_qubes_message',
|
30
|
+
message: 'vagrant ip ' + vagrant_ip.ip_address.to_s)
|
31
|
+
|
32
|
+
command = 'echo "' + vagrant_ip.ip_address.to_s\
|
33
|
+
+ '" | qrexec-client-vm dom0 vagrant_openfw+' + env[:machine].config.vm.hostname
|
34
|
+
|
35
|
+
stdout, stderr, status = Open3.capture3(command)
|
36
|
+
if status != 0
|
37
|
+
raise Errors::QRExecError,
|
38
|
+
message: 'qrexec failed with status' + status.to_s
|
39
|
+
end
|
40
|
+
else
|
41
|
+
raise Errors::GeneralError,
|
42
|
+
message: 'VM not running so cannot edit firewall policy'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/vagrant-qubes/action.rb
CHANGED
@@ -30,16 +30,31 @@ module VagrantPlugins
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def self.action_ssh
|
34
|
+
Vagrant::Action::Builder.new.tap do |b|
|
35
|
+
b.use ReadState
|
36
|
+
b.use ReadSSHInfo
|
37
|
+
b.use SSHExec
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.action_openfirewall
|
42
|
+
Vagrant::Action::Builder.new.tap do |b|
|
43
|
+
b.use ReadState
|
44
|
+
b.use OpenFirewall
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
33
48
|
def self.action_up
|
34
49
|
Vagrant::Action::Builder.new.tap do |b|
|
35
50
|
b.use ConfigValidate
|
36
|
-
# b.use HandleBox - This downloads the "box"
|
37
51
|
b.use ReadState
|
38
52
|
b.use CreateVM
|
39
53
|
b.use ReadState
|
40
54
|
b.use Boot
|
41
55
|
b.use Call, WaitForState, :running, 240 do |env1, b1|
|
42
56
|
if env1[:result] == 'True'
|
57
|
+
b1.use action_openfirewall
|
43
58
|
b1.use action_provision
|
44
59
|
end
|
45
60
|
end
|
@@ -52,7 +67,7 @@ module VagrantPlugins
|
|
52
67
|
b.use Call, WaitForState, :running, 240 do |env1, b1|
|
53
68
|
if env1[:result] == 'True'
|
54
69
|
b1.use ReadState
|
55
|
-
|
70
|
+
b1.use Provision
|
56
71
|
#b1.use SyncedFolderCleanup
|
57
72
|
#b1.use SyncedFolders
|
58
73
|
#b1.use SetHostname
|
@@ -91,6 +106,7 @@ module VagrantPlugins
|
|
91
106
|
autoload :ReadSSHInfo, action_root.join('read_ssh_info')
|
92
107
|
autoload :Halt, action_root.join('halt')
|
93
108
|
autoload :Destroy, action_root.join('destroy')
|
109
|
+
autoload :OpenFirewall, action_root.join('openfirewall')
|
94
110
|
end
|
95
111
|
end
|
96
112
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-qubes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary Pentland
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/vagrant-qubes/action/createvm.rb
|
76
76
|
- lib/vagrant-qubes/action/destroy.rb
|
77
77
|
- lib/vagrant-qubes/action/halt.rb
|
78
|
+
- lib/vagrant-qubes/action/openfirewall.rb
|
78
79
|
- lib/vagrant-qubes/action/read_ssh_info.rb
|
79
80
|
- lib/vagrant-qubes/action/read_state.rb
|
80
81
|
- lib/vagrant-qubes/action/wait_for_state.rb
|