Akismetを使ったトラックバック・スパム対策

いい加減にトラックバック・スパムがうざくなってきたので対策してみました。COREBlog2におけるコメント&トラックバック・スパム対策に関しては、清水川さんが纏めてくれているので、それを参考にAkismetというWordPress標準の対策機能を使ってSPAM判定をするようにしました。

1. akismet.py をダウンロードしてパスの通った所(/usr/lib/python2.3など)に置く

2. akismet.pyをZope環境から呼び出せるように設定

[Zopeのディレクトリ]/Products にGlobalModulesという名前のディレクトリを作成
下記の内容の __init__.py というファイルを中に作成
from Products.PythonScripts.Utility import allow_module
allow_module("akismet")

3. WordPressのアカウントを登録して、APIキーを取得

APIキーは、http://wordpress.com/signup/ でサインアップするとメールで送られてきます。

4. ZMIから portal_skins/COREBlog2/tbping を編集して、太字部分のコードを追加
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import log
import akismet

cbtool = getToolByName(context, 'coreblog2_tool')

REQUEST = context.REQUEST
form = REQUEST.form
RESPONSE = context.REQUEST.RESPONSE
entry = context

excerpt = ''
if form.has_key('excerpt'):
    excerpt = form['excerpt']

title = cbtool.convert_charcode(form['title'])
blog_name = cbtool.convert_charcode(form['blog_name'])
excerpt = cbtool.convert_charcode(excerpt)

#Try to add trackback
try:
    #Check SPAM
    is_spam = False
    my_api_key = "xxxxxxxxxxx"
    try:
        real_key = akismet.verify_key(my_api_key, context.absolute_url())
        if real_key:
            is_spam = akismet.comment_check(my_api_key,
                          context.absolute_url(),
                          REQUEST.getClientAddr(),
                          REQUEST.get('HTTP_USER_AGENT', ''),
                          comment_type="trackback",
                          comment_author_url=form['url'],
                          comment_content=form['excerpt'].encode('utf-8'))
    except Exception, e:
        log( 'COREBlog2/tbping: '
                     'akismet exception occured, %s' % e )
    if is_spam:
        raise RuntimeError, 'akismet judged as SPAM. %s' % form['url']
    #Send notify mail if need
    if context.getSend_trackback_notification():
        try:
            to_addr   = context.getNotify_to()
            from_addr = context.getNotify_to()
これで問題のトラックバック・スパムは、ほぼ防げているようです。でも、自分でテストした感じでは、問題のないトラックバックもスパムと判定して弾いちゃうことがあるようです。とりあえず、これでしばらく様子をみますが、”ここはまずいんじゃないの”とか”もっと良い方法があるよ”とかのツッコミは大歓迎。


関連リンク:
Akismet in Python and API docs

33 Comments so far »

  1.  

    ooopinionsss said

    on 2008-12-04 12:58 p.m.

    How you think when the economic crisis will end? I wish to make statistics of independent opinions!

  2.  

    Beefrerge said

    on 2009-06-28 2:30 p.m.

    <a href=http://www.adultfriendfinder77.com>Adult friend finder</a>, Your Greatest Start Out Intimacy Personals, Matured Dating, Amateurs & Swingers

  3.  

    Beefrerge said

    on 2009-06-28 6:20 p.m.

    <a href=http://www.adultfriendfinder77.com>Adult friend finder</a>, Your Ultimate Start Out Sex Personals, Full-grown Dating, Amateurs & Swingers

  4.  

    JollaNede said

    on 2009-06-28 8:49 p.m.

    Wow such an unexpected shrinkage! The totality world stood at rest to judge goodbuy to Michael! He is Elvis of our days!R.I.P MICHAEL!

  5.  

    cwe97 said

    on 2009-06-28 11:03 p.m.

    mine was a blue 1963 chevy corvair it had a rear mounted air cooled flat six and according to ralph nader it was unsafe at any speed the gas tank on these cars were mounted on the side and if hit exploded instantly .it was a very pretty car. this is what it looked like.these were also the first production cars to have turbo chargers. i ended up selling it to a guy who wanted to use the engine for a small airplane.

    bye
    <a href=http://www.ficken-seite-3.com/>Ficken Seite 0952 </a>

  6.  

    xay43 said

    on 2009-06-29 12:53 a.m.

    mine was a blue 1963 chevy corvair it had a rear mounted air cooled flat six and according to ralph nader it was unsafe at any speed the gas tank on these cars were mounted on the side and if hit exploded instantly .it was a very pretty car. this is what it looked like.these were also the first production cars to have turbo chargers. i ended up selling it to a guy who wanted to use the engine for a small airplane.

    bye
    <a href=http://www.ficken-seite-3.com/>Ficken Seite 9578 </a>

  7.  

    ENCAPPELM said

    on 2009-06-29 1:52 a.m.

    Hey guys,

    I have this special bonus on this company which gives me 15% on the revenues of the customers I bring.

    I can give back the 10% to you and of course for my work I keep the 5%. This means that you have 10% more revenues from betting at the end of each month.

    Try it for one month and you won't lose. TRUST ME. Its a win-win situation because the intermediaries are not some big sites but me, and I am flexible in giving back your money.

    The site is www.betblow.com and its a great betting site with LIVE CASINO where you see the girls talking to you and dealing. And the poker is excellent.

    Send me a mail so that I can know your username and your mail to credit your account at the end of each month with 10% back.

    send me a mail at kostaskaliakis@gmail.com

    try it for one month. no strings attached.

  8.  

    karkaqualsels said

    on 2009-06-29 7:35 a.m.

    leann womack i hope u dance lyrics dance like no one is watching site myspace.com center of ballet and dance arts dance dance revolution tv pad review immortal technique dance with the devil video <a href=http://haotevo.za.pl>black eyed peas love mp3</a> 275 dance dance pack revolution song song how to build a lighted dance floor champion dance dancer dancing first ribbon second church dance free in lesson plan worship dance like no ones watching lyrics conformto, <a href=http://wimefyd.za.pl/black-eyed-peas-and-molasses.html>About 82 in Chicago </a> lavin cassidy school of irish dance dance formal homecoming prom semi slutty snowball dance had has have like pant peeing blood on the dance floor lyrics can dance i love really when

  9.  

    jagan0 said

    on 2009-06-29 7:47 a.m.

    Good afternoon
    This is why generic pills look different, they are of a different color and have a different shape if compared to a brand name pill. cheap uks
    Goodluck!!!
    ________________________________
    <a href= http://cealispills.info/buy-vigra/buy... > cheap pharmaceutical </a> :)

  10.  

    wowgoldfkyour said

    on 2009-06-29 9:02 a.m.

    The next installment in TOKYOPOP's bestselling Warcraft anthology series goes on sale in bookstores everywhere today, June 17. New stories include part four in Richard A. Knaak and Jae-Hwan Kim’s continuing adventures of Trag Highmountain, as well as the untold coming-of-age-story of Draka, <a href=http://www.wowgold-shopping.com>wow gold</a>mother of Thrall, from acclaimed Warcraft novelist Christie Golden.

  11.  

    joanttreskk said

    on 2009-06-30 12:35 a.m.

    Hi all!

    I`m new user on this forum. My name is Joan I`m 23 yo girl from New York.

    xoxo

    <a href=http://webcamgirls.wikispaces.com/black+webcam+girls>Webcam Girls</a>

  12.  

    Ractutouncart said

    on 2009-06-30 12:59 p.m.

    Hi everyone 
    can I use the iTunes to sync contact,applications,etc to my iPhone after jailbreak and unlock
    with redsn0w- ultrasn0w without worrying to get some error with it? can I purchase and
    use app store or itunes store normally after jailbreak and unlock?
    PLEASE EXPLAIN ME SOME ONE!?

  13.  

    Stoog said

    on 2009-06-30 2:02 p.m.

    this sounds promising.

    <a href="http://www.handikapparet2003.nu/icq/">ICQ jetzt herunterladen</a>

    http://www.handikapparet2003.nu/icq/

  14.  

    PriceBlilelem said

    on 2009-06-30 5:04 p.m.

    Тем, кто ищет свою вторую половинку заграницей
    Расскажет и научит вас вебсайт http://www.mydatelove.com

  15.  

    wowgoldfkyour said

    on 2009-06-30 6:48 p.m.

    The next installment in TOKYOPOP's bestselling Warcraft anthology series goes on sale in bookstores everywhere today, June 17. New stories include part four in Richard A. Knaak and Jae-Hwan Kim’s continuing adventures of Trag Highmountain, as well as the untold coming-of-age-story of Draka, <a href=http://www.wowgold-shopping.com>wow gold</a>mother of Thrall, from acclaimed Warcraft novelist Christie Golden.

  16.  

    Gaxephevahact said

    on 2009-06-30 7:33 p.m.

    Launched the mod wonderful program - Libertyreserve Bank

    It bugger inaccurate being done be anecdote of the from the start programs of 2009-2010 !

    Program misapplication permit raise and Anti-DDoS confinement!!!

    Plans:

    102 % after 1 daytime
    104,5% after 2 days
    107% after 3 days

    5% referral commission!

    http://libertyreservebank.com/?ref=sa...

    ______________________________________
    <a href=https://libertyreserveinvestments.biz>money online bound</a>

  17.  

    skykingcovertiger said

    on 2009-06-30 11:43 p.m.

    We are a group of dedicated players who have come together to provide <a href=http://www.wowgoldprice.com>wow gold</a> services for the community so that you, our fellow players, will be able to enjoy your play time to the fullest.

    Since our inception, we have experienced a long way to becoming one of the largest group of players in the industry. Our dedicated support team has consistently displayed professionalism while not losing the personal touch when assisting each of our customers with their distinctive needs. In the process, we have cultivated many long-term relationships with our valued customers. For that matter, we are grateful to have customers like you to be here every step of of our growth.

    We work hard with our suppliers to offer the lowest prices we can. We keep our prices as competitive as we can afford. If you find a lower price somewhere please e-mail us and we will try our hardest to match it.

    Our promise to you is that we will keep making progress every day to be the best one-stop shop for all your gaming needs.

  18.  

    Fioricet said

    on 2009-07-01 2:56 a.m.

    This combination drug product is intended as a treatment for tension headache.

    It consists of a fixed combination of butalbital, acetaminophen, and caffeine. The role each component plays in the relief of the complex of symptoms known as tension headache is incompletely understood.

  19.  

    xpv16 said

    on 2009-07-01 4:24 a.m.

    I was watching 'Dine With Me' this week and saw some poor bloke prepare mushroom soup for his guests, none of whom liked mushrooms. Unfortunately his main course was a pork dish (also with some mushrooms in the sauce) and one of the guests really disliked pork.

    This got me thinking: You often see people state what they'd like for their ideal celebration meal, or their last meal on earth, but what would be the most disappointing meal that anyone could serve up for you?

    I don't want just random comments like "I hate fish" or whatever - Please suggest 3 or 4 courses that wouldn't tickle your tastebuds.

    I like most food, so I found this quite difficult, but I wouldn't be delighted to have

    Devilled kidneys

    Raw oysters (not that I've ever tried them, they just don't appeal)

    Madras curry

    Gooseberry crumble.

    bye
    <a href=http://www.geile-seite-7.com/>Geile Seite 7 8j4 </a>

  20.  

    PriceBlilelem said

    on 2009-07-01 5:20 a.m.

    Для тех, кто не нашёл ещё своего счастья
    Расскажет и научит вас вебсайт http://www.mydatelove.com

  21.  

    NaskEndadezek said

    on 2009-07-01 5:20 a.m.

    What's Up

    I need some help... I registered for an account at <a href=http://www.esnips.com><b>eSnips.com</b></a> and now Im trying to figure out how to upload files ..

    Any other Esnips Members can walk me through this?

    Btw - For those of you who don't know, eSnips offers <a href=http://esnips.com><b>Free Software Downloads</b></a> etc.

  22.  

    Gaxephevahact said

    on 2009-07-01 1:51 p.m.

    Launched the new wonderful program - Libertyreserve Bank

    It pleasing be a precise of the outclass programs of 2009-2010 !

    Program smoke permit fantasy and Anti-DDoS exoneration!!!

    Plans:

    102 % after 1 illuminate of broad daylight
    104,5% after 2 days
    107% after 3 days

    5% referral commission!

    http://libertyreservebank.com/?ref=sa...

    ______________________________________
    <a href=https://libertyreserveinvestments.biz/?a=cust&page=hyip>hyip investment</a>

  23.  

    wowgoldfkyour said

    on 2009-07-01 6:27 p.m.

    The next installment in TOKYOPOP's bestselling Warcraft anthology series goes on sale in bookstores everywhere today, June 17. New stories include part four in Richard A. Knaak and Jae-Hwan Kim’s continuing adventures of Trag Highmountain, as well as the untold coming-of-age-story of Draka, <a href=http://www.wowgold-shopping.com>wow gold</a>mother of Thrall, from acclaimed Warcraft novelist Christie Golden.

  24.  

    hma03 said

    on 2009-07-01 6:36 p.m.

    I was watching 'Dine With Me' this week and saw some poor bloke prepare mushroom soup for his guests, none of whom liked mushrooms. Unfortunately his main course was a pork dish (also with some mushrooms in the sauce) and one of the guests really disliked pork.

    This got me thinking: You often see people state what they'd like for their ideal celebration meal, or their last meal on earth, but what would be the most disappointing meal that anyone could serve up for you?

    I don't want just random comments like "I hate fish" or whatever - Please suggest 3 or 4 courses that wouldn't tickle your tastebuds.

    I like most food, so I found this quite difficult, but I wouldn't be delighted to have

    Devilled kidneys

    Raw oysters (not that I've ever tried them, they just don't appeal)

    Madras curry

    Gooseberry crumble.

    bye
    <a href=http://www.geile-seite-7.com/>Geile Seite 7 6z5 </a>

  25.  

    acousiaCini said

    on 2009-07-01 7:39 p.m.

    coach coach dance fitness personal trainer dance fat ft lumidee man scoop learn how to dance the waltz dance heartbreakers janes last mary petty tom dance smash hits vol 1 2005 i d rather dance with you than can dance i love now that electronlens, <a href=http://mp3more.biz/mix/a/promo-only-dance-radio-march-various-artists-cold.html>About restraintoftrade in New Orleans </a> id rather dance with you lyrics adult class dance in maryland tap dirty dancing havana nights lyrics dance like this debbie allen dance academy culver city dance laugh sing 4 peice crib bedding set how learn to break dance cl bratz club dance go go n skate tokyo

  26.  

    rzl75 said

    on 2009-07-01 8:39 p.m.

    I was watching 'Dine With Me' this week and saw some poor bloke prepare mushroom soup for his guests, none of whom liked mushrooms. Unfortunately his main course was a pork dish (also with some mushrooms in the sauce) and one of the guests really disliked pork.

    This got me thinking: You often see people state what they'd like for their ideal celebration meal, or their last meal on earth, but what would be the most disappointing meal that anyone could serve up for you?

    I don't want just random comments like "I hate fish" or whatever - Please suggest 3 or 4 courses that wouldn't tickle your tastebuds.

    I like most food, so I found this quite difficult, but I wouldn't be delighted to have

    Devilled kidneys

    Raw oysters (not that I've ever tried them, they just don't appeal)

    Madras curry

    Gooseberry crumble.

    bye
    <a href=http://www.geile-seite-7.com/>Geile Seite 7 6w9 </a>

  27.  

    ENCAPPELM said

    on 2009-07-02 2:19 a.m.

    Hey guys,

    I have this special bonus on www.betblow.com which gives me 35% on the revenues of the customers I bring.

    I can give back the 20% to you and of course for my work I keep the 15%. This means that you have 10% more revenues from betting at the end of each month.

    Try it for one month and you won't lose. TRUST ME. Its a win-win situation because the intermediaries are not some big sites but me, and I am flexible in giving back your money.

    The site is www.betblow.com and its a great betting site with live casino where you see the girls talking to you and dealing. And the poker is excellent.

    Send me a mail so that I can know your username and your mail to credit your account at the end of each month with 20% back.

    send me a mail at kostaskaliakis@gmail.com

    try it for one month. no strings attached.

    http://www.betblow.com

  28.  

    Vovaexoto said

    on 2009-07-02 11:46 p.m.

    Hello everyone

    I just wanted to make a statement on the contribution of this community here. It's great.

    I want to contribute my part to this forum as well

    There is a site that has been awfully helpful to myself and some associates of mine. That site is OnlineComputerHelpers.com and they offer remote <a href=http://www.onlinecomputerhelpers.com>computer repair</a>

    I hope that my aid has been substantial and you also are able to use their services just as I have.

  29.  

    Peggybird said

    on 2009-07-02 11:53 p.m.

    Very helpful and positive forum, I have already learned a lot from just reading?

    Peggybird

  30.  

    colocation said

    on 2009-07-03 8:43 a.m.

    <a href=http://hosting.miheeff.ru>хостинг net ru</a> значительно увеличились и botnets стали более изощренными в своих операциях.
    Эти весьма распространены сети способны выполнять все виды вредоносных атак
    (спама, вредоносного ПО, фишинга, DDoS), и становится практически невозможным принять вниз.
    Традиционные блокирования IP технологий, таких, как рублей не в состоянии идти в ногу с динамичным
    активации и деактивации бесконечное количество динамических IP-адресов. Только Security Solutions
    способные обнаруживать и классифицировать вредоносные активность в режиме реального времени в состоянии обеспечить
    барьер против этой растущей угрозы.
    О Commtouch
    Commtouch технологии защиты от спама и электронной нести вредоносные программы и определяются
    зомби в режиме реального времени. Commtouch периодических План обнаружения ™ (ДРП) технология защищает
    от спам-атак и вредоносных программ, поскольку они имеют массу, распространяемые через Интернет.
    Commtouch в GlobalView ™ технология динамического блока нежелательной почты в сети
    периметру основанные на репутации отправителя и идентификации зомби движения, и
    способных выгрузку более 80% от вредоносного трафика в сети края. Вместе,
    Commtouch в Анти-Спам, Zero-час Вирусная обнаружения вспышек заболеваний и GlobalView ™ Mail
    Репутация Служба доставки трех взаимодополняющих слоев электронной почты обороны.
    Commtouch решения были отобраны десятки лицензионных партнеров, которые интеграции
    эти услуги в своей безопасности, приборы, программное обеспечение шлюзов, управляемых услуг, а также
    Клиентское программное обеспечение приложений. Более подробную информацию о повышении безопасности, с предложениями
    Commtouch технологии см. или писать.
    О Arkoon
    Основанная в 2000 году и штаб-квартирой в Лионе, Франция, в самом сердце Европы, Arkoon сети
    Безопасность является одним из ведущих европейских новаторов в предприятии Информация, Связь,
    Инфраструктура и безопасность решения. С акцентом на важнейших требований в области безопасности
    крупных корпораций, государственных организаций и среднего бизнеса по всей Европе и
    Ближний Восток, Arkoon бизнес-центре "решения предназначены для доставки предприятие Общесистемной
    безопасности в соответствии с бизнес-целями, защиты информационных систем и конечных пользователей
    против современных угроз и тех, кто еще появится. В течение 5500 UTM техника и старше
    300.000 Безопасность BOX ® лицензий установлены по всему миру, Arkoon имеет рекордный успех в
    доставлять решения, отвечать нашим потребностям клиентов. Поскольку ИТ-среды продолжает
    развиваться, а новые угрозы продолжают появляться, Arkoon продолжает инвестировать значительную часть
    поступлений в Р И Д поддерживать инновационные краю, который является гарантией постоянного
    удовлетворенности клиента. Для получения дополнительной информации http://hosting.miheeff.ru бесплатный хостинг третьего уровня

  31.  

    #Mertz-[VVHVHFHLHHLH] said

    on 2009-07-03 9:23 p.m.

    Загляните к нам в интернет-магазин для парикмахеров, где Вы найдёте продукцию компании <a href=http://www.smallbox.ru>Mertz</a>

  32.  

    MurzikBig said

    on 2009-07-04 12:58 a.m.

    Люди Ксения Собчак оказывается беременна. Вы скажите чушь нам по фигу … А вы вдумайтесь в это событие, значит не сегодня дак завтра она выйдет в декрет правильно?! Вить как говорят евреи "ссать и родить нельзя погодить"! ] ;-) А если она вылетит из обоймы значит эту хреть под названием дом 2 очень скоро коньчат! И первый развлекательный будет изображать темные человеческие передачи на вроде КВН, "убойной ночи" и т.п.

    Девочки не будут бежать после 9-и ночи успеть дамой на эту тугую программу а начнут с нами проводить больше времени, а чем больше человеческого общения с девушками тем быстрее движутся отношения, тем быстрее они …. <a href=http://mirsobchak.ru>;-) </a> Короче это обалденная новость поделитесь ей со всеми мужиками, лёд тронулся! Не долго осталось ждать! А по завершению второго дома я уверен что и из кризиса быстрее выскочим. Слышь Ксюха Собчак, рожай сразу 2-х :-)!!!

    Источник http://mirsobchak.ru/news/128-2009-06...

  33.  

    CocoChanels said

    on 2009-07-04 4:35 a.m.

    Who knows where to download XRumer 5.0 Palladium?
    Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!


Leave a comment


:

:

:

:

このエントリーのはてなブックマーク (-)