Tuesday, June 14, 2011

Keeping OpenSSH from disconnecting

Sometimes whille connecting to another remote server via, there is this unplesant disconnection. How do we deal with it. You have to look at OpenSSH configuration


# /etc/ssh/sshd_config

ClientAliveInterval 15
ClientAliveCountMax 3

From the man page from ClientAliveInterval
Sets a timeout interval in seconds after which if no data has been    received from the client, sshd will send a message through the encrypted channel to request a response from the client.  The default
is 0, indicating that these messages will not be sent to the client.  This option applies to protocol version 2 only.


ClientAliveCountMax
Sets the number of client alive messages (see above) which may be sent without sshd receiving any messages back from the client. If this threshold is reached while client alive messages are being
sent, sshd will disconnect the client, terminating the session.


If ClientAliveInterval (above) is set to 15, and ClientAliveCountMax is left 3, unresponsive ssh clients will be disconnected after approximately 45 seconds.

Do note that the ClientAlive messages are sent through the encrypted channel. On the other hand, The TCPKeepAlive Messages is not sent through encrypted Channel and thus spoofable.

Monday, June 13, 2011

Understanding how a linux command work internally

You can use strace command to understanding how a linux command work internally. For example, to check on the date command

# strace -c /bin/date

strace is a system call monitor command and provides information about system calls made by an application, including the call arguments and return value.

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
   nan    0.000000           0         5           read
   nan    0.000000           0         1           write
   nan    0.000000           0        36        30 open
   nan    0.000000           0         7           close
   nan    0.000000           0        14         9 stat
   nan    0.000000           0         8           fstat
   nan    0.000000           0         1           lseek
   nan    0.000000           0        16           mmap
   nan    0.000000           0         7           mprotect
   nan    0.000000           0         3           munmap
   nan    0.000000           0         3           brk
   nan    0.000000           0         2           rt_sigaction
   nan    0.000000           0         1           rt_sigprocmask
   nan    0.000000           0         1         1 access
   nan    0.000000           0         1           execve
   nan    0.000000           0         1           uname
   nan    0.000000           0         1           getrlimit
   nan    0.000000           0         1           arch_prctl
   nan    0.000000           0         1           futex
   nan    0.000000           0         1           set_tid_address
   nan    0.000000           0         1           clock_gettime
   nan    0.000000           0         1           set_robust_list
------ ----------- ----------- --------- --------- ----------------
100.00    0.000000                   113        40 total

Sunday, June 12, 2011

Setting up 2 different IP Addresses on a single Network Card (NIC) on CentOS

Setting of the first IP Addresses
# vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.2
NETMASK=255.255.255.0
NETMASK=192.168.1.0
GATEWAY=192.168.1.1

Setup the 2nd IP addresses

# vim /etc/sysconfig/network-scripts/ifcfg-eth0:1

DEVICE=eth0:1
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.3
NETMASK=255.255.255.0
NETMASK=192.168.1.0
GATEWAY=192.168.1.1

# service network restart

Ping the 2 IP Addresses, you should be able to both

Saturday, June 11, 2011

Disabling USB port on CentOS 5

To disable USB port on the machine, you can edit the grub.conf
# vim /boot/grub/grub.conf

Add the kernel parameter
kernel /vlinuz ..... rhgb quiet nousb

Reboot your system and you will notice all your usb ports disabled

Tuesday, June 7, 2011

Singapore university and IBM cooperate on cloud

Interesting Article on a Singapore University and IBM collaboration on Cloud.
HPC Cloud to be exact

See Singapore university and IBM cooperate on cloud (Future Gov Asia Pacific)