Linux: how to set up proxy using pac script - linux

I am using Red Hat Enterprise Linux Server release 6.2, and I have only terminal access (no GUI). My company has a proxy auto-config script (PAC), and that is the only way to get internet connection.
I had no problem with my windows machine, since it was easy to set it up in IE->Tools->Internet Options. But in Linux, especially without a GUI, there seems to be no way to use this PAC script (I have been Googling for a while). By the way, the script is over 400 lines of Javascript.
Anyone knows how to solve this problem?

Proxy settings are implemented differently according to the software you use. On graphical desktop environments there are setup tools to configure a PAC; browsers like Chromium and Firefox detect the current desktop environment and import the proxy settings from there; Firefox also used to offer options for manual configuration of proxies and PAC URLs.
Integration of proxy options is not a priority for developers of text-only software packages. Each one of your tools will have to be manually configured to use a proxy. For example, APT must have a proxy configuration file at /etc/apt/apt.conf.d/.
Some packages may consult the environment variables http_proxy, https_proxy, et al, for proxy configuration.
You will need to read the documentation of the packages you will use in your GUI-less Linux to learn how to configure each of them to use the company's proxy. Some packages will use protocols and ports other than HTTP(S), FTP, GOPHER, which may be forbidden by the company's firewall.

I know this is an old thread.
In my case, I did the following steps
Download the automatic configuration script and copy proxy address from that file.
export "http_proxy" and "https_proxy" in bashrc using the proxy address get from step 1
Reload bashrc file

use the PAC even in the terminal environment. it works.

Related

How to configure Xdebug for multiple users on a local machine?

I have a new installation of Centos 7 running cPanel and WHM on an AWS EC2 instance. All software is the latest versions.
I used WHM to setup 5 users, which in turn creates linux users with their own home directory and their own public_html directories. Then I have enabled MATE Desktop and Tigervnc so each developer can connect to the machine in a vnc session.
So basically this setup is 5 linux users with their own apache vhosts, running their IDE on the same local server.
I then installed Xdebug using pecl and now I want to setup VSCode on each persons account to use Xdebug. I am also using opcache.
When trying to use VSCode, it seems like we can get the debugger to work, but there is no output in the console of VSCode. I installed the php-debugger extension in VSCode.
Also we seem to have a problem with VSCode not able to handle include/require statements. It always says that they cannot be found. But the files are indeed there and indeed have the correct permissions to be read/written.
I am not really sure how to configure Xdebug and VSCode to get them to work for all local developers with VSCode. Will what I am doing even work? Do I need remote connections? Do I need a DBGp proxy? Does Xdebug only allow one debugging session at a time? Do I need to install Xdebug for each user?
Can anyone provide some directions on how to set this up?
Thanks
Will what I am doing even work?
Likely :-)
Do I need remote connections?
On the Xdebug side, it does not matter whether it's "remote" or on the same machine, in both cases a TCP/IP connection is used. The "remote" in "remote debugger" was always a bad choice of words by the Xdebug developer (me).
Do I need a DBGp proxy?
You don't need it. What you need to be able to do is to have each user initiate a debugging session to their own IDE. As everything runs on the same machine, you can't just reuse ports. Xdebug always connects to the same configured port (9003 by default).
There are two alternatives:
Use a the DBGp proxy to direct incoming connections from the Xdebug port to registered IDEs. Each of these IDEs will have registered their key with the proxy, so the proxy knows where to forward the request to. You will need to use a browser extension so that each developer can set their own unique IDE key as the Xdebug session (cookie) value.
Use Xdebug Cloud, which would handle the complicated proxy set-up for you, and the developers only have to set their IDE Key (or now, Cloud key) through the browser extension again, as well as in their IDE. Only PhpStorm supports this for now. There is configuration documentation available.
Does Xdebug only allow one debugging session at a time?
No. Xdebug supports one debugging connection per PHP request, but IDEs might not accept more than one incoming connection. Both PhpStorm and VS Code's Debug Plugin don't have this problem.
Do I need to install Xdebug for each user?
No. Xdebug is installed as part of PHP, and as you've only got one PHP installation, having Xdebug available as part of the is enough.

How to get the KDE proxy settings

For Gnome, we use gsettings list-recursively org.gnome.system.proxy to get the proxy related configuration.
How to fetch the Proxy configuration of a KDE desktop with
kwriteconfig.I believe kwriteconfig is only for setting the KDE
configuration. Please let me know if we have any command which help us
to get the proxysettings.
kreadconfig is a command-line tool to retrieve values from KDE
configuration files.

Set Linux Proxy Without Restarting System

I tried to change my proxy in my machine since in office they use proxy and I’m not using proxy at home. So everyday I come to the office and setup the proxy using this nice tools. Though it is good but it requires restart in order to get all proxies applied.
Basically I know that the way to set proxy in Linux is modifying /etc/environment and add http_proxy values (or https_proxy for ssl), and also add no_proxy if you want to bypass some host/IP’s. The ProxyMan tool which I’ve mentioned before is basically do the same thing, but in interactive way. But still, it requires restarts to apply it all.
What I want to ask is, can we apply changes of proxy settings without restarting the machine?
Thanks…
The only time /etc/environment file is read is on login, when the PAM stack is activated.
In deeper, its pam_env.so, which reads the file.
Edit /etc/pam.d/sudo (e.g., sudo vim /etc/pam.d/sudo) and change auth to session at the start of the following line:
auth required pam_env.so readenv=1 user_readenv=0
So it should become:
session required pam_env.so readenv=1 user_readenv=0
If you use a graphical environment, you can use a tool I have developed recently; it is hosted at https://github.com/okelet/proxychanger.

Non-interactive customization and installation of FreeBSD Ports

I'm new to FreeBSD, coming from a Linux background. I want to install a port, changing one of the default configuration options, in a non-interactive way (so that I can script the installation for automated configuration of my FreeBSD servers).
As a specific example, the graphics/ImageMagick-nox11 port has a default configuration option of PERL=on. I want to change this. I realize that I can make config and then just use the generated entry in /var/db/ports/ to avoid any interaction in the future, but this still requires the initial interaction to set the options in the ncurses interface.
Ideally I want to be able to do something like the following, to build the package with perl support disabled but accepting all other defaults:
$ make PERL=off BATCH=yes install clean
What is the proper way to accomplish this? Can I somehow place port-specific configuration options like this in /etc/make.conf?
You can also unset OPTIONS via make.conf(5).
E.g.:
OPTIONS_UNSET=NLS

How to create a Mercurial repository on a remote IIS web server

I have a Windows Server 2003 running Mercurial's hgwebdir.cgi to serve repositories. Push/Pull etc is working as expected for existing repositories.
Currently I'm using remote desktop If I need a new repository on the server.
Is there a better way to do it? Command line, web interface, cgi?
Mercurial by itself only allows for the creation of repositories locally or over ssh. For http you need to either log in to the server via command line and hg init or via RDP and do essentially the same.
It is, however, very easy to create a small CGI script that will create new remote repositories over HTTP. Here's one I built that works on unix and is likely easily adapted to windows:
http://ry4an.org/unblog/UnBlog/2009-09-17
currently , running hg init where you want the repository is the way to do it, any other way would require hgwebdir to implement some kind of security better left to other/better/more os specific tools. It's not that much of a leap to imagine that the HG devs rather focus on the versioning of files than reinventing the wheel with security, at least right now.

Resources