03-15-06 01:48 AM
Troy Piggins <usenet-0603@piggo.com> writes:
> I use 'date' to get the current year and month in a format:
> $ date +"%y%m"
> 0603
> I want to also get the previous month in the same format, but I can't
> just do a mathmatical operation of 0603 - 1, because at 0601 for example
> I'd get 0600 which is clearly wrong (obviously need 0512).
> What's the simplest way to do this? Is there a one-line answer?
% date --date '-1 month'
> To be specific, I'm using it in a procmail script with disposable email
> addresses valid only for this month and the previous one (spam
> minimisation).
BTW, you may want to consider a different technique, unless you want
your mail server to be overloaded. If you notice, my posting has no
valid email address, nor does it even have a technically valid
message-id header.
When I got a new email address seven years ago, I wrote some
emacs-lisp to avoid including my real address, and quickly found out
that spammers would incorrectly scrape the message-id, which looks
like an email address, having a generated term followed by '@' and the
sending domain. Today my mail log still shows I get a dozen or so
emails to two such addresses that were *never* valid--I had made two
postings to usenet before I discovered my problem. While this is not
much (on-going dictionary attacks still weigh more heavily than this),
it was add up over time in your case. Worse, those emails can be
*validated* for a month, which could end up generating far more spam
attempts over the long run than my two message-id's.
Without loss of generality, I have /received/ exactly 11 pieces of
spam in the past seven years. This is because I use a unique username
for each recipient I exchange mail with--if I buy something at
abcd.com, I give an email address of abcd.com@«my.real.domain». If I
start receiving spam on this address, I know who sold me out, and I
remove this address. This is all simply done with adding lines to
/etc/aliases. I put the comment "#DEAD " in front of these aliases
and never receive spam on them again. Thus my /etc/aliases file has
11 lines commented out in this manner.
The following command:
% grep "^#DEAD " /etc/aliases | cut -b 7- | cut -d: -f 1 | xargs -n1 -i§ gre
p " <§@my.real.domain>" /var/log/maillog* | cut -d: -f6 | uniq -c
shows only 4 of these 11 have been used for a grand total of 152 times
in the past 30 days. Of these, 1 of the 4 was just "killed" (don't
buy goods from basoncomputer.com--they will sell your address) and
accounts for 78 of 158 hits. Another was a mistake (using my son's
common name) for 42 of 158--but these are surely just dictionary
attacks, as my 2˝ year old hasn't being using his address that much.
My entire scripting consists of /usr/local/bin/append-alias:
#!/bin/sh
if [ "$1" != "" ]; then
echo "$1: $USER" >> /etc/aliases
newaliases
else
echo "Usage: $0 <mail-alias>"
fi
I considered changing this to using webmail from free sites that allow
pop (like gmail), and then gathering email with fetchmail (and having
my server not respond on port 25 at all), but that's probably more
overhead...
I have conquered spam! :-)
--
© 2006 Kurt Swanson AB
[ Post a follow-up to this message ]
|