Skip to content

Internxt: Add Optional 2FA Secret to automate 2FA code generation.#9529

Open
Adelzu wants to merge 1 commit into
rclone:masterfrom
Adelzu:master
Open

Internxt: Add Optional 2FA Secret to automate 2FA code generation.#9529
Adelzu wants to merge 1 commit into
rclone:masterfrom
Adelzu:master

Conversation

@Adelzu

@Adelzu Adelzu commented Jun 16, 2026

Copy link
Copy Markdown

In automated backup scenarios using Internxt integration with 2FA enabled on the account, using totp (2FA code) is not sufficient as it can result in a sudden authorization issues with Internxt. Instead of using a one time use 2fa code, you can set the integration up with 2FA secret and rclone will automatically generate 2FA code when needed.

What is the purpose of this change?

Internxt Integration: Adds the ability to use 2FA secret instead of 2FA code, making the authentication more robust and self-recovering.

Was the change discussed in an issue or in the forum before?

Yes,
https://forum.rclone.org/t/use-internext-otp-secret-instead-of-totp-code/53932

Closes #9528

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

In automated backup scenarios using Internxt integration with 2FA enabled on the account, using totp (2FA code) is not sufficient as it can result in a sudden authoriza
tion issues with Internxt. Instead of using a one time use 2fa code, you can set the integration up with 2FA secret and rclone will automatically generate 2FA code when nee
ded.
@Adelzu

Adelzu commented Jun 17, 2026

Copy link
Copy Markdown
Author

Hi @ncw

Appreciate your support in reviewing this, the change is minimal.

Thanks,

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please see comments inline

Storing the TOTP seed in the rclone config materially weakens 2FA: an attacker with the config file now has password and a working second factor, reducing 2FA to single-factor. This is an inherent trade-off of the feature and is reasonably opt-in, with a Caution: in the config prompt. However, the docs change only updated the login-prompt paragraph - consider adding a sentence to the existing "Security Considerations" section in docs/content/internxt.md so the trade-off is documented where security-conscious users will look.

Thank you :-)

Comment thread backend/internxt/auth.go
// Returns the AccessResponse on success, or an error if 2FA is required or login fails.
func (f *Fs) reLogin(ctx context.Context) (*internxtauth.AccessResponse, error) {
password, err := obscure.Reveal(f.opt.Pass)
twoFASecret, _ := obscure.Reveal(f.opt.TwoFASecret)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't ignore errors

Move this line to below the if err != nil and make a new if err != nil with a sensible error message, eg fmt.Errorf("invalid 2FA secret: %w", err)

case "login":
twoFA, _ := m.Get("2fa_code")
twoFAObsecuredSecret, _ := m.Get("2fa_secret")
twoFASecret, _ := obscure.Reveal(twoFAObsecuredSecret)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't ignore errors


case "login":
twoFA, _ := m.Get("2fa_code")
twoFAObsecuredSecret, _ := m.Get("2fa_secret")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Typo here twoFAObscuredSecret not twoFAObsecuredSecret

Email string `config:"email"`
Pass string `config:"pass"`
TwoFA string `config:"2fa"`
TwoFASecret string `config:"2fa_secret"` // The TOTP seed/secret

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is missing a description in fs.RegInfo.Options as is 2fa - can you add them both as Advanced and Sensitive

Mimic the ones in the protondrive backend

               }, {
                        Name: "2fa",
                        Help: `The 2FA code

The value can also be provided with --protondrive-2fa=000000

The 2FA code of your proton drive account if the account is set up with 
two-factor authentication`,
                        Required: false,
                }, {
                        Name: "otp_secret_key",
                        Help: `The OTP secret key

The value can also be provided with --protondrive-otp-secret-key=ABCDEFGHIJKLMNOPQRSTUVWXYZ234567

The OTP secret key of your proton drive account if the account is set up with 
two-factor authentication`,
                        Required:   false,
                        Sensitive:  true,
                        IsPassword: true,
                }, {
                        Name:      clientUIDKey,

Which probably means we should rename 2fa secret to otp secret for consistency

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Proposal] Internxt: add ability to optionally use 2fa secret instead of 2fa code.

2 participants