Bubka / 2FAuth

A Web app to manage your Two-Factor Authentication (2FA) accounts and generate their security codes
https://docs.2fauth.app/
GNU Affero General Public License v3.0
2.12k stars 142 forks source link

Can't login after updating Portainer #278

Closed jewstan83 closed 6 months ago

jewstan83 commented 8 months ago

Version

5.0.2

Details & Steps to reproduce

update portainer restart docker server login to portainer attempt to login to 2fauth

Expectation

successful login

Error & Logs

Error: No account found using this email.

/2fauth/storage/logs $ cat laravel-2024-01-10.log 
[2024-01-10 16:14:19] local.NOTICE: App setting 'lastRadarScan' set to 1704903259  
[2024-01-10 16:14:19] local.NOTICE: App setting 'latestRelease' reset to default

Execution environment

Date: Wed, 10 Jan 2024 16:37:09 +0000 userAgent: Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0 Version: 5.0.2 Environment: local Install path: / Debug: false Cache driver: file Log channel: daily Log level: DB driver: sqlite PHP version: 8.1.22 Operating system: Linux interface: fpm-fcgi

Containerization

Additional information

The container was fine until I ran a Portainer update. After updating Portainer I restarted the server and now the account seems to be gone from the container.

Bubka commented 8 months ago

Hi, Please check your database.sqlite file (It is stored in the host folder bound to the ./2fauth container folder). When was the file created?

jewstan83 commented 8 months ago

Hi, Please check your database.sqlite file (It is stored in the host folder bound to the ./2fauth container folder). When was the file created?

lrwxrwxrwx 1 1000 1000 23 Jan 10 16:22 database.sqlite -> /2fauth/database.sqlite

Edit: full dir

/srv/database $ ls -l total 12 lrwxrwxrwx 1 1000 1000 23 Jan 10 16:22 database.sqlite -> /2fauth/database.sqlite drwxr-xr-x 2 1000 1000 4096 Dec 29 17:04 factories drwxr-xr-x 2 1000 1000 4096 Dec 29 17:04 migrations drwxr-xr-x 2 1000 1000 4096 Dec 29 17:04 seeders

Bubka commented 8 months ago

This shows the symlink metadata. Please check the file in /2fauth/database.sqlite

jewstan83 commented 8 months ago

/2fauth $ ls -l total 140 -rw-r--r-- 1 1000 1000 131072 Jan 10 17:21 database.sqlite -rw-r--r-- 1 1000 1000 8 Jan 10 16:22 installed drwxr-xr-x 5 1000 1000 4096 Jan 3 15:19 storage /2fauth $ stat database.sqlite File: database.sqlite Size: 131072 Blocks: 264 IO Block: 4096 regular file Device: 30h/48d Inode: 1099555 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 1000/ UNKNOWN) Gid: ( 1000/ UNKNOWN) Access: 2024-01-10 17:21:00.981817693 +0000 Modify: 2024-01-10 17:21:00.977817697 +0000 Change: 2024-01-10 17:21:00.977817697 +0000

Edit to say: I've had 2fauth installed and running for several months. Is it possible the database was destroyed on reboot?

Bubka commented 8 months ago

I don't know portainer so it's hard to say. How did you set up your /2fauth docker volume?

jewstan83 commented 8 months ago

It would have been setup from Portainer which really just automates standard commands.

image

I have since recreated the account and restored from backup json and it's working now. I'll provide any further information requested but hopefully this was just a fluke occurence.

Bubka commented 8 months ago

Great, you have backups 👍🏻 It was the first time you had to update & restart Portainer while a 2FAuth container was running?

jewstan83 commented 8 months ago

Yes - this was the first time I've updated Portainer since installing 2fauth. It seems to be the only container that was affected.

Bubka commented 8 months ago

Portainer has advanced containers settings: https://docs.portainer.io/user/docker/containers/advanced#volumes

Please go to the volumes section of your 2fauth container. Is there any mapping? If so, how it is configured?