2009年7月15日水曜日

ktai entryを使えるようにする

携帯などから、ブログをメール投稿できるようにする。ktai entityとktai styleをインストールする。
問題点1

***************************
There is 1 message(s).
Fatal error: Call to undefined function imagerotate() in /(フルパス)/mail2/wp-content/plugins/ktai_entry/post.php on line 1157
***************************

debian etchでは、imagerotateが定義されていない。php5をソースからコンパイルして入れ直す。ネット上の情報が直ぐに役立ちます。

$ mkdir ~/deb
$ mkdir ~/deb/php5
$ cd ~/deb/php5
$ aptitude update
$ sudo apt-get build-dep php5
$ sudo apt-get install devscripts
$ sudo apt-get install fakeroot
$ sudo apt-get install shtool
$ apt-get source php5
$ cd php5-5.2.4/
$ e debian/rules
$ debchange -i
$ dpkg-buildpackage -rfakeroot
$ sudo dpkg -i ../*.deb
$ dpkg -l


注意点として、debian/rulesの configureオプションの GD関連パラメータを次のようにします。

--with-gd=shared,/usr --enable-gd-native-ttf \ → --with-gd=shared --enable-gd-native-ttf \


ユーザの主ディレクトリ(~/)に、.fowordファイルを入れて、そのユーザーにメールが到着したら、メールを取り出せるようにする。

問題点2
メモリが足りなくて、イメージがローテイトできない

***************************
There is 1 message(s).
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 4800 bytes) in /(フルパス)/mail2/wp-content/plugins/ktai_entry/post.php on line 1157
/etc/php5/apache2/php.iniを編集する。
16M=16*1024*1024 byte →96Mに変更

問題点3
ユーザーmail2にメール投稿すると、直ぐにブログに反映するように、postfix + fowardで、トリガーをつくる。状況を調べるために、syslogを診る。

tr=10837, rcvd=28, sent=11102, time=1
Jul 15 05:51:21 oh postfix/qmgr[11058]: 6FA7417BF1C: from=, size=1404, nrcpt=1 (queue active)
Jul 15 05:51:21 oh postfix/local[22325]: warning: file /home/mail2/.forward is world writable
Jul 15 05:51:21 oh postfix/smtpd[22322]: disconnect from unknown[192.168.0.142]
Jul 15 05:51:21 oh postfix/local[22325]: 6FA7417BF1C: to=, relay=local, delay=0.12, delays=0.08/0.02/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Jul 15 05:51:21 oh postfix/qmgr[11058]: 6FA7417BF1C: removed

実行、書き込み許可権限の変更

drwxr-xr-x 10 root root 4096 Jul 14 11:47 ..
-rw------- 1 mail2 mail2 455 Jul 15 05:55 .bash_history
-rw-r--r-- 1 mail2 mail2 220 Jul 11 17:44 .bash_logout
-rw-r--r-- 1 mail2 mail2 414 Jul 11 17:44 .bash_profile
-rw-r--r-- 1 mail2 mail2 2227 Jul 11 17:44 .bashrc
-rwx------ 1 mail2 mail2 72 Jul 14 17:16 .forward
drwx------ 10 mail2 mail2 4096 Jul 14 09:41 Maildir
drwx------ 5 root root 4096 Jul 11 18:04 mail2

/uploadsディレクトリ下を707にする

Jul 15 06:02:24 oh postfix/smtpd[22372]: connect from unknown[192.168.0.142]
Jul 15 06:02:24 oh postfix/smtpd[22372]: 2DB5C17BF1C: client=unknown[192.168.0.142]
Jul 15 06:02:24 oh postfix/cleanup[22374]: 2DB5C17BF1C: message-id=<1C15317314224AE1A853CAC1283E519A@LavieLLL700>
Jul 15 06:02:24 oh postfix/qmgr[11058]: 2DB5C17BF1C: from=, size=1441, nrcpt=1 (queue active)
Jul 15 06:02:24 oh postfix/smtpd[22372]: disconnect from unknown[192.168.0.142]
Jul 15 06:02:31 oh postfix/local[22375]: 2DB5C17BF1C: to=, relay=local, delay=7.1, delays=0.08/0.03/0/7, dsn=2.0.0, status=sent (delivered to command: /usr/bin/php /(フルパス)/mail2/wp-content/plugins/ktai_entry/inject.php)
Jul 15 06:02:31 oh postfix/qmgr[11058]: 2DB5C17BF1C: removed

uploadsディレクトリの権限が707系なのが気になる。
たとえば、実行ファイルを添付ファイルにして、送信し、それを、ブラウザ上で実行させて任意のコードを実行させうる可能性とか・・・。
※ phpファイルを送ってみたが、メールは却下された。

これで、メール投稿が出来るようになった。(^_^)v

注意:メールの回転をしたい場合、本文の内容が
「ROT:R

回転の例です。」
というように改行を2回入れた方が無難です。

0 件のコメント: