Changing default putty settings.

Sometimes Putty’s default settings drives me insane.
The annoying system bell and invisible dark blue on black colour scheme suck. (My opinion)

Cool reference:

In a nutshell:
Putty settings summary.
Category: Session
Connection type: SSH
Close window on exit: Never

Category: Terminal > Bell
Action to happen when a bell occurs: Visual bell (flash window)
Taskbar/caption indication: Flashing

Category: Window
Lines of scrollback: 20000
Reset scrollback on keypress: Checked
Reset scrollback on display activity: Unchecked

Category: Window > Appearance
Font: Lucida Console, 9-point
Font quality: ClearType
Gap between text and window edge: 3

Category: Window > Translation
Character set: UTF-8
Handling of line drawing characters: Unicode

Category: Window > Selection
Action of mouse buttons: xterm (Right extends, Middle pastes)
Paste to clipboard in RTF as well as plain text: enabled

Category: Window > Colours
ANSI Blue: Red:74 Green:74 Blue:255
ANSI Blue Bold: Red:140: Green:140 Blue:255

Category: Connection
Seconds between keepalives (0 to turn off): 25

Category: Connection > SSH > X11
Enable X11 forwarding: enabled

MNDP and Mac-Telnet for Linux based devices.

I recently wanted my servers to be visible under Mikrotik’s network neighbors.

Thanx to:
This works rather well.
Just saw i needed to open firewall rules:

-A INPUT -m state --state NEW -m udp -p udp --dport 5678 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 20561 -j ACCEPT

I had do add this to get i compiled under Centos 5 in files: mactelnetd.c, protocol.c and mactelnet.c to fix some pre glibc 2.9 issue…

#include <byteswap.h>
#define htole16(x)      (bswap_16(htonl(x)))
#define htole32(x)      (bswap_32(htonl(x)))
#define le16toh(x)      (ntohl(bswap_16(x)))
#define le32toh(x)      (ntohl(bswap_32(x)))

This also looks interesting:

Ioncube loader install on Centos 6


A condenced howto to install ioncube loaders on Centos 6.

cd /usr/src;
tar -xvf ioncube_loaders_lin_x86-64.tar.gz;
cd ioncube;
cp ioncube_loader_lin_* /usr/local/lib/;
echo "zend_extension = /usr/local/lib/" > /etc/php.d/ioncube.ini;
service httpd restart;
cd ~;
rm -Rf /usr/src/ioncube*;

You can check if installed by:

[root@localhost ~]# php -v
PHP 5.3.3 (cli) (built: Jul  3 2012 16:53:21)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with the ionCube PHP Loader v4.4.1, Copyright (c) 2002-2013, by ionCube Ltd., and
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies


So, i had the need to convert IPTV multicast effeciently to HTTP.

Luckily i found udpxy.
As on their home page:
“udpxy is a UDP-to-HTTP multicast traffic relay daemon: it forwards UDP traffic from a given multicast subscription to the requesting HTTP client”


tar -xvf udpxy.1.0.23-7-prod.tar.gz
cd udpxy-1.0.23-7/
make install
make -n install

Options provided by this version:

root@vidserv:~# udpxy
udpxy 1.0-23.7 (prod) standard [Linux 3.2.0-39-generic x86_64]
usage: udpxy [-vTS] [-a listenaddr] -p port [-m mcast_ifc_addr] [-c clients] [-l logfile] [-B sizeK] [-n nice_incr]
        -v : enable verbose output [default = disabled]
        -S : enable client statistics [default = disabled]
        -T : do NOT run as a daemon [default = daemon if root]
        -a : (IPv4) address/interface to listen on [default =]
        -p : port to listen on
        -m : (IPv4) address/interface of (multicast) source [default =]
        -c : max clients to serve [default = 3, max = 5000]
        -l : log output to file [default = stderr]
        -B : buffer size (65536, 32Kb, 1Mb) for inbound (multicast) data [default = 2048 bytes]
        -R : maximum messages to store in buffer (-1 = all) [default = 1]
        -H : maximum time (sec) to hold data in buffer (-1 = unlimited) [default = 1]
        -n : nice value increment [default = 0]
        -M : periodically renew multicast subscription (skip if 0 sec) [default = 0 sec]
  udpxy -p 4022
        listen for HTTP requests on port 4022, all network interfaces
  udpxy -a lan0 -p 4022 -m lan1
        listen for HTTP requests on interface lan0, port 4022;
        subscribe to multicast groups on interface lan1

To execute:

udpxy -p 4022

This will show proxy status in your browser:

This will open a multicast stream meant for and make it available via http.
You can open this url with VLC and it should work.

I think this is also really interesting:

Asterisk stuff i use from time to time for troubleshooting.

Ok, so from time to time you need to get some stuff out of asterisk.

Here is one to show useragents of registered phones:

for a in `asterisk -rx "sip show peers"|cut -f1 -d/` ;do asterisk -rx "sip show peer $a";done|grep Useragent

Will provide IP address and peers as well:

for a in `asterisk -rx "sip show peers" | grep -v 'Monitored\|Name\|Unspecified' | cut -d '/' -f1` ;do echo $a; asterisk -rx "sip show peer $a" | grep 'Useragent\|Addr->IP';done

This one will show registered ip’s and contact

for a in `asterisk -rx "sip show peers"|cut -f1 -d/` ;do asterisk -rx "sip show peer $a";done|grep Contact

This one will show phones that have become lagged:

cat /var/log/asterisk/full |grep NOTICE |grep Lagged | awk '{print $6}' | sort -n | uniq

Safe SSH tunnel based Mysql updates (Well i think?)

Setup user with key based authentication:

useradd -s /bin/false myuser
mkdir /home/myuser/.ssh
touch /home/myuser/.ssh/authorized_keys
chown -R myuser:myuser /home/myuser/.ssh
chmod 755 /home/myuser/.ssh
chmod 600 /home/myuser/.ssh/authorized_keys

Client side:
Install rpmforge repo and autossh.

rpm --import

rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
sed -i "s/enabled = 1/enabled = 0/" /etc/yum.repos.d/rpmforge.repo
yum -y install --enablerepo=rpmforge autossh
ssh-keygen -t rsa

Set up an RSA key pair as root on each client, leaving all questions blank:

ssh-keygen -t rsa
root@local# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/root/.ssh/id_rsa.
Your public key has been saved in /var/root/.ssh/
The key fingerprint is:
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX root@myhost.local

Now scp this to your server:

scp -P 22 /root/.ssh/

On Server: Add to your authorized_keys.

cat /tmp/ &gt;&gt; /home/myuser/.ssh/authorized_keys

Client side:
create /etc/init.d/startautossh on client with contents below. //This example nables connection to server MySQL port 3306 on localhost port 3307.

# pidfile: /var/run/
# @since 2012-02-22 15:31:47
# @author Roderick Derks
# Source function library
. /etc/init.d/functions


# Tunnel configuration

start() {
echo -n $"Starting $prog: "
if [ ! -e $AUTOSSH_PIDFILE ]; then
autossh -M 0 -q -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -L $LOCAL_PORT_LISTEN:localhost:$REMOTE_DESTINATION_PORT -p $REMOTE_SSH_SERVER_PORT  $USER@$REMOTE_DESTINATION_IP

echo pid file still exists $AUTOSSH_PIDFILE
[ $RETVAL -eq 0 ] touch /var/lock/subsys/$prog
return $RETVAL

stop() {
echo -n $"Stopping $prog: "
killproc $autossh
[ $RETVAL -eq 0 ] rm -f /var/lock/subsys/$prog rm -f $AUTOSSH_PIDFILE
return $RETVAL

case "$1" in
status $autossh

echo $"Usage: $0 {start|stop|restart|status}"

Client side: (make script executeable):

chmod +x /etc/init.d/startautossh