Salt - caching proxy

This commit is contained in:
unman 2019-08-05 11:18:03 +00:00
parent 95bfe194b6
commit 06167b3e52
4 changed files with 44 additions and 0 deletions

16
README Normal file
View File

@ -0,0 +1,16 @@
This is a caching proxy, based on apt-cacher-ng.
Note that it expects a netvm called "tor" - you should change this to whatever netvm you want to use.
Edit the netvm entry in create.sls
Config files are included, which will work out of the box for Debian,Ubuntu and Fedora.
The cache and log directories are bind-mounted in /rw in the cacher qube.
apt-cacher-ng will cache HTTPS requests if you change https:// to http://HTTPS/// in repo source lists.
Look at change_templates.sls for a suggestion how to do this across all templates.
Copy directory to /srv/salt
qubesctl state.apply cacher.create
qubesctl --skip-dom0 --targets=template-cacher state.apply cacher.install
qubesctl --skip-dom0 --targets=cacher state.apply cacher.configure

15
change_templates.sls Normal file
View File

@ -0,0 +1,15 @@
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :
#
#
#
/etc/apt/sources.list:
file.replace:
- pattern: 'https:'
- repl: 'http://HTTPS/'
- flags: [ 'IGNORECASE', 'MULTILINE' ]
/etc/apt/sources.list.d/qubes-r4.list:
file.replace:
- pattern: 'https:'
- repl: 'http://HTTPS/'
- flags: [ 'IGNORECASE', 'MULTILINE' ]

9
use.sls Normal file
View File

@ -0,0 +1,9 @@
qvm-present-id:
qvm.present:
- name: cacher
- template: template-cacher
- label: gray
/etc/qubes-rpc/policy/qubes.UpdatesProxy:
file.prepend:
- text: $type:TemplateVM $default allow,target=cacher

4
use.top Normal file
View File

@ -0,0 +1,4 @@
base:
dom0:
- match: nodegroup
- cacher.use