[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#747559: apt-setup: netrc auth.conf for apt generated in apt-setup/localx/netrc feature

Package: apt-setup
Version: 1:0.89
Severity: wishlist
Tags: d-i

Dear Maintainer,

This feature was requested on the irc channel.
It seem apt has a little known feature of /etc/apt/auth.conf in netrc to
authenticate against http apt servers that require username passwords.

Patch is incoming

The only thing missing is that only root is supposed to be able to read it (i
just rememberd :) )
Anyway, chown root:root 700 /etc/apt/auth.conf is supposed to go in somewhere i
guess, any suggestion on where?

Anthony F. McInerney

-- System Information:
Debian Release: jessie/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
>From d22016c53884695d7223fdf77c810b47fd40411c Mon Sep 17 00:00:00 2001
From: "Anthony F. McInerney" <afm404@gmail.com>
Date: Tue, 6 May 2014 18:50:32 +0100
Subject: [PATCH] Adding netrc to generate auth.conf

Signed-off-by: Anthony F. McInerney <afm404@gmail.com>
 debian/apt-setup-udeb.templates | 7 +++++++
 generators/60local              | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/debian/apt-setup-udeb.templates b/debian/apt-setup-udeb.templates
index 7b7afcf..fdfb3d8 100644
--- a/debian/apt-setup-udeb.templates
+++ b/debian/apt-setup-udeb.templates
@@ -112,3 +112,10 @@ Description: for internal use; can be preseeded
  without using 'dpkg --force-architecture', in addition to the native
  architecture. If empty, only allow installing packages from the native
+Template: apt-setup/local/netrc
+Type: string
+Description: for http apt repositories that require authentication
+does not pull apt/localx/repostory as machine due to possible parse mangle
+format as man netrc suggests
+example: machine packages.server.org login myuser password mypass
diff --git a/generators/60local b/generators/60local
index fcd4f1c..ade16f2 100755
--- a/generators/60local
+++ b/generators/60local
@@ -51,6 +51,13 @@ while db_get "apt-setup/local$i/repository" && [ "$RET" ]; do
+	netrc=
+	if db_get "apt-setup/local$i/netrc"; then
+		netrc="$RET"
+	fi
+	if [ -n "$netrc" ]; then
+		echo "$netrc">> $ROOT/etc/apt/auth.conf
+	fi
 	i="$(($i + 1))"

Reply to: