Linux http proxy server

Linux Proxy Server Settings – Set Proxy For Command Line

To use a proxy on the Linux command-line, you can set the environment variables http_proxy , https_proxy or ftp_proxy , depending on the traffic type.

These proxy server settings are used by the almost all Linux command-line utilities, e.g. ftp , wget , curl , ssh , apt-get , yum and others.

If you don’t know yet which proxy server to use, you can take one from the lists of the free public proxy servers at the end of this article.

Cool Tip: Need to improve security of the Linux system? Encrypt DNS traffic and get the protection from DNS spoofing! Read more →

Export Proxy Server Settings

Set these variables to configure Linux proxy server settings for the command-line tools:

If a proxy server requires authentication, set the proxy variables as follows:

Special Characters: If your password contains special characters, you must replace them with ASCII codes, for example the at sign @ must be replaced by the %40 code, e.g. p@ssword = p%40ssword .

Test The Proxy Server From The Linux Command-Line

First off all it is required to check that the proxy server settings are set in the corresponding proxy variables.

Than it is required to ensure that your public IP address has changed.

Also it would be interesting to measure and compare response time of the remote resources and the Internet speed with and without proxy.

Check the current proxy server settings:

Check your public IP address from the Linux command-line:

Compare the difference in the response time with the configured proxy and without it:

Check the Internet download speed through the proxy:

Unset Linux Proxy Variables

Use the following commands to disable proxy:

Cool Tip: Stay anonymous during port scanning! Use Nmap + Tor + ProxyChains ! Safe and easy penetration testing! Read more →

Automate Proxy Server Settings In Linux

If you use the same proxy server settings for the https , http and ftp traffic, you can use the following commands to set and unset the proxy settings:

If you use a proxy server often, you can create Bash functions as follows (add to your

Now use the setproxy and unsetproxy commands to set and unset Linux proxy server settings.

Lists of Free Public Proxy Servers

WARNING: Free public proxy servers can insert your IP address into the headers of requests or sniff your traffic! Don’t use them to transfer sensitive data and do not expect anonymity!

  • Hide My Ass
  • Proxy Server List
  • Anonymous Public Proxy Servers
  • Daily HTTP Proxies

Cool Tip: Even if you use proxy server, all your DNS queries still go to the name servers of your ISP (Internet Service Provider)! Improve anonymity, by using free public name servers! Read more →

Источник

Использование HTTP proxy и SOCKS в Linux

В Linux существует много полезных консольных команд, которые при необходимости хотелось бы запустить через proxy. Некоторые приложения имеют встроенную поддержку proxy, а некоторые нет. Далее описано как пользоваться востребованными утилитами через proxy, даже теми, которые этой поддержки не имеют.

Читайте также:  Origin pro для windows 10

curl: передача данных через proxy

curl имеет полноценную поддержку как HTTP proxy так и SOCKS.

Для тестирования возможно использовать proxy сервера из бесплатных списков (socks — sockslist.net, и HTTP proxy — proxyhttp.net). Проверка IP адреса будет производиться с помощью ресурса check-host.net

Часть параметров curl можно записать в файл

С помощью time и curl также можно замерить время отклика сервера:

Результат будет выглядеть так:

wget: закачка файлов через proxy

wget имеет встроенную поддержку proxy. Недостаток лишь в том, что только поддержку HTTP proxy. Для использования совместно с SOCKS рекомендуется использовать соксификатор dante.

Чтобы все время не указывать —proxy-user и —proxy-password можно их прописать в файл

ssh: доступ к серверам

Для доступа к серверам через ssh и proxy также лучше использовать соксификатор dante.

Соксификатор dante

С помощью socksify можно направить через proxy почти любое приложение, не только консольное.

Чтобы все время не вводить данные о proxy можно создать файл /etc/socks.conf
Пример для SOCKS:

Пример для HTTP proxy с авторизацией:

А также экспортировать переменные SOCKS_USERNAME и SOCKS_PASSWORD, если для SOCKS или HTTP proxy требуется авторизация:

DNS запросы через proxy

Часто требуется чтобы и преобразование имен происходило через proxy. Если использовать dante, то запрос на преобразование имен идет и через proxy, и через именной сервер указанный в /etc/resolv.conf . Понять почему же идет два одинаковых запроса вместо одного не удалось. Поэтому можно предложить два варианта:
1) Закомментировать именные сервера в файле /etc/resolv.conf, чтобы преобразование имен шло только через proxy. Это отразится на всей системе.
2) Изменить /etc/resolv.conf и выставить именные сервера необходимой страны, или просто отличные от серверов провайдера. Например установить сервера Google:

Чтобы данные не были перезаписаны именными серверами провайдера (при переподключении), можно запретить обновление списка именных серверов сетевому менеджеру (NetworkManager/wicd) или DHCP-клиенту (спасибо ergil за корректировку).

Или воспользоваться «грубым» методом — запрещением изменения файла /etc/resolv.conf:

Если есть какие-то дополнения, пожалуйста, напишите, это будет полезно узнать и применить.

Источник

Proxy server

In computer networks, a proxy server is a server (a computer system or an application) that acts as an intermediary for requests from clients seeking resources from other servers.

Contents

HTTPS MITM proxies

When debugging HTTPS connections it is sometimes useful to intercept them outside of the browser. In order for the TLS MITM to work you need to trust a certificate authority of the proxy either in your browser or system-wide.

  • Charles — Graphical trialware written in Java.

https://www.charlesproxy.com/ || charlesAUR

  • Fiddler — Proprietary and graphical, running on Mono.

https://www.telerik.com/fiddler || fiddlerAUR

  • mitmproxy — Command-line and web interface, written in Python, also has API.

https://mitmproxy.org/ || mitmproxy

  • sslsplit — Works with any TLS connections but cannot act as a HTTP proxy in a browser, written in C.

https://www.roe.ch/SSLsplit || sslsplit

Environment variables

This article or section needs expansion.

/.config/environment.d/*.conf . (Discuss in Talk:Proxy server)

Some programs, such as wget and (used by pacman) curl, use environment variables of the form protocol_proxy to determine the proxy for a given protocol (e.g. HTTP, FTP, . ).

Below is an example on how to set these variables in a shell:

Some programs look for the all caps version of the environment variables.

If the proxy environment variables are to be made available to all users and all applications, the above mentioned export commands may be added to a script, say proxy.sh inside /etc/profile.d/ . The script has to be then made executable. This method is helpful while using a desktop environment like Xfce which does not provide an option for proxy configuration. For example, Chromium browser will make use of the variables set using this method while running XFCE.

Alternatively, there is a tool named proxyman-git AUR which claims to configure system-wide proxy settings easily. It also handles proxy configurations of other software like git, npm, Dropbox, etc. The project is inspired from Alan Pope’s idea of making a script.

Читайте также:  Huawei matebook d15 mac os

Alternatively you can automate the toggling of the variables by adding a function to your .bashrc (thanks to Alan Pope for original script idea)

Omit username or password if they are not needed.

As an alternative, you may want to use the following script. Change the strings YourUserName , ProxyServerAddress:Port , LocalAddress and LocalDomain to match your own data, then edit your

/.bashrc to include the edited functions. Any new bash window will have the new functions. In existing bash windows, type source

/.bashrc . You may prefer to put function definitions in a separate file like functions then add source functions to .bashrc instead of putting everything in .bashrc . You may also want to change the name «myProxy» into something short and easy to write.

Keep proxy through sudo

If the proxy environment variables are set for the user only they will get lost when running commands with sudo (or when programs use sudo internally).

A way to prevent that is to add the following line to a sudo configuration file:

Automation with network managers

  • NetworkManager cannot change the environment variables.
  • netctl could set-up these environment variables but they would not be seen by other applications as they are not child of netctl.

About libproxy

libproxy (which is available in the extra repository) is an abstraction library which should be used by all applications that want to access a network resource. It still is in development but could lead to a unified and automated handling of proxies in GNU/Linux if widely adopted.

The role of libproxy is to read the proxy settings from different sources and make them available to applications which use the library. The interesting part with libproxy is that it offers an implementation of the Web Proxy Autodiscovery Protocol and an implementation of Proxy Auto-Config that goes with it.

The /usr/bin/proxy binary takes URL(s) as argument(s) and returns the proxy/proxies that could be used to fetch this/these network resource(s).

As of 06/04/2009 libproxy is required by libsoup. It is then indirectly used by the midori browser.

Web proxy options

  • Squid is a very popular caching/optimizing proxy
  • Privoxy is an anonymizing and ad-blocking proxy
  • tinyproxy is a small, efficient HTTP/SSL proxy daemon
  • For a simple proxy, ssh with port forwarding can be used

Simple Proxy with SSH

Connect to a server (HOST) on which you have an account (USER) as follows

For PORT, choose some number which is not an IANA registered port. This specifies that traffic on the local PORT will be forwarded to the remote HOST. ssh will act as a SOCKS server. Software supporting SOCKS proxy servers can simply be configured to connect to PORT on localhost.

Using a SOCKS proxy

There are two cases:

  • the application you want to use handles SOCKS5 proxies (for example Firefox), then you just have to configure it to use the proxy.
  • the application you want to use does not handle SOCKS proxies, then you can try to use tsocks or proxychains-ng .

In Firefox, you can use the SOCKS proxy in the menu Preferences > Network > Settings. Choose Manual Proxy Configuration, and set the SOCKS Host (and only this one, make sure the other fields, such as HTTP Proxy or SSL Proxy are left empty). For example, if a SOCKS5 proxy is running on localhost port 8080, put 127.0.0.1 in the SOCKS Host field, 8080 in the Port field, and validate.

If using proxychains-ng, the configuration takes place in /etc/proxychains.conf . You may have to uncomment the last line (set by default to use Tor), and replace it with the parameters of the SOCKS proxy. For example, if you are using the same SOCKS5 proxy as above, you will have to replace the last line by:

Читайте также:  Solar control film windows

Then, proxychains-ng can be launched with

Where program can be any program already installed on your system (e.g. xterm, gnome-terminal, etc).

If using tsocks, the configuration takes place in /etc/tsocks.conf . See tsocks.conf(5) for the options. An example minimum configuration looks like this:

curl and pacman

You may set the all_proxy environment variable to let curl and pacman (which uses curl) use your socks5 proxy:

Proxy settings on GNOME3

Some programs like Chromium and Firefox can use the settings stored by GNOME. These settings can be modified through the gnome-control-center front end and also through gsettings.

This configuration can also be set to automatically execute when NetworkManager connects to specific networks, by using the proxydriver AUR package.

Microsoft NTLM proxy

In a Windows network, NT LAN Manager (NTLM) is a suite of Microsoft security protocols which provides authentication, integrity, and confidentiality to users.

cntlm AUR from the AUR stands between your applications and the NTLM proxy, adding NTLM authentication on-the-fly. You can specify several «parent» proxies and Cntlm will try one after another until one works. All authenticated connections are cached and reused to achieve high efficiency.

Configuration

Change settings in /etc/cntlm.conf as needed, except for the password. Then run:

This will generate encrypted password hashes according to your proxy hostname, username and password.

Источник

Настройка прокси-сервера на Linux

На Линукс прокси сервер можно подключить при помощи ввода новых настроек в терминал. Ниже мы подробно разберем, какие данные нужно вводить в командную строку, чтобы правильно настроить прокси. За основу возьмем Kali Linux, но принцип настройки сервера-посредника будет идентичным на всех версиях этой операционной системы.

Настройка прокси Линукс: пошаговая инструкция

Для подключения прокси-сервера на этой операционной системе вам нужно выполнить следующие шаги:

  1. Откройте терминал.
  2. Введите туда фразу «sudo apt-get install git gcc» (без кавычек) и нажмите «Enter».

В будущем нажимайте клавишу «Enter» после ввода каждой новой команды.

Напишите «sudo apt-get remove proxychains», чтобы удалить старые данные.

Введите «git clone https://github.com/rof10r/proxychains-ng.git» для копирования нужных параметров.

Перейдите в скопированную папку, введя: «cd proxychains-ng».

Пропишите «./configure —prefix=/usr —sysconfdir=/etc».

Впишите в консоль команду «Make».

Затем: «sudo make install».

  • Дальше, чтобы установить прокси на Линукс, нужно будет подождать некоторое время, пока пройдет загрузка необходимых данных.
  • После завершения установки вводим «sudo make install-config».

    С установкой на этом мы закончили, теперь нужно настроить прокси-сервер Линукс. Для этого начнем редактирование файла с конфигурациями прокси-цепочек в блокноте.

    Введите «leafpad /etc/proxychains.conf».

    После открытия блокнота пролистайте его в самый низ до раздела «ProxyList».

    Перед нижней строкой ставим символ «#». По умолчанию его там быть не должно.

    Теперь вам понадобится прокси-сервер.

    При выборе прокси старайтесь избегать прозрачных серверов (transparent). Они не обеспечат вам анонимность при работе в интернете, так как не скрывают действительный IP-адрес.

    Если вы уже подобрали прокси-серверы, то останется лишь добавить их в базу. Для этого напишите в открытом блокноте фразу следующего вида:

    «http 223.16.229.241 8080».

    Первое число — это IP вашего прокси, второе — его порт. Пропуски такого плана делайте при помощи нажатия на кнопку «Tab».

    Закройте файл, сохранив изменения.

    Теперь вы сможете запускать любое необходимое приложение, имеющее доступ к интернету, через прокси-сервер. Для этого нужно перед командой вызова программы в консоли вводить фразу «proxychains4».

    Например, чтобы запустить на вашем компьютере браузер Firefox через прокси нужно ввести следующую фразу: «proxychains4 firefox».

    Узнать текущий IP-адрес используемого прокси-сервера можно, введя фразу «proxychains4 wget -qO- eth0.me».

    Настройка завершена! Теперь вы можете использовать прокси сервер на Линукс для повышения анонимности, защиты от различных видов сетевых атак и решения многих других задач.

    Источник

  • Оцените статью