擁抱自由,使用 linux !

在Linux底下真是太幸福了,有好多東西可以玩。想從windows解脫就是現在!

Dec-6-06

openwebmail 加上 虛擬帳號

posted by Thomas

隨手安裝openwebmail 加上虛擬帳號的筆記
最主要虛擬帳號部份請參考
使用虛擬使用者必看文件
已這為主
http://www.bluelavalamp.net/owmvirtual/
也可以參考
http://phorum.study-area.org/viewtopic.php?t=20395&highlight=adj
應該還滿簡單的

安裝完之後
以http://ubuntu-aopen/cgi-bin/openwebmail/openwebmail.pl 進行登入才有虛擬帳號
如果用ip http://127.0.0.1/cgi-bin/openwebmail/openwebmail.pl 進行登入 就是用系統帳號登入

登入管理介面

進入虛擬帳號管理

新增虛擬帳號使用者

修改 或 刪除 虛擬帳號

————————
reference http://turtle.ee.ncku.edu.tw/~tung/openwebmail/install.html

Open WebMail 安裝需求

# 支援 CGI 的 Web server
# Perl 5.005 以上 (需有 suid perl 支援)
# CGI.pm-3.05.tar.gz (必要)
# MIME-Base64-3.01.tar.gz (必要)
# Digest-1.08.tar.gz (必要)
# Digest-MD5-2.33.tar.gz (必要)
# libnet-1.19.tar.gz (必要)
# Text-Iconv-1.2.tar.gz (必要)
# libiconv-1.9.1.tar.gz (可選擇, 多國語言內碼轉換)
# CGI-SpeedyCGI-2.22.tar.gz (可選擇, 常駐執行)
# Compress-Zlib-1.33.tar.gz (可選擇, 網頁壓縮)
# ispell-3.1.20.tar.gz (可選擇, 拼字檢查)
# Authen-PAM-0.14.tar.gz (可選擇, 外掛式認證)
# ImageMagick-5.5.3.tar.gz (可選擇, 縮圖製作)

確定有perl
perl -v (可以顯示版本)

安裝需要的東西
apt-get install perl-modules libcgi-perl libmime-perl libdigest-perl libnet-perl libtext-iconv-perl speedy-cgi-perl libcompress-zlib-perl ispell liblingua-ispell-perl libauthen-pam-perl imagemagick perlmagick perl-suid

#沒有套件但也不需要自己裝 perl有cpan可以用
#MIME-Base64-3.01.tar.gz
#Digest-MD5-2.33.tar.gz
pwd
/var/www/src/openwebmail
cpan -i MIME::Base64 Digest::MD5 //這樣就可以裝perl的模組, cpan 第一次執行會問很多問題進行出使設定

安裝 openwebmail
sulibcgi-perl
mkdir -p /var/www/src/openwebmail
cd /var/www/src/openwebmail
wget http://openwebmail.org/openwebmail/download/current/
cd /var/www/
tar -zxvBpf src/openwebmail/openwebmail-current.tar.gz
ls
apache2-default cgi-bin data phpmyadmin phpsysinfo src
mv data/openwebmail/ .

vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
# Please refer to openwebmail.conf.help for the description of each option
#
domainnames auto
auth_module auth_unix.pl
mailspooldir /var/mail
ow_cgidir /var/www/cgi-bin/openwebmail
ow_cgiurl /cgi-bin/openwebmail
ow_htmldir /var/www/openwebmail
ow_htmlurl /openwebmail
logfile /var/log/openwebmail.log

enable_viruscheck no
enable_spamcheck no
enable_learnspam no

default_iconset Default
default_fscharset none



Open WebMail Project (http://openwebmail.org)

cp defaults/auth_unix.conf /var/www/cgi-bin/openwebmail/etc/

vi auth_unix.conf //修改某部份
# if this option is set to yes, openwebmail will also change the
# smbpasswd after changing the unix password successfully

passwdfile_plaintext /etc/passwd
passwdfile_encrypted /etc/shadow
passwdmkdb none

cd /var/www/cgi-bin/openwebmail
root@ubuntu-aopen:/var/www/cgi-bin/openwebmail# ./openwebmail-tool.pl –init

Please change ‘./etc/dbm.conf’ from

dbm_ext .db
dbmopen_ext none
dbmopen_haslock no

to

dbm_ext .pag
dbmopen_ext none
dbmopen_haslock no

And execute ‘./openwebmail-tool.pl –init’ again!

ps: If you are running openwebmail in persistent mode,
don’t forget to ‘touch openwebmail*.pl’, so speedycgi
will reload all scripts, modules and conf files in –init.

cp etc/defaults/dbm.conf

vi ./etc/dbm.conf

註: 如果您用的是 Apache 2.0 以後的版本, 請在 apache 的設定檔 httpd.conf 中, 將
AddDefaultCharset ISO-8859-1
改成
AddDefaultCharset off

cd /usr/lib/cgi-bin //apache2 預設 cgi-bin 在 /usr/lib, 所以link過去
ln -s /var/www/cgi-bin/openwebmail/ .

使用虛擬使用者必看文件
已這為主
http://www.bluelavalamp.net/owmvirtual/
也可以參考
http://phorum.study-area.org/viewtopic.php?t=20395&highlight=adj

try

cd /usr/lib/cgi-bin/openwebmail/etc
cp ../auth/auth_vdomain.pl .
cat /etc/passwd | grep mail
mail:x:8:8:mail:/var/mail:/bin/sh //確認這個mail帳號
vi /etc/postfix/main.cf
加入以下
default_privs = mail
#virtual user settings
virtual_maps = hash:/etc/postfix/virtual
virtual_mailbox_lock = dotlock
allow_mail_to_commands = alias,forward,include
allow_mail_to_files = alias,forward,include

vi auth/auth_vdomain.pl
my $local_uid=getpwnam($conf{’virtualuser’}||’nobody’);
換程
my $local_uid=getpwnam($conf{’virtualuser’}||’mail’);

然後依照http://www.bluelavalamp.net/owmvirtual/

我的domain是 ubuntu-aopen
出使帳號管理者是 username

step1 開始做
vi /etc/postfix/virtual.cf
ubuntu-aopen anything
username@ubuntu-aopen username.ubuntu-aopen

執行 postmap /etc/postfix/virtual.cf

step2 修改你的alias檔
vi /etc/postfix/alias
username: /var/spool/virtual/ubuntu-aopen/username

執行 postalias /etc/postfix/alias

step3 虛擬郵件資料夾
mkdir /var/spool/virtual/ubuntu-aopen
chown root.mail /var/spool/virtual/ubuntu-aopen
chmod og+wt /var/spool/virtual/ubuntu-aopen

step4 設定 openwebmail
mkdir /var/www/cgi-bin/openwebmail/etc/sites.conf/
vi /var/www/cgi-bin/openwebmail/etc/sites.conf/ubuntu-aopen
mailspooldir /var/spool/virtual/ubuntu-aopen
auth_withdomain yes
auth_module auth_vdomain.pl
domainnames ubuntu-aopen
use_homedirspools no
use_syshomedir no
enable_autoreply no
enable_setforward no
enable_vdomain yes
vdomain_admlist username
vdomain_vmpop3_pwdpath /etc/virtual
vdomain_vmpop3_pwdname passwd
vdomain_vmpop3_mailpath /var/spool/virtual
vdomain_postfix_aliases /etc/postfix/aliases
vdomain_postfix_virtual /etc/postfix/virtual.cf
vdomain_postfix_postalias /usr/sbin/postalias
vdomain_postfix_postmap /usr/sbin/postmap

step5 密碼
mkdir /etc/virtual/ubuntu-aopen
chown -R mail.mail /etc/virtual
cd /etc/virtual/ubuntu-aopen
htpasswd -c passwd username

試試看
發現無法寫入/etc/postfix/virtual, /etc/postfix/alias
權限開到777之後就可以
之後在研究要怎樣比較安全?!

目前 可以虛擬帳號可以work
但不知道 寄/收 信 有沒有問題
沒有domain name and 公司會擋

Tags:

Add A Comment