[ubuntu-us-mi] /etc/cron.daily/apt and proxy

Jay R. Wren jrwren at xmtp.net
Mon May 18 21:52:38 BST 2009

Good point!

I recently ran into this issue, since it sudo's as the admin user, which is 
by default the first user of the admin group. I didn't like this much on a 
server machine, so I simply added root as the first user in the admin group. 
Its hacky for sure, but at least this cron job isn't sudoing to my account 
every night.

The goal is to get http proxy settings which are set via the ubuntu 
administration menu, presumably by the default admin user.

There are a lot of assumptions IMO. but if the http_proxy environment 
variable is set, it will be used instead, so you could just set the 
http_proxy environment variable.  You'd have to set it either in that 
/etc/cron.daily/apt or in /etc/crontab. it doesn't look like crontab reads 
any profile or environment before starting.


From: "Robert Citek" <robert.citek at gmail.com>
Sent: Monday, May 18, 2009 10:50 AM
To: "Ubuntu Michigan Local Community Team" <ubuntu-us-mi at lists.ubuntu.com>
Subject: [ubuntu-us-mi] /etc/cron.daily/apt and proxy

> In Ubuntu 8.10, why is this chunk of code in /etc/cron.daily/apt?
> <code>
> # set the proxy based on the admin users gconf settings
> admin_user=$(getent group admin|cut -d: -f4|cut -d, -f1)
> if [ -n "$admin_user" ] && [ -x /usr/bin/sudo ] && [ -z "$http_proxy"
> ] && [ -x /usr/bin/gconftool ]; then
>        use=$(sudo -u "$admin_user" gconftool --get
> /system/http_proxy/use_http_proxy)
>        host=$(sudo -u "$admin_user" gconftool --get 
> /system/http_proxy/host)
>        port=$(sudo -u "$admin_user" gconftool --get 
> /system/http_proxy/port)
>        if [ "$use" = "true" ] && [ -n "$host" ] && [ -n "$port" ]; then
>                export http_proxy="http://$host:$port/"
>        fi
> fi
> </code>
> The two issues I have with it:
> 1) it ignores any Acquire::http::Proxy setting in a /etc/apt/apt.conf.d/ 
> file
> 2) it does not handle the case where the proxy is defined by an
> Automatic proxy configuration file.
> Regards,
> - Robert
> -- 
> ubuntu-us-mi mailing list
> ubuntu-us-mi at lists.ubuntu.com
> Modify settings or unsubscribe at: 
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-us-mi

More information about the ubuntu-us-mi mailing list