HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Hylafax messing with ssh session



Niksa Baldun wrote:
I have the strangest of problems. I am using hylafax with a pool of
iaxmodems. Sometimes when I connect to the system using ssh, I keep
getting "ATZ" on the screen and I can't input any commands. Apparently
hylafax thinks that the ssh pseudo console is actually a modem and it
tries to communicate with it.

When I restart the system, the problem goes away, but I can't find out
what triggers it. How would I go about finding the cause of this? I
tried browsing the system log, but I don't really know what to look for.

iaxmodem uses pseudo-ttys, but the way that Linux works, iaxmodem cannot request any particular device name for the pseudo-tty. So we end up with something like /dev/pts/24, but it will vary depending on many things and will not be consistent. For example, ssh also uses pseudo-ttys, and often the tty numbers are allocated based on a first-come-first-serve basis.


In order to achieve a consistent device name iaxmodem creates a symlink to the pseudo-tty, and HylaFAX uses the symlink.

If iaxmodem crashes and is not restarted then HylaFAX will be trying to operate on a broken symlink. And then maybe you log in with ssh and are given the pty that iaxmodem was just using. Now you'll start to get faxgetty talking to your pty that ssh is using.

You can make HylaFAX restart iaxmodems when they "wedge" by putting this in /var/spool/hylafax/etc/resetmodem :

-----------------------------------------
#!/bin/sh

set -x
exec 2> /tmp/resetmodem.$$


PTY=`ls -l $1 | sed 's/.*-> //g'`


IAXPID=`/usr/bin/sudo /usr/sbin/lsof "$PTY" | grep iaxmodem | sed 's/^iaxmodem *\([0-9]*\) .*/\1/g'`

/usr/bin/sudo /bin/kill -HUP $IAXPID

exit
-----------------------------------------

Make sure to mark resetmodem as executable (chmod a+x /var/spool/hylafax/etc/resetmodem).

You'll also need something like this in your /etc/sudoers file:

uucp  ALL = NOPASSWD: /bin/kill
uucp  ALL = NOPASSWD: /usr/sbin/lsof

Thanks,

Lee.


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




Project hosted by iFAX Solutions