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

How to generate a API token by command line or api? #281

Closed
JKYLien opened this issue Oct 6, 2022 · 1 comment · Fixed by #243
Closed

How to generate a API token by command line or api? #281

JKYLien opened this issue Oct 6, 2022 · 1 comment · Fixed by #243
Assignees
Labels
feature request New feature or request security Improvements or fixes to security related items

Comments

@JKYLien
Copy link

JKYLien commented Oct 6, 2022

Hi,

If I want to generate a API token, is there any way to generate by command line or api?
Because I want to write a script that automates the settings of pfsense from scratch and can use the API Token to operate pfsense, but I am stop at unable to generate a TOKEN to use.

Also, sorry for my bad English~.

@jaredhendrickson13
Copy link
Owner

Hey!

Currently, the only way to generate API tokens is within the UI. This is mostly due to concerns over brute force attacks on API tokens, but coincidentally I am working on implementing pfSense's 'Login Protection' feature within the API authentication which will be available in v1.5.0. I can include the ability to generate API tokens from the API itself alongside that feature.

I'll update this issue once a pull request contains the feature.

Thanks!

@jaredhendrickson13 jaredhendrickson13 self-assigned this Oct 7, 2022
@jaredhendrickson13 jaredhendrickson13 added feature request New feature or request security Improvements or fixes to security related items labels Oct 7, 2022
jaredhendrickson13 added a commit that referenced this issue Oct 8, 2022
* feat: generate api tokens via api

allows clients to generate new api tokens from the
/api/v1/access_token endpoint

* docs: updated auth docs

updates readme and openapi docs to state api tokens can
now be updated via api endpoint. also adds section
outlining the purpose of login protection and
how to disable it if needed

* chore: adjust login protection verbage in ui

clarifies that disabling API login protection will not
disble api protection system-wide, only within the api

* tests: added api token auth tests

* tests: fixed order of imports in token tests

* docs: fixed formatting in openapi.yml

the login protection section was missing a trailing newline that bolded the
entire section
@jaredhendrickson13 jaredhendrickson13 linked a pull request Oct 8, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request security Improvements or fixes to security related items
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants