Hylafax Mailing List Archives

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

[hylafax-users] howto: faxrm, howto: automate faxrm to do it by script



First: shame on the programmers who are not willing to provide a simple interface to administrate faxjobs for _all_ users by submitting a password like this:

whoever$ faxrm --masterpass=gogogo --jobid=137

Such a lot of people are not able to automate this because of this password asking after submitting a faxrm -a 137
I am sorry, I am not able to program in C so it's not possible to path the problem.

Second: you CAN automate it with an ftp-like approach I tell you now.

----
Howto set a password to delete faxjobs of other users
----
1 Give the password "gogogo" to any user on your system (my linuxuser is lippmann):
	faxsystem:~ # passwd lippmann
	Changing password for lippmann
	Enter the new password (minimum of 5, maximum of 8 characters)
	Please use a combination of upper and lower case letters and numbers.
	New password: gogogo
	Re-enter new password: gogogo
	Password changed.

2 Copy the encrypted password into a buffer where you can paste it later:
	gatekeeper:~ # grep lippmann /etc/shadow
	lippmann:/hWI5mZyyHDj2:11335:0:99999:7:0::
You need this string which is the encrypted password: /hWI5mZyyHDj2

3 Edit the file /var/spool/fax/etc/hosts.hfaxd and put these lines into it:
	# accept faxjobs from all users from the net 10.1.1.x
	10\.1\.1\.
	# Set administrationpassword for all users which connect from localhost
	127.0.0.1:100::/hWI5mZyyHDj2

4 Restart hylafax
	# /etc/rc.d/hylafax stop
	# /etc/rc.d/hylafax start

5 Print a faxjob from your Windows-WHFC-client to a number which does not exist to test how to delete a faxjob:

	lippmann> /usr/bin/sendfax -n -d99999 /etc/hosts
	request id is 435 (group id 435) for host localhost (1 file)

Find out the jobnumber of the fax, here it's the number 435:

	lippmann> faxstat -s
	HylaFAX scheduler on sv-bourganeuf.zdf: Running
	Modem modem (+49+911+9600157): Sending job 435

	JID  Pri S  Owner Number       Pages Dials     TTS Status
	435  127 R lippma 99999         0:1   0:12

6 Delete the faxjob:

	lippmann> ftp 127.0.0.1 4559
	Connected to 127.0.0.1.
	220 faxserver.zdf server (HylaFAX (tm) Version 4.1beta2) ready.
	Name (127.0.0.1:lippmann): lippmann      <--- no password needed!
	230 User lippmann logged in.
	Remote system type is UNIX.
	Using binary mode to transfer files.
	ftp> quote "admin gogogo"
	230 Administrative privileges established.
	ftp> quote "jkill 435"
	200 Job 435 killed.
	ftp> quit
	221 Goodbye.

If this works, you're on the way to successfully delete jobs by shellscript. 

7 Write script to delete faxjobs like this:

	#!/usr/bin/perl
	&deletejob("gogogo",$ARGV[0]);
	sub deletejob {
		my ($adminpass,$killjob)=@_;
		my $ftp = Net::FTP->new("127.0.0.1", Port => 4559)
			|| print "Error: $!";
		$ftp->login("zdfadmin","")
			|| print "Error: $!";
		$ftp->quot("admin",$adminpass)
			|| print "Error: $!";
		$ftp->quot("jkill", $killjob)
			|| print "Error: $!";
		$ftp->quit()
			|| print "Error: $!";
	}

I used this approach to kill printjobs from a webinterface. So I can delete jobs to wrong faxnumbers submitted by my users.

Friendly greetings from Nuernberg, Bavaria
Horshack

--
There is nothing new anymore.
Everything what could be invented,
is already invented.

Charles H. Duell, US Patent Office, 1899



____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services