HEX
Server: Apache/2.4.63 (Unix)
System: Linux TOMS-220NAS 4.4.302+ #86009 SMP Wed Nov 26 18:19:17 CST 2025 x86_64
User: flavio87 (1026)
PHP: 8.3.27
Disabled: NONE
Upload Files
File: //usr/syno/bin/tls-profile
#!/bin/bash

TLS_TOOL=/usr/syno/bin/synotlstool

service_length=$(/bin/cat /usr/syno/etc/security-profile/tls-profile/datastore.json |/bin/jq '.services | length')
# NOTE: if service entry i greater than zero, the configuration has already been initialized
if [[ $service_length -gt 0 ]]; then
	exit 0
fi

security_profile_path=/usr/local/libexec/security-profile
if [ ! -d "$security_profile_path" ]; then
	/usr/bin/mkdir -p "$security_profile_path"
	/usr/bin/chown root:root "$security_profile_path"
	/usr/bin/chmod 755 "$security_profile_path"
fi

tls_profile_path="$security_profile_path/tls-profile"

if [ ! -d "$tls_profile_path" ]; then
	/usr/bin/mkdir -p "$tls_profile_path"
	/usr/bin/chown root:root "$tls_profile_path"
	/usr/bin/chmod 755 "$tls_profile_path"
fi

dsm_static_service=$(/usr/bin/find /usr/syno/share/security-profile/tls-profile -name "*.conf")
for file in $dsm_static_service; do
	$TLS_TOOL --register "$file"
done

$TLS_TOOL --regen
$TLS_TOOL --render