lorenzo milesi Posts

25 maggio 2018 / / english

There’s a long standing discussion on how to force update using ddclient, because DynDNS services tipically deactivate your host if it doesn’t send an update for a certain period. And nowadays xDSL are much more stable than they used to be, so you may retain the same IP address for more than one month.

This is usually a problem, so from time to time you either have to confirm the host or update it with a fake address in order to keep it active.

Since ddclient devs still have to implement such an option I found a workaround: update weekly with a fake IP address. Clever, ain’t it? But how to accopmplish it?

17 maggio 2018 / / english

With the release of Ubuntu 18.04 Bionic Beaver administrators need to learn new tools for network management, namely iproute and netplan.

iproute has been around for quite a while, so it’s not that new. It’s a replacement of ifconfig and it’s very easy and comfortable once you learn the syntax.

netplan instead is pretty new to me, I never heard about it before. I got to know about it thanks to an excellent What’s new page on DigitalOcean, and I found out my good ol’ /etc/network/interfaces has gone. So what’s now? a YAML configuration file! I’ve never been fond of yaml, but I also admit  I never used it consistently, so let’s give it a hope.

21 aprile 2018 / / english

HTTP/2 is the volution of the HTTP/1.1 protocol, originally  developed by  Google as SPDY it’s now a standard, and gives webserver faster responses to  visitors.

First of all make sure your webserver is HTTP/2 enabled.

14 aprile 2018 / / english

I’ve installed a brand new RaspberriPi3 with Raspbian, based on Debian 9.4 Stretch.

At first I tried LiberELEC, but I didn’t find myself comfortable with not having full ssh freedom. Some commands were missing, and some packages the same.

So I turned back and installed Raspbian 9.4 Stretch, also to be  able to remotely  access the mediacenter via VNC and other stuff.

Since I didn’t mean to have keyboard and mouse connected to the Raspberry I wanted to have Kodi started at boot.

13 febbraio 2018 / / english
29 gennaio 2018 / / english

Last year we moved from a traditional Samba based network to a Nextcloud based one. Despite having some more space taken on the local disk we have the advantage of being able to work everywhere, having files backed up immediately (or at least as soon as there’s a network connection) and still being able to limit file access through groups selection.

With the old Samba configuration we had ssh access to the main server where we hold the office ssh key, and from which we start most of our remote sessions. When the file was on the filesystem it was rather easy to adapt permissions to allow unprivileged user to read the key, but now with Nextcloud the files are not accessible anymore (because the storage is encrypted! Otherwise you can access it in Nextcloud data dir).

But we still have the chance to mount Nextcloud via webdav. This is easily achievable by following Nextcloud user manual about mounting from command line.

But in the past, at least with Ubuntu 12.04, davfs mounts weren’t very much stable… Also it’s annoying to remember to mount the share when you need, but most of all remembering to unmount it before logging out (or when your session terminates unexpectedly). So I had the goal to use autofs to mount user’s Nextcloud share automatically, and of course leave them unmounted when not needed.

22 dicembre 2017 / / english

Quick tip for managing postfix’s mail queues. A customer uses an old mailing software and he got subscription of unknown domains, which then remains in queue for long time. To purge a single domain from your mail queue use the following command:

mailq | grep -B3 "\.ovh$" | grep "^[0-9A-Z]" | cut -f 1 -d ' ' | xargs -n 1 postsuper -d

this will delete all mails in queue for the TLD .ovh.

13 dicembre 2017 / / english

To debug email sending in Yii2 you have the useFileTransfer option, enabled by default, on the component configuration. With this option you can control whether mail is delivered to a MTA (Mail Transport Agent) or instead written to file.

It’s a convenient way for developers to check the content of an email, or to do tests: mails are written to @runtime/mail as .eml files which can be opened with a text editor or an email client.

But it doesn’t fit the situation where you want your customer to testdrive the application, maybe with real email addresses but of course you don’t want these emails to be delivered to the real email address? I wanted a solution which allowed me to collect all the emails generated from the application to a single email address.

17 novembre 2017 / / english

Requirement: use a local custom string for a core Yii2 message.

Since of course I didn’t want to  touch files into @vendor (which wouldn’t survive an upgrade, and are out of git control) I worked it out by customizing the i18n core component of Yii2.

Open up config/web.php (if you created the app from the basic template) and add the following into the components section:

15 novembre 2017 / / italiano