Tag: https

apt-cacher-ng で https リポジトリを直接アクセスするようにする

apt-cacher-ng で各種リポジトリをキャッシュしているのですが,https の場合エラーになってしまいます.

error message
$ sudo apt update
Err:1 https://updates.signal.org/desktop/apt xenial InRelease              Reading from proxy failed - read (115: Operation now in progress) [IP: 192.168.1.102 3142]                                                      Err:2 https://deb.opera.com/opera-stable stable InRelease
  Reading from proxy failed - read (115: Operation now in progress) [IP: 192.168.1.102 3142]
 :
W: Failed to fetch https://deb.opera.com/opera-stable/dists/stable/InRelease  Reading from proxy failed - read (115: Operation now in progress) [IP: 192.168.1.102 3142]
W: Failed to fetch https://updates.signal.org/desktop/apt/dists/xenial/InRelease  Reading from proxy failed - read (115: Operation now in progress) [IP: 192.168.1.102 3142]
W: Some index files failed to download. They have been ignored, or old ones used instead.

Debian wiki に解決方法が載っていました.https の場合はキャッシュせずに直接見に行かせる設定が出来るようです.

HTTPS repositories
apt-cacher-ng will obviously fail to serve HTTPS repositories. There are many solutions upstream but I have found the simplest solution to be to simply tunnel HTTPS connections directly on the proxy, by putting this in /etc/apt-cacher-ng/acng.conf:

PassThroughPattern: .*

This is, as far as I can tell, the only way to avoid doing a special configuration on the clients for HTTPS repositories. The downside is that HTTPS content is not cached.

/etc/apt-cacher-ng/acng.confPassThroughPattern: .* を設定してデーモンを再起動することで直接アクセスしてエラーを出さなくなりました.

以下のページのように source.list を書き換えてhttps であってもキャッシュする方法もあるようですが今回はなしで.

apt-cacher-ng環境
$ dpkg-query -W apt-cacher-ng
apt-cacher-ng   3.1-1build1
$ hostnamectl | egrep 'Operating System|Architecture'
  Operating System: Ubuntu 18.04.2 LTS
      Architecture: x86-64
apt実行環境
$ dpkg-query -W apt
apt     1.8.2
$ hostnamectl | egrep 'Operating System|Architecture'
  Operating System: Debian GNU/Linux bullseye/sid
      Architecture: x86-64