ラベル IMAP の投稿を表示しています。 すべての投稿を表示
ラベル IMAP の投稿を表示しています。 すべての投稿を表示

2007/11/28

OpenBSD/Zaurus + Mutt + GMail(IMAP)

OpenBSD/Zaurus(SL-C3000) ではGMailをIMAPで使用することにしました。
メーラーには最初Sylpheedを使用してみましたがやはり軽くはないので、Muttを使用することにしました。

MuttでIMAPのメールを読めるようにします。
ちなみにQt/EmbeddedでもMuttでIMAPメールを読んでいました。

また、これまでMuttを使用する時はnosendなどを用いてSMTPを使用していましたが、Mutt-1.5.15からSMTPを使用できるようになったみたいです。
(1.5.xは開発版ですが)

portsのMutt snapshotをアップデートして1.5.17にし、make時のFLAVORにsaslを指定しました。
GMailのSMTP送信にはSSLとSMTP認証を使用するのですが、saslを指定しないでmakeしたものでは送信できなかったためです。


$HOME/.muttrcは/etc/mutt/Muttrcから作成しました。
変更や追加したのは下記の通りです。
これだけのはずです。

ignore "from " received content- \
mime-version status x-status \
message-id authentication-results \
precedence mailng-list \
domainkey-signature list-id \
list-post list-help list-unsubscribe
(実際は一行)

(2008/01/20 スッキリさせたかったので変更)
ignore *
unignore from to replay-to date subject \
delivered-to x-ml-name user-agent \
x-mailer content-type content-transfer-encoding
(実際は一行)
(2008/01/20 変更 終了)


set assumed_charset="iso-2022-jp:euc-jp: \
shift_jis:utf-8"
(実際は一行)

set attach_charset="iso-2022-jp:euc-jp: \
shift_jis:utf-8"
(実際は一行)

set charset="EUC-JP"

set uncollapse_jump=yes

set edit_headers=yes

set editor="/usr/local/bin/nvi"

set folder=" \
imaps://ユーザID@gmail.com@imap.gmail.com"
(実際は一行)

set imap_user="ユーザID@gmail.com"

set implicit_autoview=yes

set mailcap_path="~/.mailcap"

set move=no

set realname="名前"

set send_charset=" \
us-ascii:iso-8859-1:iso-2022-jp:utf-8"
(実際は一行)

set smtp_url=" \
smtps://ユーザID@gmail.com@smtp.gmail.com"
(実際は一行)

set sort=reverse-date

set spoolfile=" \
imaps://ユーザID@gmail.com@imap.gmail.com/INBOX"
(実際は一行)


$HOME/.mailcapは次の通りです。
text/html; w3m -dump %s ;
nametemplate=%s.html ; copiousoutput
(実際は一行)



以上の設定で、GMailでIMAPメール閲覧とSMTP送信ができるようになりました。

2007/08/06

Nexentaをファイル/IMAPサーバにする

OpenSolarisカーネルのNexentaOS Alpha 7をファイル(Samba・NFS)/IMAPサーバにすることにします。

つい先日Debian/GNU Linux 4.0に移行したばかりですが、Linux以外のも使っていた方が視野が広がるかな、と。
言い訳ですけど。

あいかわらずよく分からずにやっていますので、信用しないでください。


○ NFSの設定
/share/shareをNFS共有にします(参考)。
/share/shareはzfsコマンドで作成したZFSファイルシステムです。

zfsコマンドを使用して次のコマンドを叩いただけです。
/share/shareを共有ディレクトリにします。
root@julie:~# zfs set sharenfs=rw share/share


○ Sambaの設定
NexentaOS Alpha 7に用意されている3.0.24を使用することにしました。
$ dpkg -l|grep samba
ii samba 3.0.24-2nexenta2 a LanManager-like file and printer server fo
ii samba-common 3.0.24-2nexenta2 Samba common files used by both the server a
ii samba-doc 3.0.24-2nexenta2 Samba documentation


smb.confはDebian/GNU Linux 4.0のsmb.confをほぼそのまま使おうと思ったのですが、なぜかSambaがコアダンプしてしまいます。

コアダンプの件は後で調べるとして、取り急ぎNexentaに入っていたsmb.confを基に必要なところだけ修正して使用することにしました。
使用していないプリンタの設定が残っていたりしますので、後で見直します。
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup =
Windowsグループ名

# server string is the equivalent of the NT Description field
server string = %h server (CIFS, Nexenta)

unix charset = UTF-8
dos charset = CP932

# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no

#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m

# Put a capping on the size of the log files (in Kb).
max log size = 1000

# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0

# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d


####### Authentication #######

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
; security = user

# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encrypt passwords = true

# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
passdb backend = tdbsam

obey pam restrictions = yes

; guest account = nobody
invalid users = root

# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan < for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n *password\supdated\ssuccessfully* .


############ Misc ############
# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
# for details
# You may want to add the following on a Linux system:
# SO_RCVBUF=8192 SO_SNDBUF=8192
socket options = TCP_NODELAY

#======================= Share Definitions =======================
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
public = no
writable = no
create mode = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no

[share]
comment = Julie share
path = /share/share
browseable = no

# By default, the home directories are exported read-only. Change next
# parameter to 'yes' if you want to be able to write to them.
; writable = no
writable = yes

一番のキモは
   unix charset = UTF-8
dos charset = CP932

でしょうか(参考記事)。


○ IMAPの設定
Nexentaにはcyrus-imapd-2.2というのがあり、使おうとして設定までしたのですが、今まで使っていたuw-imapdの方が私には分かりやすかったためこちらを使うことにしました。

ftp://ftp.cac.washington.edu/imap/からimap-2006j2.tar.Zをもらってきて展開しmakeしました。

make時にOpenSSL関係と思われるエラーが出てmakeに失敗しました。
$ make gso

〜 省略 〜

In file included from tcp_unix.c:29,
from osdep.c:63:
ip_unix.c: In function 'ip_nametoaddr':
ip_unix.c:165: warning: pointer targets in passing argument 1 of 'lcase' differ in signedness
ip_unix.c:165: warning: pointer targets in passing argument 1 of 'gethostbyname' differ in signedness
osdep.c:246:20: error: x509v3.h: No such file or directory
osdep.c:247:17: error: ssl.h: No such file or directory
osdep.c:248:17: error: err.h: No such file or directory
osdep.c:249:17: error: pem.h: No such file or directory
osdep.c:250:20: error: buffer.h: No such file or directory
osdep.c:251:17: error: bio.h: No such file or directory
osdep.c:252:20: error: crypto.h: No such file or directory
osdep.c:253:18: error: rand.h: No such file or directory

〜 省略 〜

sslstdio.c:163: error: request for member 'sslstream' in something not a structure or union
sslstdio.c:163: error: request for member 'obuf' in something not a structure or union
sslstdio.c:164: error: request for member 'octr' in something not a structure or union
sslstdio.c:166: error: request for member 'optr' in something not a structure or union
sslstdio.c:166: error: request for member 'obuf' in something not a structure or union
sslstdio.c:167: error: request for member 'octr' in something not a structure or union
make[3]: *** [osdep.o] Error 1
make[3]: Leaving directory `/export/home/xxx/Source/imap-2006j/c-client'
make[2]: *** [gso] Error 2
make[2]: Leaving directory `/export/home/xxx/Source/imap-2006j/c-client'
make[1]: *** [OSTYPE] Error 2
make[1]: Leaving directory `/export/home/xxx/Source/imap-2006j'
make: *** [gso] Error 2


OpenSSL関連のパスが正しくないようです。
Makefileでパスを指定している箇所はすぐ見付かりました。そもそも"gso"の指定が間違っているのかもしれません。

対処方法としてはSSLTYPE=noneを指定することにしました。
SSLは今のところ使う予定が無いためです。
$ make gso SSLTYPE=none

uw-imapdのインストールは、make後に出来たimapdを/usr/local/sbinの下にコピーしただけです。

c-client.cf, cram-md5.pwdの作成し/etc/inetd.confに記述を追加しました。
# cat /etc/c-client.cf
I accept the risk for IMAP toolkit 4.1.
set new-folder-format mbx
set mail-subdirectory Mail
set disable-plaintext 0

# cat /etc/cram-md5.pwd
ユーザ名 パスワード

# cat /etc/inetd.conf |grep imap
imap stream tcp nowait root /usr/sbin/tcpd /usr/local/sbin/imapd

そして、inetdを再起動しました。
# pkill -HUP inetd

2007/07/28

IMAPサーバをDebian上に復活させる

Debian GNU/Linux 4.0をIMAPサーバにします。
uw-imapdを使用します。
# dpkg -l|grep imapd
ii uw-imapd 2002edebian1-13.1 remote mail folder access server


/etc/c-client.cfを準備します。
julie:~# cat /etc/c-client.cf
I accept the risk for IMAP toolkit 4.1.
set new-folder-format mbx
set mail-subdirectory Mail
set disable-plaintext 0


/etc/cram-md5.pwdを準備します。
# cat /etc/cram-md5.pwd
xxx(ユーザ名) yyy(パスワード)
# ls -l /etc/cram-md5.pwd
-rw------- 1 root root 18 Jul 28 04:58 /etc/cram-md5.pwd


/etc/hosts.allowでimapdの接続を許可するホストを指定します。
imapd: xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy



--
Debianのデフォルトから変更したのはこれくらいだと思います。
一応IMAP利用可能になったみたいです。

2007/07/22

IMAPメールが受信できなかった

ここ数日間IMAPサーバ(JULIE)からIMAPのメールを取得することが出来ていなかったみたいです。

以前書いたとおりGMailからでもメールを読めるようにしており、IMAPのメールは読んでいなかったのであまり気にしていませんでしたが。


今日調べてみて思い出したのですが、NFSのセキュリティのことを調べたときに/etc/hosts.allowの設定を変更しており、それが原因だったみたいです。

以前は/etc/hosts.allowには、以下のように危ない設定をしていました。
ALL : xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy: ALLOW

どうせ私しか使わないネットワークだしこれでいいだろうと思っていたのですが、やはり気持ち悪いので、許可するサービスを列挙するように変更しました。

それが原因でクライアントからimapdにアクセスできなくなっていたみたいです。


/etc/hosts.allowに以下の記述を追加したところ、IMAPのメールを読めるようになりました。
imapd: xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy


迂闊でした。

2007/07/16

GMailを使って

今まではLinuxサーバ(JULIE)でプロバイダ(BIGLOBE)からfetchmail(POP3)でメールを取得し、JULIEをIMAPサーバとしてローカルネットワーク上でメールを閲覧していました。
(我が家のネットワーク環境はこちら)


最近GMailの使用方法を試行錯誤しており、GMailを我が家のネットワーク環境構築に組み入れられないかなと考えました。

GMailはPOP3で他のメールサーバからメールをGMailのサーバ上に取得するしくみがあります。
また、GMailサーバからPOP3でメールを取得することも出来ます。

そこで、プロバイダ(BIGLOBE)のメール取得はGMailのサーバで行い、ローカルネットワークのIMAPサーバ(JULIE)はGMailからPOP3でメールを取得することにします。
これによる私のメリットは次の点でしょうか。
・GMailの2GBという膨大な大きさの領域を使用できる。
 BIGLOBEは20MB。
 →余程のゴミメールでない限りGMail上に残しておいても大丈夫。
 →GMail上にあるメールはGMailを使える環境であればいつでも閲覧できる。(職場とか)

・何らかの理由で自宅がインターネットに接続できないときでも、ローカルネットワーク上の端末ではどこでもIMAPで過去のメールを閲覧することが出来る。

・GMailは色々面白いみたい。
 (LinuxでFUSEとやらを使用してGMail領域をmount出来るらしい)


BIGLOBEに一度集めることはせず、アドレス1〜3及びBIGLOBEの4つのアドレスからGMailに転送設定するという手段もありますが、変更しなければいけない箇所が増えてめんどくさいので止めておきます。

また、アドレス1〜3のうちの2つは転送のみ行うアドレスで、POP3などで取得することは出来ません。
ですので、アドレス1〜3及びBIGLOBEの4つのメールアドレスすべてをJULIEで直接取得することはできません。
2つは必ずどこかのアドレスに転送してから取得する必要があります。


GMailからメールを取得するため、.fetchmailrcには次のように記入しました。
--ここから--
set nobouncemail

defaults
mda "/usr/bin/procmail -d mailuser"
no mimedecode
--ここまでは、以前から記入されていたものをそのまま使う--

--ここからGMail用に追加--
poll pop.gmail.com
protocol pop3
port 995
user GMailのユーザ名@gmail.com
password GMailのパスワード
ssl
keep
--ここまで--

一応これで取得できています。

keepオプションが必要なのか分かりませんが、入れておいて悪くなることもないかなと。
多分。

2007/07/14

KMail + IMAP + Googleデスクトップ

現在使用しているVine Linux 4.1では、最近は主にKDEを使用しています。


Kontact 1.2.5(KMail 1.9.7)でIMAPのメールを主に読んでいますが、プロバイダからPOP3でサーバにメールを残す設定でメールを取り込むこともあります。

IMAPのメールはKMailの「cachedimap」という設定にしており、IMAPサーバからローカルにメールをコピーしています。



また、先日リリースされたGoogleデスクトップのLinux版もインストールしてあります。


Googleデスクトップで次の現象が発生していました。
KMailの設定が上手くできている自信はないので、問題がどこにあるのか分かっていません。

・KMailでPOP3で取り込んだメール
 →インデックスを作成してくれる

・KMailのcachedimapでローカルにコピーしているメール
 →インデックスを作成してくれない


KMailのcachedimapのメールは、ホームディレクトリの次の場所に保存されているようです。
  HOME/.kde/share/apps/kmail/dimap/.xxxxxxxxxx.directory (xは数字)


Googleデスクトップの設定には「次の場所を検索」という設定があり検索場所を指定できますが、上記の場所を指定してもインデックスを作成してくれませんでした。


そこで、`.' で始まる名前のディレクトリ(.kde)から出してやればインデックスを作成してくれるのではないかと考え、次の操作を行いました。

(1) ホームディレクトリにKMailというディレクトリを作成
$ mkdir ~/KMail


(2) KMailディレクトリの下にcachedimap保存ディレクトリをfoldersという名前に変えて移動
$ mv ~/.kde/share/apps/kmail/dimap/.xxxxxxxxxx.directory ~/KMail/folders


(3) ~/Kmail/foldersのシンボリックリンクを~/.kde/share/apps/kmail/dimap/.xxxxxxxxxx.directoryとする
$ ln -s ~/KMail/folders ~/.kde/share/apps/kmail/dimap/.xxxxxxxxxx.directory


これで、Googleデスクトップがインデックスを作成してくれるようになりました


スマートでないのは分かっていますが、いい情報がみつかるまでこれで我慢します。

POP3で取り込んだメールも.kdeの下にありますので、単純に`.' で始まる名前のディレクトリ以下にあると全部ダメという訳ではないと思います。


ヘルプセンターを良く読めば分かるのでしょうか?

我が家のネットワーク

2007年7月14日現在の、我が家のネットワーク環境です。

うちでは2台のPCで3つのOSを同時に使用しています。

以下の括弧中はホスト名です。
PC
(a) タワー型PC
 OS: WindowsXP Professional (ELIE)

(b) ノートPC (WindowsとLinuxのデュアルブート)
 OS: WindowsXP Home Edition (SHIRO)
 OS: Vine Linux 4.1 (SALIE)

(a)のELIEではVMWare Serverを使用しております。

VMWareゲストOS
 OS: Plamo Linux (JULIE) Samba/NFS/IMAP

(a)のタワー型PCにはハードディスク3台を接続してます。
その内2台はWindowsXP(ELIE)で使用しておりますが、もう1台は全ての領域をReiserFSでフォーマットしており、JULIEでマウントしています。

このReiserFSの領域の多くはSamba/NFSを使用して開放され、JULIEはファイルサーバとなっています。


また、JULIEはプロバイダからfetchmailを利用してPOP3でメールを定期的に受信し、それを今度はIMAPサーバとしてローカルネットワーク上で公開しています。

おかげで(b)にインストールしてあるWindows(SHIRO)やLinux(SALIE)だけではなく、ZaurusやWindows Mobileマシンからでもメールを参照することが出来ます。