How to change default outgoing / outbound ip address on Windows Server 2008?

If you have multiple ip addresses on your Windows Server, Windows always use nearest ip adress to gateway. So if you need to change it, you should remove all ip addresses and add it via Netsh.

netsh interface ip add address "Local Area Connection" 10.10.10.2 255.255.255.0 skipassource=true

Skipassource means Windows won’t use this ip address for outgoing communication unless explicitly set for use by outgoing packets.

Exim Mass Mail Delete from Queue

If your server suffers from a spamming attack through an exploited web site or any other means it is probable that you want to delete all offending mails. Below we provide a very useful script which does exactly this. It scans through your mail queues and deletes all mail that match the sended or the recipient address you specify

#vi /bin/cleanqueues

#!/bin/sh
if [ $1 ]; then
echo "`exim -bpru | tr '\n' + | sed -e "s/++/=/g" | tr -d + | tr = '\n' | grep "$1" | awk {'print $3'} | xargs exim -Mrm | wc -l` E- Mails deleted"
else
echo "To delete ALL the `exim -bpc` E-Mails on mail queue, give this command:"
echo "exim -bpru | awk {'print $3'} | xargs exim -Mrm"
echo ""
echo "If you want to delete only mails with an specific sender/recipient, use:"
echo "$0 [sender/recipient]"
fi

#cleanqueues somemail@spamdomain.com

update debian’s packages (repos)

Erase the first 2 repos and leave it like this:

deb http://ftp.de.debian.org/debian/ lenny main non-free contrib
deb-src http://ftp.de.debian.org/debian/ lenny main non-free contrib

deb http://security.debian.org/ lenny/updates main
deb-src http://security.debian.org/ lenny/updates main

#deb http://volatile.debian.org/debian-volatile lenny/volatile main
#deb-src http://volatile.debian.org/debian-volatile lenny/volatile main

Make sure you add “non-free contrib” at the end.
Save and exit your editor.

Then update:

# aptitude update

Then install whatever:

# aptitude install whatever

Then update your data base
# updatedb

Debian update repo

#vi /etc/apt/sources.list

# deb cdrom:[Debian GNU/Linux 6.0.0 _Squeeze_ - Official amd64 DVD Binary-1 20110205-18:15]/ squeeze contrib main
deb http://ftp.tr.debian.org/debian stable main
deb-src http://ftp.tr.debian.org/debian/ stable main
#deb cdrom:[Debian GNU/Linux 6.0.0 _Squeeze_ - Official amd64 DVD Binary-1 20110205-18:15]/ squeeze contrib main
deb http://security.debian.org/ squeeze/updates main contrib
deb-src http://security.debian.org/ squeeze/updates main contrib
# Line commented out by installer because it failed to verify:
#deb ://volatile.debian.org squeeze-updates main contrib
# Line commented out by installer because it failed to verify:
#deb-src ://volatile.debian.org squeeze-updates main contrib

How to repair a SQL Server 2005 Suspect database

To get the exact reason of a database going into suspect mode can be found using the following query,

DBCC CHECKDB ('databaseName') WITH NO_INFOMSGS, ALL_ERRORMSGS

To repair the database, run the following queries in Query Analyzer,

EXEC sp_resetstatus 'databaseName';
ALTER DATABASE "databaseName" SET EMERGENCY
DBCC checkdb('databaseName')
ALTER DATABASE "databaseName" SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('databaseName', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE "databaseName" SET MULTI_USER

Upgrading OpenSSH on CentOS 5

If you’ve taken a peek at your PCI scan results lately, you may have noticed that your scan provider is now requiring OpenSSH 4.5 or higher – a version that is not currently available in the CentOS 5 repositories. A Yum update isn’t going to help you much there.
You can, however, easily compile your own RPM and manually upgrade OpenSSH. The commands below are the ones I used to install version 5.8 (the latest stable at the time of this post), but can essentially be used for any compatible version.
First, download the OpenSSH source tarball from the vendor and unpack it. You can find the tarballs at http://www.openssh.com/portable.html

wget http://mirror.mcs.anl.gov/openssh/portable/openssh-5.8p1.tar.gz
tar -xvzf openssh-5.8p1.tar.gz

Copy the spec file and tarball:

cp ./openssh-5.8p1/contrib/redhat/openssh.spec /usr/src/redhat/SPECS/
cp openssh-5.8p1.tar.gz /usr/src/redhat/SOURCES/

Do a little magic:

cd /usr/src/redhat/SPECS
perl -i.bak -pe ‘s/^(%define no_(gnome|x11)_askpass)\s+0$/$1 1/’ openssh.spec

…and build your RPM:

rpmbuild -bb openssh.spec

Now if you go back into /usr/src/redhat/RPMS/, you should see three RPMs. Go ahead and install them:

rpm -Uvh *.rpm

To verify the installed version, just type ‘ssh -v localhost’ and you should see the banner come up, indicating the new version.