-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
Provide options for storing secrets outside the Nix store #24288
Copy link
Copy link
Open
Labels
1.severity: securityIssues which raise a security issue, or PRs that fix oneIssues which raise a security issue, or PRs that fix one5.scope: trackingLong-lived issue tracking long-term fixes or multiple sub-problemsLong-lived issue tracking long-term fixes or multiple sub-problems6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOSIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Milestone
Metadata
Metadata
Assignees
Labels
1.severity: securityIssues which raise a security issue, or PRs that fix oneIssues which raise a security issue, or PRs that fix one5.scope: trackingLong-lived issue tracking long-term fixes or multiple sub-problemsLong-lived issue tracking long-term fixes or multiple sub-problems6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOSIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Fields
Give feedbackNo fields configured for issues without a type.
Introduction
Dear module authors and maintainers,
We currently have many modules that force users to store their secrets in the world-readble Nix store. This is bad for security. We should give users the option of specifying their secrets in individual files which can be stored outside the Nix store with suitable ownership and permissions. Users could then also use
nixopsto manage their secret files.There's still the convenient but unsafe option of storing the secret file in the Nix store using
pkgs.writeTextFile. If NixOS/nix#8 gets resolved these files can be encrypted / made private. Also see: NixOS/rfcs#5.Proposal
The list below contains all the options that force a secret being stored in the Nix store. I propose the following:
Each option should get a warning in the documentation of the form: "Warning: this secret is stored in the world-readable Nix store!"
Each option should get an alternative
passwordFileoption.For backwards compatibility the
passwordFileoption should get a default based on thepasswordoption:Some upstream programs don't support setting a password using a file. In that case an issue should be created in the upstream issue-tracker asking for that feature. (See Support specifying rpcpassword by file namecoin/namecoin-core#148 for example). A URL to the issue should be placed in the list below and in the documentation of the
passwordoption so that it's easier to track when it gets resolved.If after some time (lets use September 2017 for now) the upstream developers have not provided the feature to specify the password by file, the NixOS module should be changed such that the config file that contains the password is written to
/runbefore the service starts up. So something like the following:Lets use this issue for planning and to track progress. Please mention in the comments if you have provided a
passwordFileoption for one of the options below. Then I check the box to indicate it has been resolved. See PR wordpress: replace the dbPassword option with dbPasswordFile #24146 for reference.If we make sure the new options are backwards compatible we could consider cherry-picking them onto
release-17.03making sure users get these security fixes ASAP.Secret options
basicAuthnixos/modules/services/web-servers/nginx/vhost-options.nix#L118
@globin
networking.defaultMailServer.authPassnixos/modules/programs/ssmtp.nix#L92
PR: ssmtp: use the authPassFile option instead of authPass #24331
networking.wireless.networks.*.psknixos/modules/services/networking/wpa_supplicant.nix#L49
@edolstra
security.duosec.skeynixos/modules/security/duosec.nix#L59
@thoughtpolice
services.aiccu.passwordnixos/modules/services/networking/aiccu.nix#L48@edwtjo mentions: SixXS is closing down its IPv6 tunnel in June so it doesn't seem worth the effort to create a patch for aiccu to support password files. Lets just remove the service in 0606.
services.almir.director_passwordnixos/modules/services/backup/almir.nix#L129
@domenkozar
services.bacula-dir.passwordnixos/modules/services/backup/bacula.nix#L313
@domenkozar
Feature request for a PasswordFile parameter
services.bacula-[fd|sd].director.*.passwordnixos/modules/services/backup/bacula.nix#L114
@domenkozar
See the feature request above.
services.bepasty.servers.*.secretKeynixos/modules/services/misc/bepasty.nix#L72
@makefu
PR: bepasty: add secretKeyFile option #24755
services.btsync.httpPassnixos/modules/services/networking/btsync.nix#L175
@thoughtpolice
services.buildbot-worker.workerPassnixos/modules/services/continuous-integration/buildbot/worker.nix#L56
@nand0p
services.cadvisor.storageDriverPasswordnixos/modules/services/monitoring/cadvisor.nix#L54
@offlinehacker
PR: cadviser: add storageDriverPasswordFile option #24341
services.cassandra.keyStorePasswordnixos/modules/services/databases/cassandra.nix#L236
@cransom
See: https://issues.apache.org/jira/browse/CASSANDRA-13428
services.cassandra.trustStorePasswordnixos/modules/services/databases/cassandra.nix#L241
@cransom
See: https://issues.apache.org/jira/browse/CASSANDRA-13428
services.cgminer.pools.*.passwordnixos/modules/services/misc/cgminer.nix#L60
@offlinehacker
services.cjdns.authorizedPasswordsnixos/modules/services/networking/cjdns.nix#L103
@ehmry
services.cfdyndns.apikeynixos/modules/services/misc/cfdyndns.nix#L20
@colemickens
services.coturn.cli-passwordnixos/modules/services/networking/coturn.nix#L249
@Ralith
services.coturn.static-auth-secretnixos/modules/services/networking/coturn.nix#L174
@Ralith
services.cpuminer-cryptonight.passnixos/modules/services/misc/cpuminer-cryptonight.nix#L38
@ehmry
services.crowd.openidPasswordnixos/modules/services/web-apps/atlassian/crowd.nix#L53
@fpletz @globin
services.dd-agent.api_keynixos/modules/services/monitoring/dd-agent.nix#L112
@shlevy
services.ddclient.passwordnixos/modules/services/networking/ddclient.nix#L47
@rbvermaa
services.factorio.game-passwordnixos/modules/services/games/factorio.nix#L144
@elitak
services.factorio.passwordnixos/modules/services/games/factorio.nix#L130
@elitak
services.frab.secretKeyBasnixos/modules/services/web-apps/frab.nix#L118
@fpletz
services.gammu-smsd.backend.sql.passwordnixos/modules/services/misc/gammu-smsd.nix#L192
@zohl
services.gitlab.databasePasswordnixos/modules/services/misc/gitlab.nix#L203
@fpletz @offlinehacker
PR: nixos/gitlab: Store secrets in files rather than the store #31358
services.gitlab.secrets.secretnixos/modules/services/misc/gitlab.nix#L326
@fpletz @offlinehacker
PR: nixos/gitlab: Store secrets in files rather than the store #31358
services.gitlab.smtp.passwordnixos/modules/services/misc/gitlab.nix#L295
@fpletz @offlinehacker
services.gogs.database.passwordnixos/modules/services/misc/gogs.nix#L102
@schneefux
PR: Gogs service password handling improvements #25116
services.grafana.database.passwordnixos/modules/services/monitoring/grafana.nix#L137
@offlinehacker
services.grafana.security.adminPasswordnixos/modules/services/monitoring/grafana.nix#L157
@offlinehacker
services.grafana.security.secretKeynixos/modules/services/monitoring/grafana.nix#L163
@offlinehacker
services.graylog.passwordSecretnixos/modules/services/logging/graylog.nix#L68
@fadenb
services.graylog.rootPasswordSha2nixos/modules/services/logging/graylog.nix#L82
@fadenb
services.hologram-server.ldapBindPasswordnixos/modules/services/security/hologram-server.nix#L68
@nand0p
services.hostapd.wpaPassphrasenixos/modules/services/networking/hostapd.nix#L124
services.httpd.extraSubservices..."limesurvey"...adminPasswordnixos/modules/services/web-servers/apache-httpd/limesurvey.nix#L143
@offlinehacker
services.httpd.extraSubservices..."limesurvey"...dbPasswordnixos/modules/services/web-servers/apache-httpd/limesurvey.nix#L131
@offlinehacker
services.httpd.extraSubservices..."mediawiki"...dbPasswordnixos/modules/services/web-servers/apache-httpd/mediawiki.nix#L207
@shlevy @ip1981
services.httpd.extraSubservices..."owncloud"...adminPasswordnixos/modules/services/web-servers/apache-httpd/owncloud.nix#L403
@matejc
services.httpd.extraSubservices..."owncloud"...dbPasswordnixos/modules/services/web-servers/apache-httpd/owncloud.nix#L429
@matejc
services.httpd.extraSubservices..."owncloud"...SMTPPassnixos/modules/services/web-servers/apache-httpd/owncloud.nix#L527
@matejc
services.httpd.extraSubservices..."wordpress"...dbPasswordnixos/modules/services/web-servers/apache-httpd/wordpress.nix#L138
@qknight
PR: wordpress: replace the dbPassword option with dbPasswordFile #24146
services.i2pd.proto.http.passnixos/modules/services/networking/i2pd.nix#L351
@edwtjo
services.icecast.admin.passwordnixos/modules/services/audio/icecast.nix#L62
@k0ral
services.longview.mysqlPasswordnixos/modules/services/monitoring/longview.nix#L78
@rvl
PR: longview service: don't write passwords to nix store #24366
services.matrix-synapse.macaroon_secret_keynixos/modules/services/misc/matrix-synapse.nix#L545
@roblabla
services.matrix-synapse.registration_shared_secretnixos/modules/services/misc/matrix-synapse.nix#L453
@roblabla
services.matrix-synapse.turn_shared_secretnixos/modules/services/misc/matrix-synapse.nix#L434
@roblabla
services.matrix-synapse.recaptcha_private_keynixos/modules/services/misc/matrix-synapse.nix#L404
@roblabla
services.mattermost.localDatabasePasswordnixos/modules/services/web-apps/mattermost.nix#L108
@fpletz
services.murmur.passwordnixos/modules/services/networking/murmur.nix#L105
@thoughtpolice
services.mysql.replication.masterPasswordnixos/modules/services/databases/mysql.nix#L149
@edolstra
services.namecoind.rpc.passwordnixos/modules/services/networking/namecoind.nix#L90
@rnhmjoj
See: Support specifying rpcpassword by file namecoin/namecoin-core#148
services.nntp-proxy.upstreamPasswordnixos/modules/services/networking/nntp-proxy.nix#L99
@fadenb
services.oauth2_proxy.cookie.secretnixos/modules/services/security/oauth2_proxy.nix#L371
@jml
services.panamax.secretKeynixos/modules/services/cluster/panamax.nix#L63
@matejc
services.prometheus.*.consul_sd_config.passwordnixos/modules/services/monitoring/prometheus/default.nix#L243
@fpletz @doshitan
services.prometheus.*.scrape_config.basic_auth.passwordnixos/modules/services/monitoring/prometheus/default.nix#L128
@fpletz @doshitan
services.prometheus.unifiExporter.unifiPasswordnixos/modules/services/monitoring/prometheus/unifi-exporter.nix#L45
@fpletz @doshitan
services.redis.requirePassnixos/modules/services/databases/redis.nix#L160
@offlinehacker
services.redmine.databasePasswordnixos/modules/services/misc/redmine.nix#L103
@domenkozar
services.redsocks.redsocks.passwordnixos/modules/services/networking/redsocks.nix#L109
@Ekleog
services.rippleDataApi.couchdb.passnixos/modules/services/misc/ripple-data-api.nix#L109
@offlinehacker
services.rippled.ports.*.passwordnixos/modules/services/misc/rippled.nix#L114
@ehmry
services.selfoss.database.passwordnixos/modules/services/web-apps/selfoss.nix#L89
@regnat
services.terraria..passwordnixos/modules/services/games/terraria.nix#L50
@pshendry @garbas
services.tor.torsocks.socks5Passwordnixos/modules/services/security/torsocks.nix#L89
@thoughtpolice
services.tt-rss.database.passwordnixos/modules/services/web-apps/tt-rss.nix#L163
@zohl
services.tt-rss.email.passwordnixos/modules/services/web-apps/tt-rss.nix#L291
@zohl
services.wakeonlan.interfaces.*.passwordnixos/modules/services/networking/wakeonlan.nix#L32
services.yandex-disk.passwordnixos/modules/services/network-filesystems/yandex-disk.nix#L38
@grwlf @7c6f434c
services.zabbixServer.dbPasswordnixos/modules/services/monitoring/zabbix-server.nix#L66
@robberer
This list was compiled by running the following in
<nixpkgs>and manually inspecting and processing the result: