hypweb.net
XOOPSマニア  最新情報のRSS(サイト全体)
[ 自宅サーバーWebRing |ID=54 前後5表示乱移動サイト一覧 ]

TOP » UsersWiki » calendar nao-pon/blog/2008.04
Archives
2003
1 2 3 4 5 6 7 8 9 10 11 12
2004
1 2 3 4 5 6 7 8 9 10 11 12
2005
1 2 3 4 5 6 7 8 9 10 11 12
2006
1 2 3 4 5 6 7 8 9 10 11 12
2007
1 2 3 4 5 6 7 8 9 10 11 12
2008
1 2 3 4 5 6 7 8 9 10 11 12
2009
1 2 3 4 5 6 7 8 9 10 11 12
2010
1 2 3 4 5 6 7 8 9 10 11 12
2011
1 2 3 4 5 6 7 8 9 10 11 12
2012
1 2 3 4 5 6 7 8 9 10 11 12
2013
1 2 3 4 5 6 7 8 9 10 11 12
2014
1 2 3 4 5 6 7 8 9 10 11 12
2015
1 2 3 4 5 6 7 8 9 10 11 12
2016
1 2 3 4 5 6 7 8 9 10 11 12
2017
1 2 3 4 5 6 7 8 9 10 11 12
2020
1 2 3 4 5 6 7 8 9 10 11 12
2021
1 2 3 4 5 6 7 8 9 10 11 12
2022
1 2 3 4 5 6 7 8 9 10 11 12
2023
1 2 3 4 5 6 7 8 9 10 11 12
<< 2008.4 >>
[nao-pon/blog]
    1 2 3
7 8 10 11
13 15 16 17 19
20 21 22 23 24 25 26
27 28 30      
 
Tag: Moblog

またモブログ始めました anchor.png

080404_144646.JPG

xpWikiにPukiWikiModのmoblogプラグインを移植して、また始めてみます。

((s:4f55))NAOKI((s:4f21))

at 2:46 pm

Page Top

Fw:〓【位置お知らせ】 anchor.png

測位精度:1(300m≦測位誤差)
測位日時:2008/04/04 16:21

+ このマップの Wiki 記法

(map.navitime.jp?pos=N35.10.26.65E136.54.28.47&x-acr=1&geo=wgs84)

  • Marker: at 6:09 pm

    Fw:〓【位置お知らせ】
    ( at 6:09 pm )

at 6:09 pm

Page Top

上小田井 anchor.png

地図表示: (map.navitime.jp?pos=N35.13.18.68E136.52.37.33&x-acr=3&geo=wgs84)

  • Marker: at 10:46 pm

    上小田井
    ( at 10:46 pm )

at 10:46 pm


地図表示: (map.navitime.jp?pos=N35.14.31.60E136.52.59.44&x-acr=2&geo=wgs84)

  • Marker: 井瀬木

    ( at 10:51 pm )

at 10:51 pm


 
Tag: Moblog

春です anchor.png

080405_070311.JPG

新しい出会いの季節です。

なんか、ワクワクします。

((s:4f55))NAOKI((s:4f21))

at 7:06 am

Page Top

BigKat !! anchor.png

080405_143513.JPG

友達がゲームセンターのクレーンで大量にゲットして、お裾分けしてくれました。

一本食べただけで、おなか一杯 o(^o^)o

((s:4f55))NAOKI((s:4f21))

at 2:45 pm


 
Tag: Moblog

言うまでもないよ anchor.png

080406_083229.JPG

面白い立て看板をみかけた。

シンナー遊びが同列なんだ・・・。

((s:4f55))NAOKI((s:4f21))

at 8:38 am


 

XMail Server の SPF(Sender Policy Framework) 対応 anchor.png

xpWiki のプラグイン moblog では、メールによってページを作成することができますが、認証判断は送信元メールアドレスのみで行っています。

できるだけ簡単に投稿できるようにしたかったので、敢えて Subject や本文にパスワードを入れたりする仕様にしなかったのですが、他人の成りすましによる偽投稿が可能なので、なんとか防がなければいけません。

その、動作検証するのに SPF 環境が必要なので、自宅サーバーの XMail Server (Win32) に SPF フィルターを導入しました。

調べてみると、XMail の Web サイトに、xm-spf.pl という perl のフィルターがありましたので、導入してみましたが上手く動きません。早速、ソースを眺めてみましたが、久々の perl なので、結構手間取りましたが、数箇所おかしなところがあったので、修正し、Mail Header に "Received-SPF:" を付け加えるフィルターも書いてみました。

Mail::SPF::Query のレスポンスが "fail" だった場合、XMail に終了コード(4)を返しますので、問答無用で受け取り拒否します。

Page Top

Mail::SPF::Query が必要です anchor.png

サーバー機のコマンドプロンプトで

>cpan
>install Mail::SPF::Query

として、インストールして置いてください。

Page Top

フィルター定義 anchor.png

  • SMTP RCPT 後処理 フィルター (Mail::SPF::Query を使用して判定します)
    • filespf_rcpt.pl
    • フィルター定義
      起動コマンド最初の引数その他の引数
      C:\Perl\bin\perl.exe[絶対パス]/spf_rcpt.pl--file $(FILE) --tmp c:/winnt/temp
      C:\Perl\bin は環境に合わせる--tmp の引数は、システムのテンポラリディレクトリ
  • SMTPセッション終了後処理 (Mail Header に "Received-SPF: [判定結果]" を書き加えます。)
    • filespf_in.pl
    • フィルター定義
      送信者アドレスあて先アドレスリモートIPローカルIP起動ファイル起動コマンドと引数
      **0.0.0.0/00.0.0.0/0spf_in.tab"C:\Perl\bin\perl.exe" "[絶対パス]/spf_in.pl" "$(FILE)" "c:/winnt/temp"
      C:\Perl\bin は環境に合わせる
      c:/winnt/temp は SMTP RCPT 後処理 フィルターと合わせる
    • SpamAssassin を利用しているなら、spf_in.tab を SpamAssassin の定義の前に持ってくると、SpamAssassin で Header 判定できるようになります。
Page Top
プログラムソース anchor.png
filespf_rcpt.pl
Everything is expanded.Everything is shortened.
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
-
|
!
-
|
!
!
 
-
|
!
 
-
|
|
|
|
-
|
|
!
-
!
|
|
-
!
-
!
|
-
!
|
|
-
!
-
|
|
-
|
!
!
 
-
|
!
 
 
-
|
-
-
|
!
|
!
!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
-
-
|
|
|
|
!
!
!
 
-
|
|
!
 
 
#!/usr/bin/perl
#
# spf_rcpt.pl based on xm-spf.pl by nao-pon (hypweb.net)
#
# xm-spf.pl by Davide Libenzi ( XMail Perl filter for SPF )
# Copyright (C) 2004  Davide Libenzi
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# Davide Libenzi <davidel@xmailserver.org>
#
 
use strict;
use Mail::SPF::Query;
 
my $opt_file = undef;
my $opt_ip = undef;
my $opt_sender = undef;
my $opt_helo = undef;
my $opt_rcpt_to = undef;
my $opt_local = undef;
my $opt_trusted = undef;
my $opt_guess = undef;
my $opt_exp = undef;
my $opt_max_lookup = undef;
my $opt_sanitize = undef;
my $opt_name = "spfquery";
my $opt_debug = 0;
my $opt_keep_comments = 0;
my $opt_fallback = undef;
my $opt_override = undef;
my $opt_dns = undef;
my $opt_help = undef;
my $opt_pcode = 0;
my $opt_fcode = 3;
my @opt_bypass = ();
 
push(@opt_bypass, "^127\\.0\\.0\\.1\$");
my $mid;
my $opt_tmp = undef;
my $i;
 
for ($i = 0; $i <= $#ARGV; $i++) {
    if ($ARGV[$i] eq "--file") {
        if (++$i <= $#ARGV) {
            $opt_file = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--tmp") {
        if (++$i <= $#ARGV) {
            $opt_tmp = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--ip") {
        if (++$i <= $#ARGV) {
            $opt_ip = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--sender") {
        if (++$i <= $#ARGV) {
            $opt_sender = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--helo") {
        if (++$i <= $#ARGV) {
            $opt_helo = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--rcpt-to") {
        if (++$i <= $#ARGV) {
            $opt_rcpt_to = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--debug") {
        if (++$i <= $#ARGV) {
            $opt_debug = int($ARGV[$i]);
        }
    } elsif ($ARGV[$i] eq "--local") {
        if (++$i <= $#ARGV) {
            $opt_local = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--trusted") {
        if (++$i <= $#ARGV) {
            $opt_trusted = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--guess") {
        if (++$i <= $#ARGV) {
            $opt_guess = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--expl") {
        if (++$i <= $#ARGV) {
            $opt_exp = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--max-lookup") {
        if (++$i <= $#ARGV) {
            $opt_max_lookup = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--sanitize") {
        if (++$i <= $#ARGV) {
            $opt_sanitize = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--name") {
        if (++$i <= $#ARGV) {
            $opt_name = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--fallback") {
        if (++$i <= $#ARGV) {
            $opt_fallback = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--override") {
        if (++$i <= $#ARGV) {
            $opt_override = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--dns") {
        if (++$i <= $#ARGV) {
            $opt_dns = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--pcode") {
        if (++$i <= $#ARGV) {
            $opt_pcode = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--fcode") {
        if (++$i <= $#ARGV) {
            $opt_fcode = $ARGV[$i];
        }
    } elsif ($ARGV[$i] eq "--bypass") {
        if (++$i <= $#ARGV) {
            push(@opt_bypass, $ARGV[$i]);
        }
    } elsif ($ARGV[$i] eq "--help") {
        $opt_help = 1;
    }
}
 
if ($opt_help) {
    exit($opt_pcode);
}
 
if (defined($opt_file)) {
 
    my $ln;
    my @hvars;
 
    if (!open(MFIL, "$opt_file")) {
        print STDERR "unable to open ${opt_file}\n";
        exit($opt_pcode);
    }
# Read message info
    $ln = <MFIL>;
    chomp($ln);
    @hvars = split(/;/, $ln);
# Discard SMTP domain
    $ln = <MFIL>;
# Discard message ID
    $mid = <MFIL>;
    chomp($mid);
# Read MAIL FROM
    $ln = <MFIL>;
    chomp($ln);
    close(MFIL);
# Handle both cases of early message file and spool file
    ($opt_sender = $ln) =~ s/[^<]+<([^>]*)>.*/$1/;
    if ($#hvars > 3) {
        $opt_helo = $hvars[0];
        ($opt_ip = $hvars[1]) =~ s/\[([^:]+)\]:[0-9]+/$1/;
    } else {
        ($opt_ip = $hvars[0]) =~ s/\[([^:]+)\]:[0-9]+/$1/;
    }
}
 
if (!defined($opt_helo) && ($opt_sender =~ /\@/)) {
    ($opt_helo = $opt_sender) =~ s/.*\@(.*)/$1/;
}
 
my $reg;
for ($i = 0; $i <= $#opt_bypass; $i++) {
    $reg = $opt_bypass[$i];
    if ($opt_ip =~ /$reg/) {
        if ($opt_debug) {
            print "whitelist ip ${opt_ip}\n";
        }
        exit($opt_pcode);
    }
}
 
my $query = new Mail::SPF::Query(ipv4       => $opt_ip,
                 sender     => $opt_sender,
                 helo       => $opt_helo,
                 local      => $opt_local,
                 trusted    => $opt_trusted,
                 guess      => $opt_guess,
                 default_explanation => $opt_exp,
                 max_lookup => $opt_max_lookup,
                 sanitize   => $opt_sanitize,
                 myhostname => $opt_name,
                 fallback   => $opt_fallback,
                 override   => $opt_override,
                 debug      => $opt_debug,
                 );
my ($result, $smtp_comment, $header_comment, $spf_record, $detail) = $query->result();
my $rcode = ($result eq "fail") ? $opt_fcode: $opt_pcode;
 
if (defined($opt_file)) {
    if ($rcode eq 0) {
        if (defined($opt_tmp) && $mid){
            open(FILE,">${opt_tmp}/${mid}.SPF");
                flock(FILE,2);
                print FILE "Received-SPF: ".$result." ( $header_comment )";
            close(FILE);
        }
    }
}
 
if ($opt_debug) {
    print $query->result . "\n";
    print $rcode;
}
 
exit($rcode);
filespf_in.pl
Everything is expanded.Everything is shortened.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-
|
|
|
|
!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
-
|
|
-
|
!
-
|
|
|
|
|
|
|
|
|
|
!
|
!
 
 
 
 
 
 
 
#!/usr/bin/perl
#
# spf_in.pl by nao-pon (hypweb.net)
# License: GPL
#
 
use strict;
 
my $file = $ARGV[0];
my $temp = $ARGV[1];
 
open(FILE, $file) || exit(0);
my @tmp = <FILE>;
close(FILE);
 
if (!@tmp) {exit(0);}
 
my @dat = ();
my $check = 0;
my $i = 0;
my $mid;
my $spf_file;
my $spf;
foreach(@tmp){
    $i++;
    chomp;
    if ($i eq 3) {
        $mid = $_;
    }
    if (!$check && /^<<MAIL\-DATA>>$/) {
        $check = 1;
        push(@dat, "$_\n");
        $spf_file = "${temp}/${mid}.SPF";
        open(FILE, $spf_file) || exit(0);
        $spf = <FILE>;
        close(FILE);
        unlink($spf_file);
        chomp($spf);
        push(@dat, "$spf\n");
        next;
    }
    push(@dat, "$_\n");
}
 
open(FILE,">$file");
    flock(FILE,2);
    print FILE @dat;
close(FILE);
 
exit(7);

 
Tag: Moblog

刺繍作品を色紙に anchor.png

080409_160320.JPG

刺繍の作品を裏打ちして、色紙に仕立てます。

((s:4f55))NAOKI((s:4f21))

at 4:05 pm


 
Tag: Moblog

まったりしてます anchor.png

080412_102311.JPG

歯科医院の鉢植に咲いていました。

春は、ほんとにいいなぁ〜

((s:4f55))NAOKI((s:4f21))

at 10:26 am


 
Tag: Moblog

リプトン ゴリョク anchor.png

080414_213808.JPG

始めて買ってみた。

最初に飲んだ時は、普通にカップにティーパックを入れてお湯を注いだらめっちゃマズくて「なんじゃこれ」って思ったけど、パッケージをよく見たら【ちゃんと蒸らすべし】と書いてあったので、蒸らしてみたら意外に美味しかった。

説明書きは、きちんと読みましょう! d(^-^)

((s:4f55))NAOKI((s:4f21))

at 9:48 pm


 

HypCommonFunc 更新 anchor.png

HypCommonFunc の trust 側を更新しました。 (Version 20080418)

  • HypCommonFunc(hyp_common.tar.gz)
    • 上記リンクからアーカイブ(hyp_common.tar.gz) をダウンロードし解凍後、hyp_common/html ディレクトリを削除して、hyp_common ディレクトリを XOOPS_TRUST_PATH/class ディレクトリへアップロードしてください。
Page Top
更新内容 anchor.png

favicon を表示する、favicon.php で、ブラウザのキャッシュを有効に使うように指定していたつもりが、全く効いていなかった :hammer: ので、その修正をしました。 :-P

旧バージョンのままだと、サーバー負荷が高くなることがありまので、アップデートされることをお勧めします。 :-)


 
Tag: Moblog

いろいろ買い物した anchor.png

080429_165142.JPG

けど、娘のものばかり・・・ orz...

((s:4f55))NAOKI((s:4f21))

at 4:54 pm



トップ 印刷に適した表示   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom Powered by xpWiki
このページのTopへ
メインメニュー
ログイン

ユーザー名:


パスワード:





パスワード紛失  |新規登録
最近の更新
オンライン状況
291 人のユーザが現在オンラインです。 (28 人のユーザが UsersWiki を参照しています。)

登録ユーザ: 0
ゲスト: 291

もっと...
サイト情報