Showing posts with label openvz. Show all posts
Showing posts with label openvz. Show all posts

September 30, 2014

Как устранить уязвимость Shellshock на сервере или VDS под управлением Debian

Проверьте присутствует ли уязвимость:

env X="() { :;} ; echo busted" bash -c "echo stuff"

Если в выводе содержится "busted", дыра Shellshock присутствует.


Как это выглядит на уязвимой машине под управлением Debian OpenVZ VPS:

Вверху видно что текущая версия Bash это 4.2.


Теперь латаем дыру.


Обновляем список пакетов.

apt-get update

Проверьте свою версию баша. В моем случае это была 4.2+dfsg-0.1+deb7u3. Обновите баш. Здесь описано как выбрать определенную версию пакета для установки в случае если доступны несколько.

apt-get install bash=4.2+dfsg-0.1+deb7u3

Воткак выглядит пропатченный сервер:

Старая версия была 4.2+dfsg-0.1, после обновления стала 4.2+dfsg-0.1+deb7u3. Ну и последний тест, в результате которого значение busted не выводится.


Источник: http://habrahabr.ru/company/mailru/blog/238475/

How to quickly check and fix the Shellshock Bash vulnerability

First, see if this applies to you. Though since all of the bash versions for the last 25 years are vulnerable to this exploit, it most likely does.


To check if your machine has the Shellshock vulnerability, run the following:

env X='() { :;}; echo vulnerable' bash -c "echo this is a test"

If the output includes "busted", the machine is vulnerable to the Shellshock exploit.


Here's an example of how the output looks like on an infected Debian OpenVZ VPS:

At the top of the output you can see the current Bash version being 4.2.


Now, this is the time to update your bash version to the one that is more secure and has the exploit patched.


First, update the package list.

apt-get update

Refer to this in case you get the GPG errors.

Then see what's the latest Bash version you got. In my case it was 4.2+dfsg-0.1+deb7u3. Upgrade Bash to the latest version. Here's how you can specify which version of the package to install in case you have multiple available.

apt-get install bash=4.2+dfsg-0.1+deb7u3

This will install the recent version.


Here's how the patched VPS looks like now:

As you can see, initially the bash version was 4.2+dfsg-0.1, and after the upgrade it's 4.2+dfsg-0.1+deb7u3. Then there's another test which doesn't output the busted value anymore.


Source: http://habrahabr.ru/company/mailru/blog/238475/

UPD: More vulnerabilities to test against: http://en.wikipedia.org/wiki/Shellshock_(software_bug)#Reported_vulnerabilities. Bad news is that not all of those are fixed by the update, so now we wait.

October 22, 2012

Свой DNS-сервер для параноиков

This is how you make a DNS server from your low-end Debian VPS.
apt-get update
apt-get install -y --no-install-recommends resolvconf dnsmasq

sed -i 's,#\(no-resolv\),\1,' /etc/dnsmasq.conf
sed -i 's,#\(no-poll\),\1,' /etc/dnsmasq.conf
sed -i 's,#\(log-queries\),\1,' /etc/dnsmasq.conf
echo "server=208.67.222.222" >> /etc/dnsmasq.conf
echo "log-facility=/var/log/dnsmasq.log" >> /etc/dnsmasq.conf
/etc/init.d/dnsmasq restart

echo "nameserver 127.0.0.1" > /etc/resolv.conf

Теперь можно указать в /etc/hosts список вечно блокируемых на уровне ДНС сайтов:
127.0.0.1 google-analytics.com
127.0.0.1 www.google-analytics.com
127.0.0.1 ssl.google-analytics.com
127.0.0.1 counter.yadro.ru
127.0.0.1 top.list.ru
127.0.0.1 counter.rambler.ru
127.0.0.1 top100-images.rambler.ru
127.0.0.1 mc.yandex.ru
и т.д.
Наполнять любыми доменами по своему желанию.

В статье используется DNS-сервер 208.67.222.222. Список других бесплатныйх ДНСов: (взят отсюда)
Другие DNS-сервисы:

OpenDNS.com:
208.67.222.222
208.67.220.220

http://www.scrubit.com/
67.138.54.100
207.225.209.66

http://www.dnsadvantage.com/
156.154.70.1
156.154.71.1

Level 3 Communications
4.2.2.1
4.2.2.2
4.2.2.3
4.2.2.4
4.2.2.5
4.2.2.6

Verizon
151.197.0.38
151.197.0.39
151.202.0.84
151.202.0.85
151.202.0.85
151.203.0.84
151.203.0.85
199.45.32.37
199.45.32.38
199.45.32.40
199.45.32.43

GTE
192.76.85.133
206.124.64.1

One Connect IP
67.138.54.100

Exetel
220.233.167.31

VRx Network Services
99.166.31.3

SpeakEasy
66.93.87.2
216.231.41.2
216.254.95.2
64.81.45.2
64.81.111.2
64.81.127.2
64.81.79.2
64.81.159.2
66.92.64.2
66.92.224.2
66.92.159.2
64.81.79.2
64.81.159.2
64.81.127.2
64.81.45.2
216.27.175.2
66.92.159.2
66.93.87.2

Sprintlink
199.2.252.10
204.97.212.10
204.117.214.10

Cisco
64.102.255.44
128.107.241.185 

При использовании этих серверов вместо серверов провайдера будьте готовы, что запросы станут выполняться медленнее, т.к. серверы расположены далеко от вас.