thewetbeaversmileswhentickled.com

thewetbeaversmileswhentickled.com

 

Implementing procmail on plesk

Posted 2 years, 10 months ago on May 14, 2006 by yerma  Scripts

I had a need to implement procmail on a server running redhat and plesk so after a bit of googling I stumbled across this message:

I recently attempted to implement a (fairly simple I thought) procmail rule to
delete mail with a high SpamAssassin score. I'm wondering if someone would be
willing to tell me what I did wrong? The mails are deleted but I still get a
message with blank subject and blank body.

I'm using qmail and have spamassassin running as a replacement qmail-queue file
in /var/qmail/bin which then passes it on to the real qmail-queue file. I just
added in a pipe to send it through procmail before passing on to qmail-queue as
such:

spamc | procmail -m -p delete-high.rc | qmail-queue.original

The delete-high.rc file contains:

:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*
/dev/null

:0
|

SpamAssassin scoring includes a header with a quantity of * characters to
represent the score. If it's 12 or above in this example, I don't want to even
see it, dump it to /dev/null, don't even bother me with it.

I've also tried this on a different server in a .qmail file and still got the
blank emails each time a high-scoring spam was dumped.

I realize it's probably something very simple I've done wrong.. But then I have
never professed to be a procmail expert :)

---Comment

Rescan scsi bus

Posted 3 years, 1 month ago on February 27, 2006 by yerma  Scripts

Can't remember where I got this script from but it proved very helpful when trying to sort out a debian machine with LVM.

---Comment

testing technorati ping

Posted 3 years, 1 month ago on February 27, 2006 by yerma  Scripts

Added a new thing for technorati pings

---Comment

Time based email forwarding

Posted 3 years, 1 month ago on February 26, 2006 by yerma  Scripts

A while back I worked on a small procmail recipe which took me a while to get right but which has proved invaluable since. I have been using a blackberry for about 2 years now and find it invaluable for work and also keeping up-to-date with my home email. I didn't want the blackberry pinging all the time with crap mail so firstly I wanted only certain email forwarded and secondly only at certain times of the day(after 5.30 if in the office, before midnight, at the w/end etc etc). I couldn't find a lot online about it and tried a few things before stumbling across the idea of using a procmail recipe - I did have a link to where I got the original ideas from but can't find the link now. The recipe is:

uncomment one of the below:


#in office
#:0 c
#* ^From.*(emailaddress|emailaddress2).*(((Mon|Tue|Wed|Thu|Fri).*(1[789]|2[0123]):[0-5][0-9]:.*)|(Sat|Sun)).*
#! blackberryaddress@whatever.com

#out of office
:0 c
* ^From.*(emailaddress|emailaddress2).*(((Mon|Tue|Wed|Thu|Fri).*(0[789]|2[0123]|1[0-9]):[0-5][0-9]:.*)|(Sat|Sun)).*
! blackberryaddress@whatever.com

---Comment

Backups

Posted 3 years, 5 months ago on November 1, 2005 by yerma  Scripts

I have created a few scripts to help in my backing up procedures - I normally install cygwin to enable me to use most unix commands from a windows environment. The following assumes that you have 2(or more) servers - for clarity sake I will call one backup and one web (obviously we are backing up from web to backup).To make the below function will require the below cygwin packages:

  • cron
  • bzip2
  • cpio
  • email - this needs config'd RTFM
  • sshd


The below scripts all take advantage of ssh key authentication to avoid password authentication on the remote host - there is a great tutorial here to setup the sshd - one caveat is that I set nontsec instead of ntsec.

To enable remote authentication without a key do the following:

Login to web:
ssh-keygen -t dsa
mv .ssh/id_dsa.pub ~/web.pub
scp ~/web.pub USERNAME@web:

Login to backup:

cat web.pub >> .ssh/authorized_keys

You should now be able to login without a password.Next step is to put the
scripts in place(rename them all from .txt to .sh). On the web server download the
backups.sh script into your scripts folder (I use ~/scripts with chmod 700). Edit the parameters at the top.

#the backup server
BACKUPSERVER=""
#this server name
THISSERVER=""
#where the local files are stored with no trailing slash
LOCALFILES=""
#Logfile
LOGFILE="/tmp/backups.log"


On the backup server download the "dobackups.txt"[/files/dobackups.txt] and place in your scripts file - edit your variables again:


#Recieve the site to backup from the command line
SITETOBACKUP=$1
LOGFILE="/tmp/backups.log"
#Where the files will be stored when zipped etc - no trailing slash
FILELOC=""


Test it out and it should all work without probs - if it all works okay then setup your cron job on the web server (0 1 * * * /path/to/script.sh) and your ready to go.

I have also included an Oracle script for doing an exp which should be useful.

---Comment

Banning ssh attacks on debian

Posted 3 years, 5 months ago on October 26, 2005 by yerma  Scripts

Howto ban SSH attacks on debian

I saw this implemented on gentoo
here and very
little needed to be changed to make it work with debian. There is a great explanation on that page as well so take a visit.


apt-get install swatch

Then create /etc/swatch.conf


# Global swatch filter file

# To ignore a IP-range - this is your lifeline :)
ignore /ip\.goes\.in\.here/

#Invalid SSH Login Attempts
watchfor /: [iI]llegal [uU]ser/
# uncomment this to let them fail 3 times
#threshold 3:3600
mail addresses=root,subject="SSH:\ Invalid\ User\ Access-IPTables\ Rule\ Added"
exec "/sbin/iptables -A swatch_rejects -s $10 -j DROP"
exec "echo $10 >> /opt/badlist.txt"

#Failed SSH Login Attempts
watchfor /: [aA]uthentication [fF]ail/
# uncomment this to let them fail 3 times
#threshold 3:3600
mail addresses=root,subject="SSH:\ Failed\ User\ Login-IPTables\ Rule\ Added"
exec "echo $10 >> /opt/badlist.txt"



Then in your iptables script(at the end):
[code]
#create the chain
iptables -N swatch_rejects
#link it to the input
iptables -I INPUT -j swatch_rejects
#kill any previously running swatch pid - there should be a check in here
kill -9 `cat /var/run/swatch.pid`
#delete existing pid file
rm -rf /var/run/swatch.pid
#run swatch - watch the wrap
/usr/bin/swatch --tail-file=/var/log/auth.log --config-file=/etc/swatch.conf
--awk-field-syntax --pid-file=/var/run/swatch.pid --tail-args='--follow=name -n 0' --daemon
[\code]

---Comment

 

 

 

 

 

 

 

Music

RSS feeds

Refered

Sections

Apple
Fun Stuff
Just Stuff
Links
lost
News
Projects
radio1links
Scripts
Sun Server testing
trips
Web Development
Work

Older Stuff

The saga begins......
Call to prayer
Away again
Dog Soldiers
Macbook is cracked
Mentals of the world unite....
funny mac vids
Coldfusion and windows(or...
Visio on the web layer
Cyanide and Happiness

Linkage



Add to Google

My status