Bill Farmer

Random thoughts on random subjects

Pi-hole Cloudflare, DNSCrypt, Unbound Setup

by Bill Farmer. Categories: Hacking .

Pi-hole

I came across a reference to Pi-hole recently, so as my old pi has been gathering dust, I thought I would try it out. The pi already had Raspbian Stretch Lite installed, so I uninstalled some of the packages I had previously installed, and loaded Pi-Hole using the One-Step Automated Install.

The installation script asks a series of questions using text dialogs and produces a log as it goes.

pi@catherine:~ $ curl -sSL https://install.pi-hole.net | bash
stty: 'standard input': Inappropriate ioctl for device

  [✗] Root user check
  [i] Script called with non-root privileges
      The Pi-hole requires elevated privileges to install and run
      Please check the installer for any concerns regarding this requirement
      Make sure to download this script from a trusted source

  [✓] Sudo utility check
stty: 'standard input': Inappropriate ioctl for device

  [✓] Root user check

  [i] Existing PHP installation detected : PHP version 7.0.33-0+deb9u3
  [✓] Disk space check
  [✓] Update local cache of available packages

  [✓] Checking apt-get for upgraded packages... up to date!

  [i] Installer Dependency checks...
  [✓] Checking for apt-utils
  [✓] Checking for dialog
  [✓] Checking for debconf
  [✓] Checking for dhcpcd5
  [✓] Checking for git
  [✓] Checking for iproute2
  [✓] Checking for whiptail

  [i] Using interface: eth0
  [i] Using Cloudflare
  [i] Your static IPv4 address: 192.168.1.252
  [i] Your static IPv4 gateway: 192.168.1.254
  [✓] Set IP address to 192.168.1.252
  You may need to restart after the install is complete
  [i] IPv4 address: 192.168.1.252
  [i] IPv6 address:
  [i] Web Interface On
  [i] Web Server On
  [i] Logging On.
  [✗] Check for existing repository in /etc/.pihole
  [✓] Clone https://github.com/pi-hole/pi-hole.git into /etc/.pihole

  [✗] Check for existing repository in /var/www/html/admin
  [✓] Clone https://github.com/pi-hole/AdminLTE.git into /var/www/html/admin

  [i] Main Dependency checks...
  [✓] Checking for cron
  [✓] Checking for curl
  [✓] Checking for dnsutils
  [✓] Checking for iputils-ping
  [✓] Checking for lsof
  [✓] Checking for netcat
  [✓] Checking for psmisc
  [✓] Checking for sudo
  [✓] Checking for unzip
  [✓] Checking for wget
  [✓] Checking for idn2
  [✓] Checking for sqlite3
  [✓] Checking for libcap2-bin
  [✓] Checking for dns-root-data
  [✓] Checking for resolvconf
  [✓] Checking for libcap2
  [✓] Checking for lighttpd
  [✓] Checking for php7.0-common
  [✓] Checking for php7.0-cgi
  [✓] Checking for php7.0-sqlite3

  [✓] Enabling lighttpd service to start on reboot...

  [i] FTL Checks...

  [✓] Detected ARM-hf architecture (armv6l)
  [i] Checking for existing FTL binary...
  [✓] Downloading and Installing FTL
  [✓] Creating user 'pihole'
  [✓] Installing scripts from /etc/.pihole

  [i] Installing configs from /etc/.pihole...
  [i] Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
  [✓] Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf

  [i] Installing blocking page...
  [✓] Creating directory for blocking page, and copying files
  [✗] Backing up index.lighttpd.html
      No default index.lighttpd.html file found... not backing up

  [✓] Installing sudoer file

  [✓] Installing latest Cron script

  [✓] Installing latest logrotate script
  [i] Backing up /etc/dnsmasq.conf to /etc/dnsmasq.conf.old

  [i] Skipping firewall configuration
  [✓] man pages installed and database updated
  [i] Testing if systemd-resolved is enabled
  [i] Systemd-resolved is not enabled
  [✓] Restarting lighttpd service...
  [✓] Enabling lighttpd service to start on reboot...
  [i] Restarting services...
  [✓] Enabling pihole-FTL service to start on reboot...
  [✓] Restarting pihole-FTL service...
  [✓] Deleting existing list cache
  [i] Pi-hole blocking is enabled
  [i] Neutrino emissions detected...
  [✓] Pulling blocklist source list into range

  [i] Target: raw.githubusercontent.com (hosts)
  [✓] Status: Retrieval successful

  [i] Target: mirror1.malwaredomains.com (justdomains)
  [✓] Status: Retrieval successful

  [i] Target: sysctl.org (hosts)
  [✓] Status: Retrieval successful

  [i] Target: zeustracker.abuse.ch (blocklist.php?download=domainblocklist)
  [✓] Status: Retrieval successful

  [i] Target: s3.amazonaws.com (simple_tracking.txt)
  [✓] Status: Retrieval successful

  [i] Target: s3.amazonaws.com (simple_ad.txt)
  [✓] Status: Retrieval successful

  [i] Target: hosts-file.net (ad_servers.txt)
  [✓] Status: Retrieval successful

  [✓] Consolidating blocklists
  [✓] Extracting domains from blocklists
  [i] Number of domains being pulled in by gravity: 135697
  [✓] Removing duplicate domains
  [i] Number of unique domains trapped in the Event Horizon: 113438
  [i] Nothing to whitelist!
  [i] Number of regex filters: 0
  [✓] Parsing domains into hosts format
  [✓] Cleaning up stray matter

  [✓] Force-reloading DNS service
  [✓] DNS service is running
  [i] Pi-hole blocking will be enabled
  [i] Enabling blocking
  [✓] Reloading DNS service
  [✓] Pi-hole Enabled
  [i] Web Interface password: ********
  [i] This can be changed using 'pihole -a -p'

  [i] View the web interface at http://pi.hole/admin or http://192.168.1.252/admin

  [i] You may now configure your devices to use the Pi-hole as their DNS server
  [i] Pi-hole DNS (IPv4): 192.168.1.252
  [i] If you set a new IP address, please restart the server running the Pi-hole

  [i] The install log is located at: /etc/pihole/install.log
Installation Complete!

My router uses the IP address 192.168.1.254 and allocates DHCP IP addresses from 192.168.1.1 and does not allow DHCP configuration. I opted to use the ethernet port and use IP address 192.168.1.252 and the Cloudflare DNS service. The router does allow DNS configuration, so I changed the default DNS to 192.168.1.252 so I don’t have to make any changes to DNS configuration elsewhere.

Read more →

Mushrooms and Soy Sauce

by Bill Farmer. Categories: Recipes .

When I was working for the electric light company in Hove, many years ago, the canteen ladies frequently served up, as part of a buffet, sliced raw mushrooms in soy sauce. Tasty side dish with a salad or buffet.

Ingredients

  • Thinly sliced mushrooms
  • Dark soy sauce

Method

  1. Thinly slice the mushrooms into a bowl
  2. Sprinkle over the soy sauce
  3. Leave for a while for the sauce to soak into and soften the mushrooms

I have not seen this elsewhere or online, so I assume that the canteen ladies came up with the idea themselves.

Read more →

Source Code Syntax Highlighting

by Bill Farmer. Categories: Hacking .

One of the enhancements suggested for my android editor is syntax highlighting. The libraries I have found, including the one used in this blog, parse the input and produce output in HTML, using styled spans. Emacs makes extensive use of regular expressions for highlighting.

HTML output is not very useful for a text editor. It could be used with Html.fromHtml() to produce styled text. This would then be loaded back into the editor all while the user is attempting to edit the text. I don’t think so. So I explored alternatives.

Read more →

Musical Temperaments

by Bill Farmer. Categories: Hacking .

My Tuner app uses equal temperament because that is the current standard and it is relatively easy to calculate using double precision arithmetic and maths library functions. First, declare some constants.

    private static final int OCTAVE = 12;
    private static final int EQUAL = 8;
    private static final int A_OFFSET = 9;
    private static final int C5_OFFSET = 57;

The calculation first produces the cents relative to the reference, usually 440Hz. Then the note number with an added constant because octaves start at C, not A. Then the reference frequency for that note, then the cents difference.

Read more →

Draw Musical Staff

by Bill Farmer. Categories: Hacking .

A musical staff is not a trivial thing to draw because of the complex curves needed for the treble and bass clef. What is needed is a source of vector drawing coordinates.

The data used was originally intended for use in postscript, so the vertical axis is reversed.

    // Treble clef
    private static final float tc[][]=
    {
        {-6, 16},  {-8, 13},  {-14, 19},  {-10, 35},  {2, 35},  {8, 37},
        {21, 30},  {21, 17},  {21, 5},  {10, -1},  {0, -1},  {-12, -1},
        {-23, 5},  {-23, 22},  {-23, 29},  {-22, 37},  {-7, 49},  {10, 61},
        {10, 68},  {10, 73},  {10, 78},  {9, 82},  {7, 82},  {2, 78},
        {-2, 68},  {-2, 62},  {-2, 25},  {10, 18},  {11, -8},  {11, -18},
        {5, -23},  {-4, -23},  {-10, -23},  {-15, -18},  {-15, -13},
        {-15, -8},  {-12, -4},  {-7, -4},  {3, -4},  {3, -20},  {-6, -17},
        {-5, -23},  {9, -20},  {9, -9},  {7, 24},  {-5, 30},  {-5, 67},
        {-5, 78},  {-2, 87},  {7, 91},  {13, 87},  {18, 80},  {17, 73},
        {17, 62},  {10, 54},  {1, 45},  {-5, 38},  {-15, 33},  {-15, 19},
        {-15, 7},  {-8, 1},  {0, 1},  {8, 1},  {15, 6},  {15, 14},  {15, 23},
        {7, 26},  {2, 26},  {-5, 26},  {-9, 21},  {-6, 16}
    };

    // Bass clef
    private static final float bc[][] =
    {
        {-2.3f,3},
        {6,7}, {10.5f,12}, {10.5f,16},
        {10.5f,20.5f}, {8.5f,23.5f}, {6.2f,23.3f},
        {5.2f,23.5f}, {2,23.5f}, {0.5f,19.5f},
        {2,20}, {4,19.5f}, {4,18},
        {4,17}, {3.5f,16}, {2,16},
        {1,16}, {0,16.9f}, {0,18.5f},
        {0,21}, {2.1f,24}, {6,24},
        {10,24}, {13.5f,21.5f}, {13.5f,16.5f},
        {13.5f,11}, {7,5.5f}, {-2.0f,2.8f},
        {14.9f,21},
        {14.9f,22.5f}, {16.9f,22.5f}, {16.9f,21},
        {16.9f,19.5f}, {14.9f,19.5f}, {14.9f,21},
        {14.9f,15},
        {14.9f,16.5f}, {16.9f,16.5f}, {16.9f,15},
        {16.9f,13.5f}, {14.9f,13.5f}, {14.9f,15}
    };

Both these sets of points are made up of an initial move, followed by a series of cubic bezier curves. The bass clef has three sections, the symbol, followed by the two dots.

Read more →
Previous page Next page