Raspberry Pi Kernel/Firmware Upgrade/Downgrade

I’ve been looking at a problem with one of my Raspberry Pi projects freezing every now and again.  I have a suspicion from reading recent posts that it could be kernel related.  I found a good article here which also links to the rpi-update utility on Github here

The great thing here is the utility allows a downgrade.

I can also never remember how to find the current kernel version so, for me, this is what I use:

uname -srvm

Unattended Upgrades on my Raspberry Pi’s

I can never quite remember how I like my unattended upgrades configured on my Raspberry Pi’s so I’m just popping it here.  It should work for all versions!

nano /etc/apt/apt.conf.d/50unattended-upgrades

 

Unattended-Upgrade::Origins-Pattern {
        "origin=Raspbian,codename=${distro_codename},label=Raspbian";
        "origin=Raspberry Pi Foundation,codename=${distro_codename},label=Raspberry Pi Foundation";
};

Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "02:00";

To check it:

unattended-upgrade --dry-run

Logs can be found at:

/var/log/unattended-upgrades/unattended-upgrades.log

and

/var/log/unattended-upgrades/unattended-upgrades-dpkg.log

 

CTF Resources

This is really just a place for me to remind myself of useful resources I’ve used when undertaking CTF challenges 🙂

Cryptography Resources:

Dcode – the essential site for deciphering and decoding messages
Cryptii – Modular online encoding, encryption and conversion tool
quipqiup – a fast and automated cryptogram solver

Network Resources:

netcat (nc) -a feature-rich network debugging and investigation tool

BBC micro:bit expoloration

On a whim I nipped out and bought the only BBC micro:bit in stock at PB Tech in New Plymouth as I was curious to have a play and see where it might fit in between Raspberry Pi’s and Arduino’s for teaching kids.

I thought turning it into a simple digital watch would be a fun place to start learning so, below is the result.

The virtual micro:bits, below, are interactive so click on the ‘shake’ button to simulate shaking it in real life to display the time.

The code can also be found in my Github repo, here.  It will be the most recent version if I have made changes and haven’t had time, or have forgotten, to update this post 🙂

Enjoy!

Pi-hole in a Docker Container on a Raspberry Pi

While I was disappearing down a rabbit hole investigating unbound as a DNS Privacy server, I came across Pi-Hole – A black hole for Internet advertisements.

I’ve always used uBlock Origin for ad blocking but that is a per client thing which is a bit of a hassle.

Pi-hole provides ad blocking for all clients on the network, seamlessly.  I just configure DNS on each client, via DHCP, to point towards the Pi-Hole server.

Obviously, I love Docker so it’s in a Docker Container on a Raspberry Pi.

Currently, I’ve sacrificed DNS privacy but I’ll work on that later in terms of getting Pi-hole to send all DNS queries through my own DNS server.

This is how I implemented it.  Obviously, these aren’t detailed instructions but more of a reference to jog my memory if I need it!

********************
Note: Substitute the IP address of the host that the Container is running on for ${IP} and ${IPv6}
********************

docker run -d \
    --name=pihole \
    --hostname=pihole \
    -p 53:53/tcp -p 53:53/udp -p 80:80 \
    -e ServerIP="${IP}" \
    -e ServerIPv6="${IPv6}" \
    -v pihole_data_1:/etc/pihole/ \
    -v pihole_data_2:/etc/dnsmasq.d/ \
    --restart=unless-stopped \
    pihole/pihole:v4.0_armhf

 

 

Raspberry Pi Docker Container to send all LAN DNS requests to Cloudflare’s 1.1.1.1 DNS over TLS

I wanted to implement this on a Raspberry Pi that I have running Docker.  However, I wasn’t able to find an image in Docker Hub for the ARM architecture that the Raspberry Pi uses so I made my own based on the x86-64 image, here.

  • Place the Dockerfile and unbound.conf in the same directory.
  • Docker file:
FROM arm32v6/alpine:3.7
EXPOSE 53/udp
RUN apk add --update --no-cache -q --progress unbound && \
    rm -rf /etc/unbound/unbound.conf /var/cache/apk/*
COPY unbound.conf /etc/unbound/unbound.conf
ENTRYPOINT unbound -d
  • unbound.conf:
server:
  verbosity: 0
  use-syslog: no
  qname-minimisation: yes
  do-tcp: yes
  prefetch: yes
  rrset-roundrobin: yes
  use-caps-for-id: yes
  do-ip4: yes
  do-ip6: no
  interface: 0.0.0.0
  access-control: 0.0.0.0/0 allow
forward-zone:
  name: "."
  forward-addr: [email protected]
  forward-addr: [email protected]
  forward-ssl-upstream: yes

 

  • Build the Docker image:
docker build -t itinnovations/cloudflaretlsdns:latest .

 

  • Start a container as a daemon from the above image:
docker run -d \
  --name=CloudflareTLSDNS \
  --restart=unless-stopped \
  -p 53:53/udp \
  itinnovations/cloudflaretlsdns

 

  • Configure all clients to point to the IP address of the Docker Host for DNS.

Install pip on OS X via Terminal


GUTE-URLS

Wordpress is loading infos from ahmadawais

Please wait for API server guteurls.de to collect data from
ahmadawais.com/install-pip-ma...

sudo easy_install pip

Get Stock Quote from Yahoo using Node-RED

[
    {
        "id": "d5d3c55c.ff8808",
        "type": "debug",
        "z": "3b163621.c03b8a",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 930,
        "y": 180,
        "wires": []
    },
    {
        "id": "39834827.c17818",
        "type": "http request",
        "z": "3b163621.c03b8a",
        "name": "Yahoo Stock",
        "method": "GET",
        "ret": "txt",
        "url": "http://download.finance.yahoo.com/d/quotes.csv?s=^IXIC&f=nsl1opc1p2&e=.csv",
        "tls": "",
        "x": 510,
        "y": 180,
        "wires": [
            [
                "247647e3.b30f88",
                "5db14531.5fb30c"
            ]
        ]
    },
    {
        "id": "5aba260a.74be08",
        "type": "inject",
        "z": "3b163621.c03b8a",
        "name": "Click me to request a stock quote...",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": true,
        "x": 210,
        "y": 180,
        "wires": [
            [
                "39834827.c17818"
            ]
        ]
    },
    {
        "id": "247647e3.b30f88",
        "type": "csv",
        "z": "3b163621.c03b8a",
        "name": "Columns",
        "sep": ",",
        "hdrin": "",
        "hdrout": "",
        "multi": "one",
        "ret": "\\n",
        "temp": "1,2,3,4,5,6,7",
        "x": 720,
        "y": 180,
        "wires": [
            [
                "d5d3c55c.ff8808"
            ]
        ]
    },
    {
        "id": "2f5e310b.99ce8e",
        "type": "comment",
        "z": "3b163621.c03b8a",
        "name": "Readme...",
        "info": "Reference for requesting stock quote...\nhttps://support.klipfolio.com/hc/en-us/articles/215546368-Use-Yahoo-Finance-as-a-data-source-\n\nTo play around, you may be able to change the \nURL in the node that says Yahoo Stock to \nthe URL of your Restful API?\n\nAnyway, aside from that, if you click on the \nlittle square box to the RHS of the node that\nsays \"Click me to request a stock quote...\"\nthat will inject a new timestamp and make a new\nrequest\n\nThere are two outputs.  Check the Debug tab to see them\n\n1 - The raw csv from Yahoo\n2 - The CSV converted to JSON\n\nGood luck!",
        "x": 100,
        "y": 100,
        "wires": []
    },
    {
        "id": "5db14531.5fb30c",
        "type": "debug",
        "z": "3b163621.c03b8a",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 730,
        "y": 260,
        "wires": []
    }
]