• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst]Hylafax und Firewall, Faxe verteilen nach msn 10,2

Ghoul

Member
Hallo alle zusammen!!
Mir raucht langsam der Kopf und die Augen werden trübe.
Folgende Probleme:
Habe hylafax auf einem Server Installiert um von meinen 2 anderen Computern aus
Faxen zu können.
Auf dem WindowsXP Prof Rechner ist Cypheus installiert und funktioniert auch, aber nur wenn ich die Firewall abgeschaltet habe (auf dem Server).
Ich habe auf der Fierwall dir Ports 4559 4557(war wohl früher mal der Port für Hylafax) und 444 (auch irgenwo gelesen) freigegeben.
trotzdem geht Faxen nicht. Ansehen der Faxe starten von Cyhpeus und alles funktioniert.
Was muss ich noch freigeben damit ich auch Faxen kann?

Auf dem Zweiten Rechner läuft Suse10.2, von dem recher aus kann ich gar nict Faxen. (auch bei ausgeschalteter firewall nicht)
Weder mit Kdeprintfax noch mit sendfax aus der konsole.
Fehlermeldung: 425 Cannot build data connection: Connection timed out.
Ping funktioniert aber. Sendfax.log ist leer.
Auf dem Server und dem Linuxrechner sind Hylafax 4.3.0-25 installiert. Auf dem Win rechner Cypheus 3.02
In der hosts.hfaxd sind die ip adressen der beiden Rechner eingetragen. keine user oder andre besonderheiten

Das blöde ist unter unter Suse10.0 hat das ganze funktioniert.
Nach dem Plattenchrash habe ich mir aber gedacht mal ne neuere
suse zu installieren, und würde diese nun auch gerne zum laufen bringen.
Die unterschiede zwischen den versionen sind die ISDN Treiber
und die hylafax version (oder nicht, bin mir bei der Version nicht sicher).
Ach so gefaxt wird mit Fritz!X USB.

Ich hoffe das mir jemand helfen kann die Sachen zum laufen zu bringen
 
OP
Ghoul

Ghoul

Member
Die Sache mit Cypheus habe ich geregelt
Habe eine Zweite Netzkarte eingebaut die mit dem Router verbunden
in der Firewall als Externe Zone eingetragen und die erste karte als interne Zone.
Da auf dem Server dowieso Squid mit Squidguard als internetzugang läuft ist das gar nicht so schlimm.

Ist aber immernoch das Problem das ich vom Linuxrechner nicht
Faxen kann.

Kann jeman Helfen :?:
 
OP
Ghoul

Ghoul

Member
Oh man ist das Peinlich :oops: :oops: :oops:
Vor lauter einstellen der Firewall auf dem Server habe ich die Firewall auf dem Client vergessen.
Geht nun fast alles. Versuche gerade die Faxe nach eingehender MSN
zu sortieren. Was noch nicht funktioniert. Da bin aber noch dran.

@whois
ja ich ich habe die rpm, passend zum Kernel genommen.
Hast du vielleicht noch einen Link zu meinem jetzigen Problem?
Die Links die du hier gepostet hast, aus denen werde ich nicht richtig
schlau. Die angegebenen Dateien (Faxdispatch und faxrcvd) sehen bei
mir irgendwie anders aus, als in den Anleitungen.
 

whois

Ultimate Guru
Hi

Zeigst du uns die Files mal. :wink:
Sieh dir auch mal die Links an.

http://tobias.schroepf.de/doku/doku.php?id=gentoo:fax_server
http://www.linuxnetmag.com/de/issue8/m8hylafax1.html
http://www.linuxforen.de/forums/showthread.php?t=67700

cu
 
OP
Ghoul

Ghoul

Member
Faxdispatch:
#
# Dispatch fax to email depending on own MSN or extention (ISDN lines)
# sourced from faxrcvd

if [ "$7" != "" ]; then
PHONEMATCH=$7\$
USERENTRY=`grep -v "^#" etc/users | grep "$PHONEMATCH"`
if [ "$USERENTRY" != "" ]; then
USERNAME=`echo $USERENTRY | awk '{print $1}'`
SENDTO="$USERNAME"
fi
fi

faxrcvd:
#! /bin/sh
# $Id: faxrcvd.sh.in,v 1.30 2006/04/22 03:25:42 darren Exp $
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#

#
# faxrcvd file devID commID error-msg
#
if [ $# -lt 4 ]; then
echo "Usage: $0 file devID commID error-msg [ callID-1 [ callID-2 [ ... [ callID-n ] ] ] ]"
exit 1
fi

test -f etc/setup.cache || {
SPOOL=`pwd`
cat<<EOF

FATAL ERROR: $SPOOL/etc/setup.cache is missing!

The file $SPOOL/etc/setup.cache is not present. This
probably means the machine has not been setup using the faxsetup(8C)
command. Read the documentation on setting up HylaFAX before you
startup a server system.

EOF
exit 1
}

# These settings may not be present in setup.cache if user upgraded and
# didn't re-run faxsetup; we set them before calling setup.cache for
# backward compatibility.
ENCODING=base64
MIMENCODE=mimencode
TIFF2PDF=bin/tiff2pdf
TTYCMD=tty
CHARSET=us-ascii

. etc/setup.cache
. bin/common-functions

INFO=$SBIN/faxinfo
FAX2PS=$TIFFBIN/fax2ps
TIFF2PS=tiff2ps
TOADDR=FaxMaster
FROMADDR=fax
TIFFINFO=tiffinfo
NOTIFY_FAXMASTER=always

#
# Redirect errors to a tty, if possible, rather than
# dev-nulling them or allowing them to creep into
# the mail.
#
if $TTYCMD >/dev/null 2>&1; then
ERRORSTO=`$TTYCMD`
else
ERRORSTO=/dev/null
fi

#
# Permit various types of attachment types: ps, tif, pdf
# Note that non-ASCII filetypes require an encoder.
# pdf requires tiff2ps and tiff2pdf
#
FILETYPE=ps
SENDTO=

#
# There is no good portable way to find out the fully qualified
# domain name (FQDN) of the host or the TCP port for the hylafax
# service so we fudge here. Folks may want to tailor this to
# their needs; e.g. add a domain or use localhost so the loopback
# interface is used.
#
HOSTNAME=`linuxserver` # XXX no good way to find FQDN
PORT=4559 # XXX no good way to lookup service

FILE="$1"; shift;
DEVICE="$1"; shift;
COMMID="$1"; shift;
MSG="$1"; shift;
COUNT=1
while [ $# -ge 1 ]; do
# The eval has $1 set yet, and this forces a variable-to-variable
# assignment, allowing us to not need to do escaping
eval CALLID$COUNT='$1'
shift
COUNT=`expr $COUNT + 1`
done
CIDNUMBER="$CALLID1"
CIDNAME="$CALLID2"

FILENAME=`echo $FILE | $SED -e 's/\.tif//' -e 's/recvq\///'`
SENDER="`$INFO $FILE | $AWK -F: '/Sender/ { print $2 }' 2>$ERRORSTO | $SED 's/^.//'`"
SUBADDR="`$INFO $FILE | $AWK -F: '/SubAddr/ { print $2 }' 2>$ERRORSTO | $SED 's/^.//'`"

#
# Apply customizations. All customizable variables should
# be set to their non-customized defaults prior to this.
#
if [ -f bin/FaxDispatch ]; then
. bin/FaxDispatch # NB: FaxDispatch sets SENDTO
fi

#
# Fetch language settings (after FaxDispatch for customization of $LANG).
#
. bin/dictionary
if [ -f etc/FaxDictionary ]; then
. etc/FaxDictionary
fi
setInfoSize

#
# Produce mailable encoding for binary files.
#
encode()
{
if [ -x "$MIMENCODE" ]; then
$MIMENCODE < $1 2>$ERRORSTO
elif [ -x "$UUENCODE" ]; then
if [ "$ENCODING" = "base64" ]; then
$UUENCODE -m $1 $1 | grep -E -v "^begin|^====$" 2>$ERRORSTO
else
$UUENCODE $1 $1 | grep -E -v "^begin|^====$" 2>$ERRORSTO
fi
else
# Do not use "-x" for backward compatibility; even if it fails
# this is last chance to encode data, so there's nothing to lose.
$MIMENCODE < $1 2>$ERRORSTO
fi
}

if [ -f $FILE ]; then
#
# Don't send FaxMaster duplicates, and FaxMaster may not even
# want a message at all, depending on NOTIFY_FAXMASTER.
#
case $NOTIFY_FAXMASTER$MSG in
never*) NOTIFY_FAXMASTER=no;;
errors) NOTIFY_FAXMASTER=no;;
*) NOTIFY_FAXMASTER=yes;;
esac
if [ "$TOADDR" != "$SENDTO" -a "$NOTIFY_FAXMASTER" != "no" ]; then
(echo "Mime-Version: 1.0"
echo "Content-Type: text/plain; charset=$CHARSET"
echo "Content-Transfer-Encoding: quoted-printable"
echo "To: $TOADDR"
echo "From: $DICTRECEIVEAGENT <$FROMADDR>"
eval echo "Subject: $DICTRECEIVEDFROM";
echo ""
echo "$FILE (ftp://$HOSTNAME:$PORT/$FILE):";
faxInfo $FILE
printf "%`echo $INFOSIZE`s: $DEVICE\n" "$DICTRECEIVEDON"
if [ "$MSG" ]; then
echo ""
echo "$DICTMSGINTRO"
echo ""
echo " $MSG"
echo ""
echo "$DICTLOGFOLLOWS"
echo ""
if [ -f log/c$COMMID ]; then
$SED -e '/-- data/d' \
-e '/start.*timer/d' -e '/stop.*timer/d' \
-e 's/=/=3D/g' \
log/c$COMMID
elif [ -n "$COMMID" ]; then
echo "$DICTNOLOGAVAIL ($DICTCOMMID c$COMMID)."
else
echo "$DICTNOLOGAVAIL."
fi
else
printf "%`echo $INFOSIZE`s: c$COMMID (ftp://$HOSTNAME:$PORT/log/c$COMMID)\n" "$DICTCOMMID"
fi
if [ -n "$SENDTO" ]; then
echo ""
eval echo "$DICTDISPATCHEDTO"
fi
) 2>$ERRORSTO | $SENDMAIL -f$FROMADDR -oi $TOADDR
fi
if [ -n "$SENDTO" ]; then
(MIMEBOUNDARY="NextPart$$"
echo "Mime-Version: 1.0"
echo "Content-Type: Multipart/Mixed; Boundary=\"$MIMEBOUNDARY\""
echo "Content-Transfer-Encoding: 7bit"
echo "To: $SENDTO"
echo "From: $DICTRECEIVEAGENT <$FROMADDR>"
eval echo "Subject: $DICTRECEIVEDFROM";
echo ""
echo "--$MIMEBOUNDARY"
echo "Content-Type: text/plain; charset=$CHARSET"
echo "Content-Transfer-Encoding: quoted-printable"
echo ""
faxInfo $FILE
printf "%`echo $INFOSIZE`s: $DEVICE\n" "$DICTRECEIVEDON"
if [ "$MSG" ]; then
echo ""
echo "$DICTMSGINTRO"
echo ""
echo " $MSG"
echo ""
echo "$DICTLOGFOLLOWS"
echo ""
if [ -f log/c$COMMID ]; then
$SED -e '/-- data/d' \
-e '/start.*timer/d' -e '/stop.*timer/d' \
-e 's/=/=3D/g' \
log/c$COMMID
elif [ -n "$COMMID" ]; then
echo "$DICTNOLOGAVAIL ($DICTCOMMID c$COMMID)."
else
echo "$DICTNOLOGAVAIL."
fi
else
printf "%`echo $INFOSIZE`s: c$COMMID\n" "$DICTCOMMID"
fi
echo ""
echo "--$MIMEBOUNDARY"
if [ "$FILETYPE" = "tif" ]; then
echo "Content-Type: image/tiff; name=\"$FILENAME.tif\""
echo "Content-Description: FAX document"
echo "Content-Transfer-Encoding: $ENCODING"
echo "Content-Disposition: attachment; filename=\"$FILENAME.tif\""
echo ""
encode $FILE;
elif [ "$FILETYPE" = "pdf" ]; then
echo "Content-Type: application/pdf; name=\"$FILENAME.pdf\""
echo "Content-Description: FAX document"
echo "Content-Transfer-Encoding: $ENCODING"
echo "Content-Disposition: attachment; filename=\"$FILENAME.pdf\""
echo ""
$TIFF2PDF -o $FILE.pdf $FILE
encode $FILE.pdf
$RM -f $FILE.pdf 2>$ERRORSTO
else # default as Postscript
echo "Content-Type: application/postscript; name=\"$FILENAME.ps\""
echo "Content-Description: FAX document"
echo "Content-Transfer-Encoding: 7bit"
echo "Content-Disposition: attachment; filename=\"$FILENAME.ps\""
echo ""
$FAX2PS $FILE 2>$ERRORSTO
fi
echo ""
echo "--$MIMEBOUNDARY--"
) 2>$ERRORSTO | $SENDMAIL -f$FROMADDR -oi $SENDTO
fi
else
#
# Generate notification mail for a failed attempt.
#
(echo "Mime-Version: 1.0"
echo "Content-Type: text/plain; charset=$CHARSET"
echo "Content-Transfer-Encoding: quoted-printable"
echo "To: $TOADDR"
echo "From: $DICTRECEIVEAGENT <$FROMADDR>"
echo "Subject: $DICTNOTRECEIVED"
echo ""
eval echo "$DICTATTEMPTEDFAXFAILED"
echo ""
echo " $MSG"
echo ""
echo "$DICTLOGFOLLOWS"
echo ""
if [ -f log/c$COMMID ]; then
$SED -e '/-- data/d' \
-e '/start.*timer/d' -e '/stop.*timer/d' \
-e 's/=/=3D/g' \
log/c$COMMID
elif [ -n "$COMMID" ]; then
echo "$DICTNOLOGAVAIL ($DICTCOMMID c$COMMID)."
else
echo "$DICTNOLOGAVAIL."
fi
) 2>$ERRORSTO | $SENDMAIL -f$FROMADDR -oi $TOADDR
fi

users:
nutzername1@hostname 123456 #die msn für diesen Nutzer
nutzername2@hostname 987456 #die msn für den Nutzer

faxrcvd sieht so aus wie das script von radmac5 im Linuxforenlink den du geschickt hast.

edit:
Wenn ich bei SendTo einen user direkt eintrage dann bekommt der
user auch das fax per mail. Scheint also als wenn Faxdispatch den user nicht an facrcvd übergibt.

edit2:
Ich habe in der Faxdispatch direkt unter den Kommentaren folgen Zeile eingefügt:
$7 > faxdispatch.txt
Ich bin kein bash könner aber ich denke damit sollte eingentlich der
inhalt der Variablen in die Datei geschrieben werden. Die Datei ist
aber leer. Vielleicht hilft das ja jemanden. Denn wenn ich das richtig
verstehe muss in der Variablen etwas drinstehen damit der If block
überhaupt abgearbeitet wird und die Varialble $USERNAME gesetzt wird, oder?

edit3: Das $7 > faxdispatch.txt nicht funktioniert weiß ich jetzt
bin aber ein kleines stück weiter gekommen habe in der faxrcvd
folgendes eingetragen:
FILE="$1"; shift;
echo $1 > Variablen.txt
DEVICE="$1"; shift;
echo $1 >> Variablen.txt
COMMID="$1"; shift;
echo $1 >> Variablen.txt
MSG="$1"; shift;
echo $1 >> Variablen.txt

Der Platz wo die Variable von COMMID eingetragen werden sollte
ist leer. Sollte da vielleicht die eingangs MSN stehen? Ich konnte das
bis jetzt noch nicht rausfinden.
 
OP
Ghoul

Ghoul

Member
So habe es hinbekommen die Variable $7 ist nach CALLID3 gewandert.
Faxdispatch dementsprechend geändert, nun läufts.
 

whois

Ultimate Guru
Hmm Ich habe mich Blöd gesucht und nichts gefunden. :wink:
Hinzu kommt das ich nur zu Hause Hylafax im Einsatz mit Suse10 habe und das nicht in der Firma testen kann.
Ich habe gerade bei Google gesucht und gelesen das dies wohl öfter vorkommt.
 
OP
Ghoul

Ghoul

Member
Steht sogar 2mal hier im Forum. Allerdings habe ich die Threads auch erst gefunden als ich Callid3 in der Suche eingegeben habe. Und da war es schon zu Spät.
Soll ich die geänderte Faxdispatch sonst mal Posten??
 
OP
Ghoul

Ghoul

Member
Code:
# Dispatch fax to email depending on own MSN or extention (ISDN lines)
# sourced from faxrcvd
#
if [ "$CALLID3" != "" ]; then
    PHONEMATCH="$CALLID3"
    USERENTRY=`grep -v "^#" /var/spool/fax/etc/users | grep "$PHONEMATCH"`
    if [ "$USERENTRY" != "" ]; then
	USERNAME=`echo $USERENTRY | awk '{print $1}'`
	SENDTO="$USERNAME"
    fi
fi

@whois
Ich ändere noch den Threadtitel und die ersten Beiträge (Firewall)
kannst du gerne löschen, sind sowieso peinlich genug :roll:
 

whois

Ultimate Guru
Danke

Hast du was dagegen das ich dies noch in unsere Wiki einbringe solbald ich ein bisschen Zeit habe?
 
Oben