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

Enabling 2FA on TrueNAS Scale causes 401 errors for freenas_api_connect Basic Auth #166

Open
kaypeter87 opened this issue Sep 25, 2023 · 15 comments
Assignees
Labels
beta A fix is currently in beta. Development In Development Enhancement New feature or request Waiting for feedback wontfix This will not be worked on

Comments

@kaypeter87
Copy link

I am on TrueNAS-SCALE-22.12.3.3 and pve-manager/7.4-16/0f39f621 (running kernel: 5.15.104-1-pve)

It's mentioned that SSH is used to run zfs commands to TrueNAS, but 2FA seems cause a 401 error to the plugin.

Sep 24 20:42:19 proxmox2 pvedaemon[488042]: [ERROR]FreeNAS::API::PVE::Storage::LunCmd::FreeNAS::freenas_api_connect : Response code: 401
Sep 24 20:42:19 proxmox2 pvedaemon[488042]: [ERROR]FreeNAS::API::PVE::Storage::LunCmd::FreeNAS::freenas_api_connect : Response content: HTTP Basic Auth is unavailable when OTP is enabled

There is an option to enable 2FA over SSH, but this is disabled by default.

image

I'm not entirely sure how the freenas_api_connect function handles this, but it seems API calls now require 2FA codes when its enabled? I had this working with 2FA on Core. Seems like something has changed on the TrueNAS side requiring it.

@eugenefvdm
Copy link

eugenefvdm commented Sep 25, 2023

Hi! The screenshot helps a lot. To me it appears you're thinking it's a 2FA issue whereby the error text indicates:

...is unavailable when OTP is enabled

Above where it says, One-Time Password (OTP) Digits*, is there an option to try without OTP?

@kaypeter87
Copy link
Author

NP! I forgot to add, I do not get the error and everything works when I disable 2FA altogether from my TrueNAS instance.

@kaypeter87
Copy link
Author

Hi! The screenshot helps a lot. To me it appears you're thinking it's a 2FA issue whereby the error text indicates:

...is unavailable when OTP is enabled

Above where it says, One-Time Password (OTP) Digits*, is there an option to try without OTP?

For this specific question, no there is no option to try without OTP.

Copy link

stale bot commented Dec 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Dec 4, 2023
@kaypeter87
Copy link
Author

I might have some time to submit a PR during the holidays.

@stale stale bot removed the wontfix This will not be worked on label Dec 6, 2023
@hunter-nl
Copy link

I've the same issue. But I need 2FA to keep enabled. So hopefully there will some quick fix coming in FreeNAS-ProxMox.

@TheGrandWazoo TheGrandWazoo self-assigned this Dec 9, 2023
@TheGrandWazoo TheGrandWazoo added the Diagnose Diagnose/Discuss a issue or concern label Dec 9, 2023
@TheGrandWazoo
Copy link
Owner

Well you would not want to enable 2fa for a API user. Possible to create a user without 2fa and then use that to connect to TrueNAS?

I will need to replicate this. Will be doing it tonight/tomorrow to see the possibilities can be. I have a patch coming for Token instead of User based auth so that might help.

@hunter-nl
Copy link

I had to disable 2FA system wide for all users to get Freenas-Proxmox working again.
Hopefully the token solution is soon available.

@kaypeter87
Copy link
Author

Well you would not want to enable 2fa for a API user. Possible to create a user without 2fa and then use that to connect to TrueNAS?

I will need to replicate this. Will be doing it tonight/tomorrow to see the possibilities can be. I have a patch coming for Token instead of User based auth so that might help.

Agreed 👍 but I believe the 2FA is system wide which forces the API user to have 2FA. The token feature will definitely help out with this, appreciate the hard work.

I'll try to play around with the settings on the truenas side to see how the plugin reacts in different scenarios.

@hunter-nl
Copy link

I will need to replicate this. Will be doing it tonight/tomorrow to see the possibilities can be. I have a patch coming for Token instead of User based auth so that might help.

Any progress on this?

@TheGrandWazoo
Copy link
Owner

Yes. I have a version that using the Bearer Token. Will be pushing to the 'truenas-proxmox-testing' repo in a day or so.
Also just making a few changes to some variables so seeing if the code updates the underlying config correctly.

@TheGrandWazoo TheGrandWazoo added Development In Development beta A fix is currently in beta. Enhancement New feature or request and removed Diagnose Diagnose/Discuss a issue or concern labels Dec 28, 2023
Copy link

stale bot commented Feb 27, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Feb 27, 2024
@hunter-nl
Copy link

Any progress on this issue?

@stale stale bot removed the wontfix This will not be worked on label Feb 27, 2024
@TheGrandWazoo
Copy link
Owner

The testing repo has the Bearer Token feature. Please try that and let me know. I have been running it as I do not get any 2FA.

Copy link

stale bot commented May 22, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta A fix is currently in beta. Development In Development Enhancement New feature or request Waiting for feedback wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants