Hot!Generating API keys

Author
andrewm659
New Member
  • Total Posts : 4
  • Scores: 0
  • Reward points: 0
  • Joined: 2019/12/23 19:38:18
  • Status: offline
2021/05/10 19:40:28 (permalink)
0

Generating API keys

I am trying to generate an API key for a local user on my Fortigate 60D running version 6.2.7.  I am trying to monitor this with prometheus and grafana but keep getting access denied.  I am using the fortigate_exporter to monitor this.


 
[ameyer@mon001 ~]$ curl -ilk https://10.150.1.1:7443/api/v2/cmdb/firewall/address?vdom=root&access_token=
[1] 2487587
[ameyer@mon001 ~]$ HTTP/1.1 401 Unauthorized
Date: Mon, 10 May 2021 19:22:34 GMT
Server: Apache
Content-Length: 503
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<p>Additionally, a 401 Unauthorized
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

[1]+ Done curl -ilk https://10.150.1.1:7443/api/v2/cmdb/firewall/address?vdom=root
[ameyer@mon001 ~]$
 


Not sure what I am doing wrong.
#1
emnoc
Expert Member
  • Total Posts : 6160
  • Scores: 429
  • Reward points: 0
  • Joined: 2008/03/20 13:30:33
  • Location: AUSTIN TX AREA
  • Status: offline
Re: Generating API keys 2021/05/11 03:24:00 (permalink)
5 (1)
Not sure what you mean by generate since none of those API are for generating a apikey.
 
I've written a few post on api and api-users that you can study.
  
http://socpuppet.blogspot.com/2019/09/howto-use-fortios-apiuser.html
 
 
I 1st would practice making API GET callouts b4 trying to add/delete/modify an existing object.
 
 
Ken Felix

PCNSE 
NSE 
StrongSwan  
#2
andrewm659
New Member
  • Total Posts : 4
  • Scores: 0
  • Reward points: 0
  • Joined: 2019/12/23 19:38:18
  • Status: offline
Re: Generating API keys 2021/05/11 05:48:16 (permalink)
0
I will check this out and let you know how it goes.  I am trying to get the prometheus fortigate_exporter working with the api key for your reference.
#3
andrewm659
New Member
  • Total Posts : 4
  • Scores: 0
  • Reward points: 0
  • Joined: 2019/12/23 19:38:18
  • Status: offline
Re: Generating API keys 2021/05/12 12:47:46 (permalink)
0
So running through your examples worked.  Not sure why it isn't working w/ the prometheus fortinet_exporter.
#4
Jump to:
© 2021 APG vNext Commercial Version 5.5