By admin on Wednesday, 9 of July , 2008 at 10:21 am
Recently I’ve noticed quite a few new spam messages making through my mail server into my mailbox so time to update Spam Assassin and let it know what its missing:
1. I have a seperate mailbox I access explicitly for the purpose of holding Spam, so when my personal junk email folders have a significant amount of real spam in which dont have the ***SPAM*** mark, I move them over to the Spam mailbox.
2. Logging into my mail server as root, I can then proceed to the mailbox store, and inform spamassassin that everything in there should be treat as spam. It’s always a good idea to double check the mail though !
3. Command I use to inform SpamAssassin is the sa-learn command :
sa-learn –spam –progress <path-to-spam-mailbox>
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Category: Linux
By admin on Saturday, 16 of February , 2008 at 2:35 pm
This little snippet is a script I have running via Cron, set to execute every 30 minutes. If like me, you have maybe running forum software that isnt so great handling image uploads in posts and find that users complain because they themselves arent too sure how to resize images prior to posting then this may be useful.
What it does is scan a specified folder every 30 minutes(as set by cron) for new uploaded jpg’s that are greater than a specified size. Using the ImageMagick libraries, it then applies compression and resizes proportionally the image if it exceeds a specified height & width. Images which have been uploaded as 2Mb originals have been processed and saved as 20k files, thats 1% of the original size without any real noticable difference in quality. People tend to upload images which are suitable for professional printing and far exceed the quality required for simple website viewing.
This is my code:
#!/bin/bash
src_dir="/var/www/ukordinance/images/fbfiles/images"
DATETIME=`date +%d-%m-%Y-%H:%M`
echo "Looking for files in : $src_dir on $DATETIME"
#find $src_dir -iname '*.jp*g' -size +100k -mmin -30
for i in `find $src_dir -iname '*.jp*g' -size +256k` ;
do
echo "Processing : "$i
convert -resize 1024x768\> -quality 80 $i $i;
done
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Category: Linux
By admin on Saturday, 9 of June , 2007 at 11:40 am
The code below will first create a file called Exclude containing the paths to all common document files I wish to exclude from my backup, images, documents etc.
Secondly the tar command will be used to create a compressed tgz containing everything in the given folder and recursive folders excluding the files as detected.
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Category: Linux
By admin on Thursday, 15 of February , 2007 at 6:37 pm
Today I decided to install Postgrey on my mail server to help reduce the mass influx of crap I get in my mailbox on a daily basis. I’m not the type of person to have only one email address, I feel the need to use a catch all as I despise the thought of losing emails. And yes there are several thousand items in my inbox I haven’t brought myself to removing.
Anyway I’ve had it running a couple of hours now and it looks to be pretty efficient in its job and its FAR easier to setup than spamassassin etc.
What is it ?
In a nutshell, Postgrey rejects incoming emails. Yes that sounds drastic but a legitimate mail server will resend the message where as the mailservers spammers use tend to send out messages in such bulk they want to get the job over and done with as quickly as possible and don’t care if they miss a few recipients. Thats the idea anyway.
On with the setup ..
Firstly I am using postfix on a ubuntu 6.06 based server & assume all instructions are executed as sudo.
1. Install with apt-get
apt-get install postgrey
2. Edit the postfix configuration so it will work with postgrey. I use nano as an editor.
nano /etc/postfix/main.cf
Find the line - smtpd_recipient_restrictions =
Add the following lines, you may already have the first, I did.
reject_unauth_destination
check_policy_service inet:127.0.0.1:60000
3. Alter postfix settings (Optional)
By default, postfix will delay an incoming message for 300s, I think 5 minutes is a bit steep so you can change this, although this may increase the chances of receiving spam. I changed mine to 1 minute.
nano /etc/default/postgrey
Find the line POSTGREY_OPTS=”–inet=127.0.0.1:60000 –delay=300″ and change 300 to 60 so you end up with POSTGREY_OPTS=”–inet=127.0.0.1:60000 –delay=60″
Next you may wish to specify certain email addresses or domains that you wish postgrey to ignore as you trust them. These configurations are in the whitelist file.
nano /etc/postgrey/whitelist_clients
If you trust every address from hotmail (EXAMPLE ONLY !) you can add @hotmail.com on its own line in this file.
4. Restart Everything
/etc/init.d/postgrey restart
postfix reload
Thats it. You can monitor your mail log using tail /var/log/mail.log -f whilst sending an email to yourself from hotmail for example, and you should see the mail being rejected to make sure its working.
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Category: Linux