Friday 5 October 2018

Raspberry Pi - Useful stuff

Some useful config details to get the Pi up and running, this is based on Raspbian with the minimal installation image on version 9.
(Make sure to use a powerful enough PSU otherwise you will get undervoltage warnings in logs and the red LED will flicker)

To update to latest version:
  • apt-get update
  • apt-get dist-upgrade

Use raspi-config to configure this:
  • The Edimax EW-7800Un wireless card is automatically detected. Option 2 & 2 to setup the SSID & password
  • Check localization options are correct with option 4, including WiFi region.
  • Enable ssh with option 5 & 2 (This can also be done by putting the SD card in another machine, mounting the linux partition and creating the empty file /boot/ssh)

To configure a static IP on wireless, add this to /etc/dhcpcd.conf
  • static ip_address=192.168.0.108/24
  • static routers=192.168.0.1
  • static domain_name_servers=192.168.0.1

The red power LED can be turned off:
  • echo 0 > /sys/class/leds/led1/brightness
The green activity LED can also be turned off:
  • echo none > /sys/class/leds/led0/trigger

Might as well turn the HDMI output off (saves a few mA)
  • tvservice -o

You can disable bluetooth and wifi on the newer models:
  • Add dtoverlay=pi3-disable-bt to /boot/config.txt
  • Add dtoverlay=pi3-disable-wifi to /boot/config.txt

That's a basic headless wireless system, it's now good to go.

Install rng-tools (fixes startup issues with dnscrypt-proxy, cloudflared)
  • apt-get install rng-tools
  • Edit /etc/default/rng-tools to specify /dev/hwrng device


Tuesday 23 January 2018

User session messages in the system log on Centos 7

Here's how to get rid of those annoying systemd messages that flood /var/log/messages on Centos 7.

Filter them out with an rsyslog filter script in /etc/rsyslog.d -

echo 'if $programname == "systemd" and ($msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice" or $msg contains "Starting user-" or $msg contains "Starting User Slice of" or $msg contains "Removed session" or $msg contains "Removed slice User Slice of" or $msg contains "Stopping User Slice of") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf

Then restart rsyslog

systemctl restart rsyslog

Shamelessly stolen from Red Hat here

Thursday 11 January 2018

Useful commands to check SSL certs

Here's some useful stuff to examine SSL certs.
I've pulled some of this from here

Check a key
  • openssl rsa -in key.file -check
  • openssl ec -in key.file (For an EC cert)
Check a cert

  • openssl x509 -in cert.file -text -noout
 Test an SSL connection
  • openssl s_client -connect some.site.com:443
  • openssl s_client -connect some.site.com:443 -servername some.site.com
    (If website uses SNI)