cybozu-go / aptutil

Go utilities for Debian APT repositories
MIT License
124 stars 29 forks source link

How to support security.debian.org? #37

Closed kenhys closed 6 years ago

kenhys commented 6 years ago

Problem

It seems that go-apt-cacher can't handle missing path case. Are there any workaround configuration on this issue?

Expected

There is a workaround configuration in go-apt-cacher.toml or something.

Actual

It works with apt-line:

deb http://security.debian.org/debian-security/ jessie/updates main
deb-src http://security.debian.org/debian-security/ jessie/updates main

and go-apt-cacher.toml.

[mapping]
debian = "http://ftp.jp.debian.org/debian"
debian-security = "http://security.debian.org/debian-security"

But It doesn't work with apt-line and above toml:

deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main
% sudo apt update
...(skip)...
Fetched 23.1 MB in 2s (10.4 MB/s)                                                 
W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/source/Sources  404  Not Found

W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

How to configure go-apt-cacher.toml mapping correctly for http://security.debian.org/? (without modifiyng /etc/apt/sources.list?)

ymmt2005 commented 6 years ago

@kenhys Thank you for the bug report. This may be related to #27. I will take a look.

ymmt2005 commented 6 years ago

@kenhys I failed to reproduce the reported problem with apt on Ubuntu 16.04. Could you provide information about the environment where the problem can be reproduced?

go-apt-cacher.toml:

(snip)

[mapping]
debian = "http://ftp.jp.debian.org/debian"
debian-security = "http://security.debian.org/debian-security"

/etc/apt/sources.list:

deb http://localhost:3142/debian jessie main
deb-src http://localhost:3142/debian jessie main
deb http://localhost:3142/debian-security jessie/updates main
deb-src http://localhost:3142/debian-security jessie/updates main

Result of sudo apt update:

$ sudo apt update
Ign:1 http://localhost:3142/debian jessie InRelease
Get:2 http://localhost:3142/debian-security jessie/updates InRelease [63.1 kB]
Get:3 http://localhost:3142/debian jessie Release [148 kB] 
Get:4 http://localhost:3142/debian jessie Release.gpg [2,434 B]                   
Hit:5 http://packages.microsoft.com/repos/vscode stable InRelease                       
Ign:6 http://localhost:3142/debian jessie/main Sources
Ign:7 http://localhost:3142/debian jessie/main amd64 Packages
Ign:8 http://localhost:3142/debian jessie/main i386 Packages
Get:9 http://localhost:3142/debian jessie/main Translation-en [4,583 kB]
Get:6 http://localhost:3142/debian jessie/main Sources [9,167 kB]   
Get:7 http://localhost:3142/debian jessie/main amd64 Packages [9,064 kB]
Get:8 http://localhost:3142/debian jessie/main i386 Packages [9,065 kB]
Fetched 32.1 MB in 2s (14.7 MB/s)                                
Reading package lists... Done
Building dependency tree       
Reading state information... Done
113 packages can be upgraded. Run 'apt list --upgradable' to see them.
kenhys commented 6 years ago

Thanks, @ymmt2005

Here is the reproducible environment, I know:

I think that important point to reproduce this issue is "missing path" (/debian-security suffix) with guest container's default apt-line.

deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main

And problem is how to map missing path( /debian-security ) between apt-line(guest) and go-apt-cacher.toml(host) correctly.

ymmt2005 commented 6 years ago

Understood. What you want is a forward HTTP proxy, isn't it?

go-apt-cacher is not a forward HTTP proxy by design. It is a reverse HTTP(HTTPS) proxy specially designed for APT repositories. By being a reverse-proxy, go-apt-cacher can support HTTPS origins as well as HTTP.

Please read the detailed descriptions in this article: http://ymmt2005.hatenablog.com/entry/2016/07/19/Introducing_go-apt-cacher_and_go-apt-mirror

So, you need to edit /etc/apt/sources.list to point go-apt-cacher directly.

kenhys commented 6 years ago

Ah, I got it. I've misunderstood design of it. So, I'll close this issue. Thanks, @ymmt2005 !