Архив

Архив раздела ‘Linux’

Linux: CMake, Kernel module etc

14 Декабрь 2011 Нет комментариев

Linux: Как написать модуль ядра:
The Kernel Newbie Corner: Your First Loadable Kernel Module | Linux.com.

http://www.tldp.org/LDP/lkmpg/2.6/html/

CMake:
Отличные примеры, в т.ч. компиляции модуля ядра через CMAKE: How to use cmake

Categories: Linux Tags: ,

how to install java on ubuntu 11.10

2 Декабрь 2011 Нет комментариев

OpenJDK 7 Java Runtime

sudo apt-get install openjdk-7-jre

install Java for browser – firefox/chrome…

sudo apt-get install icedtea6-plugin

Источник: how to install java on ubuntu 11.10.

Categories: Linux Tags:

Как узнать какие файлы открывает программа при запуске

17 Ноябрь 2011 Нет комментариев

strace -f -e trace=open

Categories: Linux, Без рубрики Tags:

Kubuntu KDE Переключение мониторов Lenovo ThinkPad X220

10 Ноябрь 2011 Нет комментариев

1. Создаем обработчик события fn-f7:

echo "event=ibm/hotkey HKEY 00000080 00001007" > /etc/acpi/events/lenovo-fn-f7
echo "action=/usr/bin/autoswitch.sh" >> /etc/acpi/events/lenovo-fn-f7

2. Рестартуем ACPI

sudo service acpid restart

3. Содержимое /usr/bin/autoswitch.sh:

#!/bin/bash
#
#
# http://www.thinkwiki.org/wiki/Sample_Fn-F7_script

screen_change() {
VGA1_CONNECTED=$( $SU xrandr -q | grep "VGA1 connected" )

echo `date` ${VGA1_CONNECTED} >> /tmp/333

if [ -n "${VGA1_CONNECTED}" ]; then
echo "VGA1 is connected"
xrandr --output VGA1 --auto && xrandr --output LVDS1 --off
else
echo "VGA1 is not connected"
xrandr --output LVDS1 --auto && xrandr --output VGA1 --off
fi
}

# based on /etc/acpi/screenblank.sh (Ubuntu 7.10)
# . /usr/share/acpi-support/power-funcs # for getXuser
getXuser() {
user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
if [ x"$user" = x"" ]; then
user=`finger| grep -m1 ":$displaynum" | awk '{print $1}'`
fi
if [ x"$user" != x"" ]; then
userhome=`getent passwd $user | cut -d: -f6`
export XAUTHORITY=$userhome/.Xauthority
else
export XAUTHORITY=""
fi
}
# end of getXuser from /usr/share/acpi-support/power-funcs
#
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
screen_change
fi
done

Материалы по теме:

ThinkPad fn-F7: http://www.thinkwiki.org/wiki/Sample_Fn-F7_script

xrandr -q | grep ‘VGA1 connected’ \ && xrandr —output LVDS1 —off —output VGA1 —auto \ || xrandr —output LVDS1 —auto —output VGA1 —off

Источник: Верхом на Debian GNU Linux: Простое переключение мониторов.

Еще кое-чего по теме: http://www.helplinux.ru/wiki/kb:ubuntu-eeepc-switch-display

И еще: http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

Categories: Linux Tags: , ,

Настройка vnc для коннекта к существующей сессии X

23 Сентябрь 2011 Нет комментариев

Установка x11vnc:

sudo apt-get install x11vnc
x11vnc -usepw -shared -find -forever -clip xinerama1 &

-usepw использовать ~/.vnc/passwd (предложит создать в случае отсутствия)
-shared разрешить более одного подключения
-forever не выходить после успешного коннекта
-find найти самостоятельно дисплей
-clip xinerama1 — ограничить 1-м дисплеем
попытался запустить из-под рута с параметром -unixpw, но навскидку не заработало

Если очень хочется, то можно подрубить xrdp:
sudo apt-get install xrdp

xrdp.conf:

[globals]
bitmap_cache=yes
bitmap_compression=yes
port=3389
crypt_level=low
channel_code=1

[xrdp1]
name=x11vnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
port=5900

TODO: nxproxy - сжатие X

Categories: Linux Tags:

VLC Transcoding

Транскодинг из консоли:

sudo apt-get install libfaac0
vlc udp://@239.195.0.7 --ttl 25 --sout '#transcode{vcodec=h264,acodec=aac,vb=200,ab=32,channels=1}:duplicate{dst=std{access=udp,dst=225.100.199.99:1234}}'

UBUNTU codecs http://ubuntuforums.org/showthread.php?t=1117283

Воспроизведение CSA-потока с помощью VLC:
vlc test_csa.ts --ts-csa-ck=5555555555555555 --ts-csa2-ck=5555555555555555

Categories: IPTV, Linux, Без рубрики Tags:

Получение EPG с транспондеров

Устанавливаем tv_grab_dvb
apt-get install php5-cli mysql-client php5-mysql php5-pgsql

cd /usr/src
svn co http://www.darkskiez.co.uk/svn/tv_grab_dvb/trunk tv_grab_dvb
cd tv_grab_dvb/
make
cp tv_grab_dvb /usr/local/bin/

Устанавливаем скрипт, который объединяет EPG со всех транспондеров в один файл
wget -O/usr/local/bin/iptv_xmltv_from_dvb.php http://www.sokolov.me/iptv/linuxstreamer/iptv_xmltv_from_dvb.php
chmod 755 /usr/local/bin/iptv_xmltv_from_dvb.php

Шедулим в кроне

*/40 * * * * /usr/local/bin/iptv_xmltv_from_dvb.php -a0,1,2,3,4 -o /var/www/tvprogram.xml

Categories: IPTV, Linux Tags: ,

Обновление Ubuntu

20 Апрель 2011 Нет комментариев

Обновление на след. релиз:
do-release-upgrade

сначала скачиваем новый /etc/apt/sources.list

apt-get clean
apt-get update
apt-get dist-upgrade

Если будут ошибки зависимостей нужно будет запустить

apt-get install -f && dpkg --configure -a

Categories: Linux Tags:

защита sip от перебора

20 Октябрь 2010 Нет комментариев

 

fail2ban — достаточно удобный способ защиты сервисов от перебора паролей и других атак на основе анализа log файлов приложений.
представляет собой набор скриптов на phyton

имеется в портах freebsd и пекетах debian,ubuntu

настройки специфичные для asterisk:

The contents of /etc/fail2ban/filter.d/asterisk.conf should be the following:

 

# Fail2Ban configuration file
#
#
# $Revision: 250 $
#

[INCLUDES]

# Read common prefixes. If any customizations available -- read them from
# common.local
#before = common.conf

[Definition]

#_daemon = asterisk

# Option:  failregex
# Notes.:  regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#

failregex = NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Wrong password
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - No matching peer found
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Username/auth name mismatch
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Device does not match ACL
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Peer is not supposed to register
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - ACL error (permit/deny)
NOTICE.* <HOST> failed to authenticate as '.*'$
NOTICE.* .*: No registration for peer '.*' \(from <HOST>\)
NOTICE.* .*: Host <HOST> failed MD5 authentication for '.*' (.*)
NOTICE.* .*: Failed to authenticate user .*@<HOST>.*

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

</code>
Next edit /etc/fail2ban/jail.conf to include the following section so that it uses the new filter. This does a 3-day ban on the IP that performed the attack. It is recommend to set the bantime in the [DEFAULT] section so if affects all attacks. It is also recommend to turn on an iptables ban for ssh, httpd/apache, and ftp if they are running on the system. Be sure to edit the sendmail-whois action to send notifications to an appropriate address:

[asterisk-iptables]
enabled  = true
filter   = asterisk
action   = iptables-allports[name=ASTERISK, protocol=all]
mail-whois[name=ASTERISK, dest=root, sender=sip3@unetcom.ru]
logpath  = /var/log/asterisk/full
maxretry = 4
bantime = 259200

To change this format, open /etc/asterisk/logger.conf and add the following line under [general] section (You may have to create this before the [logfiles] section). This causes the date and time to be formatted as Year-Month-Day Hour:Minute:Second, [2008-10-01 13:40:04] is an example.

[general]
dateformat=%F %T

для применения изменений перезапустим логгер
asterisk -rx "logger reload"

Categories: Asterisk, Linux Tags: ,

DVB-карты

17 Сентябрь 2010 Нет комментариев
Categories: IPTV, Linux Tags: