Category Archives: Synology

Synology Docker MariaDb / .NET Core 6 / Homewizzard Electrical meter reading

HomeWizard P1 meter

Recently I came across a small device that can be connected to the Smart Energy Meter as it is used in the Netherlands, among other places:

HomeWizard.nl

This small device is connected to the P1 port of the smart meter. The HomeWizzard is then connected to the WiFi network.

The HomeWizzard device publishes a REST api at this endpoint https://[your-homewizzard-device-ip]/api/v1/data.

Continue reading
Share

Synology and usb share numbering

synology_diskstationWhen you connect a USB device to your Synology diskstation a share is created with a sequence number. The last number assigned (and the device id it is assigned to) is stored in the file /usr/syno/etc/usbno_guid.map.

You can delete devices you no longer use and assign your own numbers here to the USB shares. This is very usefull when you have backup tasks that backup to a specific USB share (like I have).

Share

Add SSH user to your Synology Diskstation

It is best not to SSH into your diskstation with your admin or root account. Create a separate user for this with the appropriate permissions. The steps below outline the procedure to create a new user with SSH access to your diskstation.

1. Create a user through the webinterface, DSM, of your diskstation.

2. Open a (root) terminal on your diskstation and edit the password file:

vi /etc/passwd

The last line in this file is your new user. The user cannot login because the shell is set to /sbin/nologin. Change the /sbin/nologin to /bin/ash

Copy the $HOME/.profile to /var/services/homes/[new user]
Edit this .profile file and change the value of $HOME to /var/services/homes/[new user]

3. Now you can login to your diskstation with SSH and username / password:

ssh newuser@diskstation.local

4. To automate the login procedure create an rsa public/private key pair (this should be done on your local machine; not your diskstation). For this to work be sure to enable the “User home service” on your diskstation (press User Home button on user control panel).

# Keep the defaults if possible; filename is id_rsa; remember your passphrase!
ssh-keygen

5. Copy the public part of the key to your NAS to $HOME/.ssh

6. Create an authorized key file and set file permission to user-read only:

cd $HOME/.ssh
cat [your_public_key_file] >> authorized_keys
chmod 400 authorized_keys
rm [your_public_key_file]

7. Exit your terminal

8. SSH again to your diskstation; type your passphrase and you are in:

ssh newuser@diskstation.local
Share
Synology

Synology DiskStation and using a custom SSL certificate

The original post can be found here. For archiving purposes and quick access I have copied this to my blog.

Prepare your Synology DiskStation

openssl synology

  • At first you should generate a temporary work folder. For example /usr/local/ssl/ and cd to this location.

The generation of SSL-certificates is always in two steps. At first you have to generate a certificate authority key. Then you generate a server certificate out of the certificate authority key. The server certificate will be used when starting the webserver. The certificate authority key has to be installed on the client pc.

Generation of the certificate authority key

  1. During the key generation you have to enter a passphrase which you need later to generate the certificates. Generate the key ca.key with the following command (openssl is pre-installed on your synology):
    openssl genrsa -des3 -out ca.key 1024
  2. Generation of the key certificate:
    openssl req -new -key ca.key -out ca.csr
  3. Generation of the final certificate authority key (valid 10 years):
    openssl x509 -days 3650 -signkey ca.key -in ca.csr -req -out ca.crt

Generation of the server-certificate

    1. Generation of the key:
      openssl genrsa -out server.key 1024
    2. |Generation of the key certificate – most important is the Common Name. It is important that it matches your DNS-Name. Example: name.dyndns.org. You can also use wildcards like *.name.dyndns.org.
      openssl req -new -key server.key -out server.csr
    3. Generation of the server certificate:
      openssl x509 -days 3650 -CA ca.crt -CAkey ca.key -set_serial 01 -in server.csr -req -out server.crt

Installing the files

      1. Change into the Synology certificate folder:
        cd /usr/syno/etc/ssl
      2. Make a backup folder for the old files:
        mkdir bak
      3. Copy the old files into the backup folder:
        cp -r ssl.crt bak
        cp -r ssl.csr bak
        cp -r ssl.key bak
      4. Move the new files to the certificate folder:
        mv /usr/local/ssl/ca.crt ssl.crt
        mv /usr/local/ssl/server.crt ssl.crt
        mv /usr/local/ssl/ca.csr ssl.csr
        mv /usr/local/ssl/server.csr ssl.csr
        mv /usr/local/ssl/ca.key ssl.key
        mv /usr/local/ssl/server.key ssl.key
      5. The ca.crt has to be installed on the client workstations. For this we copy the file into the folder public.
        cp /usr/syno/etc/ssl/ssl.crt/ca.crt /volume1/public
      6. Restart your Synology Station

Installation of the certificate on the client workstation

Finally the certificate has to installed on the client workstations as a trusted certificate authority. Copy the file ca.crt to the client pc. Install it within windows explorer with rightclick -> install certificate.

Restoring certificates

In case something goes wrong, Synology has supplied an easy way to, not restore, but create a set of new and working certificates. This should restore the certificates if importing certificates from the web manager has failed. If you need a telnet or ssh client use PuTTY.

      • Login as root, using the admin users password, to the Synology NAS drive using telnet or ssh and type the following in the command prompt:
        cd /usr/syno/etc/ssl/
        ./mkcert.sh
      • Allow the script to finish, and type reboot in the prompt.
      • In a while the NAS drive should have rebooted, and everything should be fine again.
Share
Synology

Subversion installation on your Synology DiskStation

subversionOn the SynologyWiki is an excellent article about installing Subversion on to your synology diskstation. Is is a step by step guide describing all the details for installing subversion on your diskstation.

Integrate Subversion and Visual Studio

You can also integrate SVN with your visual studio environment (almost like TFS). With the software from ankhSVN, for example, you can perfectly integrate SVN and Visual Studio (2008).

Use the Options window to configure the ankhSVN plugin:
image001
The file “app.config” is checked out; other files are also under version control

image002

View all of your pending changes.
image003

All other regular source control options, like banching and merging, labeling, shelving etcetera are all available.

Share