Linux Box Admin
Trusted Remote Administration
logo

Tilde
What's new
Articles
Micro HowTos
About
Contact







What's new
Tlswrap
(1 vote)
Daemons
Tuesday, 30 October 2007
   
    Tlswrap    
     
       
 
 If you are using FTP server with ssl/tls support you must know that only a few ftp clients
(namely free ones) have the support for secure file transfers.
 
Tlswrap is a daemon that accepts unencrypted connections  and forwards them 
to certain destination encrypted. 
 
Tlswrap supports full ftp encryption  for data and command channels. It works on unix
platforms as well as windows.
 
How it works: 
 
In order to use tlswrap to encrypt the connection, you have to connect to the host/port 
where tlswrap is listening and  give it a full username@host:port combination to forward
the encrypted connection to.
Let´s say tlswrap is installed on localhost port 2121, then you have to connect to localhost:2121
with username in form username@remote_host:remote_port.
Tlswrap parses the username line and connects to the remote host.
 
Installation: 
Download the current version of tlswrap from it´s homepage .
 
tar -xzf tlswrap-1.04.tar.gz
cd tlswrap-1.04
./configure
make
make install


The binary will reside in /usr/local/bin.
 
Only neccessary command line options are -h host and -l port.
tlswrap -h your_ip -p your_port
 
 
   
       
         
 
monitoring apache connections
(1 vote)
System Administration
Monday, 29 October 2007
   
    monitoring apache connections    
     
       
 
 If you run a more or less loaded apache web server, you will sooner or later happend to be in a situation that you need to know what ips are currently connected.  
 
Here's when netstat command comes in very handy.
To list all connections just issue:
netstat -a
 
Since apache uses TCP we can limit the output to TCP connection:
netstat -at
 
and we eliminate the dns lookup time overhead by adding another flag:
netstat -ant 

Ok, this will list all the tcp connections. Next we want to only list connections belonging  to apache. Apache's binnary is called httpd and netstat with -p parameter will list socket owner's process number and process name.
 
netstat -anpt|grep httpd
 
Now we have all sockets owned by apache. The problem is, that not all of them belong to currently connected users. We need to filter out only ESTABLISHED connections.
 
netstat -anpt|grep httpd|grep ESTABLISHED
 
Ok, almost there - now we use the cut utility to get only remote ips connected:
 netstat -anpt|grep httpd|grep ESTABLISHED|cut -b45-60|cut -d':' -f1
 
Now we have only remote ips, but it can be a pretty long list and there will be duplicit ips listed. We will use uniq and sort commands to sort it by number of occurences of remote ip address:
 
 netstat -anpt|grep httpd|grep ESTABLISHED|cut -b45-60|cut -d':' -f1|sort -rn|uniq -c|sort -t' ' +1
 
If you wonder why there are 2 sorts - the first one is neccessary for uniq to filter out same lines, the second one orders the whole thing by number of ip occurences given by the output of uniq -c command.
 
Now you have nice sorted list of ips connecting to your web server at the current moment. Using watch command you can monitor the output for a longer time:
 
watch "netstat -anpt|grep httpd|grep ESTABLISHED|cut -b45-60|cut -d':' -f1|sort -rn|uniq -c|sort -t' ' +1" 
 
 
 
 
 
 
 
   
       
         
 
Screenshots through Xvfb
(1 vote)
Userland
Sunday, 28 October 2007
   
    Screenshots through Xvfb    
     
       
 
Xvfb acts like a normal X server, but insted of writing the output to the graphics adapter, it writes the graphical output in a binary format into memory. This gives us the opportunity to capture any window running at the Xvfb DISPLAY.
 
Xvfb is included in standard Xorg installations and can be run with a couple of basic parameters.
 
Xvfb :1 -screen 0 1400x2000x24
 
This tells the Xvfb to run on DISPLAY number 1 and screen number 0 with resolution width of 1400 and height 2000 in 24 bit color depth. 
 
 Now we can capture the screen of any window running in the Xvfb DISPLAY/screen with xwd utility.
We have to tell the xwd which screen to capture by either setting the DISPLAY environment variable:
export DISPLAY=:1.0 
 
or by adding a -display and -screen parameters to the xwd tool. Taking the first approach we issue:
 
 xwd -root -silent > screen.xwd
 
 Now we have a binary file screen.xwd. In order to convert the xwd file to more convenient format we have 2 utilities - xwdtopnm and pnmtojpeg. The first converts the xwd to pnm and the second from pnm to jpeg image format. 
 
Now to put it all together: 
 
xwd -root -silent | xwdtopnm |pnmtojpeg > screen.jpg
   
       
         
 
<< Start < Prev 1 2 3 4 5 6 7 8 Next > End >>

Results 1 - 13 of 104


Copyright © 2006,2007 Linux Box Admin.

 
My NHL fan blog