add support to sshd_config.d

<!--- Provide a general summary of your changes in the Title above -->

[linuxserverurl]: https://linuxserver.io
[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)][linuxserverurl]

<!--- Before submitting a pull request please check the following -->

<!---  If this is a fix for a typo (in code, documentation, or the README) please file an issue and let us sort it out. We do not need a PR  -->
<!---  Ask yourself if this modification is something the whole userbase will benefit from, if this is a specific change for corner case functionality or plugins please look at making a Docker Mod or local script  https://blog.linuxserver.io/2019/09/14/customizing-our-containers/ -->
<!---  That if the PR is addressing an existing issue include, closes #<issue number> , in the body of the PR commit message   -->
<!---  You have included links to any files / patches etc your PR may be using in the body of the PR commit message -->
<!--- We maintain a changelog of major revisions to the container at the end of readme-vars.yml in the root of this repository, please add your changes there if appropriate -->

<!--- Coding guidelines: -->
<!--- 1. Installed packages in the Dockerfiles should be in alphabetical order -->
<!--- 2. Changes to Dockerfile should be replicated in Dockerfile.armhf and Dockerfile.aarch64 if applicable -->
<!--- 3. Indentation style (tabs vs 4 spaces vs 1 space) should match the rest of the document -->
<!--- 4. Readme is auto generated from readme-vars.yml, make your changes there -->

------------------------------

 - [ ] I have read the [contributing](https://github.com/linuxserver/docker-openssh-server/blob/master/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications

------------------------------

<!--- We welcome all PR’s though this doesn’t guarantee it will be accepted. -->

## Description:
<!--- Describe your changes in detail -->

## Benefits of this PR and context:
<!--- Please explain why we should accept this PR. If this fixes an outstanding bug, please reference the issue # -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Source / References:
<!--- Please include any forum posts/github links relevant to the PR -->
This commit is contained in:
Boshi Lian 2025-02-05 00:11:43 -08:00
parent 74ea2c9d96
commit a72a425b0d

View File

@ -33,7 +33,6 @@ echo "${USER_NAME}:${USER_PASSWORD}" | chpasswd
# Migration
if [[ -f /config/ssh_host_keys/sshd_config ]]; then
mv /config/ssh_host_keys/sshd_config /config/sshd/sshd_config
sed -i 's/Include \/etc\/ssh\/sshd_config.d\/\*.conf/#Include \/etc\/ssh\/sshd_config.d\/\*.conf/' /config/sshd/sshd_config
echo "This file has been moved to /config/sshd/sshd_config" > /config/ssh_host_keys/sshd_config_README
chmod 600 /config/ssh_host_keys/ssh_host_*_key
chmod 644 /config/ssh_host_keys/ssh_host_*_key.pub
@ -41,10 +40,11 @@ fi
if [[ ! -f /config/sshd/sshd_config ]]; then
sed -i '/#PidFile/c\PidFile \/config\/sshd.pid' /etc/ssh/sshd_config
sed -i 's/Include \/etc\/ssh\/sshd_config.d\/\*.conf/#Include \/etc\/ssh\/sshd_config.d\/\*.conf/' /etc/ssh/sshd_config
cp -a /etc/ssh/sshd_config /config/sshd/sshd_config
fi
sed -i 's/Include \/etc\/ssh\/sshd_config.d\/\*.conf/Include \/config\/sshd\/sshd_config.d\/\*.conf/' /config/sshd/sshd_config
if [[ ! -d /config/ssh_host_keys ]]; then
mkdir -p /config/ssh_host_keys
ssh-keygen -A