Unhandled Error in output-app_hooks
ppan5 opened this issue · 1 comments
ppan5 commented
Hi everone,
I want to call a python-script after a successful login. The configuration is below:
#-----------------------#
# APPLICATION HOOKS #
#-----------------------#
[output-app_hooks]
# Enable app_hooks output plugin
#
# input: true/false
# required: YES
# default: false
enabled = true
[...]
# Calls the script when a login is successful with the following arguments
# ./script LOGIN_SUCCESSFUL DATETIME IP USERNAME PASSWORD
#
# input: path of script to run
# required: NO
login_successful = /home/honssh/test.py
After a successful login i got this error message:
2018-06-03 00:44:25+0200 [-] Unhandled error in Deferred:
2018-06-03 00:44:25+0200 [-] Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.7/dist-packages/twisted/_threads/_threadworker.py", line 46, in work
task()
File "/usr/lib/python2.7/dist-packages/twisted/_threads/_team.py", line 190, in doWork
task()
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/python/threadpool.py", line 246, in inContext
result = inContext.theWork()
File "/usr/lib/python2.7/dist-packages/twisted/python/threadpool.py", line 262, in <lambda>
inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
File "/opt/honssh/honssh/output/output-app_hooks.py", line 82, in login_successful
self.runCommand(command)
File "/opt/honssh/honssh/output/output-app_hooks.py", line 163, in runCommand
sp = subprocess.Popen(args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
exceptions.OSError: [Errno 13] Permission denied
Is this a bug in honssh or is it my mistake? Adding the code in the output-app_hooks.py works, but is not suitable.
tnich commented
For anyone else reading this, please ensure the script is executable and have a hash bang at the top, e.g.
#!/usr/bin/env python