Skip to content

Python3 issue in the enable 2fa part of reset2fakey.py #365

@jonasbardino

Description

@jonasbardino

Running reset2fakey.py as described in the wiki to remove a user 2FA setup fails with a byte vs str error on python3:

python3 ~/mig/server/reset2fakey.py -v -i '/C=GB/ST=NA/L=NA/O=Trinity College/OU=NA/CN=Gregory Winter/emailAddress=winter@bio.example.edu'
using configuration from MIG_CONF (or default)
Enabling 2FA setup for '/C=GB/ST=NA/L=NA/O=Trinity College/OU=NA/CN=Gregory Winter/emailAddress=winter@bio.example.edu'
Error: Problem writing temporary topic file on server. : a bytes-like object is required, not 'str'
Error: Failed to enable two-factor authentication

The enable_2fa function should be updated to use the mig.shared.fileio helpers to write temp files to fix the error, and the wiki should be updated to use the -r flag for the remove sample. Perhaps the add example should similarly use -a for symmetry but it also appears to be the default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions