Skip to content

[FEAT] Do not start server if $PASSWORD or $FILE__PASSWORD is present in the environment, but does not contain a usable password #207

Closed as not planned

Description

@norweeg

Is this a new feature request?

  • I have searched the existing issues

Wanted change

Make the image fail-closed so that, when the user starts the container with environment variables that imply they desire to secure the server with a password, but the password cannot be read or otherwise has a problem (e.g. a permissions issue with the file referenced by FILE__PASSWORD), that the server does not start but, instead, fails

Reason for change

to prevent users who believe they have secured the server with a password inadvertently running it effectively passwordless. Unless you are watching your logs, you may not notice that the password was not set, but the server was started anyway.

Proposed code change

No response

Activity

  1. github-actions commented on Aug 18, 2025

    @github-actions

    Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

  2. LinuxServer-CI commented on Sep 18, 2025

    @LinuxServer-CI
    Collaborator

    This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

  3. norweeg commented on Sep 18, 2025

    @norweeg
    Author

    not sure what further information I can provide for a feature request.....

  4. aptalca commented on Sep 18, 2025

    @aptalca
    Member

    Perhaps explain what you mean by usable password. Provide a compose yaml with which we can reproduce the scenario you're referring to.

    Currently if either of those vars are set, the auth parameters are passed to code-server with the value.

  5. norweeg commented on Sep 21, 2025

    @norweeg
    Author

    Perhaps explain what you mean by usable password. Provide a compose yaml with which we can reproduce the scenario you're referring to.

    Currently if either of those vars are set, the auth parameters are passed to code-server with the value.

    I did explain that. If you set FILE__PASSWORD, but the process cannot read the file (e.g. due to a file permissions issue) or the file does not exist (perhaps due to a typo in the file name), the server still starts, but without a password (fail open). The behavior should be changed to fail to start at all (fail close)

  6. aptalca commented on Sep 21, 2025

    @aptalca
    Member

    The title says Do not start server if $PASSWORD or $FILE__PASSWORD is present in the environment. . .. The crucial point here is that only PASSWORD is a var recognized by this container specifically, but not FILE__PASSWORD.

    The vars that are named FILE__blah are processed by the baseimages to set the value of env blah as the content of the file referenced. If the file is not accessible or does not exist, you get a log message stating that per https://github.com/linuxserver/docker-baseimage-ubuntu/blob/noble/root/etc/s6-overlay/s6-rc.d/init-envfile/run#L16 and no var will be set for blah.

    This container only cares about PASSWORD and if it's not set, it won't enable auth.

    If typos are a concern, then you could misspell the var names, too, ie. PASSWROD or FILE__PASWORD.

    In any case, you should always check the log when you create a new container or change the parameters.

  7. norweeg commented on Sep 22, 2025

    @norweeg
    Author

    I'm not saying you should protect users from EVERY possible scenario, but allowing the services to start when it is clear by the existence of a variable in the environment that the user clearly intended to have it protected by a password, but no password could be read, that the service should fail to start rather than failing open allowing open access to a service the user clearly did not intend to have open.

  8. aptalca commented on Sep 22, 2025

    @aptalca
    Member

    when it is clear by the existence of a variable in the environment that the user clearly intended to have it protected by a password

    It is not clear because FILE__PASSWORD is not a var that is recognized or tracked in this container. Only PASSWORD is. And in your case, PASSWORD var is not set, as listed in the container log.

  9. norweeg commented on Sep 22, 2025

    @norweeg
    Author

    when it is clear by the existence of a variable in the environment that the user clearly intended to have it protected by a password

    It is not clear because FILE__PASSWORD is not a var that is recognized or tracked in this container. Only PASSWORD is. And in your case, PASSWORD var is not set, as listed in the container log.

    then explain this section of README.md

  10. Roxedus commented on Sep 22, 2025

    @Roxedus
    Member

    The FILE__ logic is not tied to the logic used to start the service. The FILE__ logic will set the variable, if the file exists, and simply just not set it if that's not the case.

  11. LinuxServer-CI commented on Oct 23, 2025

    @LinuxServer-CI
    Collaborator

    This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

  12. norweeg commented on Oct 23, 2025

    @norweeg
    Author

    The FILE__ logic is not tied to the logic used to start the service. The FILE__ logic will set the variable, if the file exists, and simply just not set it if that's not the case.

    right. Therein lies the problem: consider the case that there was a problem reading the file (permissions issue, typo in file name, file was inaccessible on a network file system at the time the server was starting, or anything else that might cause the file to fail to be read), the system will treat this as if no password was set and start anyway without any password, exposing it to access across whatever network (up to and including the public internet) that the server is accessible from. What I am saying is that the existence of a non-null FILE__PASSWORD environment variable strongly implies that the user wanted there to be a password, therefore, the startup process should exit with an error indicating a problem reading the password from file (i.e. fail-close) instead of starting without a password (i.e. fail-open).

  13. aptalca commented on Oct 23, 2025

    @aptalca
    Member

    I don't think you understand what we're trying to tell you. FILE__PASSWORD is not a variable recognized by this container. The container does not recognize that you're trying to set a password. All it does is, convert whatever FILE__BLAH env var to a BLAH var.

    You can set an env var FILE__WHATEVERIWANT and it will simply attempt to set a var WHATEVERIWANT.

    When that type of conversion of any var fails, you get a log message. It does not matter (the code doesn't recognize or care) whether you're trying to set a password or not.

    Adding a special check for FILE__PASSWORD is not something I'm remotely interested in. The use case is too much of an edge case.

    With that said, feel free to customize the image to fit your needs: https://www.linuxserver.io/blog/2019-09-14-customizing-our-containers

  14. moved this from Issues to Done in Issue & PR Trackeron Oct 23, 2025
  15. norweeg commented on Oct 24, 2025

    @norweeg
    Author

    I don't think you understand what we're trying to tell you. FILE__PASSWORD is not a variable recognized by this container. The container does not recognize that you're trying to set a password. All it does is, convert whatever FILE__BLAH env var to a BLAH var.

    You can set an env var FILE__WHATEVERIWANT and it will simply attempt to set a var WHATEVERIWANT.

    When that type of conversion of any var fails, you get a log message. It does not matter (the code doesn't recognize or care) whether you're trying to set a password or not.

    Adding a special check for FILE__PASSWORD is not something I'm remotely interested in. The use case is too much of an edge case.

    With that said, feel free to customize the image to fit your needs: https://www.linuxserver.io/blog/2019-09-14-customizing-our-containers

    no, I understood you clearly the first time, that PASSWORD can be set by FILE__PASSWORD but PASSWORD is ultimately what is used. I don't think you understood my point that PASSWORD having no value because the user intentionally chose to not set it and PASSWORD having now value because of a read error when reading from the file indicated in FILE__PASSWORD are two completely different scenarios and ought to be treated as such, but sure, maintain a fail-open configuration in this and all your images that set password in this way. You can blame the user all you want and say "don't make typos" and "watch your logs" all you want to which I say not all start-ups are interactive. Sometimes they are automated, sometimes they are at boot and sometimes file reads can and do fail for a variety of reasons, including some which the user may not have knowledge or control over (e.g. network latency/connectivity issues of a network filesystem). Clearly you want to punish users who, whether it is their fault or not, unintentionally expose their unprotected server (and its embedded terminal) to any malicious actors who may attempt to access it thinking that they had at least put a password in front of it and to condescend to anyone suggesting that fail-open is bad and could easily be changed.

  16. LinuxServer-CI commented on Nov 24, 2025

    @LinuxServer-CI
    Collaborator

    This issue is locked due to inactivity

  17. locked as resolved and limited conversation to collaborators on Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions