Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[O/S] [Solved] Configuring proxy

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
pavank
Posts: 8
Joined: 2020-07-13 01:21

[O/S] [Solved] Configuring proxy

#1 Post by pavank »

Hi there,
I'm naive to Debian/Linux, hope you can assist me here. I configured the proxy during the OS install (http://FQDN:port), FYI - Please see the attached screenshot but after the install, couldn't find the settings to update or change the proxy address. I checked at

Code: Select all

/etc/profile.d/
as well as

Code: Select all

/etc/apt/apt.conf.d
with no luck. I'm I missing something here? I'm I supposed to see the configured proxy address during the OS install, will you be able to assist please? Thank you.

Code: Select all

myhostname:/etc/profile.d$ ls
bash_completion.sh
myhostname:/etc/apt/apt.conf.d$ ls
00CDMountPoint  00trustcdrom  01autoremove  01autoremove-kernels  20apt-show-versions  20listchanges  20packagekit  50appstream  50unattended-upgrades  60icons  60icons-hidpi  60icons-large  60icons-large-hidpi  70debconf
Attachments
Capture.PNG

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: [O/S] Configuring proxy

#2 Post by Aki »

Hello,
pavank wrote: 2023-02-09 03:12 [..] I configured the proxy during the OS install (http://FQDN:port), FYI - Please see the attached screenshot but after the install, couldn't find the settings to update or change the proxy address. [..] I'm I missing something here? I'm I supposed to see the configured proxy address during the OS install, will you be able to assist please? Thank you.
The proxy configuration during debian installation applies only to debian installer. When it is configured, a system-wide variable named "http_proxy" or "https_proxy" is set [1] and it's later used to download debian packages by the debian installer.

If you want to configure a standard proxy for the package manager or for the whole OS, you can see the Debian Administrator Handbook [2] (search for "proxy").

Hope that helps.
---
[1] https://sources.debian.org/src/base-ins ... inst/#L126
[2] https://debian-handbook.info/browse/stable/
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

pavank
Posts: 8
Joined: 2020-07-13 01:21

Re: [O/S] Configuring proxy

#3 Post by pavank »

Thanks for the reply and the links Aki, good to know the installation steps. As per your below comments and install steps, I was under the impression that the proxy setup that I used during the OS install will only apply for installation and proxy configuration will clear up after the OS install. But, when I do the 'apt update', still trying to resolve the old proxy. Please see the below output, where 'xxx.xxxx.xxx' is my old proxy address. I manage to find config under /etc/apt/apt.conf, have updated the proxy address and am now able to resolve and able to do the 'apt update'. About setting up the system-wide proxy, I couldn't the setup info (unless I missed it) in the Debian handbook apart from the Squid proxy setup. But I'm not looking to set up a Squid proxy on this machine, I'm looking to leverage the existing proxy server in my environment to access the internet. So, I set up the proxy at /etc/profile.d/proxy.sh and appears to be working.

~$ sudo apt update
[sudo] password for debadmin:
Err:1 http://security.debian.org/debian-security bullseye-security InRelease
Could not resolve 'xxx.xxxx.xxx'
Err:2 http://deb.debian.org/debian bullseye InRelease
Could not resolve 'xxx.xxxx.xxx'
Err:3 https://dl.google.com/linux/chrome/deb stable InRelease
Could not resolve 'xxx.xxxx.xxx'
Err:4 http://deb.debian.org/debian bullseye-updates InRelease
Could not resolve 'xxx.xxxx.xxx'
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease Could not resolve 'xxx.xxxx.xxx'
W: Failed to fetch http://security.debian.org/debian-secur ... /InRelease Could not resolve 'xxx.xxxx.xxx'
W: Failed to fetch http://deb.debian.org/debian/dists/bull ... /InRelease Could not resolve 'xxx.xxxx.xxx'
W: Failed to fetch https://dl.google.com/linux/chrome/deb/ ... /InRelease Could not resolve 'xxx.xxxx.xxx'
W: Some index files failed to download. They have been ignored, or old ones used instead.
~$

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: [O/S] Configuring proxy

#4 Post by Aki »

Hello pavank,
pavank wrote: 2023-02-13 00:02 Thanks for the reply and the links Aki, good to know the installation steps. As per your below comments and install steps, I was under the impression that the proxy setup that I used during the OS install will only apply for installation and proxy configuration will clear up after the OS install. But, when I do the 'apt update', still trying to resolve the old proxy. Please see the below output, where 'xxx.xxxx.xxx' is my old proxy address. I manage to find config under /etc/apt/apt.conf, have updated the proxy address and am now able to resolve and able to do the 'apt update'.
Thank you for remarking it. You are right. As you noted, the proxy setup during repository configuration persists after the installation is completed and it is stored in /etc/apt/apt.conf, for example:

Code: Select all

Acquire::http::Proxy "http://192.128.122.1:8888";
I replicated it for extra security in a test installation using a local proxy (tinyproxy). I apologize for the inconvenience.
pavank wrote: 2023-02-13 00:02About setting up the system-wide proxy, I couldn't the setup info (unless I missed it) in the Debian handbook apart from the Squid proxy setup. But I'm not looking to set up a Squid proxy on this machine, I'm looking to leverage the existing proxy server in my environment to access the internet. So, I set up the proxy at /etc/profile.d/proxy.sh and appears to be working.
Thanks for the feedback. If you could post the contents of your /etc/profile.d/proxy.sh here, after you have masked out the address of the configured proxy, it might be useful for other users.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

pavank
Posts: 8
Joined: 2020-07-13 01:21

Re: [O/S] Configuring proxy

#5 Post by pavank »

Sorry for the late reply Aki, this went off the track.
Aki wrote: 2023-02-13 10:55 I replicated it for extra security in a test installation using a local proxy (tinyproxy). I apologize for the inconvenience.
No worries, good to know that its expected behaviour.

Aki wrote: 2023-02-13 10:55 Thanks for the feedback. If you could post the contents of your /etc/profile.d/proxy.sh here, after you have masked out the address of the configured proxy, it might be useful for other users.

Here are the steps I followed to set up system-wide proxy. My requirement is http and https only. Where xx is IP address and yyyy is the port number.

Code: Select all

:~$sudo nano/etc/profile.d/proxy.sh
# http/https
export http_proxy="http://xx.xx.xx.xx:yyyy/"
export https_proxy="http://xx.xx.xx.xx:yyyy/"

# For curl
export HTTP_PROXY="http://xx.xx.xx.xx:yyyy/"
export HTTPS_PROXY="http://xx.xx.xx.xx:yyyy/"
Added the execution

Code: Select all

:~$chmod +x /etc/profile.d/proxy.sh
Log out and log back in or source the file for runtime use.

Code: Select all

:~$source /etc/profile.d/proxy.sh
To check the proxy settings, run the following.

Code: Select all

:~$env | grep -i proxy

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: [O/S] Configuring proxy

#6 Post by Aki »

Hello,

Thank you so much for updating the thread, so that it will be useful to other forum viewers.

It would be nice to mark the tread as solved. You can do it adding the prefix "[Solved]" to the subject of the first message of the topic.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

pavank
Posts: 8
Joined: 2020-07-13 01:21

Re: [O/S] [Solved] Configuring proxy

#7 Post by pavank »

Yes indeed helps others and thanks for updating to 'solved' Aki.

Post Reply