Install additions to Ubuntu server

Prereq is a ”vanilla” Ubuntu 16.04 LTS server

Update Ubuntu

$sudo apt-get update
$sudo apt-get upgrade
($sudo apt-get dist-upgrade)
$sudo apt-get autoremove

Install ntpd and unzip

$ sudo apt-get install ntp unzip

Install xinit

$ sudo apt-get install xinit
($ sudo apt-get install x11-apps)

Install Minimal Xfce Desktop

$ sudo apt-get install --no-install-recommends xubuntu-desktop

Tribute to Dan Nanni http://ask.xmodulo.com/install-minimal-ubuntu-desktop.html for the info on How to install minimal Ubuntu desktop

Install xRDP

$ sudo apt-get install xrdp

Change keyboard settings

$ sudo dpkg-reconfigure keyboard-configuration

Change time zone settings

$ sudo dpkg-reconfigure tzdata

OpenSSL, compare certificate vs. private key

To view the certificate Modulus:

openssl x509 -noout -modulus -in [certificate-file.crt]

To view the key Modulus:

openssl rsa -noout -modulus -in [key-file.key]

Command to compare certificate vs private key

$ certMod=$(openssl x509 -text -noout -modulus -in server.crt | grep "Modulus=") && \
	keyMod=$(openssl rsa -text -noout -modulus -in server.key | grep "Modulus=") && \
	[[ $certMod == $keyMod ]] && echo "Equal"

Tribut to Peter Mescalchin magnetikonline for the script above https://gist.github.com/magnetikonline/fbdb26fcb34ca5038c03507cbdfdb534

Publicerat i PKI

Openssl – parse certificate and crl files

Parse certificate in binary format

openssl x509 -in certfile.cer -text -noout -inform der

Parse crl in binary format

openssl crl -in crlfile.crl -text -noout -inform der

Parse PEM file with several certificates

openssl crl2pkcs7 -nocrl -certfile FILE.pem | \
openssl pkcs7 -print_certs
Publicerat i PKI

Homebrew

Install Homebrew

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Check your system for potential problems

$ brew doctor

Fetch the newest version of Homebrew

$ brew update

List all installed formulae

$ brew list

Install formulae

$ brew install [package]

Write raspbian image to SD card using Mac

Insert the SD card

Check for automatically mounted volumes

$ ls /Volumes/
MacBookSSD	boot

Identify mounted volumes

$ diskutil list
/dev/disk0 (internal, physical):
   #:                     TYPE NAME             SIZE       IDENTIFIER
   0:    GUID_partition_scheme                 *480.1 GB   disk0
   1:                      EFI EFI              209.7 MB   disk0s1
   2:                Apple_HFS MacBookSSD       479.2 GB   disk0s2
   3:               Apple_Boot Recovery HD      650.0 MB   disk0s3

/dev/disk1 (internal, physical):
   #:                     TYPE NAME             SIZE       IDENTIFIER
   0:   FDisk_partition_scheme                 *31.9 GB    disk1
   1:           Windows_FAT_32 boot             43.7 MB    disk1s1
   2:                    Linux                  31.9 GB    disk1s2

Unmount mounted volume

$ sudo umount /dev/disk1s1

Write the image to the SD card

$ sudo dd if=2017-07-05-raspbian-jessie-lite.img of=/dev/disk1 bs=1m

If you want to check the progress, press ctrl+t

$ diskutil eject /dev/disk1

Install Telldus-core for Tellstick Duo

Prereq is Raspbian Jessie Lite

Add the following line to your /etc/apt/sources.list:

deb http://download.telldus.com/debian/ stable main

Download and register Telldus public key

$ wget -q http://download.telldus.com/debian/telldus-public.key -O- | sudo apt-key add -

The key fingerprint is

$ 70C4 10C9 D73D 53E8 38B3 1C58 5A94 9181 E501 EA76
Telldus Technologies AB <info.tech@telldus.se>

Update the repository

$ sudo apt-get update

Install telldus-core and FTDI USB driver

$ sudo apt-get install telldus-core libtelldus-core-dev libftdi1

Reboot

$ sudo init 6

Mount Raspberry Pi SD card on Mac


Using Homebrew, install osxfuse and ext4fuse

$ brew cask install osxfuse
$ brew install ext4fuse

Find the Raspberry Pi’s partition ID

$ diskutil list

Create a mount point

sudo mkdir /Volumes/rpi

Mount the drive

sudo ext4fuse /dev/disk2s2 /Volumes/rpi -o allow_other

Unmount the drive

sudo umount /Volumes/rpi

Tribute to Jeff Geerling https://www.jeffgeerling.com/blog/2017/mount-raspberry-pi-sd-card-on-mac-read-only-osxfuse-and-ext4fuse

Java keytool

List certificates

keytool -list -keystore keystore.jks -v

keytool -list -keystore server.p12 -storetype PKCS12 -v

Convert from JKS to P12

keytool -importkeystore -srckeystore keystore.jks \
-srcstoretype JKS -deststoretype PKCS12 -destkeystore keystore.p12

Convert from P12 to JKS

keytool -importkeystore -srckeystore keystore.p12 \
-srcstoretype PKCS12 -deststoretype JKS -destkeystore keystore.jks

Import a root or intermediate CA certificate to an existing Java keystore

keytool -import -trustcacerts -alias rootCA -file CAcert.crt \
-keystore keystore.jks