mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Change default log file path to /var/log/pihole/FTL.log
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
+2
-2
@@ -78,7 +78,7 @@ void getLogFilePath(void)
|
||||
}
|
||||
|
||||
// Read LOGFILE value if available
|
||||
// defaults to: "/var/log/pihole/pihole-FTL.log"
|
||||
// defaults to: "/var/log/pihole/FTL.log"
|
||||
buffer = parse_FTLconf(fp, "LOGFILE");
|
||||
|
||||
errno = 0;
|
||||
@@ -86,7 +86,7 @@ void getLogFilePath(void)
|
||||
if(buffer == NULL || sscanf(buffer, "%127ms", &FTLfiles.log) != 1)
|
||||
{
|
||||
// Use standard path if no custom path was obtained from the config file
|
||||
FTLfiles.log = strdup("/var/log/pihole/pihole-FTL.log");
|
||||
FTLfiles.log = strdup("/var/log/pihole/FTL.log");
|
||||
}
|
||||
|
||||
// Test if memory allocation was successful
|
||||
|
||||
@@ -241,7 +241,7 @@ void SQLite3LogCallback(void *pArg, int iErrCode, const char *zMsg)
|
||||
void db_init(void)
|
||||
{
|
||||
// Initialize SQLite3 logging callback
|
||||
// This ensures SQLite3 errors and warnings are logged to pihole-FTL.log
|
||||
// This ensures SQLite3 errors and warnings are logged to FTL.log
|
||||
// We use this to possibly catch even more errors in places we do not
|
||||
// explicitly check for failures to have happened
|
||||
sqlite3_config(SQLITE_CONFIG_LOG, SQLite3LogCallback, NULL);
|
||||
|
||||
@@ -1021,7 +1021,7 @@ bool gravityDB_getTable(const unsigned char list)
|
||||
// as there are domains available. Once we reached the
|
||||
// end of the table, it returns NULL. It also returns
|
||||
// NULL when it encounters an error (e.g., on reading
|
||||
// errors). Errors are logged to pihole-FTL.log
|
||||
// errors). Errors are logged to FTL.log
|
||||
// This function is performance critical as it might
|
||||
// be called millions of times for large blocking lists
|
||||
inline const char* gravityDB_getDomain(int *rowid)
|
||||
@@ -1066,9 +1066,8 @@ void gravityDB_finalizeTable(void)
|
||||
table_stmt = NULL;
|
||||
}
|
||||
|
||||
// Get number of domains in a specified table of the gravity database
|
||||
// We return the constant DB_FAILED and log to pihole-FTL.log if we
|
||||
// encounter any error
|
||||
// Get number of domains in a specified table of the gravity database We return
|
||||
// the constant DB_FAILED and log to FTL.log if we encounter any error
|
||||
int gravityDB_count(const enum gravity_tables list)
|
||||
{
|
||||
if(!gravityDB_opened && !gravityDB_open())
|
||||
|
||||
@@ -304,7 +304,7 @@ void logg_regex_warning(const char *type, const char *warning, const int dbindex
|
||||
if(getpid() != main_pid())
|
||||
return;
|
||||
|
||||
// Log to pihole-FTL.log
|
||||
// Log to FTL.log
|
||||
logg("REGEX WARNING: Invalid regex %s filter \"%s\": %s",
|
||||
type, regex, warning);
|
||||
|
||||
@@ -317,7 +317,7 @@ void logg_subnet_warning(const char *ip, const int matching_count, const char *m
|
||||
const int matching_bits, const char *chosen_match_text,
|
||||
const int chosen_match_id)
|
||||
{
|
||||
// Log to pihole-FTL.log
|
||||
// Log to FTL.log
|
||||
logg("SUBNET WARNING: Client %s is managed by %i groups (IDs %s), all describing /%i subnets. "
|
||||
"FTL chose the most recent entry %s (ID %i) for this client.",
|
||||
ip, matching_count, matching_ids, matching_bits,
|
||||
@@ -331,7 +331,7 @@ void logg_subnet_warning(const char *ip, const int matching_count, const char *m
|
||||
|
||||
void logg_hostname_warning(const char *ip, const char *name, const unsigned int pos)
|
||||
{
|
||||
// Log to pihole-FTL.log
|
||||
// Log to FTL.log
|
||||
logg("HOSTNAME WARNING: Host name of client \"%s\" => \"%s\" contains (at least) one invalid character at position %d",
|
||||
ip, name, pos);
|
||||
|
||||
@@ -341,7 +341,7 @@ void logg_hostname_warning(const char *ip, const char *name, const unsigned int
|
||||
|
||||
void logg_fatal_dnsmasq_message(const char *message)
|
||||
{
|
||||
// Log to pihole-FTL.log
|
||||
// Log to FTL.log
|
||||
logg("FATAL ERROR in dnsmasq core: %s", message);
|
||||
|
||||
// Log to database
|
||||
@@ -356,7 +356,7 @@ void logg_rate_limit_message(const char *clientIP, const unsigned int rate_limit
|
||||
{
|
||||
const time_t turnaround = get_rate_limit_turnaround(rate_limit_count);
|
||||
|
||||
// Log to pihole-FTL.log
|
||||
// Log to FTL.log
|
||||
logg("Rate-limiting %s for at least %ld second%s",
|
||||
clientIP, turnaround, turnaround == 1 ? "" : "s");
|
||||
|
||||
@@ -366,7 +366,7 @@ void logg_rate_limit_message(const char *clientIP, const unsigned int rate_limit
|
||||
|
||||
void logg_warn_dnsmasq_message(char *message)
|
||||
{
|
||||
// Log to pihole-FTL.log
|
||||
// Log to FTL.log
|
||||
logg("WARNING in dnsmasq core: %s", message);
|
||||
|
||||
// Log to database
|
||||
|
||||
+6
-6
@@ -20,14 +20,14 @@ while pidof -s pihole-FTL > /dev/null; do
|
||||
done
|
||||
|
||||
# Clean up possible old files from earlier test runs
|
||||
rm -f /etc/pihole/gravity.db /etc/pihole/pihole-FTL.db /var/log/pihole/pihole.log /var/log/pihole/pihole-FTL.log /dev/shm/FTL-*
|
||||
rm -f /etc/pihole/gravity.db /etc/pihole/pihole-FTL.db /var/log/pihole/pihole.log /var/log/pihole/FTL.log /dev/shm/FTL-*
|
||||
|
||||
# Create necessary directories and files
|
||||
mkdir -p /home/pihole /etc/pihole /run/pihole /var/log/pihole
|
||||
echo "" > /var/log/pihole/pihole-FTL.log
|
||||
echo "" > /var/log/pihole/FTL.log
|
||||
echo "" > /var/log/pihole/pihole.log
|
||||
touch /run/pihole-FTL.pid /run/pihole-FTL.port dig.log ptr.log
|
||||
chown pihole:pihole /etc/pihole /run/pihole /var/log/pihole/pihole.log /var/log/pihole/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
|
||||
chown pihole:pihole /etc/pihole /run/pihole /var/log/pihole/pihole.log /var/log/pihole/FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
|
||||
|
||||
# Copy binary into a location the new user pihole can access
|
||||
cp ./pihole-FTL /home/pihole/pihole-FTL
|
||||
@@ -97,11 +97,11 @@ curl_to_tricorder() {
|
||||
}
|
||||
|
||||
if [[ $RET != 0 ]]; then
|
||||
echo -n "pihole.log: "
|
||||
echo -n "pihole/pihole.log: "
|
||||
curl_to_tricorder /var/log/pihole/pihole.log
|
||||
echo ""
|
||||
echo -n "pihole-FTL.log: "
|
||||
curl_to_tricorder /var/log/pihole/pihole-FTL.log
|
||||
echo -n "pihole/FTL.log: "
|
||||
curl_to_tricorder /var/log/pihole/FTL.log
|
||||
echo ""
|
||||
echo -n "dig.log: "
|
||||
curl_to_tricorder ./dig.log
|
||||
|
||||
+68
-68
@@ -33,19 +33,19 @@
|
||||
}
|
||||
|
||||
@test "Starting tests without prior history" {
|
||||
run bash -c 'grep -c "Total DNS queries: 0" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "Total DNS queries: 0" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
}
|
||||
|
||||
@test "Initial blocking status is enabled" {
|
||||
run bash -c 'grep -c "Blocking status is enabled" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "Blocking status is enabled" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
}
|
||||
|
||||
@test "Number of compiled regex filters as expected" {
|
||||
run bash -c 'grep "Compiled [0-9]* whitelist" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep "Compiled [0-9]* whitelist" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == *"Compiled 2 whitelist and 9 blacklist regex filters"* ]]
|
||||
}
|
||||
@@ -159,31 +159,31 @@
|
||||
@test "Client 4: Client is recognized by MAC address" {
|
||||
run bash -c "dig TXT CHAOS version.bind -b 127.0.0.4 @127.0.0.1 +short"
|
||||
run sleep 0.1
|
||||
run bash -c "grep -c \"Found database hardware address 127.0.0.4 -> aa:bb:cc:dd:ee:ff\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c \"Found database hardware address 127.0.0.4 -> aa:bb:cc:dd:ee:ff\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c \"Gravity database: Client aa:bb:cc:dd:ee:ff found. Using groups (4)\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c \"Gravity database: Client aa:bb:cc:dd:ee:ff found. Using groups (4)\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} != "0" ]]
|
||||
run bash -c "grep -c 'Regex blacklist: Querying groups for client 127.0.0.4: \"SELECT id from vw_regex_blacklist WHERE group_id IN (4);\"' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex blacklist: Querying groups for client 127.0.0.4: \"SELECT id from vw_regex_blacklist WHERE group_id IN (4);\"' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'Regex whitelist: Querying groups for client 127.0.0.4: \"SELECT id from vw_regex_whitelist WHERE group_id IN (4);\"' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex whitelist: Querying groups for client 127.0.0.4: \"SELECT id from vw_regex_whitelist WHERE group_id IN (4);\"' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_whitelist WHERE domain = ? AND group_id IN (4));' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_whitelist WHERE domain = ? AND group_id IN (4));' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} != "0" ]]
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_blacklist WHERE domain = ? AND group_id IN (4));' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_blacklist WHERE domain = ? AND group_id IN (4));' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} != "0" ]]
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_gravity WHERE domain = ? AND group_id IN (4));' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_gravity WHERE domain = ? AND group_id IN (4));' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} != "0" ]]
|
||||
run bash -c "grep -c 'Regex whitelist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.4' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex whitelist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.4' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "2" ]]
|
||||
run bash -c "grep -c 'Regex blacklist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.4' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex blacklist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.4' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "9" ]]
|
||||
}
|
||||
@@ -191,31 +191,31 @@
|
||||
@test "Client 5: Client is recognized by MAC address" {
|
||||
run bash -c "dig TXT CHAOS version.bind -b 127.0.0.5 @127.0.0.1 +short"
|
||||
run sleep 0.1
|
||||
run bash -c "grep -c \"Found database hardware address 127.0.0.5 -> aa:bb:cc:dd:ee:ff\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c \"Found database hardware address 127.0.0.5 -> aa:bb:cc:dd:ee:ff\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c \"Gravity database: Client aa:bb:cc:dd:ee:ff found. Using groups (4)\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c \"Gravity database: Client aa:bb:cc:dd:ee:ff found. Using groups (4)\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} != "0" ]]
|
||||
run bash -c "grep -c 'Regex blacklist: Querying groups for client 127.0.0.5: \"SELECT id from vw_regex_blacklist WHERE group_id IN (4);\"' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex blacklist: Querying groups for client 127.0.0.5: \"SELECT id from vw_regex_blacklist WHERE group_id IN (4);\"' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'Regex whitelist: Querying groups for client 127.0.0.5: \"SELECT id from vw_regex_whitelist WHERE group_id IN (4);\"' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex whitelist: Querying groups for client 127.0.0.5: \"SELECT id from vw_regex_whitelist WHERE group_id IN (4);\"' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_whitelist WHERE domain = ? AND group_id IN (4));' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_whitelist WHERE domain = ? AND group_id IN (4));' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} != "0" ]]
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_blacklist WHERE domain = ? AND group_id IN (4));' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_blacklist WHERE domain = ? AND group_id IN (4));' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} != "0" ]]
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_gravity WHERE domain = ? AND group_id IN (4));' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_gravity WHERE domain = ? AND group_id IN (4));' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} != "0" ]]
|
||||
run bash -c "grep -c 'Regex whitelist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.5' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex whitelist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.5' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "2" ]]
|
||||
run bash -c "grep -c 'Regex blacklist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.5' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex blacklist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.5' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "9" ]]
|
||||
}
|
||||
@@ -223,37 +223,37 @@
|
||||
@test "Client 6: Client is recognized by interface name" {
|
||||
run bash -c "dig TXT CHAOS version.bind -b 127.0.0.6 @127.0.0.1 +short"
|
||||
run sleep 0.1
|
||||
run bash -c "grep -c \"Found database hardware address 127.0.0.6 -> 00:11:22:33:44:55\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c \"Found database hardware address 127.0.0.6 -> 00:11:22:33:44:55\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c \"There is no record for 00:11:22:33:44:55 in the client table\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c \"There is no record for 00:11:22:33:44:55 in the client table\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c \"Found database interface 127.0.0.6 -> enp0s123\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c \"Found database interface 127.0.0.6 -> enp0s123\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c \"Gravity database: Client 00:11:22:33:44:55 found (identified by interface enp0s123). Using groups (5)\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c \"Gravity database: Client 00:11:22:33:44:55 found (identified by interface enp0s123). Using groups (5)\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'Regex blacklist: Querying groups for client 127.0.0.6: \"SELECT id from vw_regex_blacklist WHERE group_id IN (5);\"' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex blacklist: Querying groups for client 127.0.0.6: \"SELECT id from vw_regex_blacklist WHERE group_id IN (5);\"' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'Regex whitelist: Querying groups for client 127.0.0.6: \"SELECT id from vw_regex_whitelist WHERE group_id IN (5);\"' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex whitelist: Querying groups for client 127.0.0.6: \"SELECT id from vw_regex_whitelist WHERE group_id IN (5);\"' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_whitelist WHERE domain = ? AND group_id IN (5));' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_whitelist WHERE domain = ? AND group_id IN (5));' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_blacklist WHERE domain = ? AND group_id IN (5));' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_blacklist WHERE domain = ? AND group_id IN (5));' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_gravity WHERE domain = ? AND group_id IN (5));' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'get_client_querystr: SELECT EXISTS(SELECT domain from vw_gravity WHERE domain = ? AND group_id IN (5));' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c "grep -c 'Regex whitelist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.6' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex whitelist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.6' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "2" ]]
|
||||
run bash -c "grep -c 'Regex blacklist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.6' /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "grep -c 'Regex blacklist ([[:digit:]]*, DB ID [[:digit:]]*) .* NOT ENABLED for client 127.0.0.6' /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "9" ]]
|
||||
}
|
||||
@@ -652,48 +652,48 @@
|
||||
[[ ${lines[3]} == "Available arguments:" ]]
|
||||
}
|
||||
|
||||
@test "No WARNING messages in pihole-FTL.log (besides known capability issues)" {
|
||||
run bash -c 'grep "WARNING" /var/log/pihole/pihole-FTL.log'
|
||||
@test "No WARNING messages in FTL.log (besides known capability issues)" {
|
||||
run bash -c 'grep "WARNING" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
run bash -c 'grep "WARNING" /var/log/pihole/pihole-FTL.log | grep -c -v -E "CAP_NET_ADMIN|CAP_NET_RAW|CAP_SYS_NICE|CAP_IPC_LOCK|CAP_CHOWN"'
|
||||
run bash -c 'grep "WARNING" /var/log/pihole/FTL.log | grep -c -v -E "CAP_NET_ADMIN|CAP_NET_RAW|CAP_SYS_NICE|CAP_IPC_LOCK|CAP_CHOWN"'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "0" ]]
|
||||
}
|
||||
|
||||
@test "No \"database not available\" messages in pihole-FTL.log" {
|
||||
run bash -c 'grep -c "database not available" /var/log/pihole/pihole-FTL.log'
|
||||
@test "No \"database not available\" messages in FTL.log" {
|
||||
run bash -c 'grep -c "database not available" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "0" ]]
|
||||
}
|
||||
|
||||
@test "No ERROR messages in pihole-FTL.log" {
|
||||
run bash -c 'grep "ERROR" /var/log/pihole/pihole-FTL.log'
|
||||
@test "No ERROR messages in FTL.log" {
|
||||
run bash -c 'grep "ERROR" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
run bash -c 'grep -c "ERROR" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "ERROR" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "0" ]]
|
||||
}
|
||||
|
||||
@test "No FATAL messages in pihole-FTL.log (besides error due to starting FTL more than once)" {
|
||||
run bash -c 'grep "FATAL" /var/log/pihole/pihole-FTL.log'
|
||||
@test "No FATAL messages in FTL.log (besides error due to starting FTL more than once)" {
|
||||
run bash -c 'grep "FATAL" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
run bash -c 'grep "FATAL:" /var/log/pihole/pihole-FTL.log | grep -c -v "FATAL: create_shm(): Failed to create shared memory object \"FTL-lock\": File exists"'
|
||||
run bash -c 'grep "FATAL:" /var/log/pihole/FTL.log | grep -c -v "FATAL: create_shm(): Failed to create shared memory object \"FTL-lock\": File exists"'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "0" ]]
|
||||
}
|
||||
|
||||
# Regex tests
|
||||
@test "Compiled blacklist regex as expected" {
|
||||
run bash -c 'grep -c "Compiling blacklist regex 0 (DB ID 6): regex\[0-9\].ftl" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "Compiling blacklist regex 0 (DB ID 6): regex\[0-9\].ftl" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
}
|
||||
|
||||
@test "Compiled whitelist regex as expected" {
|
||||
run bash -c 'grep -c "Compiling whitelist regex 0 (DB ID 3): regex2" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "Compiling whitelist regex 0 (DB ID 3): regex2" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c 'grep -c "Compiling whitelist regex 1 (DB ID 4): ^gravity-whitelisted" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "Compiling whitelist regex 1 (DB ID 4): ^gravity-whitelisted" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
}
|
||||
@@ -1078,21 +1078,21 @@
|
||||
}
|
||||
|
||||
@test "Architecture is correctly reported on startup" {
|
||||
run bash -c 'grep "Compiled for" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep "Compiled for" /var/log/pihole/FTL.log'
|
||||
printf "Output: %s\n\$CI_ARCH: %s\nuname -m: %s\n" "${lines[@]:-not set}" "${CI_ARCH:-not set}" "$(uname -m)"
|
||||
[[ ${lines[0]} == *"Compiled for ${CI_ARCH:-$(uname -m)}"* ]]
|
||||
}
|
||||
|
||||
@test "Building machine (CI) is reported on startup" {
|
||||
[[ ${CI_ARCH} != "" ]] && compiled_str="on CI" || compiled_str="locally" && export compiled_str
|
||||
run bash -c 'grep "Compiled for" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep "Compiled for" /var/log/pihole/FTL.log'
|
||||
printf "Output: %s\n\$CI_ARCH: %s\n" "${lines[@]:-not set}" "${CI_ARCH:-not set}"
|
||||
[[ ${lines[0]} == *"(compiled ${compiled_str})"* ]]
|
||||
}
|
||||
|
||||
@test "Compiler version is correctly reported on startup" {
|
||||
compiler_version="$(${CC} --version | head -n1)" && export compiler_version
|
||||
run bash -c 'grep "Compiled for" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep "Compiled for" /var/log/pihole/FTL.log'
|
||||
printf "Output: %s\n\$CC: %s\nVersion: %s\n" "${lines[@]:-not set}" "${CC:-not set}" "${compiler_version:-not set}"
|
||||
[[ ${lines[0]} == *"using ${compiler_version}"* ]]
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@
|
||||
}
|
||||
|
||||
@test "No errors on setting busy handlers for the databases" {
|
||||
run bash -c 'grep -c "Cannot set busy handler" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "Cannot set busy handler" /var/log/pihole/FTL.log'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "0" ]]
|
||||
}
|
||||
@@ -1136,7 +1136,7 @@
|
||||
|
||||
@test "EDNS(0) analysis working as expected" {
|
||||
# Get number of lines in the log before the test
|
||||
before="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
before="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Run test command
|
||||
# CLIENT SUBNET COOKIE MAC HEX MAC TEXT CPE-ID
|
||||
@@ -1146,10 +1146,10 @@
|
||||
[[ $status == 0 ]]
|
||||
|
||||
# Get number of lines in the log after the test
|
||||
after="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
after="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Extract relevant log lines
|
||||
log="$(sed -n "${before},${after}p" /var/log/pihole/pihole-FTL.log)"
|
||||
log="$(sed -n "${before},${after}p" /var/log/pihole/FTL.log)"
|
||||
printf "%s\n" "${log}"
|
||||
|
||||
# Start actual test
|
||||
@@ -1172,7 +1172,7 @@
|
||||
|
||||
@test "EDNS(0) ECS can overwrite client address (IPv4)" {
|
||||
# Get number of lines in the log before the test
|
||||
before="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
before="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Run test command
|
||||
run bash -c 'dig localhost +short +subnet=192.168.47.97/32 @127.0.0.1'
|
||||
@@ -1181,17 +1181,17 @@
|
||||
[[ $status == 0 ]]
|
||||
|
||||
# Get number of lines in the log after the test
|
||||
after="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
after="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Extract relevant log lines
|
||||
run bash -c "sed -n \"${before},${after}p\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "sed -n \"${before},${after}p\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ "${lines[@]}" == *"**** new UDP IPv4 query[A] query \"localhost\" from lo/192.168.47.97#53 "* ]]
|
||||
}
|
||||
|
||||
@test "EDNS(0) ECS can overwrite client address (IPv6)" {
|
||||
# Get number of lines in the log before the test
|
||||
before="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
before="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Run test command
|
||||
run bash -c 'dig localhost +short +subnet=fe80::b167:af1e:968b:dead/128 @127.0.0.1'
|
||||
@@ -1200,29 +1200,29 @@
|
||||
[[ $status == 0 ]]
|
||||
|
||||
# Get number of lines in the log after the test
|
||||
after="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
after="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Extract relevant log lines
|
||||
run bash -c "sed -n \"${before},${after}p\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "sed -n \"${before},${after}p\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ "${lines[@]}" == *"**** new UDP IPv4 query[A] query \"localhost\" from lo/fe80::b167:af1e:968b:dead#53 "* ]]
|
||||
}
|
||||
|
||||
@test "alias-client is imported and used for configured client" {
|
||||
run bash -c 'grep -c "Added alias-client \"some-aliasclient\" (aliasclient-0) with FTL ID 0" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "Added alias-client \"some-aliasclient\" (aliasclient-0) with FTL ID 0" /var/log/pihole/FTL.log'
|
||||
printf "Added: %s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c 'grep -c "Aliasclient ID 127.0.0.6 -> 0" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "Aliasclient ID 127.0.0.6 -> 0" /var/log/pihole/FTL.log'
|
||||
printf "Found ID: %s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
run bash -c 'grep -c "Client .* (127.0.0.6) IS managed by this alias-client, adding counts" /var/log/pihole/pihole-FTL.log'
|
||||
run bash -c 'grep -c "Client .* (127.0.0.6) IS managed by this alias-client, adding counts" /var/log/pihole/FTL.log'
|
||||
printf "Adding counts: %s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == "1" ]]
|
||||
}
|
||||
|
||||
@test "EDNS(0) ECS skipped for loopback address (IPv4)" {
|
||||
# Get number of lines in the log before the test
|
||||
before="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
before="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Run test command
|
||||
run bash -c 'dig localhost +short +subnet=127.0.0.1/32 @127.0.0.1'
|
||||
@@ -1231,17 +1231,17 @@
|
||||
[[ $status == 0 ]]
|
||||
|
||||
# Get number of lines in the log after the test
|
||||
after="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
after="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Extract relevant log lines
|
||||
run bash -c "sed -n \"${before},${after}p\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "sed -n \"${before},${after}p\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ "${lines[@]}" == *"EDNS(0) CLIENT SUBNET: Skipped 127.0.0.1/32 (IPv4 loopback address)"* ]]
|
||||
}
|
||||
|
||||
@test "EDNS(0) ECS skipped for loopback address (IPv6)" {
|
||||
# Get number of lines in the log before the test
|
||||
before="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
before="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Run test command
|
||||
run bash -c 'dig localhost +short +subnet=::1/128 @127.0.0.1'
|
||||
@@ -1250,10 +1250,10 @@
|
||||
[[ $status == 0 ]]
|
||||
|
||||
# Get number of lines in the log after the test
|
||||
after="$(grep -c ^ /var/log/pihole/pihole-FTL.log)"
|
||||
after="$(grep -c ^ /var/log/pihole/FTL.log)"
|
||||
|
||||
# Extract relevant log lines
|
||||
run bash -c "sed -n \"${before},${after}p\" /var/log/pihole/pihole-FTL.log"
|
||||
run bash -c "sed -n \"${before},${after}p\" /var/log/pihole/FTL.log"
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ "${lines[@]}" == *"EDNS(0) CLIENT SUBNET: Skipped ::1/128 (IPv6 loopback address)"* ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user