Page 1 of 1

Automatic login

Posted: Mon May 18, 2020 9:43 am
by evisus
Cheers!

I would like your help in the following case:

We need to perform automatic login in Nagios NA using a method similar to Nagios XI in "Auth Tokens".

Our intention is to send the user and the credential by means of a post or "Auth Tokens" so that the user does not have to enter his credential in Nagios NA.

I have seen the documentation but something similar is not seen. Can you give me any hints on how to achieve this?

Thank you

Re: Automatic login

Posted: Tue May 19, 2020 9:38 am
by cdienger
NNA doesn't have the same option, but you can 'automatically' login with a couple steps:

First open the nagiosna/login page and parse it to find the csrf_tna value which will be in a form:

Code: Select all

<form action="/nagiosna/login" method="post" accept-charset="utf-8" class="form-horizontal login"><div style="display:none">
<input type="hidden" name="csrf_tna" value="0fadf4df1fde7d4e102a0c5302b3306b" />
put this in the body along with the username and password of a POST request to nagiosna/login:

Code: Select all

POST /nagiosna/login HTTP/1.1
Host: nna_ip
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 79
Origin: http://nna_ip
Connection: keep-alive
Referer: http://nna_ip/nagiosna/login
Upgrade-Insecure-Requests: 1
DNT: 1

csrf_tna=0fadf4df1fde7d4e102a0c5302b3306b&username=nagiosadmin&password=welcome