Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[hylafax-users] mail2fax gateway

149 views
Skip to first unread message

Samuel Laakso

unread,
Nov 4, 2009, 3:58:28 PM11/4/09
to hylafa...@hylafax.org
I've set up a hylafax E-mail to Fax gateway. My setup:

Centos 5.4

Hylafax 6.0.3

IAXmodem 0.3.1-11

Postfix

I followed the guide here:
http://hylafax.sourceforge.net/howto/faxing.php

to setup an alias for incoming mail <phone#>@fax.server.com that routes
to a shell script that extract the information for faxmail/sendfax and
sends it on its happy way.

If I run the commands from the root shell, everything works fine. If I
send an email to postfix thus using the script, it executes the command
as the user "nobody," textfmt errors about not being able to find font
maps, and dies. For those w/ html email, I've highlighted the errors in
the logs.

See two contrasting logs below. My hunch is that it's a permission
problem. Any input would be greatly appreciated. Thank you!

What a successful job (from the shell) looks like:

#cat mail2faxmail.30197 | faxmail -v -T sla...@thecaseygroup.com |
sendfax -vv -n -D -f sla...@thecaseygroup.com -i "test fax" -d
1234567890

HEADER From SLa...@thecaseygroup.com Wed Nov 4 15: 43:30 2009

HEADER Return-Path: <SLa...@thecaseygroup.com>

HEADER X-Original-To: 12345...@fax.XXXXXXX.com

HEADER Delivered-To: mail...@fax.XXXXXXX.com

HEADER Received: from mail.caseygrp.com (exchange.XXXXXXX.com
[172.16.0.27])

+HEADER Received: by fax.XXXXXXX.com (Fax Daemon) with SMTP id
91A192845C

+HEADER Received: for <12345...@fax.XXXXXXX.com>; Wed, 4 Nov
2009 15:43:30 -0500 (EST)

HEADER X-MimeOLE: Produced By Microsoft Exchange V6.5

HEADER Content-class: urn:content-classes:message

HEADER MIME-Version: 1.0

HEADER Content-Type: multipart/alternative;

+HEADER Content-Type:
boundary="----_=_NextPart_001_01CA5D8F.7D3BCD4F"

HEADER Subject: test fax

HEADER Date: Wed, 4 Nov 2009 15:43:15 -0500

HEADER Message-ID:
<CE9EDE51E26DC04E960...@Exchange.XXXXXXX.com>

HEADER Thread-Topic: test fax

HEADER Thread-Index: Acpdj27ohAvY6c4ySrKgnFPjfU8gIg==

HEADER From: "Samuel Laakso" <SLa...@thecaseygroup.com>

HEADER To: <12345...@fax.XXXXXXX.com>

faxmail: This is a MIME message

MIME part (line 23): multipart/alternative charset=us-ascii
encoding=7bit

HEADER Content-Type: text/plain;

+HEADER Content-Type: charset="us-ascii"

HEADER Content-Transfer-Encoding: quoted-printable

MIME part (line 30): text/plain charset=us-ascii
encoding=quoted-printable

HEADER Content-Type: text/html;

+HEADER Content-Type: charset="us-ascii"

HEADER Content-Transfer-Encoding: quoted-printable

MIME part (line 56): text/html charset=us-ascii
encoding=quoted-printable

Trying localhost [2] (127.0.0.1) at port 4559...

Connected to tcg-it-fax1.XXXXXXX.com.

220 tcg-it-fax1.XXXXXXX.com server (HylaFAX (tm) Version 6.0.3) ready.

-> USER root

230 User root logged in.

match against (..., 512)

rule: offset 0 string = "%!" -- failed (comparison)

rule: offset 0 long = 0x4d4d -- failed (comparison)

rule: offset 0 long = 0x4949 -- failed (comparison)

rule: offset 0 long = 0x1da -- failed (comparison)

rule: offset 0 long = 0x1f1e -- failed (comparison)

rule: offset 0 long = 0x1f9d -- failed (comparison)

rule: offset 0 long = 0x506 -- failed (comparison)

rule: offset 0 long = 0x5343 -- failed (comparison)

rule: offset 0 long = 0xf702 -- failed (comparison)

rule: offset 0 string = "GIF" -- failed (comparison)

rule: offset 0 tiff = 0x59a66a95 -- failed (comparison)

rule: offset 0 long = 0x1b45 -- failed (comparison)

rule: offset 0 long = 0x1b25 -- failed (comparison)

rule: offset 0 long = 0x1b26 -- failed (comparison)

rule: offset 0 long = 0x1b2a -- failed (comparison)

rule: offset 0 string = "%PDF" -- failed (comparison)

rule: offset 0 string = "x T psc" -- failed (comparison)

rule: offset 0 string = "begin" -- failed (comparison)

rule: offset 0 string = "xbtoa" -- failed (comparison)

rule: offset 0 string = "P1" -- failed (comparison)

rule: offset 0 string = "P2" -- failed (comparison)

rule: offset 0 string = "P3" -- failed (comparison)

rule: offset 0 string = "P4" -- failed (comparison)

rule: offset 0 string = "P5" -- failed (comparison)

rule: offset 0 string = "P6" -- failed (comparison)

rule: offset 0 string = "WNGZWZSS" -- failed (comparison)

rule: offset 0 string = "#Inventor V" -- failed (comparison)

rule: offset 0 string = "\x89PNG" -- failed (comparison)

rule: offset 0 long = 0xffd8 -- failed (comparison)

rule: offset 0 long = 0xd8ff -- failed (comparison)

rule: offset 0 string = "#FIG" -- failed (comparison)

rule: offset 0 ascii = -- success (result postscript, rule "%F/textfmt
-B -f Courier-Bold -Ml=0.4in -p 11 -s %s >%o <%i")

CONVERT "/usr/sbin/textfmt -B -f Courier-Bold -Ml=0.4in
-p 11 -s default >'/tmp//sndfaxNAB90T' <'/tmp//sndfaxmwUngw'"

Apply DisplayNumber rules to "1234567890"

--> return result "1234567890"

-> FORM PS

200 Format set to PS.

-> TYPE I

200 Type set to Image.

SEND compressed data, 11162 bytes

-> EPRT |1|127.0.0.1|38535|

200 EPRT command successful.

-> MODE Z

200 Mode set to ZIP.

-> STOT

150 FILE: /tmp/doc42.ps (Opening new data connection).

SEND 3521 bytes transmitted (3.2x compression)

226 Transfer complete (FILE: /tmp/doc42.ps).

-> JNEW

200 New job created: jobid: 28 groupid: 28.

-> JPARM FROMUSER "slaakso"

213 FROMUSER set to "slaakso".

-> JPARM LASTTIME 000259

213 LASTTIME set to 000259.

-> JPARM MAXDIALS 12

213 MAXDIALS set to 12.

-> JPARM MAXTRIES 3

213 MAXTRIES set to 3.

-> JPARM SCHEDPRI 127

213 SCHEDPRI set to 127.

-> JPARM DIALSTRING "1234567890"

213 DIALSTRING set to "1234567890".

-> JPARM NOTIFYADDR "sla...@thecaseygroup.com"

213 NOTIFYADDR set to "sla...@thecaseygroup.com".

-> JPARM JOBINFO "test fax"

213 JOBINFO set to "test fax".

-> JPARM VRES 98

213 VRES set to 98.

-> JPARM PAGEWIDTH 209

213 PAGEWIDTH set to 209.

-> JPARM PAGELENGTH 296

213 PAGELENGTH set to 296.

-> JPARM NOTIFY "done"

213 NOTIFY set to "done".

-> JPARM PAGECHOP "default"

213 PAGECHOP set to "default".

-> JPARM CHOPTHRESHOLD 3

213 CHOPTHRESHOLD set to 3.

-> JPARM DOCUMENT /tmp/doc42.ps

200 Added document /tmp/doc42.ps as docq/doc42.ps.28.

-> JSUBM

200 Job 28 submitted.

request id is 28 (group id 28) for host localhost (1 file)

What a failed job looks like:

+ cp /tmp/mail2fax.30197/_message_ /tmp/mail2faxmail.30197

++ grep -e '^subject:' -i /tmp/mail2fax.30197/_message_

++ sed q

++ sed 's/^[^:]*: *//g'

+ JOBID='test fax'

++ grep -e '^to:' -i /tmp/mail2fax.30197/_message_

++ sed q

+ TOLINE='To: <12345...@fax.XXXXXXXX.com>'

++ grep -e '^from:' -i /tmp/mail2fax.30197/_message_

++ sed q

+ FROMLINE='From: "Samuel Laakso" <SLa...@thecaseygroup.com>'

++ echo To: '<12345...@fax.XXXXXXX.com>'

++ grep '<.*>'

+ '[' 'To: <12345...@fax.XXXXXXX.com>' '!=' '' ']'

++ echo To: '<12345...@fax.XXXXXXX.com>'

++ sed -e 's/.*<\(.*[^@]*\)@.*>.*/\1/'

+ TONUMBER=1234567890

++ echo From: '"Samuel' 'Laakso"' '<SLa...@thecaseygroup.com>'

++ grep '<.*>'

+ '[' 'From: "Samuel Laakso" <SLa...@thecaseygroup.com>' '!=' '' ']'

++ echo From: '"Samuel' 'Laakso"' '<SLa...@thecaseygroup.com>'

++ sed -e 's/.*<\(.*\).*>.*/\1/'

+ FROMPATH=SLa...@thecaseygroup.com

+ cat /tmp/mail2fax.30197/_message_

+ faxmail -v -T SLa...@thecaseygroup.com

HEADER From SLa...@thecaseygroup.com Wed Nov 4 15: 43:30 2009

HEADER Return-Path: <SLa...@thecaseygroup.com>

HEADER X-Original-To: 12345...@fax.XXXXXXX.com

HEADER Delivered-To: mail...@fax.XXXXXXX.com

HEADER Received: from mail.caseygrp.com (exchange.XXXXXXX.com
[172.16.0.27])

+HEADER Received: by fax.XXXXXXX.com (Fax Daemon) with SMTP id
91A192845C

+HEADER Received: for <12345...@fax.XXXXXXX.com>; Wed, 4 Nov
2009 15:43:30 -0500 (EST)

HEADER X-MimeOLE: Produced By Microsoft Exchange V6.5

HEADER Content-class: urn:content-classes:message

HEADER MIME-Version: 1.0

HEADER Content-Type: multipart/alternative;

+HEADER Content-Type:
boundary="----_=_NextPart_001_01CA5D8F.7D3BCD4F"

HEADER Subject: test fax

HEADER Date: Wed, 4 Nov 2009 15:43:15 -0500

HEADER Message-ID:
<CE9EDE51E26DC04E960...@Exchange.XXXXXXX.com>

HEADER Thread-Topic: test fax

HEADER Thread-Index: Acpdj27ohAvY6c4ySrKgnFPjfU8gIg==

HEADER From: "Samuel Laakso" <SLa...@thecaseygroup.com>

HEADER To: <12345...@fax.XXXXXXX.com>

Warning: n022003l.afm invalid Fontmap entry - no filename presentFont
Courier: /n022003l.afm: Can not open font metrics file; using fixed
widths.

faxmail: This is a MIME message

Warning: n019004l.afm invalid Fontmap entry - no filename presentFont
Helvetica-Bold: /n019004l.afm: Can not open font metrics file; using
fixed widths.

Warning: n019023l.afm invalid Fontmap entry - no filename presentFont
Helvetica-Oblique: /n019023l.afm: Can not open font metrics file; using
fixed widths.

MIME part (line 23): multipart/alternative charset=us-ascii
encoding=7bit

HEADER Content-Type: text/plain;

+HEADER Content-Type: charset="us-ascii"

HEADER Content-Transfer-Encoding: quoted-printable

MIME part (line 30): text/plain charset=us-ascii
encoding=quoted-printable

HEADER Content-Type: text/html;

+HEADER Content-Type: charset="us-ascii"

HEADER Content-Transfer-Encoding: quoted-printable

MIME part (line 56): text/html charset=us-ascii
encoding=quoted-printable

+ sendfax -vv -n -D -f SLa...@thecaseygroup.com -i 'test fax' -d
1234567890

/usr/sbin/textfmt: No font metric information found for "Courier-Bold".

Usage: /usr/sbin/textfmt [-1] [-2] [-B] [-c] [-D] [-f fontname] [-F
fontdir(s)] [-m N] [-o #] [-p #] [-r] [-U] [-Ml=#,r=#,t=#,b=#] [-V #]
files... >out.ps

Default options: -f Courier -1 -p 11bp -o 0

faxmail: unable to process message:

Error converting document; command was
"/usr/sbin/textfmt -B -f Courier-Bold -Ml=0.4in -p 11 -s
default >'/tmp//sndfax0giB6a' <'/tmp//faxmail.uBHmyI/part.2'".

Trying localhost [2] (127.0.0.1) at port 4559...

Connected to tcg-it-fax1.XXXXXXX.com.

220 tcg-it-fax1.XXXXXXX.com server (HylaFAX (tm) Version 6.0.3) ready.

-> USER nobody

230 User nobody logged in.

match against (..., 512)

rule: offset 0 string = "%!" -- failed (comparison)

rule: offset 0 long = 0x4d4d -- failed (comparison)

rule: offset 0 long = 0x4949 -- failed (comparison)

rule: offset 0 long = 0x1da -- failed (comparison)

rule: offset 0 long = 0x1f1e -- failed (comparison)

rule: offset 0 long = 0x1f9d -- failed (comparison)

rule: offset 0 long = 0x506 -- failed (comparison)

rule: offset 0 long = 0x5343 -- failed (comparison)

rule: offset 0 long = 0xf702 -- failed (comparison)

rule: offset 0 string = "GIF" -- failed (comparison)

rule: offset 0 tiff = 0x59a66a95 -- failed (comparison)

rule: offset 0 long = 0x1b45 -- failed (comparison)

rule: offset 0 long = 0x1b25 -- failed (comparison)

rule: offset 0 long = 0x1b26 -- failed (comparison)

rule: offset 0 long = 0x1b2a -- failed (comparison)

rule: offset 0 string = "%PDF" -- failed (comparison)

rule: offset 0 string = "x T psc" -- failed (comparison)

rule: offset 0 string = "begin" -- failed (comparison)

rule: offset 0 string = "xbtoa" -- failed (comparison)

rule: offset 0 string = "P1" -- failed (comparison)

rule: offset 0 string = "P2" -- failed (comparison)

rule: offset 0 string = "P3" -- failed (comparison)

rule: offset 0 string = "P4" -- failed (comparison)

rule: offset 0 string = "P5" -- failed (comparison)

rule: offset 0 string = "P6" -- failed (comparison)

rule: offset 0 string = "WNGZWZSS" -- failed (comparison)

rule: offset 0 string = "#Inventor V" -- failed (comparison)

rule: offset 0 string = "\x89PNG" -- failed (comparison)

rule: offset 0 long = 0xffd8 -- failed (comparison)

rule: offset 0 long = 0xd8ff -- failed (comparison)

rule: offset 0 string = "#FIG" -- failed (comparison)

rule: offset 0 ascii = -- success (result postscript, rule "%F/textfmt
-B -f Courier-Bold -Ml=0.4in -p 11 -s %s >%o <%i")

CONVERT "/usr/sbin/textfmt -B -f Courier-Bold -Ml=0.4in
-p 11 -s default >'/tmp//sndfaxKMiodw' <'/tmp//sndfaxW15cOM'"

/usr/sbin/textfmt: No font metric information found for "Courier-Bold".

Usage: /usr/sbin/textfmt [-1] [-2] [-B] [-c] [-D] [-f fontname] [-F
fontdir(s)] [-m N] [-o #] [-p #] [-r] [-U] [-Ml=#,r=#,t=#,b=#] [-V #]
files... >out.ps

Default options: -f Courier -1 -p 11bp -o 0

Error converting document; command was "/usr/sbin/textfmt -B -f
Courier-Bold -Ml=0.4in -p 11 -s default
>'/tmp//sndfaxKMiodw' <'/tmp//sndfaxW15cOM'"

+ exit 0

Chris Weiss

unread,
Nov 4, 2009, 4:15:31 PM11/4/09
to Samuel Laakso, hylafa...@hylafax.org
On Wed, Nov 4, 2009 at 2:57 PM, Samuel Laakso <SLa...@thecaseygroup.com> wrote:
> If I run the commands from the root shell, everything works fine. If I send
> an email to postfix thus using the script, it executes the command as the
> user �nobody,� textfmt errors about not being able to find font maps, and

I've had similar issues with mailman. My solution was to add a sudo
line with NOPASSWD option to allow nobody to exec my script as a user
with permissions. this way it keeps each piece running with the
"recommended" security settings


____________________ HylaFAX(tm) Users Mailing List _______________________
To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe hylafax-us...@hylafax.org < /dev/null
*To learn about commercial HylaFAX(tm) support, mail sa...@ifax.com.*

Dominique dHotman

unread,
Nov 4, 2009, 11:18:27 PM11/4/09
to Chris Weiss, SLa...@thecaseygroup.com, hylafa...@hylafax.org
This could also be a path issue because the script as run as user nobody the
shell that is used is /sbin/nologin which means that all the normal stuff
you depend on in your session (i.e. path, fontpath, gdfontpath, etc) is now
not set and the result is programs like textfmt dont work properly.

You could try and set these path variables in your script or possibly there
is a way to explicitly tell textfmt where to look for fonts.

Samuel Laakso

unread,
Nov 6, 2009, 12:33:39 PM11/6/09
to Dominique dHotman, Chris Weiss, hylafa...@hylafax.org
I tried adding the user nobody as a sudoer for the script, but ran into
different error, "Command output: Cannot open audit interface -
aborting."

From the textfmt manpage, it uses /etc/hylafax/hyla.conf for its
configuration.

Would anyone be able to tell me how to set a path variable for the
fontmaps explicitly in the script?

From: Dominique dHotman [mailto:domi...@dhotman.za.net]
Sent: Wednesday, November 04, 2009 11:18 PM
To: Chris Weiss; Samuel Laakso
Cc: hylafa...@hylafax.org
Subject: Re: [hylafax-users] mail2fax gateway

This could also be a path issue because the script as run as user nobody
the shell that is used is /sbin/nologin which means that all the normal
stuff you depend on in your session (i.e. path, fontpath, gdfontpath,
etc) is now not set and the result is programs like textfmt dont work
properly.

You could try and set these path variables in your script or possibly
there is a way to explicitly tell textfmt where to look for fonts.

On Wed, Nov 4, 2009 at 11:14 PM, Chris Weiss <cwe...@gmail.com> wrote:

On Wed, Nov 4, 2009 at 2:57 PM, Samuel Laakso
<SLa...@thecaseygroup.com> wrote:
> If I run the commands from the root shell, everything works fine. If I
send
> an email to postfix thus using the script, it executes the command as
the

> user "nobody," textfmt errors about not being able to find font maps,

0 new messages