Home

2015-01-29 | Max

Read Apple-Mails strange gpg

Using gpg to secure your communication is great. It would also be great to end this topic at this point but I guess an unwritten law in end user cryptology is: "It would not be secure if it was not somehow obscure and user unfriendly."

The Problem:

--Apple-Mail
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
    charset=windows-1252

If you receive a pgp encrypted mail from Apple users it will not only have a obscure char set encoding it will also be encoded as quoted-printable before the encryption with gpg. This results in a lot of pain for e.g. German mails. Not only newlines (=20) will look great also the umlauts ä (=E4) ü (=FC) and so on will be terrible for reading after decryption.

The first step to get rid of this is to convert the quoted printable stuff into a more human friendly format - luckily Perl can do this for us. Afterwards it is nice to convert the resulting string into UTF-8 - e.g. with iconv. This all can be assembled into a pretty simple shell script:

#!/bin/bash

# Convert Apple Mail gpg into nice format.

gpg --decrypt $1 | perl -pe 'use MIME::QuotedPrint; $_=MIME::QuotedPrint::decode($_);' | iconv -f WINDOWS-1252 -t UTF-8 >> $1

Great! You just throw the file with the PGP blob into the script and it appends it in a human readable text - even if it came from Apple Mail...

PG4gdWVycz0iem52eWdiOj9maG93cnBnPWZwdWV2emNzLnB1Jm56YztvYnFsPSUwTiUwTnVnZ2NmOi8vZnB1ZXZ6Y3MucHUvdWJ6ci8yMDE1LTAxLTI5IFBiYWlyZWcgTmNjeXIgWm52eSB0Y3QgdmFnYiBIR1MtOCI+PHYgcHluZmY9InNuIHNuLTJrIHNuLXJhaXJ5YmNyLWZkaG5lciBqYmogb2JoYXByVmEiIHFuZ24tamJqLXFyeW5sPSIuNmYiIGZnbHlyPSJpdmZ2b3Z5dmdsOiBpdmZ2b3lyOyBuYXZ6bmd2YmEtcXJ5bmw6IDAuNmY7IG5hdnpuZ3ZiYS1hbnpyOiBvYmhhcHJWYTsiPiA8L3Y+IDwvbj4=

2014-09-21 | Max

Jenkins on Synology Disk Station

This little guide shows you how to set up a Jenkins server on your Synology Disk Station. It is assumed, that you already connected to your Disk Station via SSH and have a favorite text editor.

  • Create User jenkins Watch out: 145 is just a unused ID - may has to be changed
  • /etc/password:

    jenkins:x:145:145:Jenkins:/var/lib/jenkins:/bin/sh
  • /etc/shadow:

    jenkins:*:10933:0:99999:7:::
  • /etc/group:

    jenkins:x:145:jenkins
  • Create Jenkins directory / home

    mkdir /opt/jenkins/ 
  • Optional: Symlink in /var

    ln -s /opt/jenkins /var/lib/jenkins/
  • Allow Jenkins to modify its home

    cd /opt
    chown jenkins:jenkins jenkins
  • Download latest Jenkins

    cd /opt/jenkins
    wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
  • Copy jenkins.sh to /usr/local/etc/rc.d/ don't forget chmod +x
  • Link into autostart (this step does not work propper - you might have to start the jenkins manually after every boot).
    ln -s /usr/local/etc/rc.d/jenkins.sh /usr/syno/etc/rc.d/S999jenkins.sh

Your Jenkins server is now up and running on the port 8080 of your NAS. Have fun.

PG4gdWVycz0iem52eWdiOj9maG93cnBnPWZwdWV2emNzLnB1Jm56YztvYnFsPSUwTiUwTnVnZ2NmOi8vZnB1ZXZ6Y3MucHUvdWJ6ci8yMDE0LTA5LTIxIFdyYXh2YWYgYmEgRmxhYnlidGwiPjx2IHB5bmZmPSJzbiBzbi0yayBzbi1yYWlyeWJjci1mZGhuZXIgamJqIG9iaGFwclZhIiBxbmduLWpiai1xcnlubD0iLjZmIiBmZ2x5cj0iaXZmdm92eXZnbDogaXZmdm95cjsgbmF2em5ndmJhLXFyeW5sOiAwLjZmOyBuYXZ6bmd2YmEtYW56cjogb2JoYXByVmE7Ij4gPC92PiA8L24+