Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting Demo User Post Installation #873

Open
Armageddon0x00 opened this issue Sep 11, 2024 · 5 comments
Open

Deleting Demo User Post Installation #873

Armageddon0x00 opened this issue Sep 11, 2024 · 5 comments

Comments

@Armageddon0x00
Copy link

Is this a feature for the backend or frontend?

Backend

What would you like?

I would like to be able to delete the default demo user created (the variables configured inside docker env.) inside container with ease.
Since it is explicitly mentioned that Demo user can not be deleted if configured (assuming this deletion is not possible on frontend for some reason), I want a utility like script that will come shipped with ghcr.io/plankanban/planka that can be executed inside container for clean up.

The script / tool (which we are going to call inside the docker container as delete_default_acc) will do:

  • Read env variables that are defined by user in compose
  • Connect to the db to check if that correlation exists
  • Safely remove the given user (if another admin account is already created, if not exit with error)

Why is this needed?

Due to some bugs (specially defined for first login process by other users too) demo accounts sometimes not disabled on some cases. I do not want to reconfigure everything or risk first login issues again.

I want to be able to delete the default demo user for mainly security purposes since most people that encountered this bug will not recreate/reconfigure (delete volumes, configure env. variables again etc.) their compose.

Other information

There are probably ways doing these (directly connecting to DB and cascade deleting user etc.). I am not doing by hand mostly because I am not sure about the impacts of manually deleting users (specially the default one that is created in first init) after creating a new admin account.

I am willing to help on this issue (if it is okay with the roadmap of the project) and create the script that does work defined in this issue under guidance.

Yes, I am aware this is probably a dirty workaround but with proper documentation and new tool most of the issues mentioned can be resolved.

@daniel-hiller
Copy link
Member

Why do you not simply remove the variables and restart the container?

After that you are able to delete/change the user

@Armageddon0x00
Copy link
Author

Hi @daniel-hiller,

TL;DR
The main reason for this is to use it as a workaround in new user - fresh install user management problems. I do not want to do fresh installs (and risk non-working service again) if I mess up the env. variables.

Example Issues

Take this issues for example (there are more but just as a PoC of my current problem)
issue1
issue2
issue3
issue4 which is unresolved / abondoned

All these issues could be easily solved with the official utility scripts created for user management (talking about specifically docker here.)

My Reasoning

As for my own reason, I created planka using docker compose with everything latest and according to documentation. Set my environment variables (default admin things) and tried to login using those credentials for a solid 6 hours. I debugged everything involved in the process (checked each docker container logs, checked service logs inside each container, checked reverse proxy logs etc. etc.). Spent hours on troubleshooting. Then i restarted the same compose file without changing anything (clearing volumes and networks first as I always did before) and this time it worked.

Now I have my planka service running smooth as butter but I have the demo user enabled with default demo credentials which I have no easy way of removing (also a security issue obviously). And I am not risking 5 more hours to see if I can just create the service without this user.

A Root Cause to be Determined.

To my suprise, when i came to create an bug issue on the subject I saw this has always been a common and unpinned issue in every version. User creation and login problem on fresh installs. A utility script would save this project time, save users from debugging numerous hours etc.

I just feel like a simple addition/workaround like this could provide to be useful and a time saver.

Thanks.

@meltyshev
Copy link
Member

Hi! It sounds like it might be better to create a script that generates user accounts, so you wouldn't need to set these DEFAULT_ADMIN_* variables at all 🤔

@Armageddon0x00
Copy link
Author

Yeah, thats a good idea to but most of the users will not want to bash into the container to run that script.

It might be better to create a startup script that will create a temporary admin user (that is able to create more users and deletable). Then prints the startup user information to container logs (which is a practice most container based applications use already.)

Logic:

  • Check if at least one user exists in the DB (with admin rights). If exists exit.
  • If no admin user is present create a temporary user planka-(8charid):planka-(8char). Put user to DB.
  • Print the new temporary user information in container logs also stating this is a temp user and should be deleted (since credentials are exposed directly etc.)
  • Exit.

Notes:

  • This process fully ignores DEFAULT_ADMIN_* variable set.

I will be experimenting on this. If my weak coding skills and project map alligns I will send a PR in the future.

Thanks.

@meltyshev
Copy link
Member

Sounds like a good option! For compatibility with the DEFAULT_ADMIN_* environment variables, I suggest creating a user only if DEFAULT_ADMIN_EMAIL is not set. Your PR would be greatly appreciated :)

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

No branches or pull requests

3 participants