2Fauth app loses its configuration after every restart of NS8

NethServer Version: 8
Module: 2-FAuth

Hello friends from Team Genius,

I am currently testing your 2-Fauth app and have noticed that the registered users disappear completely after every restart of my NS8 instance. The same applies to the users registered authentication devices. Is this a ‘special security feature’ of the app, or am I doing something wrong?

Regards…

Uwe

Maybe debug helps to understand the root cause?

I don’t see anything there that could provide me with an explanation.

I was thinking that the data is not saved to a persistant volume, but to a wrong volume.

2 Likes

echo $PATH
/home/2fauth1/.config/bin:/var/lib/nethserver/node/bin:/usr/local/agent/pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/agent/bin

cc @oneitonitram

@LayLow is right, the volumes are wrong so the sqlite database isn’t saved.

@transocean you could edit the service file…

runagent -m 2fauth1 systemctl --user edit --full 2fauth-app

… and adapt the ExecStart line to just use the volume 2fauth-app:/2fauth:Z:

ExecStart=/usr/bin/podman run --conmon-pidfile %t/2fauth-app.pid \
    --cidfile %t/2fauth-app.ctr-id --cgroups=no-conmon \
    --pod-id-file %t/2fauth.pod-id --replace -d --name  2fauth-app \
    --volume 2fauth-app:/2fauth:Z \
    --env-file=%S/state/key.env \
    --env-file=%S/state/app.env \
    ${I2FAUTH_IMAGE}

Restart the service to apply the changes which means the data is lost once more:

runagent -m 2fauth1 systemctl --user restart 2fauth

From now on the data should be persistent.

3 Likes

Thanks Markus. I will test it.

1 Like

Thanks @LayLow and @mrmarkuz

Now it works.

2 Likes

Does the configuration of the app’s mail function work in the same way as password-pusher?

pushing an update shortly, with the changes..

3 Likes

It’s a similar way to setup mail, see https://hub.docker.com/r/2fauth/2fauth#mail-settings

1 Like

I dont find the way to the .env for editing :slightly_frowning_face:

1 Like

In this case you could use the app.env file.

runagent -m 2fauth1 nano app.env

To check for available env files:

runagent -m 2fauth1 ls -l | grep env

Following settings worked in 2fauth to get no error but it wasn’t sent by the mail instance due to missing authentication.
I didn’t find a way to disable authentication and I’m afraid it’s not possible in the docker version of 2fauth.

MAIL_FROM_ADDRESS=user@domain.tld
MAIL_FROM_NAME=2FAuth
MAIL_ENCRYPTION=
MAIL_HOST=10.5.4.1
MAIL_MAILER=log
MAIL_PASSWORD=
MAIL_PORT=25
MAIL_USERNAME=

Sources:

1 Like

:pray::pray: :pray: :pray: :pray:

1 Like

@oneitonitram just for the record, was this fixed please?

As of version 1.0.1 released 5 days ago, yes the issue was fixed, are youu experiencing any challenges still?

2 Likes

Nope, just some housekeeping on the wiki, thanks!

3 Likes