Set Linux Proxy Without Restarting System - linux

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.

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.

Deleting an environmental variable for IIS

I've understood that, in order to make IIS read a new environmental variable, I have to reset it via an administrator's command:
iireset /restart
I know that one can also restart IIS from the admin panel at server level.
More context to my complete web app setup in my previous question/answer: in brief it is a Python Flask app running on IIS through WSGI and FastCGI.
What is still surprising me is that now, if I delete a previously created environmental variable, IIS keep seeing it, even after restarting it, as done above.
Why is that possibly happening? And how should I delete the variable for IIS?
If you insist that you want to go with environmental variables (notice that you also have the alternative .env file), then you need to set them via the IIS FastCGI Settings from the IIS admin at server level for your specific application (the one you enabled via wfastcgi-enable).
Edit the specific row as said above and you'll find the Environment Variables collection under the "General" group of FastCGI Properties.
Now you can add and delete any of those variables and it will take effect immediately, without the need of any IIS reboot.

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

Linux: how to set up proxy using pac script

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.

Setting up a local SVN repository with encrypted passwords with TortoiseSVN

I am planning on using a local repository, using only TortoiseSVN's "create repository here" feature.
The repo is created and I can read and write to it just fine. The problem is that I can't get authentication to work. I thought I wanted Windows authentication, but I actually want the simple text-file based authentication so I can force the current system user (i.e. any person can be using the same Windows account and I want to differentiate between them) to provide their name and password. I haven't found any information on how to do this without svnserve running.
So far, I have modified svnserve.conf like this:
anon-access = read
auth-access = write
password-db = passwd
realm = LocalOnly
I didn't mess with the [sasl] section.
I also modified passwd:
[users]
harry = teH0wLIpW0gyQ
I am trying to use encrypted passwords created with a simple perl script. However, regardless of what I do with the repo (i.e. including writing to the repo), I am never prompted for a password.
I tried clearing TortoiseSVN's authentication cache since I do connect to a remote repo, but this didn't matter at all.
Has anyone tried this and succeeded? Or is it not possible without svnserve?
Not possible without svnserve - it takes care of the challenge/response.
Try Subversion Edge. you can edit the file you are mentioning using the GUI provided by the tool. It uses its own http server(not svnserve or IIS).
Unfortunately your best bet with a local repository is to use your file system permissions. A simple and free option for a server (that's easy to manager) would be VisualSVN Server. You can hang it off or a workstation or drop it on a public webserver somewhere. I now have mine setup with a reverse proxy with IIS7 so it's integrated with the rest of my web site.

Resources