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

Add authentication documentation #950

Merged
merged 6 commits into from
Nov 4, 2023
Merged

Add authentication documentation #950

merged 6 commits into from
Nov 4, 2023

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Nov 2, 2023

What does this implement/fix?

See title. This is basically an extended version of my comment on Discourse.

Related issue or feature (if applicable): N/A

Pull request in docs with documentation (if applicable): N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

Checklist:

  • The code change is tested and works locally.
  • I based my code and PRs against the repositories developmental branch.
  • I signed off all commits. Pi-hole enforces the DCO for all contributions
  • I signed all my commits. Pi-hole requires signatures to verify authorship
  • I have read the above and my PR is ready for review.

@DL6ER DL6ER requested a review from a team November 2, 2023 10:27
Copy link

netlify bot commented Nov 2, 2023

Deploy Preview for pihole-docs ready!

Name Link
🔨 Latest commit 277e51b
🔍 Latest deploy log https://app.netlify.com/sites/pihole-docs/deploys/65453b0595c8f1000898322b
😎 Deploy Preview https://deploy-preview-950--pihole-docs.netlify.app/api/auth
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@pralor-bot
Copy link
Collaborator

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/authenticating-to-v6-api/66010/14

docs/api/auth.md Outdated Show resolved Hide resolved
docs/api/auth.md Outdated Show resolved Hide resolved
docs/api/auth.md Outdated

Once you have a valid SID, you can use it to authenticate your requests. You can do this in four different ways:

1. In the request URI: `http://pi.hole/admin/api.php?sid=vFA+EP4MQ5JJvJg+3Q2Jnw=`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no api.php anymore...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried various ways to get the sid using method 1 and was never able to do it. In the end, I used a Chrome plugin to modify the header. If the example could return a result, like top domains, it may be more instructive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NittanySeaLion Thanks for the hint! You are absolutely right, this method was documented to work in a few places but ... well ... it wasn't actually implemented in FTL ... pi-hole/FTL#1728 does that now


## Limited number of concurrent sessions

The Pi-hole API only allows a limited number of concurrent sessions. This means that if you try to login with a new session while the maximum number of sessions is already active, you may be denied access. This is to prevent abuse and resource exhaustion. In case you hit this limit, please make sure to logout from your sessions when you don't need them anymore as this will free up API slots for future requests. Unused sessions will be automatically terminated after a certain amount of time.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Pi-hole API only allows a limited number of concurrent sessions. This means that if you try to login with a new session while the maximum number of sessions is already active, you may be denied access. This is to prevent abuse and resource exhaustion. In case you hit this limit, please make sure to logout from your sessions when you don't need them anymore as this will free up API slots for future requests. Unused sessions will be automatically terminated after a certain amount of time.
The Pi-hole API only allows a hard-coded limit of 16 concurrent sessions. This means that if you try to login with a new session while the maximum number of sessions is already active, you may be denied access. This is to prevent abuse and resource exhaustion. In case you hit this limit, please make sure to logout from your sessions when you don't need them anymore as this will free up API slots for future requests. Unused sessions will be automatically terminated after a certain amount of time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did intentionally not specify this here as we may change this in the future or even give users the ability to set the number of maximum concurrent sessions on their own will.

@DL6ER DL6ER merged commit a6b505f into release/v6.0 Nov 4, 2023
10 checks passed
@DL6ER DL6ER deleted the new/auth branch November 4, 2023 06:23
@ramazansancar
Copy link

Why is this page not visible? On this site https://docs.pi-hole.net/
FYI @DL6ER @yubiuser @NittanySeaLion

@yubiuser
Copy link
Member

Because it is still not released. v6 is still in development. Use https://deploy-preview-338--pihole-docs.netlify.app/api/auth/

@ramazansancar
Copy link

Because it is still not released. v6 is still in development. Use https://deploy-preview-338--pihole-docs.netlify.app/api/auth/

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants