SamenvattingJe hebt twee dingen nodig: Een man in the middle DNS die voor de omleiding zorgt en een webserver die HTTP Requests naar apt-proxy leidt. Dat kan allemaal op dezelfde server, maar is niet noodzakelijk. Een mooie scheiding zou MitM DNS op een server en webserver plus proxy op een andere server.
Several addressesThe server has serval functions and uses different addresses for different functions. Addresses, IP-aliases, are configured in /etc/network/interfaces the relevant part:# The primary network interface allow-hotplug eth0 auto eth0 iface eth0 inet static address 192.168.45.71 # An alias on the primary network interface auto eth0:1 iface eth0:1 inet static name Ethernet alias forDNS address 192.168.45.10 # An alias on the primary network interface auto eth0:2 iface eth0:2 inet static name Ethernet alias aptproxy address 192.168.45.38 Two Domain Name ServersThere are two DNSes. bind and dnsmasq. bindListen only on localhost. Configured in /etc/bind/named.conf.options the relevant part: listen-on { 127.0.0.1/32; } ; # due a second DNS on this very same computer Addresses. Configured in /etc/dnsdata/brd.losc.nl.db the relevant part: ; Domain Name Server dns IN A 192.168.45.10 ; aptproxy IN A 192.168.45.38 HINFO "IPalias" "Apache_plus_apt-cacher-ng" ; dnsmasq
listen-address=192.168.45.10 Omleidingen: # Add domains which you want to force to an IP address here. address=/ftp.de.debian.org/192.168.45.38 address=/ftp.nl.debian.org/192.168.45.38 address=/gb.archive.ubuntu.com/192.168.45.38 address=/nl.archive.ubuntu.com/192.168.45.38 dHCpHost Configuration domain name server
option domain-name-servers dns.brd.losc.nl ; webserver/etc/apache2/sites-available/aptproxy Oppakken
ServerAlias ftp.nl.debian.org ServerAlias ftp.de.debian.org ServerAlias nl.archive.ubuntu.com ServerAlias gb.archive.ubuntu.com Omleiden
ProxyPass /debian http://localhost:3142/debian ProxyPassReverse /debian http://localhost:3142/debian ProxyPass /ubuntu http://localhost:3142/ubuntu ProxyPassReverse /ubuntu http://localhost:3142/ubuntu aptproxy/etc/apt-cacher-ng/acng.conf listen
Port:3142 split
tarball# Repository remapping. See manual for details. # In this example, backends file is generated during package installation. Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu |