Skip to content

Commit df630d0

Browse files
committed
fix: Allow SSH server to start
1 parent 9819514 commit df630d0

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

baseline/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ DEBIAN_FRONTEND=noninteractive apt install -y nginx \
1717
php-fileinfo php-posix php-json php-iconv php-ctype php-zip php-sockets \
1818
python3-pygments nodejs ca-certificates \
1919
sudo subversion mercurial php-xmlwriter php-opcache imagemagick php-imagick \
20-
postfix locales git python3-pip npm hostname php-apcu certbot supervisor mariadb-client cron
20+
postfix locales git python3-pip npm hostname php-apcu certbot supervisor mariadb-client cron openssh-server
2121

2222
# Do not start services automatically
2323
update-rc.d cron remove

docker-compose.yml.standalone

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ services:
1616
ports:
1717
- "1443:443"
1818
- "1080:80"
19-
- "1022:22"
19+
- "2222:2222"
20+
- "24:24"
2021
#volumes:
2122
# - /home/docker/phab-stand/repos:/repos
2223
# - /home/docker/phab-stand/extensions:/srv/phabricator/phabricator/src/extensions

preflight/run-ssh.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,25 @@ if [ "$PHABRICATOR_HOST_KEYS_PATH" == "" ]; then
1313
exit 0
1414
fi
1515

16+
# In case if not already present,
17+
# avoid 'Missing privilege separation directory: /run/sshd' error
18+
mkdir -p /run/sshd
19+
1620
# Generate SSH host keys if they aren't already present
1721
if [ ! -f /baked ]; then
1822
if [ -d $PHABRICATOR_HOST_KEYS_PATH ]; then
1923
cp -v $PHABRICATOR_HOST_KEYS_PATH/* /etc/ssh/
2024
#ensure correct file modes of private keys
2125
chmod 600 /etc/ssh/ssh_host_{dsa_,ecdsa_,ed25519_,,rsa_}key
2226
fi
23-
#generate missing keys --> sshd needs sometimes more keys for newer protocols
24-
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
25-
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
26-
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t ed25519
27-
28-
mkdir -pv $PHABRICATOR_HOST_KEYS_PATH
29-
#copy only when the file does not exist
30-
cp -vn /etc/ssh/ssh_host_{dsa_,ecdsa_,ed25519_,,rsa_}key{,.pub} $PHABRICATOR_HOST_KEYS_PATH/
27+
#generate missing keys --> sshd needs sometimes more keys for newer protocols
28+
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''; fi
29+
if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''; fi
30+
if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -t ed25519 -N ''; fi
31+
32+
mkdir -pv $PHABRICATOR_HOST_KEYS_PATH
33+
#copy only when the file does not exist
34+
cp -vn /etc/ssh/ssh_host_{dsa_,ecdsa_,ed25519_,,rsa_}key{,.pub} $PHABRICATOR_HOST_KEYS_PATH/
3135
fi
3236

3337
if [ ! -f /is-baking ]; then

preflight/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ echo '' >> /etc/php/7.4/fpm/php-fpm.conf
4949
echo 'php_value[include_path] = "/srv/phabricator/PHPExcel/Classes"' >> /etc/php/7.4/fpm/php-fpm.conf
5050

5151
# Move the default SSH to port 24
52-
echo "" >> /etc/ssh/sshd_config
53-
echo "Port 24" >> /etc/ssh/sshd_config
52+
mkdir -p /etc/ssh/sshd_config.d/
53+
echo "Port 24" >> /etc/ssh/sshd_config.d/phabricator_host_default.conf
5454

5555
# Configure Phabricator SSH service
5656
chown root:root /etc/phabricator-ssh/*

0 commit comments

Comments
 (0)