vagrant-proxyconf 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -0
- data/Gemfile +3 -2
- data/lib/vagrant-proxyconf/action/configure_docker_proxy.rb +86 -1
- data/lib/vagrant-proxyconf/version.rb +1 -1
- data/spec/unit/vagrant-proxyconf/action/configure_docker_proxy_spec.rb +78 -2
- data/test/issues/172/.rspec +2 -0
- data/test/issues/172/Dockerfile +47 -0
- data/test/issues/172/README.md +31 -0
- data/test/issues/172/Rakefile +27 -0
- data/test/issues/172/Vagrantfile +48 -0
- data/test/issues/172/entrypoint.sh +50 -0
- data/test/issues/172/spec/default/redhat_spec.rb +15 -0
- data/test/issues/172/spec/docker_host/redhat_spec.rb +250 -0
- data/test/issues/172/spec/spec_helper.rb +52 -0
- data/test/issues/172/tinyproxy.conf +333 -0
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0f389b148d8815b5a0f81a851900dbea47114c3f6b60597107d7815eb6ab0fa9
|
4
|
+
data.tar.gz: b3f551cedfd75ebb27d06d495b4bffee2e5832a1b45dec1065933b999939ef13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8a521ab63ab244683f2027ae6dc5902f9f8ff9b08514f3099ff0fcfd9e3f1105a1518fdd924f2fcb57ca53a131a5510cb877eeaefd28b3bef47eab00fe265e6
|
7
|
+
data.tar.gz: 4cd46b6a73344a8d1ee2fe045d2c398c172298d6fa0c2fbda69785e76999d1748072bbf3cc832433494921b9d27dc19644125414198746cf0e236713f3ac06af
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -18,8 +18,8 @@ end
|
|
18
18
|
#### End Added due to https://groups.google.com/forum/#!topic/vagrant-up/J8J6LmhzBqM/discussion
|
19
19
|
|
20
20
|
gem 'vagrant',
|
21
|
-
git: 'https://github.com/
|
22
|
-
ref: ENV.fetch('VAGRANT_VERSION', 'v2.2.
|
21
|
+
git: 'https://github.com/hashicorp/vagrant.git',
|
22
|
+
ref: ENV.fetch('VAGRANT_VERSION', 'v2.2.4')
|
23
23
|
|
24
24
|
gem 'rake'
|
25
25
|
gem 'rspec', '~> 3.1'
|
@@ -27,6 +27,7 @@ gem 'rspec-its', '~> 1.0'
|
|
27
27
|
|
28
28
|
group :development do
|
29
29
|
gem 'guard-rspec'
|
30
|
+
gem 'mini_portile2'
|
30
31
|
gem 'pry'
|
31
32
|
gem 'rb-readline'
|
32
33
|
gem 'redcarpet'
|
@@ -20,6 +20,7 @@ module VagrantPlugins
|
|
20
20
|
detect_export
|
21
21
|
write_docker_config
|
22
22
|
update_docker_client_config
|
23
|
+
update_docker_systemd_config
|
23
24
|
|
24
25
|
true
|
25
26
|
end
|
@@ -33,6 +34,7 @@ module VagrantPlugins
|
|
33
34
|
|
34
35
|
write_docker_config
|
35
36
|
update_docker_client_config
|
37
|
+
update_docker_systemd_config
|
36
38
|
|
37
39
|
true
|
38
40
|
end
|
@@ -109,6 +111,64 @@ module VagrantPlugins
|
|
109
111
|
config_json
|
110
112
|
end
|
111
113
|
|
114
|
+
def update_docker_systemd_config
|
115
|
+
return if !supports_systemd?
|
116
|
+
changed = false
|
117
|
+
|
118
|
+
if disabled?
|
119
|
+
@machine.communicate.tap do |comm|
|
120
|
+
changed = true if comm.test('[ -f /etc/systemd/system/docker.service.d/http-proxy.conf ]')
|
121
|
+
changed = true if comm.test('[ -f /etc/systemd/system/docker.service.d/https-proxy.conf ]')
|
122
|
+
|
123
|
+
comm.sudo('rm -f /etc/systemd/system/docker.service.d/http-proxy.conf')
|
124
|
+
comm.sudo('rm -f /etc/systemd/system/docker.service.d/https-proxy.conf')
|
125
|
+
comm.sudo('systemctl daemon-reload')
|
126
|
+
|
127
|
+
if changed
|
128
|
+
comm.sudo("systemctl restart #{docker}")
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
changed = true
|
134
|
+
return changed
|
135
|
+
end
|
136
|
+
|
137
|
+
systemd_config = docker_systemd_config
|
138
|
+
@docker_systemd_config = tempfile(systemd_config).path
|
139
|
+
|
140
|
+
@machine.communicate.tap do |comm|
|
141
|
+
|
142
|
+
comm.sudo("mkdir -p /etc/systemd/system/docker.service.d")
|
143
|
+
comm.upload(@docker_systemd_config, "/tmp/vagrant-proxyconf-docker-systemd-config")
|
144
|
+
|
145
|
+
if comm.test("diff -Naur /etc/systemd/system/docker.service.d/http-proxy.conf /tmp/vagrant-proxyconf-docker-systemd-config")
|
146
|
+
# system config file is the same as the current config
|
147
|
+
|
148
|
+
changed = false
|
149
|
+
else
|
150
|
+
# system config file is not the same as the current config
|
151
|
+
|
152
|
+
comm.sudo("mv /tmp/vagrant-proxyconf-docker-systemd-config /etc/systemd/system/docker.service.d/http-proxy.conf")
|
153
|
+
changed = true
|
154
|
+
end
|
155
|
+
|
156
|
+
comm.sudo('chown -R 0:0 /etc/systemd/system/docker.service.d/')
|
157
|
+
comm.sudo('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
|
158
|
+
|
159
|
+
if changed
|
160
|
+
# there were changes so restart docker
|
161
|
+
|
162
|
+
comm.sudo('systemctl daemon-reload')
|
163
|
+
comm.sudo("systemctl restart #{docker}")
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
|
168
|
+
changed
|
169
|
+
|
170
|
+
end
|
171
|
+
|
112
172
|
def docker
|
113
173
|
if config_path && config_path.include?('docker.io')
|
114
174
|
'docker.io'
|
@@ -143,6 +203,14 @@ module VagrantPlugins
|
|
143
203
|
return false
|
144
204
|
end
|
145
205
|
|
206
|
+
def supports_systemd?
|
207
|
+
|
208
|
+
@machine.communicate.tap do |comm|
|
209
|
+
comm.test('command -v systemctl') ? true : false
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
146
214
|
def write_docker_config
|
147
215
|
tmp = "/tmp/vagrant-proxyconf"
|
148
216
|
path = config_path
|
@@ -173,7 +241,7 @@ module VagrantPlugins
|
|
173
241
|
|
174
242
|
def detect_export
|
175
243
|
@machine.communicate.tap do |comm|
|
176
|
-
|
244
|
+
supports_systemd? ? @export = '' : @export = 'export '
|
177
245
|
end
|
178
246
|
end
|
179
247
|
|
@@ -207,6 +275,23 @@ module VagrantPlugins
|
|
207
275
|
#{@export}no_proxy=\"#{config.no_proxy || ''}\"
|
208
276
|
CONFIG
|
209
277
|
end
|
278
|
+
|
279
|
+
def docker_systemd_config
|
280
|
+
return if disabled?
|
281
|
+
|
282
|
+
environment = []
|
283
|
+
environment << 'Environment="HTTP_PROXY=' + config.http + '"' if config.http
|
284
|
+
environment << 'Environment="HTTPS_PROXY=' + config.https + '"' if config.https
|
285
|
+
environment << 'Environment="NO_PROXY=' + config.no_proxy + '"' if config.no_proxy
|
286
|
+
|
287
|
+
return if !environment.any?
|
288
|
+
|
289
|
+
<<-SYSTEMD.gsub(/^\s+/, '')
|
290
|
+
[Service]
|
291
|
+
#{environment.join("\n")}
|
292
|
+
SYSTEMD
|
293
|
+
end
|
294
|
+
|
210
295
|
end
|
211
296
|
end
|
212
297
|
end
|
@@ -27,6 +27,8 @@ def mock_update_docker_client_config(machine)
|
|
27
27
|
allow(machine).to receive_message_chain(:communicate, :sudo).with("chown root:root /etc/docker")
|
28
28
|
end
|
29
29
|
|
30
|
+
def mock_update_docker_systemd_config(machine)
|
31
|
+
end
|
30
32
|
|
31
33
|
describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
32
34
|
|
@@ -93,6 +95,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
93
95
|
|
94
96
|
# update_docker_client_config mock
|
95
97
|
allow(docker_proxy).to receive(:supports_config_json?).and_return(true)
|
98
|
+
allow(docker_proxy).to receive(:supports_systemd?).and_return(false)
|
96
99
|
|
97
100
|
@docker_proxy = docker_proxy
|
98
101
|
end
|
@@ -101,14 +104,80 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
101
104
|
before :each do
|
102
105
|
fixture = fixture_file("docker_client_config_json_enabled_proxy")
|
103
106
|
configure_docker_proxy(fixture)
|
107
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with(
|
108
|
+
"sed -e '/^export HTTP_PROXY=/ d\n/^export http_proxy=/ d\n/^export HTTPS_PROXY=/ d\n/^export https_proxy=/ d\n/^export NO_PROXY=/ d\n/^export no_proxy=/ d\n' /etc/default/docker > /etc/default/docker.new"
|
109
|
+
)
|
104
110
|
end
|
105
111
|
|
106
112
|
it 'update /etc/docker/config.json' do
|
107
|
-
|
113
|
+
expect(@docker_proxy.send(:configure_machine)).to eq true
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'and when configuring systemd' do
|
118
|
+
let(:app) { OpenStruct.new }
|
119
|
+
let(:env) { OpenStruct.new }
|
120
|
+
let(:machine) { double('machine') }
|
121
|
+
|
122
|
+
def configure_docker_proxy(fixture)
|
123
|
+
docker_proxy = described_class.new(app, env)
|
124
|
+
docker_proxy.instance_variable_set(:@machine, machine)
|
125
|
+
|
126
|
+
# #docker_client_config_path mock
|
127
|
+
fixture = docker_proxy.send(:tempfile, load_fixture(fixture)).path
|
128
|
+
docker_proxy.instance_variable_set(:@docker_client_config_path, fixture)
|
129
|
+
|
130
|
+
# #supported? mock
|
131
|
+
allow(machine).to receive_message_chain(:guest, :capability?).with(:docker_proxy_conf).and_return(true)
|
132
|
+
allow(machine).to receive_message_chain(:guest, :capability).with(:docker_proxy_conf).and_return('/etc/default/docker')
|
133
|
+
|
134
|
+
# #config mock
|
135
|
+
config = create_config_proxy(
|
136
|
+
:enabled => true,
|
137
|
+
:http => 'http://proxy-server-01.example.com:8080',
|
138
|
+
:https => 'https://proxy-server-01.example.com:8080',
|
139
|
+
:no_proxy => 'localhost',
|
140
|
+
)
|
141
|
+
|
142
|
+
allow(machine).to receive_message_chain(:config, :proxy).and_return(config)
|
143
|
+
allow(machine).to receive_message_chain(:config, :public_send).with(:docker_proxy).and_return(config)
|
144
|
+
allow(machine).to receive_message_chain(:communicate, :test).with('command -v systemctl').and_return(true)
|
145
|
+
|
146
|
+
mock_write_docker_config(machine)
|
147
|
+
mock_update_docker_client_config(machine)
|
148
|
+
|
149
|
+
@docker_proxy = docker_proxy
|
150
|
+
end
|
151
|
+
|
152
|
+
context 'when directory: /etc/systemd/system/docker.service.d does not exist' do
|
153
|
+
|
154
|
+
before :each do
|
155
|
+
fixture = fixture_file("docker_client_config_json_enabled_proxy")
|
156
|
+
configure_docker_proxy(fixture)
|
157
|
+
|
158
|
+
# update_docker_client_config mock
|
159
|
+
allow(@docker_proxy).to receive(:supports_config_json?).and_return(false)
|
160
|
+
allow(@docker_proxy).to receive(:supports_systemd?).and_return(true)
|
161
|
+
|
162
|
+
# systemd_config mocking
|
163
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with("mkdir -p /etc/systemd/system/docker.service.d")
|
164
|
+
allow(machine).to receive_message_chain(:communicate, :upload).with(@docker_proxy.instance_variable_get(:@docker_systemd_config), "/tmp")
|
165
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with('chown -R 0:0 /etc/systemd/system/docker.service.d/')
|
166
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with('chmod 0644 /etc/systemd/system/docker.service.d/http-proxy.conf')
|
167
|
+
allow(machine).to receive_message_chain(:communicate, :test).with('command -v systemctl').and_return(false)
|
168
|
+
allow(machine).to receive_message_chain(:communicate, :test).with('diff -Naur /etc/systemd/system/docker.service.d/http-proxy.conf /tmp/vagrant-proxyconf-docker-systemd-config').and_return(false)
|
169
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with('mv /tmp/vagrant-proxyconf-docker-systemd-config /etc/systemd/system/docker.service.d/http-proxy.conf')
|
170
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with('systemctl daemon-reload')
|
171
|
+
allow(machine).to receive_message_chain(:communicate, :sudo).with('systemctl restart docker')
|
172
|
+
end
|
173
|
+
|
174
|
+
it 'should create directory: /etc/systemd/system/docker.service.d' do
|
175
|
+
expect(@docker_proxy.send(:update_docker_systemd_config)).to eq true
|
176
|
+
end
|
108
177
|
|
109
|
-
expect(@docker_proxy.send(:configure_machine)).to eq true
|
110
178
|
end
|
111
179
|
end
|
180
|
+
|
112
181
|
end
|
113
182
|
end
|
114
183
|
|
@@ -323,6 +392,9 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
323
392
|
config_path = docker_proxy.send(:tempfile, load_fixture(fixture)).path
|
324
393
|
docker_proxy.instance_variable_set(:@docker_client_config_path, config_path)
|
325
394
|
|
395
|
+
# to isolate this test, we turn of support for systemd
|
396
|
+
allow(docker_proxy).to receive(:supports_systemd?).and_return(false)
|
397
|
+
|
326
398
|
allow(machine).to receive_message_chain(:guest, :capability?).with(:docker_proxy_conf).and_return(true)
|
327
399
|
allow(machine).to receive_message_chain(:guest, :capability).with(:docker_proxy_conf).and_return('/etc/default/docker')
|
328
400
|
|
@@ -337,6 +409,7 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
337
409
|
allow(machine).to receive_message_chain(:config, :proxy).and_return(config)
|
338
410
|
allow(machine).to receive_message_chain(:config, :public_send).with(:docker_proxy).and_return(config)
|
339
411
|
|
412
|
+
|
340
413
|
# mock write_docker_config
|
341
414
|
mock_write_docker_config(machine)
|
342
415
|
|
@@ -361,6 +434,9 @@ describe VagrantPlugins::ProxyConf::Action::ConfigureDockerProxy do
|
|
361
434
|
docker_proxy.instance_variable_set(:@machine, machine)
|
362
435
|
docker_proxy.instance_variable_set(:@version, [18, 9, 0])
|
363
436
|
|
437
|
+
# to isolate this test, we turn of support for systemd
|
438
|
+
allow(docker_proxy).to receive(:supports_systemd?).and_return(false)
|
439
|
+
|
364
440
|
fixture = fixture_file("docker_client_config_json_enabled_proxy")
|
365
441
|
config_path = docker_proxy.send(:tempfile, load_fixture(fixture)).path
|
366
442
|
docker_proxy.instance_variable_set(:@docker_client_config_path, config_path)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
FROM centos:7
|
2
|
+
|
3
|
+
ENV CI_USERNAME vagrant
|
4
|
+
ENV CI_PASSWORD vagrant
|
5
|
+
ENV CI_HOMEDIR /home/vagrant
|
6
|
+
ENV CI_SHELL /bin/bash
|
7
|
+
|
8
|
+
EXPOSE 8888
|
9
|
+
|
10
|
+
RUN yum clean all && \
|
11
|
+
yum makecache fast && \
|
12
|
+
yum -y install epel-release && \
|
13
|
+
yum clean expire-cache && \
|
14
|
+
yum -y install \
|
15
|
+
curl \
|
16
|
+
initscripts \
|
17
|
+
openssh-clients \
|
18
|
+
openssh-server \
|
19
|
+
sudo \
|
20
|
+
tinyproxy
|
21
|
+
|
22
|
+
RUN /usr/sbin/sshd-keygen && \
|
23
|
+
mkdir -p /var/run/sshd && \
|
24
|
+
rm -f /usr/lib/tmpfiles.d/systemd-nologin.conf
|
25
|
+
|
26
|
+
RUN if ! getent passwd $CI_USERNAME; then \
|
27
|
+
useradd -m -d ${CI_HOMEDIR} -s ${CI_SHELL} $CI_USERNAME; \
|
28
|
+
fi && \
|
29
|
+
echo "${CI_USERNAME}:${CI_PASSWORD}" | chpasswd && \
|
30
|
+
echo "${CI_USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
|
31
|
+
mkdir -p /etc/sudoers.d && \
|
32
|
+
echo "${CI_USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/${CI_USERNAME} && \
|
33
|
+
chmod 0440 /etc/sudoers.d/${CI_USERNAME} && \
|
34
|
+
mkdir -p ${CI_HOMEDIR}/.ssh && \
|
35
|
+
chown -R ${CI_USERNAME}:${CI_USERNAME} ${CI_HOMEDIR}/.ssh && \
|
36
|
+
chmod 0700 ${CI_HOMEDIR}/.ssh && \
|
37
|
+
curl -L https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub > ${CI_HOMEDIR}/.ssh/vagrant.pub && \
|
38
|
+
touch ${CI_HOMEDIR}/.ssh/authorized_keys && \
|
39
|
+
grep -q "$(cat ${CI_HOMEDIR}/.ssh/vagrant.pub | awk '{print $2}')" ${CI_HOMEDIR}/.ssh/authorized_keys || cat ${CI_HOMEDIR}/.ssh/vagrant.pub >> ${CI_HOMEDIR}/.ssh/authorized_keys && \
|
40
|
+
chown ${CI_USERNAME}:${CI_USERNAME} ${CI_HOMEDIR}/.ssh/authorized_keys && \
|
41
|
+
chmod 0600 ${CI_HOMEDIR}/.ssh/authorized_keys
|
42
|
+
|
43
|
+
COPY tinyproxy.conf /etc/tinyproxy/tinyproxy.conf
|
44
|
+
COPY entrypoint.sh /entrypoint.sh
|
45
|
+
|
46
|
+
ENTRYPOINT ["/entrypoint.sh"]
|
47
|
+
CMD [ "start" ]
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Tests
|
2
|
+
-----
|
3
|
+
|
4
|
+
If you are testing the current release of this plugin via bundler
|
5
|
+
|
6
|
+
```
|
7
|
+
bundle exec vagrant up default
|
8
|
+
```
|
9
|
+
|
10
|
+
## Expect
|
11
|
+
|
12
|
+
|
13
|
+
### Box `default``
|
14
|
+
|
15
|
+
- The box `default` is a docker container that will be a reverse
|
16
|
+
proxy. It should provision itself and work without errors.
|
17
|
+
|
18
|
+
- You can check that the proxy is working by
|
19
|
+
`tail -f /var/log/tinyproxy/tinyproxy.log` inside the container
|
20
|
+
|
21
|
+
- **NOTE**: You'll need to use `docker exec <hash> -it bash` to get into the container
|
22
|
+
|
23
|
+
|
24
|
+
### Box `docker-host`
|
25
|
+
|
26
|
+
- Vagrant should automatically instally docker-ce.
|
27
|
+
- The box should come up and provision itself with the proxy settings
|
28
|
+
configured in your Vagrantfile.
|
29
|
+
|
30
|
+
|
31
|
+
- **NOTE**: You can use `ssh` to connect to this container.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
task :spec => 'spec:all'
|
5
|
+
task :default => :spec
|
6
|
+
|
7
|
+
namespace :spec do
|
8
|
+
targets = []
|
9
|
+
Dir.glob('./spec/*').each do |dir|
|
10
|
+
next unless File.directory?(dir)
|
11
|
+
target = File.basename(dir)
|
12
|
+
target = "_#{target}" if target == "default"
|
13
|
+
targets << target
|
14
|
+
end
|
15
|
+
|
16
|
+
task :all => targets
|
17
|
+
task :default => :all
|
18
|
+
|
19
|
+
targets.each do |target|
|
20
|
+
original_target = target == "_default" ? target[1..-1] : target
|
21
|
+
desc "Run serverspec tests to #{original_target}"
|
22
|
+
RSpec::Core::RakeTask.new(target.to_sym) do |t|
|
23
|
+
ENV['TARGET_HOST'] = original_target
|
24
|
+
t.pattern = "spec/#{original_target}/*_spec.rb"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# this should be the IP address of the :default box
|
2
|
+
$PROXY_HOST ="10.0.2.2"
|
3
|
+
$PROXY_PORT="8888"
|
4
|
+
$PROXY_NO_PROXY=[
|
5
|
+
'localhost',
|
6
|
+
]
|
7
|
+
|
8
|
+
ENV['HTTP_PROXY'] = ENV.fetch('HTTP_PROXY', "http://#{$PROXY_HOST}:#{$PROXY_PORT}")
|
9
|
+
ENV['HTTPS_PROXY'] = ENV.fetch('HTTPS_PROXY', "https://#{$PROXY_HOST}:#{$PROXY_PORT}")
|
10
|
+
ENV['NO_PROXY'] = ENV.fetch('NO_PROXY', $PROXY_NO_PROXY.join(","))
|
11
|
+
|
12
|
+
puts "HTTP_PROXY = '#{ENV["HTTP_PROXY"]}'"
|
13
|
+
puts "HTTPS_PROXY = '#{ENV["HTTPS_PROXY"]}'"
|
14
|
+
puts "NO_PROXY = '#{ENV["NO_PROXY"]}'"
|
15
|
+
|
16
|
+
puts "vagrant-proxyconf is installed? #{Vagrant.has_plugin?('vagrant-proxyconf')}"
|
17
|
+
|
18
|
+
|
19
|
+
Vagrant.configure("2") do |config|
|
20
|
+
|
21
|
+
config.vm.define 'default' do |c|
|
22
|
+
c.vm.box = nil
|
23
|
+
|
24
|
+
if Vagrant.has_plugin?('vagrant-proxyconf')
|
25
|
+
c.proxy.enabled = false
|
26
|
+
end
|
27
|
+
|
28
|
+
c.vm.provider "docker" do |d|
|
29
|
+
d.build_dir = "."
|
30
|
+
d.expose = ["#{$PROXY_PORT}"]
|
31
|
+
d.has_ssh = true
|
32
|
+
d.ports = ["#{$PROXY_PORT}", "#{$PROXY_PORT}"].join(':')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
config.vm.define 'docker_host' do |c|
|
37
|
+
c.vm.box = "centos/7"
|
38
|
+
|
39
|
+
if Vagrant.has_plugin?('vagrant-proxyconf')
|
40
|
+
c.proxy.http = ENV['HTTP_PROXY']
|
41
|
+
c.proxy.https = ENV['HTTPS_PROXY']
|
42
|
+
c.proxy.no_proxy = ENV['NO_PROXY']
|
43
|
+
end
|
44
|
+
|
45
|
+
c.vm.provision "docker"
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -ex
|
3
|
+
|
4
|
+
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
5
|
+
|
6
|
+
start() {
|
7
|
+
# start ssh if sshd is installed
|
8
|
+
if [ -f /usr/sbin/sshd ]; then
|
9
|
+
|
10
|
+
/usr/sbin/sshd-keygen
|
11
|
+
/usr/sbin/sshd -t
|
12
|
+
/usr/sbin/sshd
|
13
|
+
|
14
|
+
else
|
15
|
+
|
16
|
+
true
|
17
|
+
|
18
|
+
fi
|
19
|
+
|
20
|
+
# start tinyproxy
|
21
|
+
/usr/sbin/tinyproxy \
|
22
|
+
-d \
|
23
|
+
-c "/etc/tinyproxy/tinyproxy.conf"
|
24
|
+
}
|
25
|
+
|
26
|
+
stop() {
|
27
|
+
|
28
|
+
pgrep -f 'sshd' | while read _pid
|
29
|
+
do
|
30
|
+
kill -9 $_pid
|
31
|
+
done
|
32
|
+
|
33
|
+
pgrep -f 'tinyproxy' | while read _pid
|
34
|
+
do
|
35
|
+
kill -9 $_pid
|
36
|
+
done
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
case "${1}" in
|
41
|
+
|
42
|
+
start)
|
43
|
+
start
|
44
|
+
;;
|
45
|
+
|
46
|
+
stop)
|
47
|
+
stop
|
48
|
+
;;
|
49
|
+
|
50
|
+
esac
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe package('tinyproxy') do
|
4
|
+
it { should be_installed }
|
5
|
+
end
|
6
|
+
|
7
|
+
describe service('tinyproxy') do
|
8
|
+
it { should be_enabled }
|
9
|
+
it { should be_running }
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
describe port(8888) do
|
14
|
+
it { should be_listening }
|
15
|
+
end
|
@@ -0,0 +1,250 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
PROXY_HOST = "10.0.2.2"
|
4
|
+
|
5
|
+
describe service('docker') do
|
6
|
+
it { should be_running }
|
7
|
+
it { should be_enabled }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe file('/etc/docker/config.json') do
|
11
|
+
it { should be_file }
|
12
|
+
it { should exist }
|
13
|
+
it { should be_mode 600 }
|
14
|
+
it { should be_owned_by "root" }
|
15
|
+
it { should be_grouped_into "root" }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when proxy is enabled' do
|
19
|
+
|
20
|
+
before(:context) do
|
21
|
+
ENV['HTTP_PROXY'] = "http://#{PROXY_HOST}:8888"
|
22
|
+
ENV['HTTPS_PROXY'] = "https://#{PROXY_HOST}:8888"
|
23
|
+
ENV['NO_PROXY'] = "*.example.com"
|
24
|
+
|
25
|
+
`vagrant provision #{ENV['TARGET_HOST']}`
|
26
|
+
`sleep 3`
|
27
|
+
end
|
28
|
+
|
29
|
+
describe file('/etc/docker/config.json') do
|
30
|
+
let(:expected_content) do
|
31
|
+
{
|
32
|
+
"proxies" => {
|
33
|
+
"default" => {
|
34
|
+
"httpProxy" => "http://10.0.2.2:8888",
|
35
|
+
"httpsProxy" => "https://10.0.2.2:8888",
|
36
|
+
"noProxy" => "*.example.com",
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
its(:content_as_json) do
|
43
|
+
should include(expected_content)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe file('/etc/systemd/system/docker.service.d/http-proxy.conf') do
|
48
|
+
let(:expected_content) do
|
49
|
+
<<-CONFIG.gsub(/^\s+/, "")
|
50
|
+
[Service]
|
51
|
+
Environment="HTTP_PROXY=http://10.0.2.2:8888"
|
52
|
+
Environment="HTTPS_PROXY=https://10.0.2.2:8888"
|
53
|
+
Environment="NO_PROXY=*.example.com"
|
54
|
+
CONFIG
|
55
|
+
end
|
56
|
+
|
57
|
+
it { should be_file }
|
58
|
+
it { should exist }
|
59
|
+
it { should be_mode 644 }
|
60
|
+
it { should be_owned_by "root" }
|
61
|
+
it { should be_grouped_into "root" }
|
62
|
+
its(:content) { should include(expected_content) }
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'when HTTP_PROXY=""' do
|
68
|
+
|
69
|
+
before(:context) do
|
70
|
+
ENV['HTTP_PROXY'] = ""
|
71
|
+
ENV['HTTPS_PROXY'] = "https://#{PROXY_HOST}:8888"
|
72
|
+
ENV['NO_PROXY'] = "*.example.com"
|
73
|
+
|
74
|
+
`vagrant provision #{ENV['TARGET_HOST']}`
|
75
|
+
`sleep 3`
|
76
|
+
end
|
77
|
+
|
78
|
+
describe file('/etc/docker/config.json') do
|
79
|
+
let(:expected_content) do
|
80
|
+
{
|
81
|
+
"proxies" => {
|
82
|
+
"default" => {
|
83
|
+
"httpsProxy" => "https://#{PROXY_HOST}:8888",
|
84
|
+
"noProxy" => "*.example.com",
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
its(:content_as_json) do
|
91
|
+
should include(expected_content)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe file('/etc/systemd/system/docker.service.d/http-proxy.conf') do
|
96
|
+
let(:expected_content) do
|
97
|
+
<<-CONFIG.gsub(/^\s+/, "")
|
98
|
+
[Service]
|
99
|
+
Environment="HTTPS_PROXY=https://10.0.2.2:8888"
|
100
|
+
Environment="NO_PROXY=*.example.com"
|
101
|
+
CONFIG
|
102
|
+
end
|
103
|
+
|
104
|
+
it { should be_file }
|
105
|
+
it { should exist }
|
106
|
+
it { should be_mode 644 }
|
107
|
+
it { should be_owned_by "root" }
|
108
|
+
it { should be_grouped_into "root" }
|
109
|
+
its(:content) { should include(expected_content) }
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'when HTTPS_PROXY=""' do
|
115
|
+
|
116
|
+
before(:context) do
|
117
|
+
ENV['HTTP_PROXY'] = "http://#{PROXY_HOST}:8888"
|
118
|
+
ENV['HTTPS_PROXY'] = ""
|
119
|
+
ENV['NO_PROXY'] = "*.example.com"
|
120
|
+
|
121
|
+
`vagrant provision #{ENV['TARGET_HOST']}`
|
122
|
+
end
|
123
|
+
|
124
|
+
describe file('/etc/docker/config.json') do
|
125
|
+
let(:expected_content) do
|
126
|
+
{
|
127
|
+
"proxies" => {
|
128
|
+
"default" => {
|
129
|
+
"httpProxy" => "http://#{PROXY_HOST}:8888",
|
130
|
+
"noProxy" => "*.example.com",
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
end
|
135
|
+
|
136
|
+
its(:content_as_json) do
|
137
|
+
should include(expected_content)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe file('/etc/systemd/system/docker.service.d/http-proxy.conf') do
|
142
|
+
let(:expected_content) do
|
143
|
+
<<-CONFIG.gsub(/^\s+/, "")
|
144
|
+
[Service]
|
145
|
+
Environment="HTTP_PROXY=http://10.0.2.2:8888"
|
146
|
+
Environment="NO_PROXY=*.example.com"
|
147
|
+
CONFIG
|
148
|
+
end
|
149
|
+
|
150
|
+
it { should be_file }
|
151
|
+
it { should exist }
|
152
|
+
it { should be_mode 644 }
|
153
|
+
it { should be_owned_by "root" }
|
154
|
+
it { should be_grouped_into "root" }
|
155
|
+
its(:content) { should include(expected_content) }
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
159
|
+
|
160
|
+
context 'when HTTPS_PROXY="" and HTTP_PROXY=""' do
|
161
|
+
|
162
|
+
before(:context) do
|
163
|
+
ENV['HTTP_PROXY'] = ""
|
164
|
+
ENV['HTTPS_PROXY'] = ""
|
165
|
+
ENV['NO_PROXY'] = "*.example.com"
|
166
|
+
|
167
|
+
`vagrant provision #{ENV['TARGET_HOST']}`
|
168
|
+
`sleep 3`
|
169
|
+
end
|
170
|
+
|
171
|
+
describe file('/etc/docker/config.json') do
|
172
|
+
let(:expected_content) do
|
173
|
+
{
|
174
|
+
"proxies" => {
|
175
|
+
"default" => {
|
176
|
+
"noProxy" => "*.example.com",
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
|
+
end
|
181
|
+
|
182
|
+
its(:content_as_json) do
|
183
|
+
should include(expected_content)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe file('/etc/systemd/system/docker.service.d/http-proxy.conf') do
|
188
|
+
let(:expected_content) do
|
189
|
+
<<-CONFIG.gsub(/^\s+/, "")
|
190
|
+
[Service]
|
191
|
+
Environment="NO_PROXY=*.example.com"
|
192
|
+
CONFIG
|
193
|
+
end
|
194
|
+
|
195
|
+
it { should be_file }
|
196
|
+
it { should exist }
|
197
|
+
it { should be_mode 644 }
|
198
|
+
it { should be_owned_by "root" }
|
199
|
+
it { should be_grouped_into "root" }
|
200
|
+
its(:content) { should include(expected_content) }
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
context 'when NO_PROXY=""' do
|
206
|
+
|
207
|
+
before(:context) do
|
208
|
+
ENV['HTTP_PROXY'] = "http://#{PROXY_HOST}:8888"
|
209
|
+
ENV['HTTPS_PROXY'] = "https://#{PROXY_HOST}:8888"
|
210
|
+
ENV['NO_PROXY'] = ""
|
211
|
+
|
212
|
+
`vagrant provision #{ENV['TARGET_HOST']}`
|
213
|
+
`sleep 3`
|
214
|
+
end
|
215
|
+
|
216
|
+
describe file('/etc/docker/config.json') do
|
217
|
+
let(:expected_content) do
|
218
|
+
{
|
219
|
+
"proxies" => {
|
220
|
+
"default" => {
|
221
|
+
"httpProxy" => "http://#{PROXY_HOST}:8888",
|
222
|
+
"httpsProxy" => "https://#{PROXY_HOST}:8888",
|
223
|
+
}
|
224
|
+
}
|
225
|
+
}
|
226
|
+
end
|
227
|
+
|
228
|
+
its(:content_as_json) do
|
229
|
+
should include(expected_content)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
describe file('/etc/systemd/system/docker.service.d/http-proxy.conf') do
|
234
|
+
let(:expected_content) do
|
235
|
+
<<-CONFIG.gsub(/^\s+/, "")
|
236
|
+
[Service]
|
237
|
+
Environment="HTTP_PROXY=http://10.0.2.2:8888"
|
238
|
+
Environment="HTTPS_PROXY=https://10.0.2.2:8888"
|
239
|
+
CONFIG
|
240
|
+
end
|
241
|
+
|
242
|
+
it { should be_file }
|
243
|
+
it { should exist }
|
244
|
+
it { should be_mode 644 }
|
245
|
+
it { should be_owned_by "root" }
|
246
|
+
it { should be_grouped_into "root" }
|
247
|
+
its(:content) { should include(expected_content) }
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'serverspec'
|
2
|
+
require 'net/ssh'
|
3
|
+
require 'tempfile'
|
4
|
+
|
5
|
+
set :backend, :ssh
|
6
|
+
|
7
|
+
if ENV['ASK_SUDO_PASSWORD']
|
8
|
+
begin
|
9
|
+
require 'highline/import'
|
10
|
+
rescue LoadError
|
11
|
+
fail "highline is not available. Try installing it."
|
12
|
+
end
|
13
|
+
set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
|
14
|
+
else
|
15
|
+
set :sudo_password, ENV['SUDO_PASSWORD'] || "vagrant"
|
16
|
+
end
|
17
|
+
|
18
|
+
host = ENV['TARGET_HOST']
|
19
|
+
|
20
|
+
`vagrant up #{host}`
|
21
|
+
|
22
|
+
config = Tempfile.new('', Dir.tmpdir)
|
23
|
+
config.write(`vagrant ssh-config #{host}`)
|
24
|
+
config.close
|
25
|
+
|
26
|
+
options = Net::SSH::Config.for(host, [config.path])
|
27
|
+
|
28
|
+
options[:user] ||= Etc.getlogin
|
29
|
+
|
30
|
+
set :host, options[:host_name] || host
|
31
|
+
set :ssh_options, options
|
32
|
+
|
33
|
+
# Disable sudo
|
34
|
+
# set :disable_sudo, true
|
35
|
+
|
36
|
+
|
37
|
+
# Set environment variables
|
38
|
+
set :env,
|
39
|
+
:LANG => 'C',
|
40
|
+
:LC_MESSAGES => 'C'
|
41
|
+
|
42
|
+
# Set PATH
|
43
|
+
# set :path, '/sbin:/usr/local/sbin:$PATH'
|
44
|
+
set :path, [
|
45
|
+
'/usr/local/bin',
|
46
|
+
'/usr/local/sbin',
|
47
|
+
'/usr/bin',
|
48
|
+
'/usr/sbin',
|
49
|
+
'/bin',
|
50
|
+
'/sbin',
|
51
|
+
'$PATH',
|
52
|
+
].join(':')
|
@@ -0,0 +1,333 @@
|
|
1
|
+
##
|
2
|
+
## tinyproxy.conf -- tinyproxy daemon configuration file
|
3
|
+
##
|
4
|
+
## This example tinyproxy.conf file contains example settings
|
5
|
+
## with explanations in comments. For decriptions of all
|
6
|
+
## parameters, see the tinproxy.conf(5) manual page.
|
7
|
+
##
|
8
|
+
|
9
|
+
#
|
10
|
+
# User/Group: This allows you to set the user and group that will be
|
11
|
+
# used for tinyproxy after the initial binding to the port has been done
|
12
|
+
# as the root user. Either the user or group name or the UID or GID
|
13
|
+
# number may be used.
|
14
|
+
#
|
15
|
+
User tinyproxy
|
16
|
+
Group tinyproxy
|
17
|
+
|
18
|
+
#
|
19
|
+
# Port: Specify the port which tinyproxy will listen on. Please note
|
20
|
+
# that should you choose to run on a port lower than 1024 you will need
|
21
|
+
# to start tinyproxy using root.
|
22
|
+
#
|
23
|
+
Port 8888
|
24
|
+
|
25
|
+
#
|
26
|
+
# Listen: If you have multiple interfaces this allows you to bind to
|
27
|
+
# only one. If this is commented out, tinyproxy will bind to all
|
28
|
+
# interfaces present.
|
29
|
+
#
|
30
|
+
#Listen 192.168.0.1
|
31
|
+
|
32
|
+
#
|
33
|
+
# Bind: This allows you to specify which interface will be used for
|
34
|
+
# outgoing connections. This is useful for multi-home'd machines where
|
35
|
+
# you want all traffic to appear outgoing from one particular interface.
|
36
|
+
#
|
37
|
+
#Bind 192.168.0.1
|
38
|
+
|
39
|
+
#
|
40
|
+
# BindSame: If enabled, tinyproxy will bind the outgoing connection to the
|
41
|
+
# ip address of the incoming connection.
|
42
|
+
#
|
43
|
+
#BindSame yes
|
44
|
+
|
45
|
+
#
|
46
|
+
# Timeout: The maximum number of seconds of inactivity a connection is
|
47
|
+
# allowed to have before it is closed by tinyproxy.
|
48
|
+
#
|
49
|
+
Timeout 600
|
50
|
+
|
51
|
+
#
|
52
|
+
# ErrorFile: Defines the HTML file to send when a given HTTP error
|
53
|
+
# occurs. You will probably need to customize the location to your
|
54
|
+
# particular install. The usual locations to check are:
|
55
|
+
# /usr/local/share/tinyproxy
|
56
|
+
# /usr/share/tinyproxy
|
57
|
+
# /etc/tinyproxy
|
58
|
+
#
|
59
|
+
#ErrorFile 404 "/usr/share/tinyproxy/404.html"
|
60
|
+
#ErrorFile 400 "/usr/share/tinyproxy/400.html"
|
61
|
+
#ErrorFile 503 "/usr/share/tinyproxy/503.html"
|
62
|
+
#ErrorFile 403 "/usr/share/tinyproxy/403.html"
|
63
|
+
#ErrorFile 408 "/usr/share/tinyproxy/408.html"
|
64
|
+
|
65
|
+
#
|
66
|
+
# DefaultErrorFile: The HTML file that gets sent if there is no
|
67
|
+
# HTML file defined with an ErrorFile keyword for the HTTP error
|
68
|
+
# that has occured.
|
69
|
+
#
|
70
|
+
DefaultErrorFile "/usr/share/tinyproxy/default.html"
|
71
|
+
|
72
|
+
#
|
73
|
+
# StatHost: This configures the host name or IP address that is treated
|
74
|
+
# as the stat host: Whenever a request for this host is received,
|
75
|
+
# Tinyproxy will return an internal statistics page instead of
|
76
|
+
# forwarding the request to that host. The default value of StatHost is
|
77
|
+
# tinyproxy.stats.
|
78
|
+
#
|
79
|
+
#StatHost "tinyproxy.stats"
|
80
|
+
#
|
81
|
+
|
82
|
+
#
|
83
|
+
# StatFile: The HTML file that gets sent when a request is made
|
84
|
+
# for the stathost. If this file doesn't exist a basic page is
|
85
|
+
# hardcoded in tinyproxy.
|
86
|
+
#
|
87
|
+
StatFile "/usr/share/tinyproxy/stats.html"
|
88
|
+
|
89
|
+
#
|
90
|
+
# LogFile: Allows you to specify the location where information should
|
91
|
+
# be logged to. If you would prefer to log to syslog, then disable this
|
92
|
+
# and enable the Syslog directive. These directives are mutually
|
93
|
+
# exclusive.
|
94
|
+
#
|
95
|
+
LogFile "/var/log/tinyproxy/tinyproxy.log"
|
96
|
+
|
97
|
+
#
|
98
|
+
# Syslog: Tell tinyproxy to use syslog instead of a logfile. This
|
99
|
+
# option must not be enabled if the Logfile directive is being used.
|
100
|
+
# These two directives are mutually exclusive.
|
101
|
+
#
|
102
|
+
#Syslog On
|
103
|
+
|
104
|
+
#
|
105
|
+
# LogLevel:
|
106
|
+
#
|
107
|
+
# Set the logging level. Allowed settings are:
|
108
|
+
# Critical (least verbose)
|
109
|
+
# Error
|
110
|
+
# Warning
|
111
|
+
# Notice
|
112
|
+
# Connect (to log connections without Info's noise)
|
113
|
+
# Info (most verbose)
|
114
|
+
#
|
115
|
+
# The LogLevel logs from the set level and above. For example, if the
|
116
|
+
# LogLevel was set to Warning, then all log messages from Warning to
|
117
|
+
# Critical would be output, but Notice and below would be suppressed.
|
118
|
+
#
|
119
|
+
LogLevel Info
|
120
|
+
|
121
|
+
#
|
122
|
+
# PidFile: Write the PID of the main tinyproxy thread to this file so it
|
123
|
+
# can be used for signalling purposes.
|
124
|
+
#
|
125
|
+
PidFile "/var/run/tinyproxy/tinyproxy.pid"
|
126
|
+
|
127
|
+
#
|
128
|
+
# XTinyproxy: Tell Tinyproxy to include the X-Tinyproxy header, which
|
129
|
+
# contains the client's IP address.
|
130
|
+
#
|
131
|
+
#XTinyproxy Yes
|
132
|
+
|
133
|
+
#
|
134
|
+
# Upstream:
|
135
|
+
#
|
136
|
+
# Turns on upstream proxy support.
|
137
|
+
#
|
138
|
+
# The upstream rules allow you to selectively route upstream connections
|
139
|
+
# based on the host/domain of the site being accessed.
|
140
|
+
#
|
141
|
+
# For example:
|
142
|
+
# # connection to test domain goes through testproxy
|
143
|
+
# upstream testproxy:8008 ".test.domain.invalid"
|
144
|
+
# upstream testproxy:8008 ".our_testbed.example.com"
|
145
|
+
# upstream testproxy:8008 "192.168.128.0/255.255.254.0"
|
146
|
+
#
|
147
|
+
# # no upstream proxy for internal websites and unqualified hosts
|
148
|
+
# no upstream ".internal.example.com"
|
149
|
+
# no upstream "www.example.com"
|
150
|
+
# no upstream "10.0.0.0/8"
|
151
|
+
# no upstream "192.168.0.0/255.255.254.0"
|
152
|
+
# no upstream "."
|
153
|
+
#
|
154
|
+
# # connection to these boxes go through their DMZ firewalls
|
155
|
+
# upstream cust1_firewall:8008 "testbed_for_cust1"
|
156
|
+
# upstream cust2_firewall:8008 "testbed_for_cust2"
|
157
|
+
#
|
158
|
+
# # default upstream is internet firewall
|
159
|
+
# upstream firewall.internal.example.com:80
|
160
|
+
#
|
161
|
+
# The LAST matching rule wins the route decision. As you can see, you
|
162
|
+
# can use a host, or a domain:
|
163
|
+
# name matches host exactly
|
164
|
+
# .name matches any host in domain "name"
|
165
|
+
# . matches any host with no domain (in 'empty' domain)
|
166
|
+
# IP/bits matches network/mask
|
167
|
+
# IP/mask matches network/mask
|
168
|
+
#
|
169
|
+
#Upstream some.remote.proxy:port
|
170
|
+
|
171
|
+
#
|
172
|
+
# MaxClients: This is the absolute highest number of threads which will
|
173
|
+
# be created. In other words, only MaxClients number of clients can be
|
174
|
+
# connected at the same time.
|
175
|
+
#
|
176
|
+
MaxClients 100
|
177
|
+
|
178
|
+
#
|
179
|
+
# MinSpareServers/MaxSpareServers: These settings set the upper and
|
180
|
+
# lower limit for the number of spare servers which should be available.
|
181
|
+
#
|
182
|
+
# If the number of spare servers falls below MinSpareServers then new
|
183
|
+
# server processes will be spawned. If the number of servers exceeds
|
184
|
+
# MaxSpareServers then the extras will be killed off.
|
185
|
+
#
|
186
|
+
MinSpareServers 5
|
187
|
+
MaxSpareServers 20
|
188
|
+
|
189
|
+
#
|
190
|
+
# StartServers: The number of servers to start initially.
|
191
|
+
#
|
192
|
+
StartServers 10
|
193
|
+
|
194
|
+
#
|
195
|
+
# MaxRequestsPerChild: The number of connections a thread will handle
|
196
|
+
# before it is killed. In practise this should be set to 0, which
|
197
|
+
# disables thread reaping. If you do notice problems with memory
|
198
|
+
# leakage, then set this to something like 10000.
|
199
|
+
#
|
200
|
+
MaxRequestsPerChild 0
|
201
|
+
|
202
|
+
#
|
203
|
+
# Allow: Customization of authorization controls. If there are any
|
204
|
+
# access control keywords then the default action is to DENY. Otherwise,
|
205
|
+
# the default action is ALLOW.
|
206
|
+
#
|
207
|
+
# The order of the controls are important. All incoming connections are
|
208
|
+
# tested against the controls based on order.
|
209
|
+
#
|
210
|
+
Allow 127.0.0.1
|
211
|
+
Allow 0.0.0.0/0
|
212
|
+
|
213
|
+
#
|
214
|
+
# AddHeader: Adds the specified headers to outgoing HTTP requests that
|
215
|
+
# Tinyproxy makes. Note that this option will not work for HTTPS
|
216
|
+
# traffic, as Tinyproxy has no control over what headers are exchanged.
|
217
|
+
#
|
218
|
+
#AddHeader "X-My-Header" "Powered by Tinyproxy"
|
219
|
+
|
220
|
+
#
|
221
|
+
# ViaProxyName: The "Via" header is required by the HTTP RFC, but using
|
222
|
+
# the real host name is a security concern. If the following directive
|
223
|
+
# is enabled, the string supplied will be used as the host name in the
|
224
|
+
# Via header; otherwise, the server's host name will be used.
|
225
|
+
#
|
226
|
+
ViaProxyName "tinyproxy"
|
227
|
+
|
228
|
+
#
|
229
|
+
# DisableViaHeader: When this is set to yes, Tinyproxy does NOT add
|
230
|
+
# the Via header to the requests. This virtually puts Tinyproxy into
|
231
|
+
# stealth mode. Note that RFC 2616 requires proxies to set the Via
|
232
|
+
# header, so by enabling this option, you break compliance.
|
233
|
+
# Don't disable the Via header unless you know what you are doing...
|
234
|
+
#
|
235
|
+
#DisableViaHeader Yes
|
236
|
+
|
237
|
+
#
|
238
|
+
# Filter: This allows you to specify the location of the filter file.
|
239
|
+
#
|
240
|
+
#Filter "/etc/tinyproxy/filter"
|
241
|
+
|
242
|
+
#
|
243
|
+
# FilterURLs: Filter based on URLs rather than domains.
|
244
|
+
#
|
245
|
+
#FilterURLs On
|
246
|
+
|
247
|
+
#
|
248
|
+
# FilterExtended: Use POSIX Extended regular expressions rather than
|
249
|
+
# basic.
|
250
|
+
#
|
251
|
+
#FilterExtended On
|
252
|
+
|
253
|
+
#
|
254
|
+
# FilterCaseSensitive: Use case sensitive regular expressions.
|
255
|
+
#
|
256
|
+
#FilterCaseSensitive On
|
257
|
+
|
258
|
+
#
|
259
|
+
# FilterDefaultDeny: Change the default policy of the filtering system.
|
260
|
+
# If this directive is commented out, or is set to "No" then the default
|
261
|
+
# policy is to allow everything which is not specifically denied by the
|
262
|
+
# filter file.
|
263
|
+
#
|
264
|
+
# However, by setting this directive to "Yes" the default policy becomes
|
265
|
+
# to deny everything which is _not_ specifically allowed by the filter
|
266
|
+
# file.
|
267
|
+
#
|
268
|
+
#FilterDefaultDeny Yes
|
269
|
+
|
270
|
+
#
|
271
|
+
# Anonymous: If an Anonymous keyword is present, then anonymous proxying
|
272
|
+
# is enabled. The headers listed are allowed through, while all others
|
273
|
+
# are denied. If no Anonymous keyword is present, then all headers are
|
274
|
+
# allowed through. You must include quotes around the headers.
|
275
|
+
#
|
276
|
+
# Most sites require cookies to be enabled for them to work correctly, so
|
277
|
+
# you will need to allow Cookies through if you access those sites.
|
278
|
+
#
|
279
|
+
#Anonymous "Host"
|
280
|
+
#Anonymous "Authorization"
|
281
|
+
#Anonymous "Cookie"
|
282
|
+
|
283
|
+
#
|
284
|
+
# ConnectPort: This is a list of ports allowed by tinyproxy when the
|
285
|
+
# CONNECT method is used. To disable the CONNECT method altogether, set
|
286
|
+
# the value to 0. If no ConnectPort line is found, all ports are
|
287
|
+
# allowed (which is not very secure.)
|
288
|
+
#
|
289
|
+
# The following two ports are used by SSL.
|
290
|
+
#
|
291
|
+
ConnectPort 443
|
292
|
+
ConnectPort 563
|
293
|
+
|
294
|
+
#
|
295
|
+
# Configure one or more ReversePath directives to enable reverse proxy
|
296
|
+
# support. With reverse proxying it's possible to make a number of
|
297
|
+
# sites appear as if they were part of a single site.
|
298
|
+
#
|
299
|
+
# If you uncomment the following two directives and run tinyproxy
|
300
|
+
# on your own computer at port 8888, you can access Google using
|
301
|
+
# http://localhost:8888/google/ and Wired News using
|
302
|
+
# http://localhost:8888/wired/news/. Neither will actually work
|
303
|
+
# until you uncomment ReverseMagic as they use absolute linking.
|
304
|
+
#
|
305
|
+
#ReversePath "/google/" "http://www.google.com/"
|
306
|
+
#ReversePath "/wired/" "http://www.wired.com/"
|
307
|
+
|
308
|
+
#
|
309
|
+
# When using tinyproxy as a reverse proxy, it is STRONGLY recommended
|
310
|
+
# that the normal proxy is turned off by uncommenting the next directive.
|
311
|
+
#
|
312
|
+
#ReverseOnly Yes
|
313
|
+
|
314
|
+
#
|
315
|
+
# Use a cookie to track reverse proxy mappings. If you need to reverse
|
316
|
+
# proxy sites which have absolute links you must uncomment this.
|
317
|
+
#
|
318
|
+
#ReverseMagic Yes
|
319
|
+
|
320
|
+
#
|
321
|
+
# The URL that's used to access this reverse proxy. The URL is used to
|
322
|
+
# rewrite HTTP redirects so that they won't escape the proxy. If you
|
323
|
+
# have a chain of reverse proxies, you'll need to put the outermost
|
324
|
+
# URL here (the address which the end user types into his/her browser).
|
325
|
+
#
|
326
|
+
# If not set then no rewriting occurs.
|
327
|
+
#
|
328
|
+
#ReverseBaseURL "http://localhost:8888/"
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
### foo
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-proxyconf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Teemu Matilainen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Vagrant plugin that configures the virtual machine to use proxy servers
|
14
14
|
email:
|
@@ -138,6 +138,16 @@ files:
|
|
138
138
|
- spec/unit/vagrant-proxyconf/resource_spec.rb
|
139
139
|
- spec/unit/vagrant-proxyconf/resources/yum_config_spec.rb
|
140
140
|
- spec/unit/vagrant-proxyconf/userinfo_uri_spec.rb
|
141
|
+
- test/issues/172/.rspec
|
142
|
+
- test/issues/172/Dockerfile
|
143
|
+
- test/issues/172/README.md
|
144
|
+
- test/issues/172/Rakefile
|
145
|
+
- test/issues/172/Vagrantfile
|
146
|
+
- test/issues/172/entrypoint.sh
|
147
|
+
- test/issues/172/spec/default/redhat_spec.rb
|
148
|
+
- test/issues/172/spec/docker_host/redhat_spec.rb
|
149
|
+
- test/issues/172/spec/spec_helper.rb
|
150
|
+
- test/issues/172/tinyproxy.conf
|
141
151
|
- test/issues/180/.rspec
|
142
152
|
- test/issues/180/Dockerfile
|
143
153
|
- test/issues/180/README.md
|
@@ -170,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
180
|
version: '0'
|
171
181
|
requirements: []
|
172
182
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.6
|
183
|
+
rubygems_version: 2.7.6
|
174
184
|
signing_key:
|
175
185
|
specification_version: 4
|
176
186
|
summary: A Vagrant plugin that configures the virtual machine to use proxy servers
|
@@ -230,6 +240,16 @@ test_files:
|
|
230
240
|
- spec/unit/vagrant-proxyconf/resource_spec.rb
|
231
241
|
- spec/unit/vagrant-proxyconf/resources/yum_config_spec.rb
|
232
242
|
- spec/unit/vagrant-proxyconf/userinfo_uri_spec.rb
|
243
|
+
- test/issues/172/.rspec
|
244
|
+
- test/issues/172/Dockerfile
|
245
|
+
- test/issues/172/README.md
|
246
|
+
- test/issues/172/Rakefile
|
247
|
+
- test/issues/172/Vagrantfile
|
248
|
+
- test/issues/172/entrypoint.sh
|
249
|
+
- test/issues/172/spec/default/redhat_spec.rb
|
250
|
+
- test/issues/172/spec/docker_host/redhat_spec.rb
|
251
|
+
- test/issues/172/spec/spec_helper.rb
|
252
|
+
- test/issues/172/tinyproxy.conf
|
233
253
|
- test/issues/180/.rspec
|
234
254
|
- test/issues/180/Dockerfile
|
235
255
|
- test/issues/180/README.md
|