Home / Community / Blog

You can use Let's encrypt certificates to secure communication with your e-mail server.

After you generate certificate for your mail server:

certbot-auto certonly --apache --non-interactive --agree-tos \
--email me@mydomian -d mail.jaqb.gda.pl

they have to be copied to new location because Postfix/CyrusIMAP cannot read them, the /etc/letsencrypt/live directory can be read only by root.

The solution is simple. I've copied them into /etc/postfix directory and change group to mail:

cp /etc/letsencrypt/live/mail.jaqb.gda.pl/cert.pem \
                                      /etc/postfix/cert.pem
cp /etc/letsencrypt/live/mail.jaqb.gda.pl/privkey.pem \
                                      /etc/postfix/privkey.pem
cp /etc/letsencrypt/live/mail.jaqb.gda.pl/fullchain.pem \
                                      /etc/postfix/fullchain.pem

chgrp mail /etc/postfix/cert.pem /etc/postfix/privkey.pem \
/etc/postfix/fullchain.pem 

I've added this commands to /etc/cron.monthly/letsencrypt-auto.bash file (from my last post).

Of course you have to set that appropriate options, at least in /etc/postfix/main.cf:

smtpd_tls_cert_file = /etc/postfix/cert.pem
smtpd_tls_key_file = /etc/postfix/privkey.pem
smtpd_tls_CAfile = /etc/postfix/fullchain.pem

and in /etc/imapd.conf:

tls_cert_file: /etc/postfix/cert.pem
tls_key_file: /etc/postfix/privkey.pem
tls_ca_file: /etc/postfix/fullchain.pem

After restart:

/etc/init.d/postfix restart
/etc/init.d/cyrus-imapd restart

everything should work. Good luck!

If you want to create a certificate you should download certbot-auto and install them in your system:

wget "https://dl.eff.org/certbot-auto"
mv certbot-auto /usr/local/sbin/
chmod u+x /usr/local/sbin/certbot-auto

Then you can request your first (test) certificate:

certbot-auto certonly --test-cert --apache \
--non-interactive --agree-tos --email me@mydomain.com \
-d www.jaqb.gda.pl

If you want to recreate certificate after tests you have to delete them, and then create again (without --test-cert option)

certbot-auto delete -d www.jaqb.gda.pl
certbot-auto certonly --apache --non-interactive  --agree-tos \
--email me@mydomain.com -d www.jaqb.gda.pl

Of course you can obtain more than one certificate:

certbot-auto certonly --apache --non-interactive  --agree-tos \
--email me@mydomain.com -d dev.jaqb.gda.pl

All certificates are stored in /etc/letsencrypt/live directory.

The certificates are valid only for 3 months, but don't worry everything can be automated - I've added to cron (/etc/cron.monthly/letsencrypt-auto.bash):

#!/bin/bash

certbot-auto renew --apache --non-interactive --agree-tos \
--email me@mydomain.com

I hope it will work... ;-)

I had a problem with Domoticz and switches.

I've ESP8266 module (with ESP Easy v.120) and relay (SSR) - it's very simple to get it work using web interface.

I would like to have some kind of switch not to have use phone to turn on the light. My solution it's not so simple I think it can be done better.

My ESPEasy module has address 192.168.1.7, SSR is connected to GPIO12 and touch sensot is connected to GPIO14. It has configured "Protocol" as "Domoticz HTTP". The "touch" switch is defined in ESPEasy as:

  • Device: "Switch input"
  • IDX / Var: 10 (Idx from Domoticz)
  • 1st GPIO: GPIO14
  • Type: "Switch"
  • Switch Button Type: "Normal switch"
  • Send Data: On

I didn't define relay connected to GPIO12 - it is set directly from domoticz as described below.

My domoticz has address 192.168.1.8. I defined "dummy" hardware with two "switches":

  1. "light" - it has defined "On action": http://192.168.1.7/tools?cmd=GPIO%2C12%2C0 and "Off action": http://192.168.1.7/tools?cmd=GPIO%2C12%2C1
  2. "touch" - without any settings

Next I've defined new "Event" ("Lua", "Device"):

commandArray = {}

if (devicechanged['touch']=='Off') then
    if (otherdevices['light']=='Off') then
--        print ("wlaczam");
        commandArray['light']='On'
    else
--        print ("wylaczam");
        commandArray['light']='Off'
    end
end

return commandArray

Remember to set "Event active" checkbox.

Now I can use both web interface and physical switch to turn on/off the light.

To get images placed on map based on GPS tags in Piwigo (2.9) I had to install and enable "Exiftool GPS" plugin and install exiftools.

I've downloaded it and unpack in /tmp directory:

cd /tmp
wget "http://www.sno.phy.queensu.ca/~phil/exiftool/Image-ExifTool-10.51.tar.gz"
tar -xzf Image-ExifTool-10.51.tar.gz
cd Image-ExifTool-10.51

Prepare directory and copy files

mkdir /usr/local/Image-ExifTool-10.51
cp exiftool /usr/local/Image-ExifTool-10.51/exiftool
cp -r lib /usr/local/Image-ExifTool-10.51

Prepare symbolic links

cd /usr/local
ln -s Image-ExifTool-10.51 Image-ExifTool
cd bin
ln -s ../Image-ExifTool/exiftool .
mkdir /usr/local/lib/site_perl
cd /usr/local/lib/site_perl
ln -s ../../Image-ExifTool/lib/File ../../Image-ExifTool/lib/Image .

and now it works:

root@NAS:~# exiftool --help
Syntax:  exiftool [OPTIONS] FILE

Consult the exiftool documentation for a full list of options.

I had to use Windows machine, if you use Linux you will need esptool and flash script for Linux.

First of all you have to download ESP Easy firmware, i.e. version R120. and unzip it to some folder (I've used C:\Users\username\Downloads\ESPEasy_R120)

If you have some ESP8266 module (they have different names, you have to search: ESP8266, Witty, NodeMCU or Lua) with USB interface the only think you have to do is connect to PC or you have to have serial to USB adapter.

After connect you have to check (virtual) serial port number. In my case COM3.

In first step I used smallest image:

cd C:\Users\username\Downloads\ESPEasy_R120
esptool.exe -vv -cd nodemcu -cb 115200 -cp COM3 -ca 0x00000 -cf ESPEasy_R120_512.bin

When you use putty connect to COM3 (115200 8N1) you will see log. Something like this:

WIFI : No SSID!
 INIT : I2C
 INIT : Boot OK
 INIT : Normal boot

Now you have to connect to WiFi network named ESP_0, password can be configesp. I've used Android phone, so I've been automatically redirected to configuration page where I can provide SSID and password to my WiFi. In console you can see:

WIFI : Connecting... 1
WIFI : Connected!

Then you have to disconnect from ESP_0 network and connect again. After this you will see:

FLASH: Settings saved

now you have your module configured to your WiFi network.

After this I've checked that my module (Main, Flash Size) is 4MB version and flashed them again using another image:

cd C:\Users\username\Downloads\ESPEasy_R120
esptool.exe -vv -cd nodemcu -cb 115200 -cp COM3 -ca 0x00000 -cf ESPEasy_R120_4096.bin

I didn't notice any changes so I thing 512kB image is enough.

Today I've run Domoticz on my NAS (ReadyNAS OS 6 running on Ultra 4). Installation is very simple (in contrast to run on CentOS 7). I've downloaded domoticz from their site:

cd /tmp
wget "https://releases.domoticz.com/releases/release/domoticz_linux_x86_64.tgz"

Extracted files:

cd /opt
mkdir domoticz-2017-03-13
cd domoticz-2017-03-13
tar -zxf /tmp/domoticz_linux_x86_64.tgz

Created file /lib/systemd/system/domoticz.service:

[Unit]
Description=Domoticz uruchoamiany automatycznie
After=network.target

[Service]
ExecStart=/opt/domoticz-2017-03-13/domoticz -daemon
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

and register service to start automatically :

systemctl enable domoticz
systemctl start domoticz

and that's all. Now you can check if it's work: http://192.168.1.1:8080/ - of course you have to change IP address.

If you would like to use original LEGO MindStorms Robotics Invention System simple transceiver won't be enough.

I've found schematic on eurobricks forum - it looks you have to emulate CTS signal also.

My copy of this circuit:

Reverse-engineered by Mark Bellis the serial port tower from my RCX 1.0 kit

You can find this schematic also on other pages (ie. LEGO MINDSTORMS Internals).

It's rather bypass, but works:

Excel 2007 - Password Removal:

Create backup of password-protected excel file.
Change the file extension to .zip from .xlsx.
Now extract the whole content of zip file.
Search for xml format of targeted sheet. You will find it in ‘xl -> worksheets’ directory.
Open the xml file of targeted sheet in xml editor.
Now search for ‘sheetProtection’ word in that xml file and remove it.
Save this edited xml file and replace it with old xml file in zip files.
Now change the extension from .zip to .xlsx.

This is short-cut for PowerShot SX230HS users. I got this informations from Canon Hack Development Kit site.

First of all you have to check your firmware version. Jut put an empty ver.req or vers.req file on your SD card. I've put both. Then press the func set+disp. buttons together (i.e. press set first, keep holding it down, then press disp.)

You will see something like Firmware Ver GM1.01C (in my case). The 1.01C is firmware version.

Now go to CHDK Download page and get proper file. In my case sx230hs-101c-1.4.1-4691-full.zip.

Unzip this file to your SD card and place back to camera.

Now follow the instruction:

  1. Power up camera using Playback button.
  2. Press Menu
  3. Select Firmware update
  4. Accept update by pressing OK (don't worry it will be "reverted" when you power off camera ;-)

That's all! Now you can even write your own script to camera (or use some examples).

I'd like to check if I have some duplicates in my photos. I've find ready to use list of programs ;-) I've checked second one - Similar Image Search. It's written in Java, has very ascetic interface, but it do the job.

Just my blog...

Mon Tue Wed Thu Fri Sat Sun
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30