|
907 | 907 | ''; |
908 | 908 | }; |
909 | 909 |
|
| 910 | + secrets.activeRecordPrimaryKeyFile = mkOption { |
| 911 | + type = with types; nullOr path; |
| 912 | + default = null; |
| 913 | + description = '' |
| 914 | + A file containing the secret used to encrypt some rails data |
| 915 | + in the DB. This should not be the same as `services.gitlab.secrets.activeRecordDeterministicKeyFile`! |
| 916 | +
|
| 917 | + Make sure the secret is at ideally 32 characters and all random, |
| 918 | + no regular words or you'll be exposed to dictionary attacks. |
| 919 | +
|
| 920 | + This should be a string, not a nix path, since nix paths are |
| 921 | + copied into the world-readable nix store. |
| 922 | + ''; |
| 923 | + }; |
| 924 | + |
| 925 | + secrets.activeRecordDeterministicKeyFile = mkOption { |
| 926 | + type = with types; nullOr path; |
| 927 | + default = null; |
| 928 | + description = '' |
| 929 | + A file containing the secret used to encrypt some rails data in a deterministic way |
| 930 | + in the DB. This should not be the same as `services.gitlab.secrets.activeRecordPrimaryKeyFile`! |
| 931 | +
|
| 932 | + Make sure the secret is at ideally 32 characters and all random, |
| 933 | + no regular words or you'll be exposed to dictionary attacks. |
| 934 | +
|
| 935 | + This should be a string, not a nix path, since nix paths are |
| 936 | + copied into the world-readable nix store. |
| 937 | + ''; |
| 938 | + }; |
| 939 | + |
| 940 | + secrets.activeRecordSaltFile = mkOption { |
| 941 | + type = with types; nullOr path; |
| 942 | + default = null; |
| 943 | + description = '' |
| 944 | + A file containing the salt for active record encryption in the DB. |
| 945 | +
|
| 946 | + Make sure the secret is at ideally 32 characters and all random, |
| 947 | + no regular words or you'll be exposed to dictionary attacks. |
| 948 | +
|
| 949 | + This should be a string, not a nix path, since nix paths are |
| 950 | + copied into the world-readable nix store. |
| 951 | + ''; |
| 952 | + }; |
| 953 | + |
910 | 954 | extraShellConfig = mkOption { |
911 | 955 | type = types.attrs; |
912 | 956 | default = { }; |
@@ -1180,6 +1224,18 @@ in |
1180 | 1224 | assertion = cfg.secrets.jwsFile != null; |
1181 | 1225 | message = "services.gitlab.secrets.jwsFile must be set!"; |
1182 | 1226 | } |
| 1227 | + { |
| 1228 | + assertion = cfg.secrets.activeRecordPrimaryKeyFile != null; |
| 1229 | + message = "services.gitlab.secrets.activeRecordPrimaryKeyFile must be set!"; |
| 1230 | + } |
| 1231 | + { |
| 1232 | + assertion = cfg.secrets.activeRecordDeterministicKeyFile != null; |
| 1233 | + message = "services.gitlab.secrets.activeRecordDeterministicKeyFile must be set!"; |
| 1234 | + } |
| 1235 | + { |
| 1236 | + assertion = cfg.secrets.activeRecordSaltFile != null; |
| 1237 | + message = "services.gitlab.secrets.activeRecordSaltFile must be set!"; |
| 1238 | + } |
1183 | 1239 | { |
1184 | 1240 | assertion = versionAtLeast postgresqlPackage.version "14.9"; |
1185 | 1241 | message = "PostgreSQL >= 14.9 is required to run GitLab 17. Follow the instructions in the manual section for upgrading PostgreSQL here: https://nixos.org/manual/nixos/stable/index.html#module-services-postgres-upgrading"; |
@@ -1480,11 +1536,17 @@ in |
1480 | 1536 | db="$(<'${cfg.secrets.dbFile}')" |
1481 | 1537 | otp="$(<'${cfg.secrets.otpFile}')" |
1482 | 1538 | jws="$(<'${cfg.secrets.jwsFile}')" |
1483 | | - export secret db otp jws |
| 1539 | + arprimary="$(<'${cfg.secrets.activeRecordPrimaryKeyFile}')" |
| 1540 | + ardeterministic="$(<'${cfg.secrets.activeRecordDeterministicKeyFile}')" |
| 1541 | + arsalt="$(<'${cfg.secrets.activeRecordSaltFile}')" |
| 1542 | + export secret db otp jws arprimary ardeterministic arsalt |
1484 | 1543 | jq -n '{production: {secret_key_base: $ENV.secret, |
1485 | 1544 | otp_key_base: $ENV.otp, |
1486 | 1545 | db_key_base: $ENV.db, |
1487 | | - openid_connect_signing_key: $ENV.jws}}' \ |
| 1546 | + openid_connect_signing_key: $ENV.jws, |
| 1547 | + active_record_encryption_primary_key: $ENV.arprimary, |
| 1548 | + active_record_encryption_deterministic_key: $ENV.ardeterministic, |
| 1549 | + active_record_encryption_key_derivation_salt: $ENV.arsalt}}' \ |
1488 | 1550 | > '${cfg.statePath}/config/secrets.yml' |
1489 | 1551 | ) |
1490 | 1552 |
|
|
0 commit comments