Commit c4f2ffe3 authored by pasden's avatar pasden 💬
Browse files

Fix enable_encrypt_syno.sh

parent 2802d6af
#!/bin/sh
container_name="itinvent"
syno_certs_path="/usr/syno/etc/certificate/_archive/DmsD54"
CONTAINER_NAME="itinvent"
docker cp $syno_certs_path/cert.pem $container_name:/var/opt/mssql/data/cert.pem
docker cp $syno_certs_path/privkey.pem $container_name:/var/opt/mssql/data/privkey.pem
# HOST_NAME - the name of the host for which the Let's Encrypt certificate was issued
HOST_NAME="yourHost"
# this is where the certificate obtained using Let's Encrypt is stored
FOLDER_CERTS=$(sh -c "cat /usr/syno/etc/certificate/_archive/INFO | jq '. | to_entries | .[] | select(.value.services[0].display_name==\"${HOST_NAME}\").key' | tr -d \\\" ")
SYNO_PATH_CERTS="/usr/syno/etc/certificate/_archive/${FOLDER_CERTS}"
docker cp "${SYNO_PATH_CERTS}"/cert.pem $CONTAINER_NAME:/var/opt/mssql/data/cert.pem
docker cp "${SYNO_PATH_CERTS}"/privkey.pem $CONTAINER_NAME:/var/opt/mssql/data/privkey.pem
# https://ask-ubuntu.ru/questions/41943/letsencrypt-dlya-sql-server-v-linux
docker exec -it $container_name /bin/sh -c "\
docker exec -it $CONTAINER_NAME /bin/sh -c "\
cd /var/opt/mssql/data/; \
openssl rsa -in ./privkey.pem -out ./mssql.key; \
chown root:root ./cert.pem ./mssql.key; \
......@@ -15,7 +21,7 @@ chmod 600 ./cert.pem ./mssql.key; \
/opt/mssql/bin/mssql-conf set network.tlscert /var/opt/mssql/data/cert.pem; \
/opt/mssql/bin/mssql-conf set network.tlskey /var/opt/mssql/data/mssql.key; \
/opt/mssql/bin/mssql-conf set network.tlsprotocols 1.2; \
/opt/mssql/bin/mssql-conf set network.forceencryption 1; \
/opt/mssql/bin/mssql-conf set network.forceencryption 0; \
"
docker restart $container_name
docker logs -f $container_name
docker restart $CONTAINER_NAME
docker logs -f $CONTAINER_NAME
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment