Категорії
Misc, staff, other

[shell] Удаляем старые файлы

Данный скрипт удаляет самый старый файл

find /path/to/dir -type f -exec ls -t {} + | awk '{w=NF?$NF:w} END{print w}' | xargs rm --

При использовании в скрипте, нужно экранировать плюс ‘+’

Категорії
Misc, staff, other

Быстрая копия разделов диска

Если у вас на разделе миллионы файлов, то простым копированием это может занять очень много времени. Рекомендую копировать блочно (так же отображается процесс):

pv -tpreb /dev/sdc1 | dd of=/dev/sdb1 bs=32768 conv=noerror,sync

При этом, можете поэксперементировать с размером блока bs=32768 (больше/меньше, кратный 2, начиная с 512 байт)

где /dev/sdc1 – откуда копируем, /dev/sdb1 – куда копируем.

Категорії
Misc, staff, other

Reload HAProxy Config with Minimal Downtime

Restarting HAProxy using the default init scripts will kill any existing connections, and prevent any new connections while it restarts. With the init script restart method (eg ‘/etc/init.d/haproxy restart’), if there are any configuration errors, the service wont start up again. This might be fine for low volume sites, but if you are dealing with heavy traffic, you would want to reload the configuration with the smallest amount of downtime possible.

Категорії
Misc, staff, other Security

FastNetMon – открытое решения по обнаружению DDoS-атак

Состоялся релиз программы FastNetMon 1.1.2, предназначенной для выявления входящих и исходящих DDoS-атак на основе анализа транзитного трафика. Программа разработана для фиксации серьезных всплесков интенсивности отправки пакетов (сотни тысяч пакетов в секунду), как со стороны клиентов, так и со стороны внешней сети в сторону клиентов. Данные о трафике могут собираться через PF_RING, PCAP, ULOG2, Netmap, NetFlow, sFLOW. На выходе выводится список 10 самых активных потребителей ресурсов сети, как по числу пакетов в секунду, так и по трафику. Для хранения статистики используется БД Redis. Программа написана на языке C++.

Категорії
Misc, staff, other

MASSCAN: Mass IP port scanner

This is the fastest Internet port scanner. It can scan the entire Internet in under 6 minutes, transmitting 10 million packets per second.

It produces results similar to nmap, the most famous port scanner. Internally, it operates more likescanrand, unicornscan, and ZMap, using asynchronous transmission. The major difference is that it’s faster than these other scanners. In addition, it’s more flexible, allowing arbitrary address ranges and port ranges.

NOTE: masscan uses a custom TCP/IP stack. Anything other than simple port scans will cause conflict with the local TCP/IP stack. This means you need to either use the -S option to use a separate IP address, or configure your operating system to firewall the ports that masscan uses.

https://github.com/robertdavidgraham/masscan

Категорії
Misc, staff, other

Синхронизация файлов из amazon S3

Установка осуществляется просто:

$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
$ unzip awscli-bundle.zip
$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

Итого, бинарник у нас лежит по адресу /usr/local/bin/aws. Для работы с bucket’ом S3 нужно его настроить. Настроим отдельный профиль test-bucket (если ее указывать, будет настроен дефолтный профиль)

Категорії
Linux Misc, staff, other

perf-tools – новый набор утилит для анализа производительности в Linux

Брендан Грег (Brendan Gregg), один из разработчиков DTrace, переключился на развитие средств анализа производительности в Linux и подготовлил новый набор утилит perf-tools, основанный на применении подсистем ядра Linux perf_events и ftrace. Утилиты отличаются минимальным числом зависимостей, простотой использования и дополнительными возможностями изучения параметров производительности и отзывчивости.

Категорії
Misc, staff, other Routers, GW, Internet

Балансировщик openvpn на haproxy

haproxy – достаточно известный прокси/балансировщик, который позволяет балансировать даже https/ssl. Ниже будет приведён только конфиг haproxy, так как от конфига openvpn’a это не зависит:

Категорії
Misc, staff, other

Почтовый клиент Trojita

Анонсирован выпуск IMAP-клиента Trojitá 0.5, написанного с использованием тулкита Qt и примечательного высокой скоростью работы с большими коллекциями почты. Программа изначально рассчитана на высокую скорость работы с почтовыми ящиками, содержащими десятки тысяч сообщений. Программа достаточно эффективно использует доступную полосу пропускания при использовании IMAP, в том числе никогда не загружает данные дважды и поддерживает IMAP-расширения QRESYNC, CONDSTORE, ESEARCH, CATENATE, BURL, COMPRESS=DEFLATE и CONTEXT=SORT, а также позволяет организовать доступ к IMAP через SSH. Поддерживается сборка как с Qt4, так и с Qt5. Готовые пакеты сформированы для CentOS/RHEL, Debian, Fedora, openSUSE и Ubuntu.

Категорії
FreeBSD Linux Misc, staff, other OpenBSD Security

Iron Bars Shell – restricted system shell for Linux/Unix

Iron Bars SHell, or short ibsh is my first attempt to create a restricted working environment for Linux/Unix. I’m sure that many system administrators wish or have wished for a way to lock some/all users into a safe dungeon, where they can only do harm to their own files. Even more important is the protection against users reading sensitive files, for example the /etc/passwd file, which is accessible for any person with an unrestricted shell. But many system files may be listed here. Users could easily gain information, that could help malicious hackers to compromise the system, the network, the company.
Many attempts have already been made to fix this problem. Menu-based and other interactive shells have been created, but they were not able to completely satisfy worried system administrators. The amount of documents available at various security sites about how to bypass restrictions, how to hack through these shells and gain full access, shows, that ANY experienced Linux user is able to cause big problems.

Домашняя страничка Andy
Записки молодого админа
Самостоятельная подготовка к Cisco CCNA
Самостоятельная подготовка к Cisco CCNP