0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

nixos/mysql: secure access to database in one of the nixos tests

This commit is contained in:
Aaron Andersen 2019-06-30 22:01:02 -04:00
parent d0a147e841
commit d9193f9eda

View file

@ -28,6 +28,12 @@ import ./make-test.nix ({ pkgs, ...} : {
{
users.users.testuser = { };
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.ensureUsers = [{
name = "testuser";