Article View: linux.debian.bugs.dist
Article #5970Bug#1154000: auto-apt-proxy does not check for running server using srv dns
From: samy
Date: Tue, 24 Nov 2026 19:00
Date: Tue, 24 Nov 2026 19:00
173 lines
8637 bytes
8637 bytes
This is a multi-part message in MIME format.
--------------qYny2ejfSZd0LkprOhy3LZHo
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Hello,
I would like to inform you that I have fixed my problem by patching the
code myself. The patch is as follows:
```
# ...
result=$(
/usr/lib/apt/apt-helper srv-lookup ${service}.${d} |
awk -F'\t' 'BEGIN{srand()}{print $0 "\t" rand() }' |
sort -t "$(printf '\t')" -k2n -k3n -k5n |
awk '/^[^#]/{print "http://" $1 ":" $4}'
)
for proxy in $result; do
log_debug "Testing proxy $proxy"
if hit "$proxy" | grep -q -i 'HTTP.*406'; then
log_debug "Successfully tested $proxy"
set_proxy "${proxy}"
return 0
else
log_debug "Error while testing $proxy"
fi
done
# ...
```
This should handle the SRV records priority, weight, shuffle records
with the same priority and weight, test them in order and select the
first one that works, while not setting a proxy if none work.
Note that I have not tested thoroughly my code for security
vulnerabilities. I still hope this code snippet can be useful for someone.
Best Regards
On 14/11/2026 22:08, samy wrote:
> Package: auto-apt-proxy
> Version: 14.1
> Severity: normal
> X-Debbugs-Cc:samy2014@free.fr
>
> Dear Maintainer,
>
> I am trying to setup an apt cache for my servers. Ideally, they would check the cache server, and if it is unavailable, directly download packages from official mirrors.
> In most cases, auto-apt-proxy should handle that since it check if the server is running. However, when setting the srv dns record, it does not. The comments in the code reason that it does not need to guess that it is a correct caching server, but the possibility of checking if the server is up to potentially fall back on an other does not seem do have been considered.
>
> I would appreciate if this beheaviour could be changed.
>
> Please note that while I am reporting for an old version of the package, the beheaviour is still present in its latest version.
>
> Best regards
>
>
> -- System Information:
> Debian Release: 12.15
> APT prefers oldstable-updates
> APT policy: (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, 'oldstable')
> Architecture: amd64 (x86_64)
>
> Kernel: Linux 7.0.14-20-pve (SMP w/1 CPU thread; PREEMPT)
> Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
> Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
> Shell: /bin/sh linked to /usr/bin/dash
> Init: systemd (via /run/systemd/system)
>
> Versions of packages auto-apt-proxy depends on:
> ii apt 2.6.2
>
> Versions of packages auto-apt-proxy recommends:
> ii iproute2 6.1.0-3
>
> auto-apt-proxy suggests no packages.
>
> -- no debconf information
--------------qYny2ejfSZd0LkprOhy3LZHo
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html>
<html data-lt-installed="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="padding-bottom: 1px;">
<p>Hello,</p>
<p>I would like to inform you that I have fixed my problem by
patching the code myself. The patch is as follows:</p>
<p>```</p>
<p># ...<br>
result=$(<br>
/usr/lib/apt/apt-helper srv-lookup ${service}.${d} |<br>
awk -F'\t' 'BEGIN{srand()}{print $0 "\t" rand() }'
|<br>
sort -t "$(printf '\t')" -k2n -k3n -k5n |<br>
awk '/^[^#]/{print "http://" $1 ":" $4}'<br>
)<br>
for proxy in $result; do<br>
log_debug "Testing proxy $proxy"<br>
if hit "$proxy" | grep -q -i 'HTTP.*406'; then<br>
log_debug "Successfully tested $proxy"<br>
set_proxy "${proxy}"<br>
return 0<br>
else<br>
log_debug "Error while testing $proxy"<br>
fi<br>
done</p>
<p># ...</p>
<p>```</p>
<p>This should handle the SRV records priority, weight, shuffle
records with the same priority and weight, test them in order and
select the first one that works, while not setting a proxy if none
work.</p>
<p>Note that I have not tested thoroughly my code for security
vulnerabilities. I still hope this code snippet can be useful for
someone.</p>
<p>Best Regards</p>
<div class="moz-cite-prefix">On 14/11/2026 22:08, samy wrote:<br>
</div>
<blockquote type="cite"
cite="mid:179469052343.36484.13057488585209115052.reportbug@frigg.rennes">
<pre wrap="" class="moz-quote-pre">Package: auto-apt-proxy
Version: 14.1
Severity: normal
X-Debbugs-Cc: <a class="moz-txt-link-abbreviated" href="mailto:samy2014@free.fr">samy2014@free.fr</a>
Dear Maintainer,
I am trying to setup an apt cache for my servers. Ideally, they would check the cache server, and if it is unavailable, directly download packages from official mirrors.
In most cases, auto-apt-proxy should handle that since it check if the server is running. However, when setting the srv dns record, it does not. The comments in the code reason that it does not need to guess that it is a correct caching server, but the possibility of checking if the server is up to potentially fall back on an other does not seem do have been considered.
I would appreciate if this beheaviour could be changed.
Please note that while I am reporting for an old version of the package, the beheaviour is still present in its latest version.
Best regards
-- System Information:
Debian Release: 12.15
APT prefers oldstable-updates
APT policy: (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Kernel: Linux 7.0.14-20-pve (SMP w/1 CPU thread; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages auto-apt-proxy depends on:
ii apt 2.6.2
Versions of packages auto-apt-proxy recommends:
ii iproute2 6.1.0-3
auto-apt-proxy suggests no packages.
-- no debconf information
</pre>
</blockquote>
</body>
<lt-container></lt-container>
</html>
--------------qYny2ejfSZd0LkprOhy3LZHo--
Technical Details
Message-ID:
<O33Ud-dVnn-5@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodReferences:
<NZtkd-bUv2-7@gated-at.bofh.it> <NZtkd-bUv2-7@gated-at.bofh.it>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod From: samy <samy2014@free.fr> Newsgroups: linux.debian.bugs.dist Subject: Bug#1154000: auto-apt-proxy does not check for running server using srv dns Date: Tue, 24 Nov 2026 20:00:01 +0100 Message-ID: <O33Ud-dVnn-5@gated-at.bofh.it> References: <NZtkd-bUv2-7@gated-at.bofh.it> <NZtkd-bUv2-7@gated-at.bofh.it> X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Tue Nov 24 18:53:08 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Spam-Flag: NO X-Spam-Score: -0.198 Reply-To: samy <samy2014@free.fr>, 1154000@bugs.debian.org, 1154000@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: terceiro@debian.org X-Debian-Pr-Message: followup 1154000 X-Debian-Pr-Package: auto-apt-proxy X-Debian-Pr-Source: auto-apt-proxy Content-Type: multipart/alternative; boundary="------------qYny2ejfSZd0LkprOhy3LZHo" MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US X-Debian-Message: from BTS X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2004736 List-ID: <debian-bugs-dist.lists.debian.org> List-URL: <https://lists.debian.org/debian-bugs-dist/> Approved: robomod@news.nic.it Lines: 173 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Tue, 24 Nov 2026 19:51:38 +0100 X-Original-Message-ID: <a69be499-e8d7-4db9-bb56-6a870eb48707@free.fr> X-Original-References: <179469052343.36484.13057488585209115052.reportbug@frigg.rennes> <179469052343.36484.13057488585209115052.reportbug@frigg.rennes>