
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
github.com/rclsilver-org/usg-dns-api
Advanced tools
usg-dns-api is a program that exposes an API for managing DNS records on Ubiquiti routers. It interacts with the Unifi Controller and builds a hosts file based on the following:
Reverse records are also automatically generated.
Download the .deb file from the GitHub releases using curl:
curl -L https://github.com/rclsilver-org/usg-dns-api/releases/download/<version>/usg-dns-api_<version>_mips.deb -o usg-dns-api_mips.deb
Install the .deb package:
sudo dpkg -i usg-dns-api_mips.deb
Edit the configuration file located at /etc/usg-dns-api/usg-dns-api.yaml to suit your environment.
Generate a token for API access:
sudo usg-dns-api generate-token
Enable the service to start at boot:
sudo update-rc.d usg-dns-api defaults
Start the service:
sudo /etc/init.d/usg-dns-api start
To configure dnsmasq persistently on Ubiquiti routers, edit the config.gateway.json file and add the following configuration:
{
"service": {
"forwarding": {
"options": [
"server=8.8.8.8",
"server=8.8.4.4",
"all-servers",
"no-hosts",
"addn-hosts=/config/user-data/hosts",
"domain-needed",
"bogus-priv",
"expand-hosts",
"domain=local.example.com",
"local=/local.example.com/"
]
}
}
}
List all DNS records:
curl -i -H "Authorization: <master-token>" http://<router>:8080/records
Add a DNS record:
curl -i -H "Authorization: <master-token>" -X POST http://<router>:8080/records -d '{"name": "foo", "target": "127.0.0.1"}'
Update a DNS record:
curl -i -H "Authorization: <master-token>" -X PUT http://<router>:8080/records/<id> -d '{"name": "foo", "target": "127.0.0.1"}'
Delete a DNS record:
curl -i -H "Authorization: <master-token>" -X DELETE http://<router>:8080/records/<id>
This API allows you to easily manage DNS records through a simple HTTP interface with the token-based authentication for secure access.
FAQs
Unknown package
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.