Changing the Synology icons for Mac OS X Finder

I have been the happy owner of a Synology DS-1010+ NAS for some time now. The NAS works without problems since I got it and although it took a short while, it fully supports Mac OS X Lion after the last upgrade to DSM 3.2.

One of the things that had annoyed me for some time though, was that on the Mac Finder, the Synology NAS is shown as if it was a Windows host, both for the AFP shares as well as its TimeMachine function. Functionally nothing wrong, but not as I wanted. Since I had been playing with AFP and Avahi on Linux and set this up correctly in the past based on this blog post of Simon Wheatley,I decided to check whether I could achieve the same on my NAS.

Screenshot of Mac Finder after the patchAfter a bit of debugging I found out that the Synology NAS (DSM 3.2) was also using avahi, but that its configuration files were re-generated every time the avahi service was restarted based on the configuration of the NAS. To show the right icons in the finder meant 2 simple changes to the file /usr/syno/etc/rc.d/S99avahi.sh, which changes how the Synology NAS to what is depicted to the right

In the function AddTimeMachine(), one has to add the following just before the </service-group> tag:

  <service>
    <type>_device-info._tcp</type>
    <port>0</port>
    <txt-record>model=TimeCapsule</txt-record>   
  </service>

and in the function AddAFP(), the following must be added just before the </service-group> tag:

  <service>
    <type>_device-info._tcp</type>
    <port>0</port>
    <txt-record>model=Xserve</txt-record>   
  </service>

Next, the avahi service must be restarted/reloaded with the following command:

/usr/syno/etc/rc.d/S99avahi.sh reload

and after logging in again on you Mac the Finder will start showing the right icons (apparently this information is cached).

The resulting S99avahi.sh file for DSM3.2 that can be used as a drop-in replacement is attached to this post.

Monitoring e-mail while respecting someone’s privacy

My kids each have their own e-mail address. As they are still very young and not using checking their e-mail very frequently, my wife and I would like to be able to monitor what is happening while still respecting their privacy. They each have their own logins and we do not want to check their e-mail, but we do want to know what is happening and at least be aware that they received certain e-mails (i.e. reminders from the library that they need to return books).

Today I have implemented a simple solution for this using SIEVE rules using the folowing script:


require ["enotify", "variables"];

# Store the sender in a variable
if header :matches "From" "*" {
    set "from" "${1}";
}

# Store the subject in a variable
if header :matches "Subject" "*" {
    set "subject" "${1}";
}

# And notify the parent
notify :message "NAME has new mail from ${from}: ${subject}"
                           "mailto:user@mydomain.tld";

The script above simply stores the sender and subject in a variable and then uses the enotify SIEVE extention to notify a user by e-mail. This way we get notified of a new e-mail and know who sent it and what the subject was, without ever seeing the e-mail itself.

Please note that this script requires a mail server supporting SIEVE, e.g. Cyrus or Dovecot with SIEVE plugin, contact your system administrator to find out if you can use this. For a list of clients to manage rules, see this list.