分享

CentOS安装与配置Hylafax全过程

 昵称6656145 2015-11-10

CentOS安装与配置Hylafax全过程

 

传真Server

                   功能:A:收到传真以附件形式传送到指定地址(Fax to mail)

                            B:以邮件附件的形式发送传真(包括PDF/TIF)附件(Mail to fax)

                   Hylafax传真Server(Halu推荐avantfax,此为基于Hylafax的Web管理程序)

         Hylafax软件依赖性:libtiff/ghostscript/ghostscript-fonts/sharutils

 

传真Server

                   功能:A:收到传真以附件形式传送到指定地址(Fax to mail)

                            B:以邮件附件的形式发送传真(包括PDF/TIF)附件(Mail to fax)

                   Hylafax传真Server(Halu推荐avantfax,此为基于Hylafax的Web管理程序)

         Hylafax软件依赖性:libtiff/ghostscript/ghostscript-fonts/sharutils

         软件安装:

         #yum –y install libtiff ghostscript ghostscript-fonts sharutils

         #wget ftp://ftp.hylafax.org/binary/linux/redhat/RPMS/i386/hylafax-4.4.4-1rhel5.i386.rpm

         #rpm –U hylafax-4.4.4-1rhel5.i386.rpm

 

完成后弹出如下界面:(如果没有这个画面,就直接运行faxsetup安装)

#########################################################

#                  HylaFAX installation complete!                 #

#                                                                 #

#              You should now run /usr/sbin/faxsetup to         #

#                create or update HylaFAX configuration          #

#               before you can begin using the software.           #

#                                                                 #

#########################################################

运行faxsetup命令对HylaFAX服务器进行基本配置:

# /usr/sbin/faxsetup

首先会出现一些说明;

 

接着第一个问题是

Should an entry be added for the FaxMaster to /etc/aliases [yes]? yes

在/etc/aliases加入别名, 输入yes,按enter键继续基本配置;

 

Users to receive fax related mail [root]? fandy

fandy将收到的传真相关的mail(如果统计报表等),输入fandy,按enter键继续基本配置;

 

Are these ok [yes]? yes

确认以上信息是否正确,输入yes,按enter键继续基本配置;

 

Country code [1]? 086

中国国际区号0086(中国),输入086,按enter键继续基本配置;

Area code []?20

国内城市区号(广州市020) 输入20,按enter键继续基本配置;

 

Long distance dialing prefix [1]? 0

长途码0, 输入0,按enter键继续基本配置;

 

International dialing prefix [011]? 020

国际电话前置码020, 输入020,按enter键继续基本配置;

 

Dial string rules file (relative to /var/spool/hylafax)["etc/dialrules"]?

拨号规则文件设为/var/spool/hylafax/etc/dialrule,按enter键继续基本配置;

 

Tracing during normal server operation [1]? 1

启动除错选项,输入1,按enter键继续基本配置;

 

Default tracing during send and receive session [0xfffffffff]?

接收、发送传真时启用除错功能,按enter键继续基本配置;

 

Continuation cover page (relative to /var/spool/hylafax) []?

设定封面的页的所在目录,按enter键继续基本配置;

 

Timeout when converting PostScript. documents (secs) [180]? 180

设定转换为ps文件的逾时时间180秒,输入180,按enter键继续基本配置;

 

Maximum number of concurrent jobs to a destination[1]? 1

最大同时传送一个目的的工作数,输入1,按enter键继续基本配置;

 

Define a group of modems []

除非你有好几台调制解调器,按enter键继续基本配置;

 

Time of day restrictions for outbound jobs ["Any"]?

限制外送传真的时间Any(任何时间),按enter键继续基本配置;

 

Pathname of destination controls file (relative to /var/spool/hylafax) []?

所有安装目的控制文件的所在目录相对于/var/spool/hylafax按enter键继续基本配置;

 

Timeout before purging a stale UUCP lock file (secs) [30] 30

清除UUCP设定文件的等待时间,输入30,按enter键继续基本配置;

 

Max number of pages to permit in an outbound job [0xffffffff]

外送传真的最多页数,按enter键继续基本配置;

 

Syslog facility name for ServerTracing messages [daemon]?

相关于日志信息是记录在/var/log/messages文件中,按enter键继续基本配置;

 

Are these ok [yes]? yes

确定以上的设定是否正确,输入yes,按enter键继续基本配置;

 

Restarting Hylafax server process.

Should I restart the Hylafax server process [yes]? yes

现在要启动hylafax服务器。输入yes,按enter键继续基本配置;

 

You do not appear to have any modem configured for use. Modems are

ocnfigured for use with HylaFax with the faxaddmodem[8C] command.

Do you want to run faxaddmomdem to configure a modme [yes]? yes

你尚未指定任何调制解调器,现在是否要设定使用faxaddmodem命令。输入yes,按enter键继续基本配置;

 

Serial port that modem is connected to []? ttyS0

因为之前没有设定,这里会跳出来叫你设定,调制解调器的端口一般为ttyS0。输入ttyS0,按enter键继续基本配置;

 

country code[1] 086

中国国际区号0086(中国)。输入086,按enter键继续基本配置;

 

Area code [415]? 20

中国、广东省、广州市区号:020。输入020,按enter键继续基本配置;

 

Phone number of fax modem [+1,9999.5555.1212]? +008602084680605

你调制解调器所接的电话号码,国际区号+区码+电话号码。输入+008602084680605,按enter键继续基本配置;

 

Local Identifications string (for TS/CIG) ["NothingEtup"]? Nseasy.Net

传真机的识别ID,当你传真时显示在对方传真机LCD的文字。输入Nseasy.Net,按enter键继续基本配置;

 

Long distance dialing prefix [1]? 0

长途号码0。输入0,按enter键继续基本配置;

 

International dialing prefix [011]? 020

国际电话前置号码020。输入020,按enter键继续基本配置;

 

Dial string rules file (relative to /var/spool/hylafax) [etc/dialrules]?

拔号规则设定文件为/var/spool/hylafax/etc/dialrules,按enter键继续基本配置;

 

Tracing during normal server operation [1]? 1

启动侦错功能,按enter键继续基本配置;

 

Tracing during send and receive sessions [11]? 11

接收、发送传真时执行侦错功能,按enter键继续基本配置;

 

Protection mode for received facsimile [0600]?  0777

收到传真的文件权限。输入0777,按enter键继续基本配置;

 

Protection mode for session logs [0600]? 0777

记录文件的档案权限。输入0777,按enter键继续基本配置;

 

Protection mode for ttyS0 [0600]? 0777

端口的访问权限。输入0777,按enter键继续基本配置;

 

Rings to wait before answering [1]? 2

设定响铃几声后,开始接受传真。输入2,按enter键继续基本配置;

 

Modem speaker volume [off]? on

设定是否开启Modem音量可替换on、Off、Quiet、Low、Medium、High。输入on,按enter键继续基本配置;

 

Command line arguments to getty program ["-h %l dx_%s"]?

接收传真的命令。按enter键继续基本配置;

 

Pathname of Tsi access control list file (relative to /var/spool/hylafax)[""]?

Modem的识别ID ACL文件存放的路径/var/spool/hylafax。按enter键继续基本配置;

 

Pathname of Caller-ID access control list file (relative to /var/spool/hylafax)[""]?

Caller-ID ACL 文件存放的路径/var/spool/hylafax。按enter键继续基本配置;

 

Tag line font file (relative to /var/spool/hylafax) [etc/lutRS18.pcf]?

传真最上面包含(送件人,收件人,日期,公司等)等资料我们称为tag line所使用的字型。按enter键继续基本配置;

 

Tag line form. string ["From %%1|%c|Page %%P of %%T"]?

设定前面提到的Tag line格式。按enter键继续基本配置;

 

Time before purging a stale UUCP lock file (secs) [30]? 30

清除UUCP设定文件的等待时间,输入30,按enter键继续基本配置;

 

Hold UUCP lockfile during inbound data calls [Yes]? yes

当有资料傎进来时,保留UUCP设定文件,输入yes,按enter键继续基本配置;

 

Hold UUCP lockfile during inbound voice calls [Yes]? yes

当有语音傎进来时,保留UUCP设定文件,输入yes,按enter键继续基本配置;

 

Percent good lines to accept during copy quality checking [95]? 95

输入95,按enter键继续基本配置;

 

Max consecutive bad lines to accept during copy quality checking [5]? 5

输入5,按enter键继续基本配置;

 

Max number of pages to accept in a received facsimile [25]? 48

一次传真进来的最大可接收页数,输入48,按enter键继续基本配置;

 

Syslog faxility name for ServerTracing messages [daemon]?

储存纪录的方式Daemon:记录在/var/log/messages。按enter键继续基本配置;

 

Set UID to 0 to manipulate CLOCAL [""]?

按enter键继续基本配置;

 

Use available proiority job scheduling mechanism [""]?

可使用proiorty作业调度机制,按enter键继续基本配置;

 

Are these ok [yes]? yes

确定以上的设定是否正确,输入yes,按enter键继续基本配置;

 

Probing for best speed to talk to modem:38400

开始测试Modem各项功能;

 

How should it be configured [1]? 1

输入1,按enter键继续基本配置;

 

DTE-DCE flow control scheme [default]?

按enter键继续基本配置;

 

Are these ok [yes]? yes

确定以上的设定是否正确,输入yes,按enter键继续基本配置;

 

Are these ok [yes]? yes

确定以上的设定是否正确,输入yes,按enter键继续基本配置;

 

Do you want to run faxaddmodem to configure another modem [yes]? no

问你要不要再设定其他的调制解调器, 输入no,按enter键继续基本配置;

 

Should I run faxmodem for each configured modem [yes]? yes

输入yes,按enter键继续基本配置;

 

Done verifying system setup.

至此,已经完成HylaFAX服务器进行基本配置;

--------------------------------------------------------------------------------------------------------------------------------

  hylafax的档案结构

所有的配置文件主要目录是放在/var/spool/hylafax有的是/var/spool/fax,如果你要查询所有的hylafax档

案所在的,请打rpm -ql hylafax,假设目录在/var/spool/hylafax其重要目录说明如下:

bin           ## 这里存放一些程序,如收传真,及不同格式的转换程序等

config        ## 调制解调器的样本配置文件

etc           ## 所有真正的配置文件

pollq、docq、doneq、sendq、recvq     ## 所有的queue

log           ## 记录了每一笔的收送的交谈内容

info          ## 记录了每一台曾经收送的传真机(有call id)的一些参数,以加速传真不用再查询一次

status        ## 传真机的状态文件

bin目录:

faxrcvd               ## 收到传真所要做的动作

notify、notify、awk   ## 收送传真的通知动作

pdf2fax               ## 将pdf文件转为可传真的格式tiff class F

ps2fax                ## 将ps文件转为可传真的格式tiff class F

tiff2fax               ## 将tiff传为可传真的格式tiff class F

etc目录:

config.*               ## 你的端口的设定,config.端口的名称,如config.ttyS0

hosts.hfaxd client     ## 存取传真服务器的配置文件

lastrun               ## 传真服务器最后收送的时间

setup.modem         ## 测试调制解调器的程序

lutRS18.pcf           ## tag line的字型文件

xferfaxlog             ## 收送传真的记录文件

status目录:

any.info              ## 你的hylafax的版本数据

ttyS0                 ## 依你端口的名称而有不同,内容为传真服务器的状态

--------------------------------------------------------------------------------------------------------------------------------

新增用户faxadduser,其实它就是在/var/spool/hylafax/etc/hosts.hfaxd加入用户,例如新增加用户帐户:fandy、口令:123456详细操作如下;

# faxadduser -p 123456 fandy     #指定使用者的用户名和密码

 

# faxadduser yer                  #不指定密碼則密碼是空白的(只要用户名对了不用密码就可以传真)

 

刪除用户faxdeluser,其实它就是在/var/spool/hylafax/etc/hosts.hfaxd刪除用户,例如刪除用户帐户:fandy详细操作如下;

# faxdeluser fandy                #删除使用者的用户名和密码

 

接收传真的设定:hylafax的收/送传真是分开设定的如下介绍如何设定接收部份,要设定接收传真必须使用faxgetty 详细的内容可以使用man faxgetty请在/etc/inittab中找到“#run gettys in standard runlevels”下加入一行(其中ttyS0是你调制解调器的端口如此faxgetty便可以监听ttyS0以便响应传入的要求):

7:2345:respawn:/usr/sbin/faxgetty ttyS0    #加入信息内容

 ##不加此条进行进行监听,运行faxstat时,将不会出现Modem ttyS0 (+008602084680605): Running and idle

##此时拨打传真号码时,只会听到电话等待的声音,无传真信号声.

接下来在/var/spool/hylafax/etc/hosts.hfaxd文件中添加以下几行允许所有在域192.168.1.*中的所有客户机可以正常使用传真服务器:

192.168.1.0

解决传真上方的Tagline变乱码问题;

默认使用英文Portable Compiled Font字型, 但是locale为中文显示, 修改方式:

第一种方法: 修改/var/spool/hylafax/etc/hylafax.ttySx

TagLineFormat: "From %%l | %F %T %Z | Page %%P of %%T"

 

第二种方法: 把字型那行拿掉不显示Tagline(有些地区是不允许的)

#TagLineFont : etc/lutRS18.pcf

 

如果使用分机,在发送传真前要先拔一个号码。以拔号码0或9为例,修改/var/spool/hylafax/etc/目录中的config.ttyS0文件,详细修改部分请根据公司内容电话交换机设置出局号来决定:

ModemDialCmd:                ATDT%s                # T for tone dialing

更改为:

ModemDialCmd:                ATDT9W%s                #拨 9

或者

ModemDialCmd:                ATDT0W%s                #拨 0

 功能A:

设定寄信文件格式为.tif or.pdf 及寄信者邮箱地址,修改/var/spool/hylafax/etc/目录中的FaxDispatch文件,详细修改部请根据实际情况来决定(这个档案如果没有就自己建立);

系统这里会默认建立一个 FaxMAster : fandy的 Alias,所以设定 FaxMaster 就是寄给fandy:

SENDTO=FaxMaster;

更改为:

SENDTO=fandy@nseasy.net

 

设定邮件以那种文件格式来传真(以下两种只选择其中之一pdf、tif格式):

FILETYPE=pdf;         # 设定邮件附件文件格式为PDF,可设定pdf,建议是设定pdf;

或者:

FILETYPE=tif;          # 设定邮件附件文件格式为TIFF,也可设定tif;

 

重新启动RedHat Enterprise Linux Server 5.0操作系统;

# reboot

重新启动RedHat Enterprise Linux Server 5.0操作系统后,执行ps -aux 可以看到 faxgetty 在执行;

# ps -aux

uucp      2176  0.0  0.2   7820  1228 ?        Ss   08:27   0:00 /usr/sbin/faxq

uucp      2179  0.0  0.1   4312   860 ?        Ss   08:27   0:00 /usr/sbin/hfaxd -i hylafax

 

uucp      2352  0.0  0.3   4768  1836 ?        Ss   08:28   0:00 /usr/sbin/faxgetty ttyS0

 

现在,我们可用faxstat命令来查询服务器状态;

# faxstat

HylaFAX scheduler on fax.nseasy.net: Running

Modem ttyS0 (+008602084680605): Running and idle

 ##以上两条必须完整显示,少一不可

出现以上信息说明服务器已正常运行。

功能B:实现Mail to fax功能

(1) "To: faxnumber@fax.domain.org" in the header where faxnumber is the destination number. With this method the MTA is generally configured to direct all mail for fax.domain.org to an alias that is directed at a mail-to-fax script. This will require that DNS be configured to point the hostname fax.domain.org at the HylaFAX server and that firewalling and routing permit SMTP traffic (on TCP port 25) to also arrive there.

With sendmail a virtusertable (often /etc/mail/virtusertable) should be created with an entry such as "@fax.domain.org mail2fax". Then run 'make' to create the virtusertable.db file. This tells sendmail to point all mail for fax.domain.org at the mail2fax alias. Then in /etc/aliases create an entry such as "mail2fax: |/usr/local/bin/mail2fax.sh" which will tell sendmail to send all mail for the mail2fax alias at the mail2fax.sh script. Then run 'newaliases'. If sendmail uses smrsh (and it probably des) then an appropriate symlink will need to be made for smrsh (probably 'ln -s /usr/local/bin/mail2fax.sh /etc/smrsh/mail2fax.sh').

With Postfix a virtual alias map should be created by putting an entry such as "virtual_alias_maps = hash:/etc/postfix/valias" into main.cf. Then create /etc/postfix/valias with an entry such as "@fax.domain.org mail2fax". Run 'postmap valias' to create the virtusertable.db file. This tells postfix to point all mail for fax.domain.org at the mail2fax alias. Then in /etc/aliases create an entry such as "mail2fax: |/usr/local/bin/mail2fax.sh" which will tell postfix to send all mail for the mail2fax alias at the mail2fax.sh script. Then run 'newaliases' and 'postfix reload'.

Then create

/usr/local/bin/mail2fax.sh

which will accept the mail, extract the required information for submitting the job from the headers, and submit the job. Here is a sample mail2fax.sh script(http://hylafax./howto/misc/mail2fax.sh). This sample script takes the mail, extracts information from the headers, converts the e-mail into a Postscript document using  faxmail, and submits the job using sendfax. Make sure that this script is marked as executable ('chmod a+x /usr/local/bin/mail2fax.sh'). Note that this script does not implement any type of sender screening or authentication. To prevent unauthorized senders from utilizing the mail-to-fax service this script should be modified to do authenticate the sender before submitting the fax job.

 

Eg script(http://hylafax./howto/misc/mail2fax.sh):

#!/bin/sh

#

# simple mail-to-fax utility using both faxmail and sendfax.

#

# - Lee Howard

#

#

# Mail addresses can be three ways:

#       1) user@host.org

#       2) "User Name" <user@host.org>

#       3) user@host.org (User Name)

#

# in the latter cases, quotes may or may not be used,

# there may or may not be any User Name at all, and User Name

# may come before or after user@host.org.

#

# We need to make sure we handle all these possibilities for

# both TO and FROM situations.  Return-Path is different.

#

 

RANDOMFAX=/tmp/mail2fax.$$

mkdir $RANDOMFAX

 

cat >> $RANDOMFAX/_message_

 

# Uncomment the following three lines for debugging.

#set -x

#exec > /tmp/mail2faxlog.$$ 2>&1

#cp $RANDOMFAX/_message_ /tmp/mail2faxmail.$$

 

JOBID=`grep -e "^subject:" -i $RANDOMFAX/_message_ | sed q | sed 's/^[^:]*: *//g'`

TOLINE=`grep -e "^to:" -i $RANDOMFAX/_message_ | sed q`

FROMLINE=`grep -e "^from:" -i $RANDOMFAX/_message_ | sed q`

if [ "`echo $TOLINE | grep '<.*>'`" != "" ]; then

        TONUMBER=`echo $TOLINE| sed -e 's/.*<\(.*[^@]*\)@.*>.*/\1/'`

else

        TONUMBER=`echo $TOLINE| sed -e 's/^[Tt]o://g' -e 's/[ ]*\(.*[^@]*\)@.*/\1/'`

fi

if [ "`echo $FROMLINE | grep '<.*>'`" != "" ]; then

        FROMPATH=`echo $FROMLINE| sed -e 's/.*<\(.*\).*>.*/\1/'`

else

        FROMPATH=`echo $FROMLINE| sed -e 's/^[Ff]rom://g' -e 's/[ ]*\([^ ]*\).*/\1/'`

fi

 

cat $RANDOMFAX/_message_ | faxmail -v -T $FROMPATH | sendfax -vv -n -D -f "$FROMPATH" -i "$JOBID" -d $TONUMBER

 

rm -rf $RANDOMFAX

 

exit 0

至此,HylaFAX服务器下载、安装、配置相关工作已经全部完成。

 

问题:

(1).当传真以邮件附件的形式发送时,默认的邮件内容位置在哪里? 答: /var/spool/hylafax/etc/templates/en   ##此目录下所有文件全是不同情况下的样例文件内容,不过好像不能随便修改,否则附件会以乱码的形式显示在邮件内容里.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多