linuxserver / docker-unifi-network-application

GNU General Public License v3.0
553 stars 41 forks source link

[BUG] admin password reset #15

Closed stefangweichinger closed 8 months ago

stefangweichinger commented 9 months ago

Is there an existing issue for this?

Current Behavior

Since I migrated my backup from the legacy container and logged in successfully it happened twice to me that the admin-login doesn't work anymore.

Expected Behavior

admin password shouldn't fail

Steps To Reproduce

  1. export backup from old unifi-container
  2. setup stack with new container as advised
  3. import backup
  4. login successfully with admin and known password (as in old stack)
  5. time goes by
  6. admin login fails

Environment

- OS: host: Debian 12.1
- How docker service was installed: apt

CPU architecture

x86-64

Docker creation

docker-compose file as in:

https://www.reddit.com/r/Ubiquiti/comments/16e8608/comment/k13f4yv/?utm_source=share&utm_medium=web2x&context=3

Container logs

-
github-actions[bot] commented 9 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

stefangweichinger commented 9 months ago

Additional question:

on friday I tried to reset the password by logging into mongo, and find the admin in the DB "ace". That DB does not exist in the new stack. pls advise which user to search for etc. thanks

thespad commented 9 months ago

The database is whatever you called the database when you set up the containers. If you copy/pasted our examples it's probably unifi.

stefangweichinger commented 9 months ago

@thespad yes ;-) I agree.

I already tried that, but couldn't find the admin-account.

Should this find the account:

# docker-compose exec mongodb bash
root@50d6dcda1885:/# 
root@50d6dcda1885:/# mongo
MongoDB shell version v4.4.24
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("68164fb2-55c2-4324-adbc-b5dee593123b") }
MongoDB server version: 4.4.24
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    https://docs.mongodb.com/
Questions? Try the MongoDB Developer Community Forums
    https://community.mongodb.com
---
The server generated these startup warnings when booting: 
        2023-09-16T20:20:04.732+00:00: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem
        2023-09-16T20:20:06.373+00:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
        2023-09-16T20:20:06.374+00:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
---
> 
> use unifi
switched to db unifi
> db.admin.find()
> 
> 

? thanks for any help on this

thespad commented 9 months ago

It should. I'm using mongosh because I'm on a newer version but the principle should be the same.

localhost> use unifi
switched to db unifi
unifi> db.admin.find()
[
  {
    _id: ObjectId("5717c285cd9070f06f9d8d91"),

etc.

You should also be able to do

localhost> show dbs
admin       132.00 KiB
config      116.00 KiB
local        72.00 KiB
unifi         6.01 MiB
unifi_stat   99.09 MiB

To confirm everything is as you expect there.

stefangweichinger commented 9 months ago

I can use a newer mongodb, I just followed the docs telling that 4.4 works (and newer releases should ... ). Just tell me, I can start over with this stack. Maybe this also solves my password issue.

> use unifi
switched to db unifi
> db.admin.find()
> 
> 
> show dbs
admin       0.000GB
config      0.000GB
local       0.000GB
unifi       0.001GB
unifi_stat  0.000GB

thanks so far

thespad commented 9 months ago

There's no need to use a newer version, other than your position on support. Ubiquiti currently supports up to 4.4 and Mongo currently supports 4.4 up to 7.0. However, 4.4 is only supported until February 2024.

So you can go with the fully supported version, but only for 6 months, or you can go with a newer version of mongodb that isn't formally supported by Ubiquiti yet but will be supported by Mongo.

In theory you can do in place upgrades across major versions of mongodb, but the further back you go the messier that is to achieve. Personally I'm using the 7.0 tag, but any major version .0 tag should be fairly safe update-wise.

stefangweichinger commented 9 months ago

Thanks for the details. So I'd prefer to stay with 4.4 for now. Although that doesn't tell me where my admin-user is gone to ;-)

thespad commented 9 months ago

Do

use unifi
show collections

And see if you get anything returned at all.

thespad commented 9 months ago

Though given the sizes reported by show dbs it looks like there's nothing anywhere.

stefangweichinger commented 9 months ago

I do

> use unifi
switched to db unifi
> show collections
account
admin
admin_access_log
alarm
alert
alert_setting
apgroup
appstate_log
crashlog
dashboard
device
dhcpoption
diagnostics_config
dpiapp
dpigroup
dynamicdns
event
featuremigration
firewallgroup
firewallrule
guest
heatmap
heatmappoint
hotspot2conf
hotspotop
hotspotpackage
ipsalert
map
networkconf
payment
portalfile
portconf
portforward
privilege
radiusprofile
rogue
rogueknown
routing
scheduletask
setting
site
spatialrecord
ssooauthtoken
stat
tag
task
teleport_client
teleport_token
threat_log_view
traffic_route
traffic_rule
trigger_log
user
usergroup
verification
virtualdevice
voucher
wall
wifiman_feedback
wireguard_user
wlanconf
wlangroup
thespad commented 9 months ago

So the admin collection exists at least.

stefangweichinger commented 9 months ago

Well, also the admin-user existed. I restarted the stack now and followed docker-compose logs. No new lines when I enter the creds in the login page. And login fails.

That login definitely worked on friday. I tested it, the customer tested it.

I can do more lookups, queries and provided details .. thanks

stefangweichinger commented 9 months ago

For the records: currently using lscr.io/linuxserver/unifi-network-application:7.5.174

stefangweichinger commented 9 months ago

Please advise how to continue. Doing the import of the old backup again into a fresh stack won't make much difference as far as I understand. thanks

thespad commented 9 months ago

I'm not sure what's causing your issue in the first place, unless you're doing something silly like storing your mongo database volume on NFS. The unifi database (obviously) shouldn't just spontaneously wipe itself.

stefangweichinger commented 9 months ago

No NFS, just plain local docker volumes. I think I wait for tag 7.5.176 and retry.

stefangweichinger commented 9 months ago

went back to old stack ... for now

drizuid commented 8 months ago

OP reverted due to the issues their setup was causing them. we also support the container, not the applications, so this issue would be out of scope for us. Best-effort help is available in #other-support on our discord. Closing this.