added initialization of .ssh directory

main
Andre Challier 2024-03-27 15:41:03 +01:00
parent 249fe44224
commit f637921bb2
2 changed files with 54 additions and 0 deletions

1
.env
View File

@ -2,3 +2,4 @@ WEBHOOK_GIT_DATA_PATH=/path/to/webhook-git/data
WEBHOOK_SECRET=1234
NGINX_NETWORK=network-name
WEBHOOK_GIT_NETWORK=network-name
GIT_SERVER=git.example.com

View File

@ -20,6 +20,59 @@ else
echo "Generated $output_file"
fi
#
# Copy ssh keys and config
#
path_ssh="/root/.ssh/"
path_programm_key="/data/ssh/programm-webhook.deploy.ed25519"
path_programm_pub="/data/ssh/programm-webhook.deploy.ed25519"
path_assets_key="/data/ssh/assets-webhook.deploy.ed25519"
path_assets_pub="/data/ssh/assets-webhook.deploy.ed25519"
path_ssh_config="/data/ssh/config"
if [ ! -f "$path_programm_key" ];
then
echo "Error: repository key $path_programm_key does not exist"
else
cp "$path_programm_key" "$path_ssh"
fi
if [ ! -f "$path_programm_publ" ];
then
echo "Error: repository public key $path_programm_pub does not exist"
else
cp "$path_programm_pub" "$path_ssh"
fi
if [ ! -f "$path_assets_key" ];
then
echo "Error: assets key $path_assets_key does not exist"
else
cp "$path_assets_key" "$path_ssh"
fi
if [ ! -f "$path_assets_pub" ];
then
echo "Error: assets public key $path_assets_pub does not exist"
else
cp "$path_assets_pub" "$path_ssh"
fi
if [ ! -f "$path_ssh_config" ];
then
echo "Error: ssh config $path_ssh_config does not exist"
else
cp "$path_ssh_config" "$path_ssh"
fi
#
# Create known_hosts
#
ssh-keyscan ${GIT_SERVER} >> /root/.ssh/known_hosts
#
# Start webhooks
#