-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
secure mongodb with a password #1787
Comments
While MongoDB allows for complex authentication setups with role-based permissions, to make minimal changes to our existing PHP code we'll probably want to create an admin user and have Language Forge authenticate as the admin user. That way we won't have to mess with permissions when new databases are created for new projects, as the admin user will be able to do anything on any database. |
BTW, the answer to what happens on an existing database is that
With a root user in place, you'll be able to create other users that "only" have Note: Our code might need to run |
Before adding auth, we'll want to go to our Language Forge deployment environments and create Kubernetes secrets as follows in each environment:
Then connect to Mongo in each environment (e.g. use admin;
db.createUser(
{
user: "admin", // Or value of MONGODB_USER if we decide it should be different
pwd: "CHANGE_ME", // Value of MONGODB_PASS
roles: [
{ role: "userAdminAnyDatabase", db: "admin" },
{ role: "readWriteAnyDatabase", db: "admin" },
{ role: "clusterAdmin", db: "admin" }
]
}
); UPDATE: We'll also want to create a I've been able to confirm that creating the |
Oddly enough, this isn't quite true. The Docker image docs say "Do note that none of the variables below will have any effect if you start the container with a data directory that already contains a database", but in fact So once we have created our |
@rmunn Could you maybe create the appropriate issue in lexbox for authenticating? |
@myieye - Done, sillsdev/languageforge-lexbox#812. And I updated #1787 (comment) to note the need to create two users, an |
I've created k8s secrets in LF staging and prod (called |
currently mongodb does not require a password. This was ok when the system was on a single machine, but now that it's in k8s any other service in the cluster has access to the database, we should only allow access to the db if you can provide the password.
There are
MONGO_INITDB_ROOT_USERNAME
MONGO_INITDB_ROOT_PASSWORD
environment variables. It's not clear to me what will happen to an existing database if you just add these variables, that needs to be tested before we go to production, we don't want to wipe out the db (unlikely) by just setting these.The text was updated successfully, but these errors were encountered: