mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-03-08 04:04:06 +01:00
nixos/lasuite-docs: add systemd service to create postgresql unaccent
function It is unsafe for a non-superadmin user to create a C functin in postgresql, so we need to create the function via the superadmin postgres user. This function (immutable unaccent) is needed by lasuite-docs since 4.2.0 and is used to search for keys without accents. https://github.com/suitenumerique/docs/releases/tag/v4.2.0 https://github.com/suitenumerique/docs/compare/v4.1.0...v4.2.0
This commit is contained in:
parent
ac57c05e28
commit
cdfc90c4e5
1 changed files with 50 additions and 0 deletions
|
|
@ -346,6 +346,56 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.lasuite-docs-postgresql-setup = mkIf cfg.postgresql.createLocally {
|
||||
wantedBy = [ "lasuite-docs.target" ];
|
||||
requiredBy = [ "lasuite-docs.service" ];
|
||||
before = [ "lasuite-docs.service" ];
|
||||
after = [ "postgresql-setup.service" ];
|
||||
|
||||
serviceConfig = {
|
||||
Slice = "system-lasuite-docs.slice";
|
||||
Type = "oneshot";
|
||||
User = "postgres";
|
||||
|
||||
# lasuite-docs user cannot create a C function as it is unsafe.
|
||||
ExecStart = ''
|
||||
${lib.getExe' config.services.postgresql.package "psql"} --port=${toString config.services.postgresql.settings.port} -d lasuite-docs -c "CREATE OR REPLACE FUNCTION public.immutable_unaccent(regdictionary, text) RETURNS text LANGUAGE c IMMUTABLE PARALLEL SAFE STRICT AS '$libdir/unaccent', 'unaccent_dict';"
|
||||
'';
|
||||
|
||||
# hardening
|
||||
AmbientCapabilities = "";
|
||||
CapabilityBoundingSet = [ "" ];
|
||||
DevicePolicy = "closed";
|
||||
LockPersonality = true;
|
||||
NoNewPrivileges = true;
|
||||
PrivateDevices = true;
|
||||
PrivateTmp = true;
|
||||
PrivateUsers = true;
|
||||
ProcSubset = "pid";
|
||||
ProtectClock = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectHome = true;
|
||||
ProtectHostname = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectProc = "invisible";
|
||||
ProtectSystem = "strict";
|
||||
RemoveIPC = true;
|
||||
RestrictAddressFamilies = [
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
"AF_UNIX"
|
||||
];
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
RestrictSUIDSGID = true;
|
||||
SystemCallArchitectures = "native";
|
||||
UMask = "0077";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
systemd.services.lasuite-docs = {
|
||||
description = "Docs from SuiteNumérique";
|
||||
after = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue