ใครเคยลงแบบ ไม่ลง Imap บ้างมั้ยครับ ใช้วิธี Authen วิธีอื่น ๆ ครับ
ผมลองลงด้วยการใช้ Script ที่ลองดัดแปลงจากเมืองนอกครับ
ปัญหาดูเหมือนว่าจะต้องจัดการเรื่อง Authen ที่ผ่าน Imap แต่ดูเหมือนใน Script ที่ผมไปนำมาใช้จะไม่ได้พูดถึงไว้เลย ทำให้การทำงานมันไม่สมบูรณ์ ครั้นนั่งแกะเกา ก็พบว่า Imap เวลาลงไปมันค่อนข้างทำให้ไม่มั่นใจว่าลงไปแล้ว จะทำให้ระบบเกิดรวนขึ้นมั้ย
เข้าใจว่าลง Dovecot แต่ก็ยังนึกขั้นตอนของการ Setting Account เข้าไปผ่าน Dovecot … หรือแปลง่าย ๆ ว่า นึกภาพ Imap -> PAM -> MySQL ไม่ออกครับ ใครมีคำแนะนำส่วนนี้บ้างครับ สำหรับข้างล่างลองเอาไปประยุกษ์กันดูครับ มันเป็น AutoInstall shell script ครับ เขียน file.sh แล้ว Chmod +x file.sh เพื่อรันครับ แต่บอกไว้ก่อนว่ายังติดปัญหาตามที่เขียนถามอยู่นี่แหละครับ ว่ายังไม่สมบูรณ์นัก
และบรรทัด
Interactive with question installation :
/usr/bin/php /var/www/horde-webmail/scripts/setup.php
จำเป็นต้องแก้ไขเพิ่มเข้าไปด้วยการสร้าง txt คำตอบ เช่น Setup.txt แล้วเปลี่ยนเป็น
/usr/bin/php /var/www/horde-webmail/scripts/setup.php <- path/Setup.txt
ใน Section ## Security enhancement แนะนำให้ Comment ออกไปก่อนจะดีกว่า เผื่อใครจะเทสก่อนติดตั้งจริง แล้วค่อย แยกส่วนนั้นเป็น Shell Script อีกต่างหากครับ
ใครมีประสบการณ์การ Setup Horde ขอแชร์ด้วยครับ อย่างขั้นตอนของ VirtualHost หรือการนำไปใช้ในแบบ SME ที่ต้องวิ่งผ่าน Router ADSL (อาศัยการตั้ง DMZ หรือ Port Forwarder)
----- start -----
#!/bin/bash
Preconfigure
OPWD =$(pwd)
we install the needed software packages :
/usr/bin/apt-get -y install libapache2-mod-php5 php5-gd php5-mysql php5-mcrypt php5-imap php5-tidy php5-cli php-pear
we rise the memory limit of the Apache 2 PHP module :
/bin/sed -i -e ‘s/memory_limit = .*/memory_limit = 128M/’ /etc/php5/apache2/php.ini
enhance Horde performances by installing memcached :
apt-get -y install memcached php5-memcache
We upgrade the PEAR install :
/usr/bin/pear upgrade-all
We now install PEAR and PECL extensions recommended by Horde. First, we install the packages needed in order to build the extensions :
/usr/bin/apt-get -y install libmagic-dev libgeoip-dev make php5-dev
we build and install the PECL extensions :
fileinfo : (include with new php 5.3+)
#printf ‘yes
’ | /usr/bin/pecl install fileinfo
#/bin/echo “extension=fileinfo.so” | /usr/bin/tee /etc/php5/conf.d/fileinfo.ini
lzf :
printf ‘yes
’ | /usr/bin/pecl install lzf
/bin/echo “extension=lzf.so” | /usr/bin/tee /etc/php5/conf.d/lzf.ini
We download Horde Groupware Webmail Edition :
#/usr/bin/wget http://ftp.horde.org/pub/horde-webmail/horde-webmail-latest.tar.gz \
–output-document=/tmp/horde-webmail-latest.tar.gz
/bin/cp $OPWD/horde-webmail-latest.tar.gz /tmp/horde-webmail-latest.tar.gz
We untar the downloaded file :
/bin/tar --directory /var/www -xzf /tmp/horde-webmail-lastest.tar.gz
We rename the created folder :
/bin/mv /var/www/horde-webmail-lastest /var/www/horde-webmail
[b]## Interactive with question installation :
/usr/bin/php /var/www/horde-webmail/scripts/setup.php
you need to edit the IMP configuration :
#/usr/bin/vim /var/www/horde-webmail/imp/config/servers.php[/b]
Default email domain
/bin/sed -i -e “s/^(.problems.email.=).;/\1 ‘contact@domain.com’;/” /var/www/horde-webmail/config/conf.php
/bin/sed -i -e “s/^(.problems.maildomain.=).;/\1 ‘domain.com’;/” /var/www/horde-webmail/config/conf.php
Log file
touch /var/log/horde.log
/bin/chown www-data:www-data /var/log/horde.log
/bin/chmod 0640 /var/log/horde.log
/bin/sed -i -e ‘s//tmp/horde.log//var/log/horde.log/’ /var/www/horde-webmail/config/conf.php
log rotation for this log file :
/bin/cp /var/www/horde-webmail/scripts/horde.logrotate /etc/logrotate.d/horde
Memory caching
apt-get -y install memcached php5-memcache
/etc/init.d/apache2 restart
We enable the memory cache support in Horde :
/bin/sed -i -e ‘s/^(.memcache.enabled.=).;/\1 true;/’ /var/www/horde-webmail/config/conf.php
And we set it up :
/bin/sed -i -e "/^(.*conf.memcache.enabled.=)./i\
$conf[‘memcache’][‘hostspec’] = array(‘localhost’);
\
$conf[‘memcache’][‘port’] = array(‘11211’);
\
$conf[‘memcache’][‘weight’] = array();
\
$conf[‘memcache’][‘persistent’] = false;
\
$conf[‘memcache’][‘compression’] = false;
\
$conf[‘memcache’][‘large_items’] = true;" /var/www/horde-webmail/config/conf.php
Cache location
We create a secure cache folder for Horde :
/bin/mkdir /var/cache/horde
/bin/chown www-data:root /var/cache/horde
/bin/chmod 0700 /var/cache/horde
We set up Horde so that it use this folder for its cache files :
/bin/sed -i -e "/^(.conf.umask.=)./a\
$conf[‘tmpdir’] = ‘/var/cache/horde’;" /var/www/horde-webmail/config/conf.php
We configure the regular clean up of generated cache files :
/bin/cp /var/www/horde-webmail/scripts/temp-cleanup.cron /etc/cron.daily/horde-temp-cleanup
/bin/chmod +x /etc/cron.daily/horde-temp-cleanup
/bin/sed -i -e ‘s/^(TMP_DIR=).*/\1/var/cache/horde/’ /etc/cron.daily/horde-temp-cleanup
Sending alert emails
/bin/echo "# /etc/cron.d/horde : crontab fragment for horde
Horde Alarms
*/5 * * * * /usr/bin/php /var/www/horde-webmail/scripts/alarms.php" \
| /usr/bin/tee /etc/cron.d/horde
Sessions monitoring tool
/bin/chown www-data /var/lib/php5
Attached files management
/usr/bin/apt-get -y install unrtf libwpd-tools xlhtml source-highlight ppthtml rpm wv enscript
we correct the paths to theses softwares in Horde configuration :
sed -i -e ‘s//usr/local/bin/xlhtml//usr/bin/xlhtml/’ \
-e 's/\/usr\/local\/bin\/ppthtml/\/usr\/bin\/ppthtml/' \
/var/www/horde-webmail/config/mime_drivers.php
we enable the use of the installed tools in Horde :
sed -i -e “s/// (‘deb’)/\1/g” \
-e "s/\/\/ \('enscript'\)/\1/g" \
-e "s/\/\/ \('msword'\)/\1/g" \
-e "s/\/\/ \('msexcel'\)/\1/g" \
-e "s/\/\/ \('mspowerpoint'\)/\1/g" \
-e "s/\/\/ \('rpm'\)/\1/g" \
-e "s/\/\/ \('rtf'\)/\1/g" \
-e "s/\/\/ \('srchighlite'\)/\1/g" \
-e "s/\/\/ \('webcpp'\)/\1/g" \
-e "s/\/\/ \('wordperfect'\)/\1/g" \
/var/www/horde-webmail/config/mime_drivers.php
we tell Horde where to find the MIME database :
/bin/sed -i -e "/^(.*conf.sessionhandler.type.=)./a\
$conf[‘mime’][‘magic_db’] = ‘/usr/share/file/magic’;" /var/www/horde-webmail/config/conf.php
Inline HTML mails
/bin/sed -i -e ‘/.*mime_drivers.*imp.html.=.array./{n;d}’ /var/www/horde-webmail/imp/config/mime_drivers.php
/bin/sed -i -e "/.*mime_drivers.*imp.html.=.array./a\
'inline' => true," /var/www/horde-webmail/imp/config/mime_drivers.php
Adapting to Mozilla Thunderbird defaults
/bin/sed -i -e “s/^(.‘value’ =>).‘sent-mail’,/\1 ‘Sent’,/” /var/www/horde-webmail/imp/config/prefs.php
/bin/sed -i -e “s/^(.‘value’ =>).‘drafts’,/\1 ‘Drafts’,/” /var/www/horde-webmail/imp/config/prefs.php
/bin/sed -i -e “s/^(.‘value’ =>).‘trash’,/\1 ‘Trash’,/” /var/www/horde-webmail/imp/config/prefs.php
/bin/sed -i -e “s/^(.‘value’ =>).‘Spam’,/\1 ‘Junk’,/” /var/www/horde-webmail/imp/config/prefs.php
Attached files preview
/bin/sed -i -e ‘s/^(.mailbox.show_preview.=).;/\1 true;/’ /var/www/horde-webmail/imp/config/conf.php
Enabling the cache
/bin/sed -i -e ‘s/^(.mboxcache.use_mboxcache.=).;/\1 true;/’ /var/www/horde-webmail/imp/config/conf.php
/bin/sed -i -e "/^(.*conf.mboxcache.use_mboxcache.=)./i\
$conf[‘mboxcache’][‘use_compress’] = false;
\
$conf[‘mboxcache’][‘preview_size’] = 1000;
\
$conf[‘mboxcache’][‘lifetime’] = 2592000;" /var/www/horde-webmail/imp/config/conf.php
/bin/sed -i -e ‘s/^(.mlistcache.use_mlistcache.=).;/\1 true;/’ /var/www/horde-webmail/imp/config/conf.php
/bin/sed -i -e "/^(.*conf.mlistcache.use_mlistcache.=)./i\
$conf[‘mlistcache’][‘lifetime’] = 604800;" /var/www/horde-webmail/imp/config/conf.php
Priority and attached files presence display in the messages list
/bin/sed -i -e ‘s/^(.mailbox.show_attachments.=).;/\1 true;/’ \
-e 's/^\(.*mailbox.*show_xpriority.*=\).*;/\1 true;/' \
/var/www/horde-webmail/imp/config/conf.php
CSS and Javascript Cache
For Javascript caching :
/bin/sed -i -e ‘s/^(.server.cachejs.=).;/\1 true;/’ /var/www/horde-webmail/imp/config/conf.php
/bin/sed -i -e "/^(.*conf.server.cachejs.=)./i\
$conf[‘server’][‘cachejsparams’][‘timeout’] = 86400;
\
$conf[‘server’][‘cachejsparams’][‘mtime’] = false;" /var/www/horde-webmail/imp/config/conf.php
For CSS caching :
/bin/sed -i -e ‘s/^(.server.cachecss.=).;/\1 true;/’ /var/www/horde-webmail/imp/config/conf.php
/bin/sed -i -e "/^(.*conf.server.cachecss.=)./i\
$conf[‘server’][‘cachecssparams’][‘timeout’] = 86400;
\
$conf[‘server’][‘cachecssparams’][‘mtime’] = false;" /var/www/horde-webmail/imp/config/conf.php
Fortunes
/usr/bin/apt-get -y install fortunes
/bin/sed -i -e "/^(.*conf.portal.fixed_blocks.=)./a\
$conf[‘fortune’][‘exec_path’] = ‘/usr/games/fortune’;" /var/www/horde-webmail/config/conf.php
Spell checking
/usr/bin/apt-get -y install aspell-en
/bin/sed -i \
-e “s/^(.spell.driver.=).;/\1 ‘aspell’;/” \
-e "/^(.*conf.spell.driver.=)./i\
$conf[‘spell’][‘path’] = ‘/usr/bin/aspell’;" /var/www/horde-webmail/imp/config/conf.php
Encryption
/usr/bin/apt-get -y install gnupg
configure IMP to user it :
/bin/sed -i -e "/^(.*conf.utils.gnupg_keyserver.=)./i\
$conf[‘utils’][‘gnupg’] = ‘/usr/bin/gpg’;" /var/www/horde-webmail/imp/config/conf.php
configure Mnemo to use it :
/bin/sed -i -e "/^(.*conf.menu.print.=)./i\
$conf[‘utils’][‘gnupg’] = ‘/usr/bin/gpg’;" /var/www/horde-webmail/mnemo/config/conf.php
OpenSSL
/usr/bin/apt-get -y install openssl ca-certificates
configure IMP to use it :
/bin/sed -i -e "/^(.*conf.utils.gnupg_timeout.=)./a\
$conf[‘utils’][‘openssl_cafile’] = ‘/etc/ssl/certs’;
\
$conf[‘utils’][‘openssl_binary’] = ‘/usr/bin/openssl’;" /var/www/horde-webmail/imp/config/conf.php
## Security enhancement
we change configuration files permissions :
/usr/bin/find /var/www/horde-webmail -type f -wholename “config/” | /usr/bin/xargs /bin/chown -R root:www-data
/usr/bin/find /var/www/horde-webmail -type f -wholename “config/” | /usr/bin/xargs /bin/chmod 0440
We disable the test.php files :
/usr/bin/find /var/www/horde-webmail -type f -name “test.php” | /usr/bin/xargs /bin/chmod a-rwx
We allow access to the configuration scripts to the root user only :
/usr/bin/find /var/www/horde-webmail -type d -name “scripts” | /usr/bin/xargs /bin/chown -R root:root
/usr/bin/find /var/www/horde-webmail -type d -name “scripts” | /usr/bin/xargs /bin/chmod -R go-rwx
we disable the write permission on all of Horde source :
/bin/chmod -R ugo-w /var/www/horde-webmail
We disable the display of PHP source code to users when errors occurs :
/bin/echo "# Secure PHP for horde
expose_php = Off
display_errors = Off
log_errors = On
register_globals = Off
" | tee /etc/php5/conf.d/horde.ini
/etc/init.d/apache2 restart
----- End -----