mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/mysql: secure access to database in one of the nixos tests
This commit is contained in:
parent
d0a147e841
commit
d9193f9eda
1 changed files with 6 additions and 0 deletions
|
@ -28,6 +28,12 @@ import ./make-test.nix ({ pkgs, ...} : {
|
||||||
{
|
{
|
||||||
users.users.testuser = { };
|
users.users.testuser = { };
|
||||||
services.mysql.enable = true;
|
services.mysql.enable = true;
|
||||||
|
services.mysql.initialScript = pkgs.writeText "mariadb-init.sql" ''
|
||||||
|
echo "ALTER USER root@localhost IDENTIFIED WITH unix_socket;"
|
||||||
|
echo "DELETE FROM mysql.user WHERE password = ''' AND plugin = ''';"
|
||||||
|
echo "DELETE FROM mysql.user WHERE user = ''';"
|
||||||
|
echo "FLUSH PRIVILEGES;"
|
||||||
|
'';
|
||||||
services.mysql.ensureDatabases = [ "testdb" ];
|
services.mysql.ensureDatabases = [ "testdb" ];
|
||||||
services.mysql.ensureUsers = [{
|
services.mysql.ensureUsers = [{
|
||||||
name = "testuser";
|
name = "testuser";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue