Tuesday, April 23, 2019

Tweak PI-Hole so Query Log and Long Term Queries Display in 100 Rows

This can be changed here
/var/www/html/admin/scripts/pi-hole/js/queries.js:
sudo nano  /var/www/html/admin/scripts/pi-hole/js/queries.js

Go down to:
"lengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
and delete both number 10's to default it to 25, etc.


/var/www/html/admin/scripts/pi-hole/js/queries.js On the line that says
APIstring += "=100"
100 is the amount of queries displayed by default in Query Log. You can change that to display up to 500:
APIstring += "=500"

Thursday, April 11, 2019

Tweak Pi-Hole so logging won't burn out your SD card

Connect to Pi-Hole:
ssh pi@

Run:
sudo nano /etc/pihole/pihole-FTL.conf

Add the following
PRIVACYLEVEL=0
DBINTERVAL=60
MAXDBDAYS=7

 

Wednesday, April 10, 2019

Pi-Hole Blocking via Regex

BLOCKINGREGEX=^ab.+\.com$
will block all domains that start with “ab” (^ab), have at least one further character (.+) and end in “.com” (\.com$).
Examples for what would be blocked by this rule:
  • abc.com
  • abtest.com
  • ab.test.com
  • abr-------.whatever.com
Examples for what would notbe blocked by this rule:
  • testab.com (the domain doesn’t start with “ab”)
  • tab.test.com (the domain doesn’t start with “ab”)
  • ab.com (there is no character in between “ab” and “.com”)
  • test.com.something (the domain doesn’t end in “.com”)
(^|\.)ru$
will block the entire TLD .(.ru). Examples for what would be blocked by this rule:
  • abc.ru

Sunday, April 7, 2019

Disable macOS Mojave Services The Right Way

  1. Disable SIP in recovery mode
    $ csrutil disable
    and reboot.
  2. Add services you want to disable to
    /System/Library/Sandbox/com.apple.xpc.launchd.rootless.plist.
    For example, if you want to disable 'apsd', do the following:
    $ sudo nano /System/Library/Sandbox/com.apple.xpc.launchd.rootless.plist
    Add key(s) at bottom:
    <key>com.apple.apsd</key>
    <true></true>
  3. Unload agents and daemons previously added to the whitelist
    $ launchctl unload -w or $ sudo launchctl unload -w
    For example:
    $ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist
  4. Reboot on recovery mode and enable SIP again with $ csrutil enable.
  5. Reboot again and agents and daemons will be unloaded with SIP enabled.
If you don't do the above, when you enable SIP again, the services will reload even if you unloaded them.


Some services I have disabled:

<key>com.apple.Safari.SafeBrowsing.Service.plist</key>
<true/>
<key>com.apple.SafariBookmarksSyncAgent.plist</key>
<true/>
<key>com.apple.SafariCloudHistoryPushAgent.plist</key>
<true/>
<key>com.apple.SafariHistoryServiceAgent.plist</key>
<true/>
<key>com.apple.SafariLaunchAgent.plist</key>
<true/>
<key>com.apple.SafariNotificationAgent.plist</key>
<true/>
<key>com.apple.SafariPlugInUpdateNotifier.plist</key>
<true/>
<key>com.apple.safaridavclient.plist</key>
<true/>
<key>com.apple.Safari.SafeBrowsing.Service.plist</key>
<true/>
<key>com.apple.SafariBookmarksSyncAgent.plist</key>
<true/>
<key>com.apple.SafariCloudHistoryPushAgent.plist</key>
<true/>
<key>com.apple.SafariHistoryServiceAgent.plist</key>
<true/>
<key>com.apple.SafariLaunchAgent.plist</key>
<true/>
<key>com.apple.SafariNotificationAgent.plist</key>
<true/>
<key>com.apple.SafariPlugInUpdateNotifier.plist</key>
<true/>
<key>com.apple.safaridavclient.plist</key>
<true/>
<key>com.apple.ReportCrash.Self.plist</key>
<true/>
<key>com.apple.ReportCrash.plist</key>
<true/>
<key>com.apple.CrashReporterSupportHelper.plist</key>
<true/>
<key>com.apple.ReportCrash.Root.Self.plist</key>
<true/>
<key>com.apple.ReportCrash.Root.plist</key>
<true/>
<key>com.apple.PhotoLibraryMigrationUtility.XPC.plist</key>
<true/>
<key>com.apple.cloudphotosd.plist</key>
<true/>
<key>com.apple.photoanalysisd.plist</key>
<true/>
<key>com.apple.photolibraryd.plist</key>
<true/>
<key>com.apple.DiagnosticReportCleanup.plist</key>
<true/>
<key>com.apple.diagnostics_agent.plist</key>
<true/>
<key>com.apple.InstallerDiagnostics.installerdiagd.plist</key>
<true/>
<key>com.apple.InstallerDiagnostics.installerdiagwatcher.plist</key>
<true/>
<key>com.apple.diagnosticd.plist</key>
<true/>
<key>com.apple.diagnosticextensions.osx.bluetooth.helper.plist</key>
<true/>
<key>com.apple.diagnosticextensions.osx.getmobilityinfo.helper.plist</key>
<true/>
<key>com.apple.diagnosticextensions.osx.spotlight.helper.plist</key>
<true/>
<key>com.apple.diagnosticextensions.osx.timemachine.helper.plist</key>
<true/>
<key>com.apple.diagnosticextensions.osx.wifi.helper.plist</key>
<true/>
<key>com.apple.gamed.plist</key>
<true/>
<key>com.apple.GameController.gamecontrollerd.plist</key>
<true/>
<key>com.apple.spindump_agent.plist</key>
<true/>
<key>com.apple.metadata.mds.spindump.plist</key>
<true/>
<key>com.apple.spindump.plist</key>
<true/>
<key>com.apple.Siri.agent.plist</key>
<true/>
<key>com.apple.siriknowledged.plist</key>
<true/>

Tuesday, April 2, 2019

Updating Raspberry Pi & Pi-Hole

APT (Advanced Packaging Tool)

To update software in Raspbian, you can use the apt tool in a terminal. Open a terminal window from the taskbar or application menu:
Terminal

First, update your system's package list by entering the following command:
sudo apt-get update

Next, upgrade all your installed packages to their latest versions with the following command:
sudo apt-get dist-upgrade

Generally speaking, doing this regularly will keep your installation up to date, in that it will be equivalent to the latest released image available from
raspberrypi.org/downloads.

However, there are occasional changes made in the Foundation's Raspbian image that require manual intervention, for example a newly introduced package. These are not installed with an upgrade, as this command only updates the packages you already have installed.

Updating the kernel and firmware

The kernel and firmware are installed as a Debian package, and so will also get updates when using the procedure above. These packages are updated infrequently and after extensive testing.

Updating Pi-Hole

Updating is as simple as running the following command:
pihole -up

Script for Updating Pi-Hole

#!/bin/sh
sudo apt update
sudo apt -yf dist-upgrade
sudo apt-get -y --purge autoremove
sudo apt-get autoclean
pihole -g -up
pihole -up
 

Running Raspberry Pi Config Tool

sudo raspi-config
Open "Localisation Options" 
 

Monday, April 1, 2019

Disable Device Enrollment Notification on Apple macOS

Disable Device Enrollment Notification on Mac
Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

mv com.apple.ManagedClient.cloudconfigurationd.plist com.apple.ManagedClient.cloudconfigurationd.plist.bak
mv com.apple.ManagedClient.enroll.plist com.apple.ManagedClient.enroll.plist.bak
mv com.apple.ManagedClient.plist com.apple.ManagedClient.plist.bak
mv com.apple.ManagedClient.startup.plist com.apple.ManagedClient.startup.plist.bak
Restart computer