check_http unable to use pass with "!"
-
nagiosEngie
- Posts: 104
- Joined: Thu May 03, 2018 7:57 am
check_http unable to use pass with "!"
Hello Nagios Crew,
I am having an issue wuth the check_http command.
My check uses authentication with special characters ex. user:password!
The password has a "!" in it, and being this the separator character for nagios commands output it will interpret it giving me the 401 unauthorized message.
How can I escape this character in passwords:
I have tied (taking hints from the forum) the following:
-a "user:password\!"
-a "user\password"!""
-a user:password$!
-a user:password$$!
-a user:$USER9$ (assigned the pass to a macro component)
-a user:password\\!
-a "user:password\\!"
None of these worked.
Any outher sugestions?
Thanks
Sandro
I am having an issue wuth the check_http command.
My check uses authentication with special characters ex. user:password!
The password has a "!" in it, and being this the separator character for nagios commands output it will interpret it giving me the 401 unauthorized message.
How can I escape this character in passwords:
I have tied (taking hints from the forum) the following:
-a "user:password\!"
-a "user\password"!""
-a user:password$!
-a user:password$$!
-a user:$USER9$ (assigned the pass to a macro component)
-a user:password\\!
-a "user:password\\!"
None of these worked.
Any outher sugestions?
Thanks
Sandro
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_http unable to use pass with "!"
The exclamation point is special and this article goes over how to overcome the issue
https://support.nagios.com/kb/article.php?id=580
https://support.nagios.com/kb/article.php?id=580
-
nagiosEngie
- Posts: 104
- Joined: Thu May 03, 2018 7:57 am
Re: check_http unable to use pass with "!"
Hello Scott,
I have already tried the solutionso proposed in the article. I think the parsing in the http_check command dose not follow the example.
I tried through command line and webgui as you can see in the printscreens with no luck.
The credentials are <domain>\<user>:<passwith!>
Using backslash to escape the "!" did not work.
Any other sugestions?
Thanks
Sandro
I have already tried the solutionso proposed in the article. I think the parsing in the http_check command dose not follow the example.
I tried through command line and webgui as you can see in the printscreens with no luck.
The credentials are <domain>\<user>:<passwith!>
Using backslash to escape the "!" did not work.
Any other sugestions?
Thanks
Sandro
You do not have the required permissions to view the files attached to this post.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_http unable to use pass with "!"
Did you look at the Solutions section at the bottom of that doc?
-
nagiosEngie
- Posts: 104
- Joined: Thu May 03, 2018 7:57 am
Re: check_http unable to use pass with "!"
Hi,
the WMI document dose not have any info about special characters. The only solution is the authentication file with user and pass written in it but for what I can see there is no option for this in check_http
As I said in my forst mail I already tried the user macro method with no success. As in image.
I am unable to manage a pass with "!" in it but cannot ask the customer to change all his passwords.
Any other solution?
Thanks
Sandro
the WMI document dose not have any info about special characters. The only solution is the authentication file with user and pass written in it but for what I can see there is no option for this in check_http
As I said in my forst mail I already tried the user macro method with no success. As in image.
I am unable to manage a pass with "!" in it but cannot ask the customer to change all his passwords.
Any other solution?
Thanks
Sandro
You do not have the required permissions to view the files attached to this post.
Last edited by nagiosEngie on Fri Jun 15, 2018 7:07 am, edited 1 time in total.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: check_http unable to use pass with "!"
This documentscottwilkerson wrote:The exclamation point is special and this article goes over how to overcome the issue
https://support.nagios.com/kb/article.php?id=580
You do not have the required permissions to view the files attached to this post.
-
nagiosEngie
- Posts: 104
- Joined: Thu May 03, 2018 7:57 am
Re: check_http unable to use pass with "!"
Hello,
I already tried (as I said in the 2 previuos posts that I have tried the user macro method.
I have modified the resaource.cfg file ad defined the password as in image.
I have tried defining the pass in the following ways:
$USER9$=password!
$USER9$="password!"
$USER9$=!
$USER9$="!"
Then using the $USER9$ variable in the command but with no success.
So please can you give a working solution?
Thanks
Sandro
I already tried (as I said in the 2 previuos posts that I have tried the user macro method.
I have modified the resaource.cfg file ad defined the password as in image.
I have tried defining the pass in the following ways:
$USER9$=password!
$USER9$="password!"
$USER9$=!
$USER9$="!"
Then using the $USER9$ variable in the command but with no success.
So please can you give a working solution?
Thanks
Sandro
You do not have the required permissions to view the files attached to this post.
Re: check_http unable to use pass with "!"
The bang (!) is a reserved character in most shells as well as a reserved character in Nagios Core itself, so your escaping considerations are two-fold: first for Nagios Core, then for the shell.
Try this combination of macros and escaping:
With special attention to the single-quotes around $USER9$. That worked for me.
This should also work:
Where we are again escaping ! exclusively for the benefit of the shell.
Admittedly it's not spelled out in simple language, all the tools required to solve this problem were in the aforementioned KB article. Though perhaps the article should be updated to discuss some of the basics around reserved shell characters as well as Nagios Core characters. This is definitely not the first time that article has been referenced and the solution was in escaping the shell characters.
Try this combination of macros and escaping:
Code: Select all
$USER9$=someuser:somepassword!
...
-a '$USER9$'
This should also work:
Code: Select all
$USER9$=someuser:somepassword\!
...
-a $USER9$
Admittedly it's not spelled out in simple language, all the tools required to solve this problem were in the aforementioned KB article. Though perhaps the article should be updated to discuss some of the basics around reserved shell characters as well as Nagios Core characters. This is definitely not the first time that article has been referenced and the solution was in escaping the shell characters.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
nagiosEngie
- Posts: 104
- Joined: Thu May 03, 2018 7:57 am
Re: check_http unable to use pass with "!"
Hello,
thank you all for your replies, I think I found out why this is not working.
The site I am trying to access supports NTLM authentication only, and from what I know this is not supported in check_http script.
Your suggestions will be anyway usefull for the future.
Do you have a work around for the NTLM problem?
Thanks
Sandro
thank you all for your replies, I think I found out why this is not working.
The site I am trying to access supports NTLM authentication only, and from what I know this is not supported in check_http script.
Your suggestions will be anyway usefull for the future.
Do you have a work around for the NTLM problem?
Thanks
Sandro
Re: check_http unable to use pass with "!"
Check out this post from the greatness himself @ssax:
https://support.nagios.com/forum/viewto ... 07#p229207
All the escaping considerations likely still apply.
EDIT: The final version of that plugin is actually further down the thread:
https://support.nagios.com/forum/viewto ... 07#p229385
https://support.nagios.com/forum/viewto ... 07#p229207
All the escaping considerations likely still apply.
EDIT: The final version of that plugin is actually further down the thread:
https://support.nagios.com/forum/viewto ... 07#p229385
Last edited by mcapra on Wed Jun 06, 2018 9:49 am, edited 1 time in total.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/