Skip to content

looran/synoadm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

synoadm - customize Synology DSM devices

tested on DSM 7.0

2022, Laurent Ghigonis ooookiwi@gmail.com

Usage

$ synoadm
usage: ./synoadm <synology_ip> <action>
actions
   push_ssl_cert <domain.fullchain.pem> <domain.key>
   set_htaccess <htpasswd_file> <message>
environment variables
   SSH=ssh

Note when upgrading your Synology device

If you are using synoadm set_htaccess, before upgrading your Synology device you have to disable the htaccess and re-enable it afterwards.

Disabling htaccess can be done before or after reboot with the following command:

mv /etc/nginx/conf.d/alias.htaccess.conf /root
/usr/syno/bin/synosystemctl reload nginx

After you first log-in and check everything is running fine, re-enable htaccess:

mv /root/alias.htaccess.conf /etc/nginx/conf.d/
/usr/syno/bin/synosystemctl reload nginx

Example usage for push_ssl_cert

synoadm push_ssl_cert will set custom SSL certificates for the web interface managed by nginx. It has not been tested with other Synology services.

laptop $ synoadm 192.168.1.5 push_ssl_cert /tmp/domain.fullchain.pem /tmp/domain.key 

$ openssl x509 -in /tmp/domain.fullchain.pem -text
$ openssl rsa -in /tmp/domain.key -text
writing RSA key
$ ssh root@192.168.1.5 uname -ap
$ ssh root@192.168.1.5 cat > /usr/syno/etc/certificate/_archive/yoUheE/fullchain.pem
$ ssh root@192.168.1.5 cat > /usr/syno/etc/certificate/_archive/yoUheE/privkey.pem
$ ssh root@192.168.1.5 chmod 600 /usr/syno/etc/certificate/_archive/yoUheE/privkey.pem
$ ssh root@192.168.1.5 /usr/syno/bin/synosystemctl restart nginx
[nginx] restarted.
[*] done, 192.168.1.5 now uses new SSL certificates

Prerequisite: have root access to your Synology device

  1. Get ssh access to your device

see https://kb.synology.com/en-id/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet

  1. Allow 'root' user to log-in

put your public key in /root/.ssh/authorized_keys

Installation

$ sudo make install

Related projects

Synology NAS file management from command-line

Releases

No releases published

Packages

No packages published