I have a number of OpenBSD instances in an isolated lab environment with
access to the internet solely through a squid proxy. I'd like them to
be able to install packages but I don't want to globally configure proxy
environment variables because they also communicate with other systems
that should not go through the proxy. I propose the addition of the
"proxy_url" configuration option in /etc/pkg.conf for this purpose.
The patch below works for me.
--
-Chad
Index: pkg.conf.5
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/pkg.conf.5,v
retrieving revision 1.10
diff -u -p -r1.10 pkg.conf.5
--- pkg.conf.5 5 Feb 2017 14:07:45 -0000 1.10
+++ pkg.conf.5 21 Feb 2017 02:18:24 -0000
@@ -83,6 +83,14 @@ installpath += openbsd-mirror.example.or
.Ed
.Pp
should work.
+.It Ar proxy_url
+URL to use to proxy ftp and http requests from the ftp client, e.g.
+.Bd -literal -offset indent
+proxy_url = http://proxy.example.org:3128/
+.Ed
+.Pp
+This setting does not override any existing http_proxy or ftp_proxy
+environment variables.
.It Ar nochecksum
Set to
.Ar yes
cvs server: Diffing OpenBSD
Index: OpenBSD/PackageRepository.pm
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm,v
retrieving revision 1.140
diff -u -p -r1.140 PackageRepository.pm
--- OpenBSD/PackageRepository.pm 6 Feb 2017 16:12:16 -0000
1.140
+++ OpenBSD/PackageRepository.pm 21 Feb 2017 02:18:25 -0000
@@ -729,6 +729,10 @@ sub drop_privileges_and_setup_env
PATH => '/bin:/usr/bin'
);
+ if (my $p = $self->{state}->config->value("proxy_url")) {
+ $newenv{"http_proxy"} = $newenv{"ftp_proxy"} = $p;
+ }
+
# copy selected stuff;
for my $k (qw(
TERM