Admins eHow SysAdmin Tips & Tricks

March 31, 2010

Check e-mail on a pop3 server using telnet

Filed under: General — Tags: , , , , , , , , , — admin @ 9:44 am

These steps show how to check your e-mail on a pop3 server using a telnet client.

Telnet to the pop3 server.

telnet pop3.somedomain.com 110

You should recieve a reply to this effect.

Trying A.B.C.D...
Connected to pop3.somedomain.com.
Escape character is '^]'.
+OK (rwcrpxc13) POP3 server

if you want to connect to a pop3 SSL server use the following command on a linux shell :

openssl s_client -connect FQDN:PORT

for instance for gmail it is :

openssl s_client -connect pop.gmail.com:995

You will get a response like this :

CONNECTED(00000003)
depth=1 /C=US/O=Google Inc/CN=Google Internet Authority
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=pop.gmail.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIDWjCCAsOgAwIBAgIKYgy3qQADAAAJ5zANBgkqhkiG9w0BAQUFADBGMQswCQYD
VQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZR29vZ2xlIElu
dGVybmV0IEF1dGhvcml0eTAeFw0wOTA3MTcxNzE2NTVaFw0xMDA3MTcxNzI2NTVa
MGcxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1N
b3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRYwFAYDVQQDEw1wb3Au
Z21haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDTHqjJfnRXdpmZ
4iP/WNCpvzX4N97bEZ3rvS4aDYey/DJetKZqp9DK1Ie4/C5j8M1aakwiTNA/eHS/
wNWVgQx8+HxproYKUeeYj3shYKEkHGfrRYBcyCxc7Gd6NSGaaYru3Z7nJ+STIPUJ
E1N35JAwcjjdITVI2O4LckAL4b7GkwIDAQABo4IBLDCCASgwHQYDVR0OBBYEFIln
0T5I8Mw6cqhtUS4pyMGYRxOTMB8GA1UdIwQYMBaAFL/AMOv1QxE+Z7qekfv8atrj
axIkMFsGA1UdHwRUMFIwUKBOoEyGSmh0dHA6Ly93d3cuZ3N0YXRpYy5jb20vR29v
Z2xlSW50ZXJuZXRBdXRob3JpdHkvR29vZ2xlSW50ZXJuZXRBdXRob3JpdHkuY3Js
MGYGCCsGAQUFBwEBBFowWDBWBggrBgEFBQcwAoZKaHR0cDovL3d3dy5nc3RhdGlj
LmNvbS9Hb29nbGVJbnRlcm5ldEF1dGhvcml0eS9Hb29nbGVJbnRlcm5ldEF1dGhv
cml0eS5jcnQwIQYJKwYBBAGCNxQCBBQeEgBXAGUAYgBTAGUAcgB2AGUAcjANBgkq
hkiG9w0BAQUFAAOBgQCEGIebkDpktdjtzMiTTmEiN7e4vc73hEI4K0jYKyY0Wn5N
dc44AXTfIWOzsikwb886PCUSevGs9rcw2/kaHdPaBSuGrzSCf8ODQqTC3odry3lo
PtZGr6nf/81F5UW71+bE1iWOQlJ5/olWOr2SlqYla1iOmosEctD/GyoFnDh+BA==
-----END CERTIFICATE-----
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=pop.gmail.com
issuer=/C=US/O=Google Inc/CN=Google Internet Authority
---
No client certificate CA names sent
---
SSL handshake has read 1703 bytes and written 300 bytes
---
New, TLSv1/SSLv3, Cipher is RC4-MD5
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : RC4-MD5
    Session-ID: AF09D6024039D1F70D7A6518034EF3B2E1B949C15A71ED3D0E85BC89F7D4ADC2
    Session-ID-ctx:
    Master-Key: 58D4202B16256CA5715C45B2CDDDFDDC16ABCAEF2A0993D23F3817193AE3F4A4E5531EF13CA970BADD1F8EA273FD6871
    Key-Arg   : None
    Start Time: 1270025037
    Timeout   : 300 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
---
+OK Gpop ready for requests from a.b.c.d q9pf826547gve.29

Enter your username for the pop3 e-mail account using the “user” command.

user username_here

You should recieve the following reply.

+OK

Enter your password for the pop3 e-mail account using the “pass” command.

pass password_here

You should recieve the following reply.

+OK Maildrop ready

Stat your mailbox using “stat” command.

stat

You will get response showing the number of messages on the server and total size of them.

+OK 2 9141

List the mail on the pop3 e-mail account using the “list” command.

list

You will see the list of messages on the server.

+OK scan listing follows
1 1489
2 7652
.

To see one of the messages issue the retrieve command “retr” and the message id.

retr 1

You will see the whole e-mail headers and all.

+OK 1489 octets
Return-path:
Received: from blah (blah.somedomain.net [a.b.c.d])
by blah2.somedomain.net
(iPlanet Messaging Server 5.2 HotFix 1.16 (built May 14 2003))
with ESMTP id <0HHF00C6KK6NXJ@blah2.somedomain.net> for
me@here.net; Wed, 02 Jul 2003 23:54:23 -0400 (EDT)
Date: Wed, 02 Jul 2003 23:52:59 -0400
From: Me
Subject: test
To: you@there.net
Reply-to: me@here.net
Message-id: <200307022352.59679.me@here.net>
Organization: Pantz.org
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7bit
Content-disposition: inline
User-Agent: KMail/1.5.1
Original-recipient: rfc822;me@here.net

test

If you would like to delete the message issue the dele command with the message id.

dele 1

You will then see a delete confirmation.

+OK message deleted

To finish issue the quit command.

quit

Response :

+OK
Connection closed by foreign host.

March 20, 2010

How to Disable Password Expiration on Windows Server 2008

Filed under: General,Security,Windows — Tags: , , , , , — admin @ 2:31 pm

If you’re not using Active Directory, your “Local Security Policy” dictates things like password complexity rules, account lockouts, and password expiration. To turn off password expiration:

1) Login as Administrator or a user with Administrator rights
2) Launch “Local Security Policy”: Start > Administrative Tools > Local Security Policy
3) Expand “Account Policies”
4) Select Password Policy
5) Set Maximum Password age to “0”

Source : Ryan’s Tech Notes

March 18, 2010

Prevent MySQL Injection in PHP

Filed under: General,MySQL,PHP,Security — Tags: , , , , — admin @ 5:21 pm

As it is explained everywhere on the web , the general solution to prevent mysql injection attacks in php is to use mysql_real_escape_string function , there are many guides on how to use it in conjunction with sprintf to escape dangerous characters before executing a mysql query, but I found a very innovative solution in a comment on php.net website , it recommends to escape all variables sent by user by get or post method in the beginning of every page which executes mysql queries :
first make sure magic_quotes_gpc is turned off on your php configuration , it can be checked on php info page.
this step makes sure your variables are not escaped twice.
This article explains how to disable magic quotes : Disabling Magic Quotes Guide
put the following code in the beginning of every page executing mysql queries :

	include ('mysql_connect.php');
	
	//This stops SQL Injection in POST vars
	foreach ($_POST as $key => $value) {
		$_POST[$key] = mysql_real_escape_string($value);
	}

	//This stops SQL Injection in GET vars
	foreach ($_GET as $key => $value) {
		$_GET[$key] = mysql_real_escape_string($value);
	}

mysql_real_escape_string needs you to be connected to your mysql database when you call it , so I have placed include (‘mysql_connect.php’); in the beginning of script , you can replace it with your own mysql connect commands.

March 13, 2010

Shell script to show network speed

Filed under: CentOS,Debian,DreamBox,General — Tags: , , , , , , , , , — admin @ 11:37 am

The following shell script shows current download and upload speeds for the network interface you choose.

Copy the shell script in a file named, i.e: net_speed.sh

Then after setting execution permissions:

chmod a+x net_speed.sh

You can run the shell script passing as the first argument the network interface you want to monitor:

./net_speed.sh eth0

You will get a line like that:
eth0 DOWN:15 KB/s UP:880 B/s

This script works parsing /proc/net/dev file and calculating the difference between current transmitted or received bytes and their values one second ago.

#!/bin/bash

# This shell script shows the network speed, both received and transmitted.

# Usage: net_speed.sh interface
#   e.g: net_speed.sh eth0


# Global variables
interface=$1
received_bytes=""
old_received_bytes=""
transmitted_bytes=""
old_transmitted_bytes=""


# This function parses /proc/net/dev file searching for a line containing $interface data.
# Within that line, the first and ninth numbers after ':' are respectively the received and transmited bytes.
get_bytes()
{
    line=$(cat /proc/net/dev | grep $interface | cut -d ':' -f 2 | awk '{print "received_bytes="$1, "transmitted_bytes="$9}')
    eval $line
}


# Function which calculates the speed using actual and old byte number.
# Speed is shown in KByte per second when greater or equal than 1 KByte per second.
# This function should be called each second.
get_velocity()
{
    value=$1    
    old_value=$2

    let vel=$value-$old_value
    let velKB=$vel/1024
    if [ $velKB != 0 ];
    then
 echo -n "$velKB KB/s";
    else
 echo -n "$vel B/s";
    fi
}

# Gets initial values.
get_bytes
old_received_bytes=$received_bytes
old_transmitted_bytes=$transmitted_bytes

# Shows a message and waits for one second.
echo "Starting...";
sleep 1;
echo "";


# Main loop. It will repeat forever.
while true; 
do

    # Get new transmitted and received byte number values.
    get_bytes

    # Calculates speeds.
    vel_recv=$(get_velocity $received_bytes $old_received_bytes)
    vel_trans=$(get_velocity $transmitted_bytes $old_transmitted_bytes)

    # Shows results in the console.
    echo -en "$interface DOWN:$vel_recv\tUP:$vel_trans\r"

    # Update old values to perform new calculations.
    old_received_bytes=$received_bytes
    old_transmitted_bytes=$transmitted_bytes

    # Waits one second.
    sleep 1;

done

Source : Linux Clues

March 12, 2010

Axel download manager for dreambox (dm800)

Filed under: DreamBox — Tags: , , , , — admin @ 4:57 pm

From Axel Project official site :

Axel tries to accelerate HTTP/FTP downloading process by using multiple connections for one file. It can use multiple mirrors for a download. Axel has no dependencies and is lightweight, so it might be useful as a wget clone on byte-critical systems.

I found a working compiled version of axel download manager for my dm800.
You can download it from here : Click here to download axel mipsel
First decompress the zip file then put it in /usr/bin folder of your dreambox and make it executable and enjoy 🙂

March 8, 2010

Workaround to Run Windows Vista Bar Style Sidebar in Windows 7

Filed under: General,Windows — Tags: , , , , , — admin @ 1:23 pm

There is a workaround to get back the Windows Vista Sidebar in Windows 7. Follow these steps:
1. Close the Windows 7 sidebar by killing the sidebar.exe in the task manager
2. Download this zip file: Win7-Sidebar-Fix.zip
3. Extract the zip content to your Windows Sidebar folder C:\Program Files\Windows Sidebar (overwrite existing files)
4. Run the sidebar.exe from C:\Program Files\Windows Vista Sidebar
5. Add your gadgets and have fun with the Windows Vista Sidebar!

Clipboard Manager Gadget with Customized Height

Filed under: Windows — Tags: , , — admin @ 12:29 pm

I am a fan of Clipboard manager gadget from Jan Zeman
It is a very useful gadget and lets you to use your clipboard very efficiently.
I have created a customized version of this gadget for myself with Height 260 ( instead of 160 ) which shows 13 last items of clipboard ( instead of 7 ).
You can download it here :
http://adminsehow.com/files/ClipboardManager-H260.Gadget

March 5, 2010

How to sync dreambox date and time automatically

Filed under: DreamBox — Tags: , , , — admin @ 9:37 am

I could not find rdate or ntpclient packages for dreambox , so I came up with another solution to sync my dreambox date and time when it boots up.
First you need another server with synced date and time , so we can read the correct date and time from it. also we need a webserver and php installed on it.
Create a script named “dreambox-date.php” on root folder of your web server with following content :

<?php
date_default_timezone_set("UTC");
echo date("Y.m.d-G:i:s");
?>

Create another file named “03datesync” in “/etc/network/if-up.d” folder of your dreambox with following content :

#!/bin/sh
date -u -s `wget -O - http://IP_OR_FQDN/dreambox-date.php`

Change IP_OR_FQDN to your own hosting IP and domain name.
Also make it executable :

chmod +x 03datesync

All done 🙂 Now when dreambox boots up and its network interface is up , the above script would be called and it syncs your dreambox date and time.

How to change timezone on Debian

Filed under: Debian,General — Tags: , , , — admin @ 8:40 am
dpkg-reconfigure tzdata

March 4, 2010

How to run multiple instances of yahoo messenger

Filed under: General,Windows — Tags: , , , , — admin @ 1:46 pm

It is possible to run several instances of Yahoo! Messenger using a tiny registry tweak.
Create a file named “yahoo.reg” and copy and paste the following inside it :

REGEDIT4

[HKEY_CURRENT_USER\Software\yahoo\pager\Test]
"Plural"=dword:00000001

Save the file and double click on it , windows asks for a confirmation to write the data inside windows registry , click on Yes.
We are all set 🙂

Older Posts »

Powered by WordPress