Hello i have a simple curl command get 2 arguments and send sms with them so i create a bash script "sendsms.sh" and create a exec module with that exec sendwelsms { wait = no program = "/root/sendsms.sh '%{User-Name} %{Huntgroup-Name}'" input_pairs = request shell_escape = yes output = file } i passed %{User-Name} as $1 and %{Huntgroup-Name} as $2 to that script . i put sendwelsms to end of postscript at accounting section and i want to every time a user logged this script executed now its not working any suggestion ?
On Tue, Jan 12, 2016 at 11:30:08AM +0000, Arash Shams wrote:
exec sendwelsms { wait = no program = "/root/sendsms.sh '%{User-Name} %{Huntgroup-Name}'" input_pairs = request shell_escape = yes output = file }
i passed %{User-Name} as $1 and %{Huntgroup-Name} as $2 to that script .
From the above quoting it looks like you passed "%{User-Name} %{Huntgroup-Name}" as $1 into the script.
now its not working any suggestion ?
What does the debug log say? I suspect your program setting needs to be something more like program = "/bin/sh -c '/root/sendsms.sh %{User-Name} %{Huntgroup-Name}'" untested - you probably want correctly escaped quotes around the parameters. Matthew -- Matthew Newton, Ph.D. <mcn4@le.ac.uk> Systems Specialist, Infrastructure Services, I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom For IT help contact helpdesk extn. 2253, <ithelp@le.ac.uk>
i have a internal debug in sendsms.sh and shows nothing radiusd log shows nothing and freeradius -xxx shows only ue Jan 12 15:53:24 2016 : Debug: # Instantiating module "sendwelsms" from file /etc/freeradius/mods-enabled/exec Tue Jan 12 15:53:24 2016 : Debug: exec sendwelsms { Tue Jan 12 15:53:24 2016 : Debug: sendwelsms /bin/sh -c not works and still exec module failed .
Date: Tue, 12 Jan 2016 11:54:59 +0000 From: mcn4@leicester.ac.uk To: freeradius-users@lists.freeradius.org Subject: Re: FreeRadius exec module not working
On Tue, Jan 12, 2016 at 11:30:08AM +0000, Arash Shams wrote:
exec sendwelsms { wait = no program = "/root/sendsms.sh '%{User-Name} %{Huntgroup-Name}'" input_pairs = request shell_escape = yes output = file }
i passed %{User-Name} as $1 and %{Huntgroup-Name} as $2 to that script .
From the above quoting it looks like you passed "%{User-Name} %{Huntgroup-Name}" as $1 into the script.
now its not working any suggestion ?
What does the debug log say?
I suspect your program setting needs to be something more like
program = "/bin/sh -c '/root/sendsms.sh %{User-Name} %{Huntgroup-Name}'"
untested - you probably want correctly escaped quotes around the parameters.
Matthew
-- Matthew Newton, Ph.D. <mcn4@le.ac.uk>
Systems Specialist, Infrastructure Services, I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom
For IT help contact helpdesk extn. 2253, <ithelp@le.ac.uk> - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On 12 Jan 2016, at 11:30, Arash Shams <ara4sh@hotmail.com> wrote:
i passed %{User-Name} as $1 and %{Huntgroup-Name} as $2 to that script .
That's not what you're doing: [adamb@prometheus ~] $ ./test.sh 'foo bar' $1 was: foo bar $2 was: Regards, Adam Bishop gpg: 0x6609D460 jisc.ac.uk | Networkshop 44: Save the date! | 22-24 March 2016 @ University of Manchester Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800. Jisc Services Limited is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under company number 2881024, VAT number GB 197 0632 86. The registered office is: One Castle Park, Tower Hill, Bristol BS2 0JA. T 0203 697 5800.
participants (3)
-
Adam Bishop -
Arash Shams -
Matthew Newton