Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pi-hole FTL v6.0.1 #2222

Merged
merged 16 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,20 @@ updates:
github_action-dependencies:
patterns:
- "*"
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
day: saturday
time: "10:00"
open-pull-requests-limit: 10
target-branch: development
reviewers:
- "pi-hole/ftl-maintainers"
pull-request-branch-name:
# Separate sections of the branch name with a hyphen
separator: "-"
groups:
npm-dependencies:
patterns:
- "*"
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build, Test, Deploy

permissions:
id-token: write
contents: read
contents: write # needed for softprops/action-gh-release
attestations: write

on:
Expand Down
2 changes: 1 addition & 1 deletion src/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ static void initConfig(struct config *conf)
conf->webserver.port.a = cJSON_CreateStringReference("comma-separated list of <[ip_address:]port>");
conf->webserver.port.f = FLAG_RESTART_FTL;
conf->webserver.port.t = CONF_STRING;
conf->webserver.port.d.s = (char*)"80o,[::]:80o,443so,[::]:443so";
conf->webserver.port.d.s = (char*)"80o,443os,[::]:80o,[::]:443os";
conf->webserver.port.c = validate_stub; // Type-based checking + civetweb syntax checking

conf->webserver.threads.k = "webserver.threads";
Expand Down
11 changes: 9 additions & 2 deletions src/config/env.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,21 @@ void getEnvVars(void)
// Split key and value using strtok_r
char *saveptr = NULL;
char *key = strtok_r(env_copy, "=", &saveptr);
char *value = strtok_r(NULL, "=", &saveptr);

// Log warning if value is missing
if(value == NULL)
char *value;
if(strlen(*env) <= strlen(key) + 1)
{
log_warn("Environment variable %s has no value, substituting with empty string", key);
value = (char*)"";
}
else
{
// The entire string *after* the key + 1 (for
// the '=') is the value
value = *env + strlen(key) + 1;
}
log_debug(DEBUG_CONFIG, "ENV \"%s\" = \"%s\"", key, value);

// Add to list
struct env_item *new_item = calloc(1, sizeof(struct env_item));
Expand Down
21 changes: 14 additions & 7 deletions src/config/legacy_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,13 +835,20 @@ static void readDebugingSettingsLegacy(FILE *fp)
opened = true;
}

// DEBUG_ALL
// defaults to: false
// ~0 is a shortcut for "all bits set"
setDebugOption(fp, "DEBUG_ALL", ~(enum debug_flag)0);

for(enum debug_flag flag = DEBUG_DATABASE; flag < DEBUG_EXTRA; flag <<= 1)
setDebugOption(fp, debugstr(flag), flag);
bool bit = false;
const char *debug_all = parseFTLconf(fp, "DEBUG_ALL");
if(debug_all != NULL && parseBool(debug_all, &bit) && bit)
{
// Set all debug flags if DEBUG_ALL is set to true
set_all_debug(&config, true);
}
else
{
// Iterate over all debug flags and set them if they are present
// in the config file.
for(enum debug_flag flag = DEBUG_DATABASE; flag < DEBUG_EXTRA; flag <<= 1)
setDebugOption(fp, debugstr(flag), flag);
}

// Parse debug options
set_debug_flags(&config);
Expand Down
10 changes: 10 additions & 0 deletions src/webserver/lua_web.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ int request_handler(struct mg_connection *conn, void *cbdata)
/* Handler may access the request info using mg_get_request_info */
const struct mg_request_info *req_info = mg_get_request_info(conn);

// Do not redirect for ACME challenges
log_info("Local URI: \"%s\"", req_info->local_uri_raw);
const char acme_challenge[] = "/.well-known/acme-challenge/";
const bool is_acme = strncmp(req_info->local_uri_raw, acme_challenge, strlen(acme_challenge)) == 0;
if(is_acme)
{
// ACME challenge - no authentication required
return 0;
}

// Build minimal api struct to check authentication
struct ftl_conn api = { 0 };
api.conn = conn;
Expand Down
5 changes: 2 additions & 3 deletions src/zip/teleporter.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,8 @@ const char *generate_teleporter_zip(mz_zip_archive *zip, char filename[128], voi
mz_zip_error pErr;
if(!mz_zip_validate_mem_archive(*ptr, *size, MZ_ZIP_FLAG_VALIDATE_LOCATE_FILE_FLAG, &pErr))
{
log_err("Failed to validate generated Teleporter ZIP archive: %s",
mz_zip_get_error_string(pErr));
return "Failed to validate generated Teleporter ZIP archive!";
log_warn("Failed to validate generated Teleporter ZIP archive: %s",
mz_zip_get_error_string(pErr));
}

// Generate filename for ZIP archive (it has both the hostname and the
Expand Down
2 changes: 1 addition & 1 deletion test/pihole.toml
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
#
# Possible values are:
# comma-separated list of <[ip_address:]port>
port = "80o,[::]:80o,443so,[::]:443so"
port = "80o,443os,[::]:80o,[::]:443os"

# Maximum number of worker threads allowed.
# The Pi-hole web server handles each incoming connection in a separate thread.
Expand Down
2 changes: 1 addition & 1 deletion test/test_suite.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2105,7 +2105,7 @@
[[ "${lines[0]}" == "[ 1.1.1.1 abc-custom.com def-custom.de, 2.2.2.2 äste.com steä.com ]" ]]
run bash -c './pihole-FTL --config webserver.port'
printf "%s\n" "${lines[@]}"
[[ "${lines[0]}" == "80o,[::]:80o,443so,[::]:443so" ]]
[[ "${lines[0]}" == "80o,443os,[::]:80o,[::]:443os" ]]
}

@test "Create, verify and re-import Teleporter file via CLI" {
Expand Down
Loading