Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Strong-Foundation committed Jan 5, 2025
1 parent b5761f0 commit 4232057
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
8 changes: 2 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

# Download and set up the Unbound Manager script from the GitHub repository
RUN curl -sSL https://raw.githubusercontent.com/complexorganizations/unbound-manager/main/unbound-manager.sh -o /usr/local/bin/unbound-manager.sh && \
RUN curl -sSL https://raw.githubusercontent.com/Strong-Foundation/unbound-manager/refs/heads/main/unbound-manager.sh -o /usr/local/bin/unbound-manager.sh && \
# Ensure the script is executable
chmod +x /usr/local/bin/unbound-manager.sh

# Expose port 53 for DNS services (both TCP and UDP)
EXPOSE 53/tcp 53/udp

# Set the ENTRYPOINT to run the Unbound Manager script on container startup
# The script will handle the installation and setup process automatically on the first run.
ENTRYPOINT ["/usr/local/bin/unbound-manager.sh"]
EXPOSE 53/tcp 53/udp
9 changes: 1 addition & 8 deletions unbound-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,9 @@ if [ ! -f "${UNBOUND_MANAGER}" ]; then
# Install unbound Ad Blocker Config
function ad-block-config-unbound() {
# Download the ad blocker config file from the provided URL and save it to the specified host file
curl -sSL "${UNBOUND_CONFIG_HOST_URL}" -o "${UNBOUND_CONFIG_HOST}"
# Append the path of the downloaded config file to the main unbound config file
curl "${UNBOUND_CONFIG_HOST_URL}" | awk '{print "local-zone: \""$1"\" always_refuse"}' >${UNBOUND_CONFIG_HOST}
# This makes the unbound configuration aware of the newly downloaded blocklist
echo "include: ${UNBOUND_CONFIG_HOST}" >>"${UNBOUND_CONFIG}"
# Prepend "0.0.0.0" to each line in the downloaded blocklist file to redirect blocked domains to the null IP address
# This modifies the entries so they are effectively "blocked" by resolving to an invalid address
sed -i -e "s_.*_0.0.0.0 &_" "${UNBOUND_CONFIG_HOST}"
# Filter the lines starting with "0.0.0.0" and format them as Unbound local-data entries
# The formatted lines will specify that the domain resolves to 0.0.0.0, which Unbound will treat as an invalid IP
grep "^0\.0\.0\.0" "${UNBOUND_CONFIG_HOST}" | awk '{print "local-data: \""$2" IN A 0.0.0.0\""}' >"${UNBOUND_CONFIG_HOST}"
# Print a success message indicating the ad blocker config has been applied
echo "Ad blocker config has been applied successfully."
}
Expand Down

0 comments on commit 4232057

Please sign in to comment.