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

Added docker configuration and pihole to smartdns converter #144

Merged
merged 1 commit into from
Jun 2, 2023
Merged

Added docker configuration and pihole to smartdns converter #144

merged 1 commit into from
Jun 2, 2023

Conversation

SamTV12345
Copy link
Contributor

@SamTV12345 SamTV12345 commented May 31, 2023

  • Adds a docker configuration to get started with smartdns-rs with Docker.
  • Adds a pihole to smartdns converter

The first one solves the problem that I want to host smartdns not on a host and rather in docker-compose/K3S. It is configured by mapping a conf file into the container. This can be done in Kubernetes e.g. with a initContainer

As far as I can see there are only 2 "official" adlists for smartdns. This converter script enables the user to convert a pihole adlist which always has the format 0.0.0.0 address to address /address/# which does not resolve in smartdns.
The output in smartdns-ads.txt can then be copied into your custom smartdns.conf file which then in return can be mounted into the Docker container.

@SamTV12345 SamTV12345 changed the title Added docker configuration. Added docker configuration and pihole to smartdns converter May 31, 2023
@mokeyish
Copy link
Owner

mokeyish commented Jun 1, 2023

Thanks for the contributions.

Can you move the docker related to the contrib/docker directory?

Because these changes include a specific version number, it is unlikely that I will update it every release. Put it in contrib, so that other users who need it can refer to it.

@mokeyish
Copy link
Owner

mokeyish commented Jun 1, 2023

address /address/# returns SOA

address /address/0.0.0.0 returns 0.0.0.0

Which one is better depends on your choice.

@SamTV12345
Copy link
Contributor Author

I'll try to change that to 0.0.0.0 and check if that solves the problem that some dns entries can escape the blocklist.

@SamTV12345
Copy link
Contributor Author

Concerning the docker part you could add that to the release pipeline. You can override the ARG default value with --args. An example is given here. After the release is published you can trigger that docker build pipeline and push it to your own Dockerhub/Github account registry.

@mokeyish
Copy link
Owner

mokeyish commented Jun 1, 2023

A more convenient way is putting domain names at a indenpendent file and load it by domain-set.

domains.txt

a.com
www.google.com

smartdns.conf

# load `domains.txt` as `abc`
domain-set -name abc -f domains.txt

# then
address /domain-set:abc/# 
# or
address /domain-set:abc/0.0.0.0

@mokeyish
Copy link
Owner

mokeyish commented Jun 1, 2023

Concerning the docker part you could add that to the release pipeline. You can override the ARG default value with --args. An example is given here. After the release is published you can trigger that docker build pipeline and push it to your own Dockerhub/Github account registry.

Let's move over there first. In fact, docker is not necessary for this project. The program itself is also single-file binary, easy to deploy, and only reads one configuration file. For better performance, docker is not recommended.

It would be better if github actions can automatically build the image, but I don't have the energy to implement this at the moment.

@SamTV12345
Copy link
Contributor Author

A more convenient way is putting domain names at a indenpendent file and load it by domain-set.

domains.txt

a.com
www.google.com

smartdns.conf

# load `domains.txt` as `abc`
domain-set -name abc -f domains.txt

# then
address /domain-set:abc/# 
# or
address /domain-set:abc/0.0.0.0

Good idea. I'll do that.

@SamTV12345
Copy link
Contributor Author

I did change the directory and decided for 0.0.0.0. With that a domain is 100% blocked.

@SamTV12345
Copy link
Contributor Author

Hope this is okay now.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A very useful script, also moved to contrib.

etc/.gitignore Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is? Should it be placed in contrib/docker?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is the docker entrypoint script for starting the binary.

@SamTV12345
Copy link
Contributor Author

I moved everything to contrib/docker.

@mokeyish mokeyish merged commit 6daea68 into mokeyish:main Jun 2, 2023
FlyLoongZ pushed a commit to FlyLoongZ/smartdns-rs that referenced this pull request Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants