Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 Forbidden on Connect-PRTGServer #319

Closed
2 tasks done
anthonym-iress opened this issue Jan 23, 2023 · 5 comments
Closed
2 tasks done

403 Forbidden on Connect-PRTGServer #319

anthonym-iress opened this issue Jan 23, 2023 · 5 comments
Labels
question Questions raised by people who don't know how to program or read the wiki :P

Comments

@anthonym-iress
Copy link

anthonym-iress commented Jan 23, 2023

What's going on?

I'm trying to log onto our PRTG Server with the PowerShell Module. My PRTG server is version 22.4.81.1532 x64.

Our PRTG API Version is 0.9.18

I've tried the following PowerShell script (passwords removed):

Connect-PrtgServer prtg.mycoolsite.com (New-Credential "XXXX" "XXXX")

However whenever we try to log on we get the following error: "Response status code does not indicate success: 403 (Forbidden)."

We can connect to the PRTG Server API with curl with the same credentials without issue.

I have checked the following past issues but they do not seem to be related:

#308
#314

I have also checked the troubleshooting section here without any success (https://github.com/lordmilko/PrtgAPI/wiki/Troubleshooting)

Due Dilligance

  • It wasn't covered by the wiki, I swear!
  • I have tried doing some basic research on this issue but haven't been able to come up with anything. Please help!
@anthonym-iress anthonym-iress added the question Questions raised by people who don't know how to program or read the wiki :P label Jan 23, 2023
@lordmilko
Copy link
Owner

  • Are you able to advise whether you were able to connect using PrtgAPI previously?
  • Does your PRTG server use http or https?
  • If it uses HTTPS, does it have an invalid SSL certificate?

@anthonym-iress
Copy link
Author

  • Are you able to advise whether you were able to connect using PrtgAPI previously?

This is our first time using PrtgAPI

  • Does your PRTG server use http or https?

It uses HTTPS

  • If it uses HTTPS, does it have an invalid SSL certificate?

The certificate is considered valid by Firefox, it does not expire until August.

@lordmilko
Copy link
Owner

When you generate the error, are you able to provide the output of

$error[0].Exception.StackTrace

In addition, what happens if you intentionally type the wrong username and password?

The error that you're meant to get upon entering invalid credentials is

Connect-PrtgServer : Could not authenticate to PRTG; the specified username and password were invalid.

The fact you're getting the error you're getting indicates potentially something else is getting in the way. Is there a proxy in your environment? Does PrtgAPI work from the PRTG Core server itself? My lab has the same PRTG version as you and I can confirm PrtgAPI works without issue

@anthonym-iress
Copy link
Author

When you generate the error, are you able to provide the output of

$error[0].Exception.StackTrace

Here is the strack trace:

  at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at PrtgAPI.Request.RequestEngine.ValidateHttpResponse(HttpResponseMessage responseMessage, PrtgResponse response)
   at PrtgAPI.Request.RequestEngine.ValidateHttpResponse(PrtgClient client, PrtgRequestMessage request, HttpResponseMessage responseMessage, PrtgResponse response)
   at PrtgAPI.Request.RequestEngine.ExecuteRequest(PrtgRequestMessage request, CancellationToken token, Func`2 responseParser)
   at PrtgAPI.Request.RequestEngine.ExecuteRequest(IJsonParameters parameters, Func`2 responseParser, CancellationToken token)
   at PrtgAPI.PrtgClient.GetPassHash(String password)
   at PrtgAPI.PrtgClient..ctor(String server, String username, String password, AuthMode authMode, IWebClient client, IXmlSerializer xmlSerializer)
   at PrtgAPI.PrtgClient..ctor(String server, String username, String password, AuthMode authMode, Boolean ignoreSSL)
   at PrtgAPI.PowerShell.Cmdlets.ConnectPrtgServer.Connect(PSCmdlet cmdlet)
   at PrtgAPI.PowerShell.Cmdlets.ConnectPrtgServer.ProcessRecord()
   at System.Management.Automation.Cmdlet.DoProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()

In addition, what happens if you intentionally type the wrong username and password?

The same error. 403 Forbidden.

The error that you're meant to get upon entering invalid credentials is

Connect-PrtgServer : Could not authenticate to PRTG; the specified username and password were invalid.

The fact you're getting the error you're getting indicates potentially something else is getting in the way. Is there a proxy in your environment? Does PrtgAPI work from the PRTG Core server itself? My lab has the same PRTG version as you and I can confirm PrtgAPI works without issue

I'll need to check as I don't look after this PRTG Server, I just connect to it. It works if I just hit the server up with requests in python or curl. Is there something on the backend that connects differently?

@anthonym-iress
Copy link
Author

Can I request you close this request? A coworker gave me an internal only address that doesn't get the error, I suspect a WAF or something like that is between me and the PRTG server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions raised by people who don't know how to program or read the wiki :P
Projects
None yet
Development

No branches or pull requests

2 participants