sshd_config - make 'Port' config key overridable using an env var#382
Open
FXHibon wants to merge 2 commits intoatmoz:masterfrom
Open
sshd_config - make 'Port' config key overridable using an env var#382FXHibon wants to merge 2 commits intoatmoz:masterfrom
FXHibon wants to merge 2 commits intoatmoz:masterfrom
Conversation
1599bc9 to
e34a4a2
Compare
|
Hello, |
Closed
|
I found this PR because I need exactly this feature - @atmoz any chance of merging it? |
|
This PR seems to add a lot of bashisms for a unique and specific SSHd configuration stanza. In my context I'd favor #383 ; then customizing echo 'Port 12345' > port.conf
docker run -p 12345:22 -v $PWD/port.conf:/etc/ssh/sshd_config.d/port.conf atmoz/sftpAnd you'd be able to customize anything In both cases, removing the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As atmoz/sftp is a docker image by design, one can already simply change the exposed port of the running server using the appropriate docker run options, to map the internal port 22 to any external port.
It works very well in the majority of cases, as I've been able to experiment it myself.
However, there are a few cases where it is either not wanted or not possible to use this port mapping features.
For example, if you use atmoz/sftp in a CircleCI build, you won't be able to change the port mapping ( https://discuss.circleci.com/t/change-db-containers-ports/30234/6 ), even while the port 22 is reserved by CircleCI, and not usable to containers launched in the tests.
I've read about the custom scripts located in
/etc/sftp.d( https://github.com/atmoz/sftp#execute-custom-scripts-or-applications ) that might already allow one to override everything we want, but that might sounds a bit overengineered to provide a custom executable bash scripts to update a simple config key (this is opinionated, I'm ready to hear any different opinions on this)Given the reasons listed above, I feel that it is reasonable to allow a user to override the SSHD port using a simple environment variable.
This Pull Request suggests an implementation of this.