čtvrtek 27. září 2012

GPSD debugging

gpsd -n -N -D4 /dev/ttyUSB0

Linux router iptables quick how-to

# Delete old configuration, if any
# Flush all the rules in filter and nat tables

iptables --flush

iptables --table nat --flush

# Delete all chains that are not in default filter and nat table, if any

iptables --delete-chain
iptables --table nat --delete-chain


# Set up IP FORWARDing and Masquerading (NAT)
# Interface with internet connection

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE

# Interface with nat-ed clients

iptables --append FORWARD --in-interface eth1 -j ACCEPT

#enable IP forwarding

echo 1 > /proc/sys/net/ipv4/ip_forward

Early Asterisk 1.8 SIP TLS problem

I wonder why Asterisk (1.8.3.3) when I configured it properly still didn`t run on TLS port 5061 without any error in logs. So if you are running Debian, install these packages by aptitude and then recompile Asterisk.
openssl libcrypt-dev libxcrypt-dev libcrypto++-dev libssl libssl-dev

How to alter MySQL procedure Security_type

ALTER PROCEDURE database.procedure_name SQL SECURITY INVOKER; and check:
SHOW PROCEDURE STATUS LIKE 'procedure_name';

How to use ngrep to capture SIP packets

It`s easy. With natural line breaks:

ngrep -W byline -d eth0 port 5060

To file:

ngrep -W byline -d eth0 port 5060 -O capture_file

Just INVITEs:

ngrep -W byline -d eth0 INVITE

Icinga monitoring how to

Icinga is a Nagios fork and still use Nagios plugins and NRPE/NSCA for distant monitoring. Let see how to make it work on Debian machine.  

1. Prepare
/usr/sbin/useradd -m icinga passwd icinga /usr/sbin/groupadd icinga /usr/sbin/groupadd icinga-cmd /usr/sbin/usermod -a -G icinga-cmd icinga /usr/sbin/usermod -a -G icinga-cmd www-data
2. Download from Sourceforge: http://sourceforge.net/projects/icinga/
tar xvzf icinga-x.tar.gz
./configure --with-command-group=icinga-cmd

How to ACL`s on Linux

aptitude install acl  
mount -o remount,acl /dev/hda3  
setfacl -R -m u:user:rwx /var/tmp/file  
setfacl -R -m g:group:rwx /var/tmp/file
 
“-R” is recursive. To see ACL rights just write

getfacl /var/tmp/file

And you`ll see something like this:

# file: var/tmp/file # owner: group # group: group user::rwx user:user:rwx group::rw- group:group:rwx mask::rwx other::---

And next you can add more users/groups rights to this file ;-)

How to sshfs

Almost like scp, or rsync syntax.
sshfs user@host:/path/to /local/path
And obviously if it isn`t working :)
modprobe fuse