mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-22 08:30:57 +00:00
Merge release-25.11 into staging-next-25.11
This commit is contained in:
@@ -17,6 +17,8 @@ in
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.sniffnet ];
|
||||
|
||||
security.wrappers.sniffnet = {
|
||||
owner = "root";
|
||||
group = "root";
|
||||
|
||||
@@ -296,6 +296,19 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
secureSuperUserByDefault = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to automatically secure the root@localhost user with auth_socket authentication.
|
||||
|
||||
::: {.note}
|
||||
When enabled (default), the module will ensure root@localhost uses socket authentication,
|
||||
preventing any local user from connecting as root without proper credentials.
|
||||
:::
|
||||
'';
|
||||
};
|
||||
|
||||
replication = {
|
||||
role = lib.mkOption {
|
||||
type = lib.types.enum [
|
||||
@@ -414,6 +427,10 @@ in
|
||||
assertion = !cfg.galeraCluster.enable || isMariaDB;
|
||||
message = "'services.mysql.galeraCluster.enable' expect services.mysql.package to be an mariadb variant";
|
||||
}
|
||||
{
|
||||
assertion = !isMariaDB || cfg.secureSuperUserByDefault == true;
|
||||
message = "'services.mysql.secureSuperUserByDefault' has no effect on MariaDB (which is already secure by default)";
|
||||
}
|
||||
]
|
||||
# galeraCluster options checks
|
||||
++ lib.optionals cfg.galeraCluster.enable [
|
||||
@@ -574,6 +591,7 @@ in
|
||||
let
|
||||
# The super user account to use on *first* run of MySQL server
|
||||
superUser = if isMariaDB then cfg.user else "root";
|
||||
isStateVersion2611Plus = lib.versionAtLeast config.system.stateVersion "26.11";
|
||||
in
|
||||
''
|
||||
${lib.optionalString (!hasNotify) ''
|
||||
@@ -656,6 +674,11 @@ in
|
||||
) | ${cfg.package}/bin/mysql -u ${superUser} -N
|
||||
''}
|
||||
|
||||
# Secure root@localhost for MySQL/Percona on first initialization
|
||||
${lib.optionalString (cfg.secureSuperUserByDefault && !isMariaDB) ''
|
||||
echo "ALTER USER root@localhost IDENTIFIED WITH auth_socket;" | ${cfg.package}/bin/mysql -u ${superUser} -N
|
||||
''}
|
||||
|
||||
${lib.optionalString (cfg.initialScript != null) ''
|
||||
# Execute initial script
|
||||
# using toString to avoid copying the file to nix store if given as path instead of string,
|
||||
@@ -666,6 +689,27 @@ in
|
||||
rm ${cfg.dataDir}/mysql_init
|
||||
fi
|
||||
|
||||
${lib.optionalString (cfg.secureSuperUserByDefault && !isMariaDB) ''
|
||||
# We try to detect if we are in the default insecure auth mode for MySQL (all users can connect with password)
|
||||
# If the configuration has been moved to the socket-peer credential authentication we do nothing
|
||||
# If we are not able to connect it also means the default setup has been adjusted, so we also skip and do not do any changes
|
||||
if plugin_info=$(${cfg.package}/bin/mysql -u ${superUser} --skip-column-names 2>/dev/null -e "SELECT plugin FROM mysql.user WHERE user = 'root' AND host = 'localhost';"); then
|
||||
case "$plugin_info" in
|
||||
*auth_socket*) ;;
|
||||
*)
|
||||
${lib.optionalString isStateVersion2611Plus ''
|
||||
# Attempt to auto-fix to prevent local authentication without a password
|
||||
echo "Securing root@localhost with auth_socket to local connection without password, see https://github.com/NixOS/nixpkgs/security/advisories/GHSA-6qxx-6rg8-c4p8" >&2
|
||||
echo "ALTER USER root@localhost IDENTIFIED WITH auth_socket;" | ${cfg.package}/bin/mysql -u ${superUser} -N
|
||||
''}
|
||||
${lib.optionalString (!isStateVersion2611Plus) ''
|
||||
echo "Security warning: root@localhost seems to have open authentication, consider adjusting your configuration. See https://github.com/NixOS/nixpkgs/security/advisories/GHSA-6qxx-6rg8-c4p8" >&2
|
||||
''}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
''}
|
||||
|
||||
${lib.optionalString (cfg.ensureDatabases != [ ]) ''
|
||||
(
|
||||
${lib.concatMapStrings (database: ''
|
||||
|
||||
@@ -1003,6 +1003,7 @@ in
|
||||
mysql-autobackup = handleTest ./mysql/mysql-autobackup.nix { };
|
||||
mysql-backup = handleTest ./mysql/mysql-backup.nix { };
|
||||
mysql-replication = handleTest ./mysql/mysql-replication.nix { };
|
||||
mysql-secure-root = handleTest ./mysql/mysql-secure-root.nix { };
|
||||
n8n = runTest ./n8n.nix;
|
||||
nagios = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./nagios.nix;
|
||||
nar-serve = runTest ./nar-serve.nix;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import ../../../pkgs/servers/sql/mariadb pkgs
|
||||
);
|
||||
mysqlPackages = {
|
||||
inherit (pkgs) mysql80;
|
||||
inherit (pkgs) mysql80 mysql84;
|
||||
};
|
||||
perconaPackages = {
|
||||
inherit (pkgs) percona-server_8_0 percona-server_8_4;
|
||||
|
||||
94
nixos/tests/mysql/mysql-secure-root.nix
Normal file
94
nixos/tests/mysql/mysql-secure-root.nix
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
system ? builtins.currentSystem,
|
||||
config ? { },
|
||||
pkgs ? import ../../.. { inherit system config; },
|
||||
lib ? pkgs.lib,
|
||||
}:
|
||||
|
||||
let
|
||||
makeTest = import ./../make-test-python.nix;
|
||||
inherit (import ./common.nix { inherit pkgs lib; })
|
||||
mysqlPackages
|
||||
;
|
||||
|
||||
makeSecureRootTest =
|
||||
{
|
||||
package,
|
||||
name ? "mysql_secure_root_" + (builtins.replaceStrings [ "-" "." ] [ "_" "" ] package.pname),
|
||||
}:
|
||||
makeTest {
|
||||
inherit name;
|
||||
|
||||
nodes.${name} = { pkgs, ... }: {
|
||||
services.mysql = {
|
||||
enable = true;
|
||||
package = package;
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
machine = ${name}
|
||||
machine.wait_for_unit("mysql")
|
||||
|
||||
# Verify that non-root user cannot connect as root
|
||||
machine.fail("sudo -u nobody mysql -u root -e 'SELECT 1;' 2>&1")
|
||||
|
||||
# Verify that system root can connect as root via socket
|
||||
machine.succeed("mysql -u root -e 'SELECT 1;'")
|
||||
|
||||
# Verify that root@localhost has auth_socket plugin
|
||||
machine.succeed("[ \"$(mysql -u root -N -e \"SELECT plugin FROM mysql.user WHERE user = 'root' AND host = 'localhost';\")\" = \"auth_socket\" ]")
|
||||
|
||||
# Test service restart - verify it still works
|
||||
machine.succeed("systemctl restart mysql")
|
||||
machine.wait_for_unit("mysql")
|
||||
|
||||
# After restart, verify non-root user still cannot connect as root
|
||||
machine.fail("sudo -u nobody mysql -u root -e 'SELECT 1;' 2>&1")
|
||||
|
||||
# After restart, verify system root can still connect
|
||||
machine.succeed("mysql -u root -e 'SELECT 1;'")
|
||||
|
||||
# After restart, verify root@localhost still has auth_socket
|
||||
machine.succeed("[ \"$(mysql -u root -N -e \"SELECT plugin FROM mysql.user WHERE user = 'root' AND host = 'localhost';\")\" = \"auth_socket\" ]")
|
||||
'';
|
||||
};
|
||||
|
||||
makeInsecureRootTest =
|
||||
{
|
||||
package,
|
||||
name ? "mysql_insecure_root_" + (builtins.replaceStrings [ "-" "." ] [ "_" "" ] package.pname),
|
||||
}:
|
||||
makeTest {
|
||||
inherit name;
|
||||
|
||||
nodes.${name} = { pkgs, ... }: {
|
||||
services.mysql = {
|
||||
enable = true;
|
||||
package = package;
|
||||
secureSuperUserByDefault = false;
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
machine = ${name}
|
||||
machine.wait_for_unit("mysql")
|
||||
|
||||
# With secureRootByDefault = false, anyone can connect as root (default --initialize-insecure behavior)
|
||||
machine.succeed("sudo -u nobody mysql -u root -e 'SELECT 1;' 2>&1")
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
"secure-by-default" = lib.mapAttrs (
|
||||
_: package: makeSecureRootTest { inherit package; }
|
||||
) mysqlPackages;
|
||||
"can-be-insecure" = lib.mapAttrs (
|
||||
_: package: makeInsecureRootTest { inherit package; }
|
||||
) mysqlPackages;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,10 +9,10 @@
|
||||
|
||||
buildMozillaMach rec {
|
||||
pname = "firefox";
|
||||
version = "152.0.1";
|
||||
version = "152.0.2";
|
||||
src = fetchurl {
|
||||
url = "mirror://mozilla/firefox/releases/${version}/source/firefox-${version}.source.tar.xz";
|
||||
sha512 = "9b2595148ed977040ea2b21e7d6ece70f0e53fac9b96b3115b113bea76ead6c0422f6e94b1540283b430fed5e8e9a227771a6357bf16f56d530a7fae7dc7553a";
|
||||
sha512 = "e4e54cffffcfd5751eac5817a7b74b0ef0aa43fc00ef29397cc9df9aa52572b2272b96e60373a70d712be4dc849170d8d5c1b449f3ea978b4ab28dee19056b03";
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -178,11 +178,11 @@ let
|
||||
|
||||
linux = stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
inherit pname meta passthru;
|
||||
version = "149.0.7827.155";
|
||||
version = "149.0.7827.196";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${finalAttrs.version}-1_amd64.deb";
|
||||
hash = "sha256-g0PHfyCIpOQ2bw3+Tmiu+jt+eTJs0so71+tjxhHwZVY=";
|
||||
hash = "sha256-B4XIuL7q/kGRd/w2vPmfkvsvFtvHevhL5IfC5u14IuY=";
|
||||
};
|
||||
|
||||
# With strictDeps on, some shebangs were not being patched correctly
|
||||
@@ -292,11 +292,11 @@ let
|
||||
|
||||
darwin = stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
inherit pname meta passthru;
|
||||
version = "149.0.7827.156";
|
||||
version = "149.0.7827.197";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://dl.google.com/release2/chrome/acfqxa67egsofsrqnco2a4sd4pta_149.0.7827.156/GoogleChrome-149.0.7827.156.dmg";
|
||||
hash = "sha256-fd7IqNxvaMO28Yhlc4gk8M+P7Sq+ZrplRXbnrxPDcvw=";
|
||||
url = "http://dl.google.com/release2/chrome/fs52wiq74uymls47lfo23m5l2q_149.0.7827.197/GoogleChrome-149.0.7827.197.dmg";
|
||||
hash = "sha256-kXN4dPtx0MkTKO3VJnoyTqT8uS4JDXJ16DmojZ3zT+o=";
|
||||
};
|
||||
|
||||
dontPatch = true;
|
||||
|
||||
@@ -23,13 +23,13 @@ let
|
||||
in
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "linux-firmware";
|
||||
version = "20260519";
|
||||
version = "20260622";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
owner = "kernel-firmware";
|
||||
repo = "linux-firmware";
|
||||
tag = version;
|
||||
hash = "sha256-vyrnHNnyNko7m/fZ3fXgLvvasYyJ/pzs5be/Ele+6vY=";
|
||||
hash = "sha256-nSoJhgI4hAxtNmnj5M6ticzuBSt9uNAYcmc1VR/yXxE=";
|
||||
};
|
||||
|
||||
postUnpack = ''
|
||||
|
||||
@@ -170,11 +170,11 @@ let
|
||||
in
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "microsoft-edge";
|
||||
version = "149.0.4022.69";
|
||||
version = "149.0.4022.80";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_${finalAttrs.version}-1_amd64.deb";
|
||||
hash = "sha256-0Ur+0KKJQ7VTr7IMax5BIgwSf6jNhr0Aiz+So7Hj/OE=";
|
||||
hash = "sha256-5rHSMX9HdxvQOQ03DnLJF7NTHY5Ybt7sSU5MrcGzRnY=";
|
||||
};
|
||||
|
||||
# With strictDeps on, some shebangs were not being patched correctly
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "msedgedriver";
|
||||
version = "149.0.4022.69";
|
||||
version = "149.0.4022.80";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://msedgedriver.microsoft.com/${finalAttrs.version}/edgedriver_linux64.zip";
|
||||
hash = "sha256-BtyQD+zkZWv5GhnxJOg4BkVLrCdBZr7KN1bvXyvp4B8=";
|
||||
hash = "sha256-rcGrJqrusAH1RSHUm2wJpyw36HtJTGjmQ8k0kD9ejj8=";
|
||||
stripRoot = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
libtirpc,
|
||||
rpcsvc-proto,
|
||||
curl,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
@@ -111,6 +112,10 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
connector-c = finalAttrs.finalPackage;
|
||||
server = finalAttrs.finalPackage;
|
||||
mysqlVersion = lib.versions.majorMinor finalAttrs.version;
|
||||
tests.mysql-secure-root-by-default =
|
||||
nixosTests.mysql-secure-root.secure-by-default."mysql${lib.versions.major finalAttrs.version}${lib.versions.minor finalAttrs.version}";
|
||||
tests.mysql-root-can-be-kept-insecure =
|
||||
nixosTests.mysql-secure-root.can-be-insecure."mysql${lib.versions.major finalAttrs.version}${lib.versions.minor finalAttrs.version}";
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
||||
@@ -46,11 +46,11 @@ in
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "tor";
|
||||
version = "0.4.9.9";
|
||||
version = "0.4.9.10";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://dist.torproject.org/tor-${finalAttrs.version}.tar.gz";
|
||||
hash = "sha256-vXW6f9aPYHx4Bvz3AVajAKqSbprWml5WqOZBT1In6DM=";
|
||||
hash = "sha256-3+6QTq6Pw4ouOzURVPisD8oqZkkDjxp+allGHeV9pH8=";
|
||||
};
|
||||
|
||||
outputs = [
|
||||
|
||||
@@ -1,56 +1,88 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildNpmPackage,
|
||||
fetchFromGitHub,
|
||||
unzip,
|
||||
stdenvNoCC,
|
||||
vscodium,
|
||||
vscode-extensions,
|
||||
nodejs-slim,
|
||||
makeBinaryWrapper,
|
||||
unzip,
|
||||
runCommandLocal,
|
||||
}:
|
||||
|
||||
buildNpmPackage rec {
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
inherit (vscodium) version src;
|
||||
pname = "vscode-langservers-extracted";
|
||||
version = "4.10.0";
|
||||
|
||||
srcs = [
|
||||
(fetchFromGitHub {
|
||||
owner = "hrsh7th";
|
||||
repo = "vscode-langservers-extracted";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-3m9+HZY24xdlLcFKY/5DfvftqprwLJk0vve2ZO1aEWk=";
|
||||
})
|
||||
vscodium.src
|
||||
sourceRoot =
|
||||
if stdenvNoCC.hostPlatform.isDarwin then
|
||||
"VSCodium.app/Contents/Resources/app/extensions"
|
||||
else
|
||||
"resources/app/extensions";
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeBinaryWrapper
|
||||
]
|
||||
# The Darwin release is a zip.
|
||||
# stdenv unpacks the Linux tarball (tar.gz) natively.
|
||||
# FIXME: update vscodium.src to use fetchTarball & fetchZip
|
||||
++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [
|
||||
unzip
|
||||
];
|
||||
|
||||
sourceRoot = "source";
|
||||
__structuredAttrs = true;
|
||||
strictDeps = true;
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
npmDepsHash = "sha256-XGlFtmikUrnnWXsAYzTqw2K7Y2O0bUtYug0xXFIASBQ=";
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
for language in css html json; do
|
||||
server="$language-language-features/server/dist/node/''${language}ServerMain.js"
|
||||
install -Dm644 "$server" \
|
||||
"$out/lib/extensions/$server"
|
||||
makeBinaryWrapper ${lib.getExe nodejs-slim} "$out/bin/vscode-$language-language-server" \
|
||||
--add-flag "$out/lib/extensions/$server"
|
||||
done
|
||||
|
||||
buildPhase =
|
||||
let
|
||||
extensions =
|
||||
if stdenv.hostPlatform.isDarwin then
|
||||
"../VSCodium.app/Contents/Resources/app/extensions"
|
||||
else
|
||||
"../resources/app/extensions";
|
||||
in
|
||||
''
|
||||
npx babel ${extensions}/css-language-features/server/dist/node \
|
||||
--out-dir lib/css-language-server/node/
|
||||
npx babel ${extensions}/html-language-features/server/dist/node \
|
||||
--out-dir lib/html-language-server/node/
|
||||
npx babel ${extensions}/json-language-features/server/dist/node \
|
||||
--out-dir lib/json-language-server/node/
|
||||
cp -r ${vscode-extensions.dbaeumer.vscode-eslint}/share/vscode/extensions/dbaeumer.vscode-eslint/server/out \
|
||||
lib/eslint-language-server
|
||||
'';
|
||||
server="eslint-language-features/server/out/eslintServer.js"
|
||||
install -Dm644 "${vscode-extensions.dbaeumer.vscode-eslint}/share/vscode/extensions/dbaeumer.vscode-eslint/server/out/eslintServer.js" \
|
||||
"$out/lib/extensions/$server"
|
||||
makeBinaryWrapper ${lib.getExe nodejs-slim} "$out/bin/vscode-eslint-language-server" \
|
||||
--add-flag "$out/lib/extensions/$server"
|
||||
|
||||
# Use VSCodium bundled TypeScript
|
||||
mkdir -p "$out/lib/extensions/node_modules"
|
||||
cp -a node_modules/typescript "$out/lib/extensions/node_modules/typescript"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.tests.initialization =
|
||||
runCommandLocal "vscode-langservers-extracted-initialization"
|
||||
{
|
||||
nativeBuildInputs = [ finalAttrs.finalPackage ];
|
||||
}
|
||||
''
|
||||
request() {
|
||||
init_request='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":null,"rootUri":null,"capabilities":{}}}'
|
||||
content_length=''${#init_request}
|
||||
printf "Content-Length: %d\r\n\r\n%s" "$content_length" "$init_request"
|
||||
sleep 1
|
||||
}
|
||||
|
||||
for language in css html json eslint; do
|
||||
echo "Checking $language language server"
|
||||
response=$(request | timeout 3 "vscode-$language-language-server" --stdio) || true
|
||||
grep -q '"capabilities"' <<< "$response"
|
||||
done
|
||||
|
||||
touch $out
|
||||
'';
|
||||
|
||||
meta = {
|
||||
inherit (vscodium.meta) license platforms;
|
||||
description = "HTML/CSS/JSON/ESLint language servers extracted from vscode";
|
||||
homepage = "https://github.com/hrsh7th/vscode-langservers-extracted";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ lord-valen ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import ./generic.nix {
|
||||
version = "1.10.3";
|
||||
hash = "sha256-xf8/fHMkGGApPpKoOgpUJtttorOjf51E/S5KKguwiTM=";
|
||||
cargoHash = "sha256-zu2uKtJnMi8En5btKQWgACs3mLkHnbrxA5XUkwLP+yc=";
|
||||
version = "1.10.4";
|
||||
hash = "sha256-+PutvVt7mqnZN+/vr0FwstB8JPuO3kJ4TSmX2Sx8WvA=";
|
||||
cargoHash = "sha256-rfANfheiQnHEcbBODRW0nrPrlPdWQx3S7NmSQ50q010=";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user