mirror of
https://github.com/cmur2/dyndnsd.git
synced 2024-06-02 06:34:40 +02:00
Compare commits
136 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d1e3d6f9d2 | ||
|
dc0eb621e7 | ||
|
78b4f956cd | ||
|
85c6378d73 | ||
|
556f087a10 | ||
|
c962f3eb84 | ||
|
581885daa0 | ||
|
267a96bf73 | ||
|
44a4a28094 | ||
3f962fa3bb | |||
1171e0cb92 | |||
6a933194f3 | |||
e546d03d9f | |||
|
65d52675c9 | ||
|
636d6f6379 | ||
|
26381244aa | ||
|
d51937c68b | ||
|
dbc4073b66 | ||
|
d83f8d8e69 | ||
95acdcbc70 | |||
|
38fdf44c1f | ||
|
e3d57ea3aa | ||
|
90166c8ef2 | ||
|
98b413eb6b | ||
|
43df61b819 | ||
|
8ee945ed31 | ||
|
1ae0642541 | ||
|
be33b1917a | ||
|
e6c9773b8e | ||
|
5a54dbe0c7 | ||
|
aa20275888 | ||
|
049e14afa5 | ||
|
54544b75d1 | ||
|
3274741721 | ||
|
8d8a85a78f | ||
|
cdfe350828 | ||
|
337c86f47b | ||
|
20d359f328 | ||
|
4cf6591f38 | ||
|
5a9244694a | ||
|
015ee60420 | ||
|
2d4b94c129 | ||
|
aefd59aea8 | ||
|
10fd5699ac | ||
|
ecf425dd61 | ||
|
70ad2148b9 | ||
|
93e252443a | ||
|
d9f0119ab8 | ||
|
bf225b8e6a | ||
|
6a9e05fb97 | ||
|
bc4210d5ce | ||
|
a54235fcf2 | ||
|
be87ba8f31 | ||
|
5e947316f6 | ||
c71b23d35e | |||
2258edaae6 | |||
|
f8878077cf | ||
|
2deb5f3337 | ||
|
ca92b894cb | ||
e45902f5cf | |||
|
9ae88964ec | ||
|
90ae7543d7 | ||
|
37413bcd3b | ||
|
7af351c384 | ||
|
68dac5c6f3 | ||
|
c7130c7ee4 | ||
|
3c3c1fcb24 | ||
|
425318a0d1 | ||
|
c2eda1648b | ||
|
d72cfeddd8 | ||
|
6463999ab4 | ||
|
b56922c3c8 | ||
|
71666776b4 | ||
|
c4e6e16afb | ||
|
05f86550be | ||
|
edcd7e1e47 | ||
|
6f29034aef | ||
dd7553d5fd | |||
|
a21f6a4cad | ||
|
31a7f54827 | ||
|
d415451c8e | ||
|
699c907a84 | ||
|
1ad23c8716 | ||
|
c538a6b07f | ||
|
fe3f17cd02 | ||
|
0e9b17cb0b | ||
|
0f793f92d8 | ||
|
0fd3833b9c | ||
|
5bc5977704 | ||
|
684d1f0578 | ||
|
14bac86e9d | ||
|
12afe16a78 | ||
|
75059044de | ||
|
9f7ebfe59c | ||
|
ac42413580 | ||
|
415bb36754 | ||
481504f174 | |||
|
d68a93a94f | ||
|
69d2378747 | ||
|
ac929f65aa | ||
f648c28f18 | |||
|
2e6e69810e | ||
|
e9398eab71 | ||
65f8dbb21b | |||
|
6b6f6cf3a4 | ||
|
9af4f03013 | ||
|
b77c3b0996 | ||
|
600cbeb453 | ||
|
b2d369cc4c | ||
|
31e73c7c4a | ||
|
52874542a7 | ||
|
1daf68376d | ||
|
b5f5fa9105 | ||
|
ea1d4baa04 | ||
|
944d3fbc5d | ||
|
78721c5b15 | ||
|
fce992b842 | ||
|
a2a51d63ac | ||
|
b19213d099 | ||
|
ede79802d3 | ||
|
d4483b02a2 | ||
|
1fbad10a24 | ||
|
da28c76a68 | ||
|
e5c66824ab | ||
3d787a46ea | |||
3a5b1bcb27 | |||
|
d066b3ecee | ||
|
71b0fda5ee | ||
b1e948a2dc | |||
|
e22035919b | ||
|
1ffd1de964 | ||
|
39c7dc7837 | ||
|
7528e8084e | ||
|
343a56a6ba | ||
|
6111edc067 | ||
|
0e0d9dfc86 |
13
.github/dependabot.yml
vendored
Normal file
13
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "bundler"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
commit-message:
|
||||||
|
prefix: "gems"
|
||||||
|
labels: ["dependabot"]
|
||||||
|
open-pull-requests-limit: 10
|
||||||
|
pull-request-branch-name:
|
||||||
|
separator: "-"
|
5
.github/renovate.json5
vendored
5
.github/renovate.json5
vendored
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
extends: [
|
extends: [
|
||||||
"config:base",
|
"config:recommended",
|
||||||
":dependencyDashboard",
|
":dependencyDashboard",
|
||||||
":prHourlyLimitNone",
|
":prHourlyLimitNone",
|
||||||
":prConcurrentLimitNone",
|
":prConcurrentLimitNone",
|
||||||
|
@ -30,8 +30,9 @@
|
||||||
commitMessagePrefix: "ci: ",
|
commitMessagePrefix: "ci: ",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
regexManagers: [
|
customManagers: [
|
||||||
{
|
{
|
||||||
|
customType: "regex",
|
||||||
fileMatch: ["\.rb$", "^Rakefile$"],
|
fileMatch: ["\.rb$", "^Rakefile$"],
|
||||||
matchStrings: [
|
matchStrings: [
|
||||||
"renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\s.*_version = '(?<currentValue>.*)'\\s"
|
"renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\s.*_version = '(?<currentValue>.*)'\\s"
|
||||||
|
|
8
.github/workflows/cd.yml
vendored
8
.github/workflows/cd.yml
vendored
|
@ -11,7 +11,7 @@ jobs:
|
||||||
release-dockerimage:
|
release-dockerimage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Extract dyndnsd version from tag name
|
- name: Extract dyndnsd version from tag name
|
||||||
run: |
|
run: |
|
||||||
|
@ -33,16 +33,16 @@ jobs:
|
||||||
|
|
||||||
# https://github.com/marketplace/actions/build-and-push-docker-images
|
# https://github.com/marketplace/actions/build-and-push-docker-images
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: cmur2
|
username: cmur2
|
||||||
password: ${{ secrets.DOCKER_TOKEN }}
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push Docker image for dyndnsd ${{ env.DYNDNSD_VERSION }}
|
- name: Build and push Docker image for dyndnsd ${{ env.DYNDNSD_VERSION }}
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: docker
|
context: docker
|
||||||
build-args: |
|
build-args: |
|
||||||
|
|
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
|
@ -15,13 +15,15 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
ruby-version:
|
ruby-version:
|
||||||
- '2.7'
|
|
||||||
- '3.0'
|
- '3.0'
|
||||||
- '3.1'
|
- '3.1'
|
||||||
|
- '3.2'
|
||||||
|
- '3.3'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Ruby ${{ matrix.ruby-version }}
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
|
@ -35,9 +37,19 @@ jobs:
|
||||||
actionlint:
|
actionlint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Check workflow files
|
- name: Check workflow files
|
||||||
run: |
|
run: |
|
||||||
echo "::add-matcher::.github/actionlint-matcher.json"
|
echo "::add-matcher::.github/actionlint-matcher.json"
|
||||||
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
|
||||||
./actionlint
|
./actionlint
|
||||||
|
|
||||||
|
renovate-config-validator:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/renovatebot/renovate
|
||||||
|
options: --user root
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Check Renovate config
|
||||||
|
run: renovate-config-validator --strict
|
||||||
|
|
2
.github/workflows/vulnscan.yml
vendored
2
.github/workflows/vulnscan.yml
vendored
|
@ -36,7 +36,7 @@ jobs:
|
||||||
for image in $ALL_IMAGES; do
|
for image in $ALL_IMAGES; do
|
||||||
if [[ "$image" = cmur2/dyndnsd:v$major_version.* ]]; then
|
if [[ "$image" = cmur2/dyndnsd:v$major_version.* ]]; then
|
||||||
echo -e "\nScanning newest patch release $image of major v$major_version...\n"
|
echo -e "\nScanning newest patch release $image of major v$major_version...\n"
|
||||||
if ! trivy image --skip-update --exit-code 1 "$image"; then
|
if ! trivy image --skip-db-update --scanners vuln --exit-code 1 "$image"; then
|
||||||
EXIT_CODE=1
|
EXIT_CODE=1
|
||||||
fi
|
fi
|
||||||
break
|
break
|
||||||
|
|
|
@ -3,9 +3,12 @@ require:
|
||||||
- rubocop-rspec
|
- rubocop-rspec
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
TargetRubyVersion: '2.7'
|
TargetRubyVersion: '3.0'
|
||||||
NewCops: enable
|
NewCops: enable
|
||||||
|
|
||||||
|
Gemspec/DevelopmentDependencies:
|
||||||
|
EnforcedStyle: gemspec
|
||||||
|
|
||||||
Gemspec/RequireMFA:
|
Gemspec/RequireMFA:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -99,3 +102,6 @@ RSpec/ExampleLength:
|
||||||
|
|
||||||
RSpec/MultipleExpectations:
|
RSpec/MultipleExpectations:
|
||||||
Max: 20
|
Max: 20
|
||||||
|
|
||||||
|
RSpecRails:
|
||||||
|
Enabled: false
|
||||||
|
|
74
CHANGELOG.md
74
CHANGELOG.md
|
@ -1,5 +1,79 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 3.10.0
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- add Ruby 3.3 support
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- update base of Docker image to Alpine 3.19.0 (from 3.18.3 before)
|
||||||
|
|
||||||
|
## 3.9.2 (August 10th, 2023)
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- update base of Docker image to Alpine 3.18.3 (from 3.18.2 before)
|
||||||
|
|
||||||
|
## 3.9.1 (July 6, 2023)
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- update base of Docker image to Alpine 3.18.2 (from 3.18.0 before)
|
||||||
|
|
||||||
|
## 3.9.0 (June 8, 2023)
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- Drop EOL Ruby 2.7 support, now minimum version supported is Ruby 3.0
|
||||||
|
|
||||||
|
## 3.8.2 (April 1st, 2023)
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- update base of Docker image to Alpine 3.17.3 (from 3.17.2 before)
|
||||||
|
|
||||||
|
## 3.8.1 (March 2nd, 2023)
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- update base of Docker image to Alpine 3.17.2 (from 3.17.1 before)
|
||||||
|
|
||||||
|
## 3.8.0 (January 13th, 2023)
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- add Ruby 3.2 support
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- update base of Docker image to Alpine 3.17.1 (from 3.17.0 before)
|
||||||
|
|
||||||
|
## 3.7.3 (December 29th, 2022)
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- update base of Docker image to Alpine 3.17.0 (from 3.16.2 before)
|
||||||
|
|
||||||
|
## 3.7.2 (November 10th, 2022)
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- re-release 3.7.1 to rebuild Docker image with security vulnerabilities fixes
|
||||||
|
|
||||||
|
## 3.7.1 (September 20th, 2022)
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- fix [TypeError](https://github.com/cmur2/dyndnsd/issues/205) when user has no hosts configured
|
||||||
|
|
||||||
|
## 3.7.0 (September 16th, 2022)
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- Update to Rack 3
|
||||||
|
|
||||||
## 3.6.2 (August 11th, 2022)
|
## 3.6.2 (August 11th, 2022)
|
||||||
|
|
||||||
OTHER:
|
OTHER:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# dyndnsd.rb
|
# dyndnsd.rb
|
||||||
|
|
||||||
![ci](https://github.com/cmur2/dyndnsd/workflows/ci/badge.svg) [![Dependencies](https://badges.depfu.com/badges/4f25da8493f7a29f652ac892fbf9227b/overview.svg)](https://depfu.com/github/cmur2/dyndnsd)
|
![ci](https://github.com/cmur2/dyndnsd/workflows/ci/badge.svg)
|
||||||
|
|
||||||
A small, lightweight and extensible DynDNS server written with Ruby and Rack.
|
A small, lightweight and extensible DynDNS server written with Ruby and Rack.
|
||||||
|
|
||||||
|
|
15
Rakefile
15
Rakefile
|
@ -14,18 +14,11 @@ task :solargraph do
|
||||||
sh 'solargraph typecheck'
|
sh 'solargraph typecheck'
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :solargraph do
|
|
||||||
desc 'Should be run by developer once to prepare initial solargraph usage (fill caches etc.)'
|
|
||||||
task :init do
|
|
||||||
sh 'solargraph download-core'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# renovate: datasource=github-tags depName=hadolint/hadolint
|
# renovate: datasource=github-tags depName=hadolint/hadolint
|
||||||
hadolint_version = 'v2.10.0'
|
hadolint_version = 'v2.12.0'
|
||||||
|
|
||||||
# renovate: datasource=github-tags depName=aquasecurity/trivy
|
# renovate: datasource=github-tags depName=aquasecurity/trivy
|
||||||
trivy_version = 'v0.30.4'
|
trivy_version = 'v0.51.4'
|
||||||
|
|
||||||
namespace :docker do
|
namespace :docker do
|
||||||
ci_image = 'cmur2/dyndnsd:ci'
|
ci_image = 'cmur2/dyndnsd:ci'
|
||||||
|
@ -57,7 +50,7 @@ namespace :docker do
|
||||||
chmod a+w e2e/db.json
|
chmod a+w e2e/db.json
|
||||||
SCRIPT
|
SCRIPT
|
||||||
sh "docker run -d --name=dyndnsd-ci -v $(pwd)/e2e:/etc/dyndnsd -p 8080:8080 -p 5353:5353 #{ci_image}"
|
sh "docker run -d --name=dyndnsd-ci -v $(pwd)/e2e:/etc/dyndnsd -p 8080:8080 -p 5353:5353 #{ci_image}"
|
||||||
sh 'sleep 1'
|
sh 'sleep 5'
|
||||||
puts '----------------------------------------'
|
puts '----------------------------------------'
|
||||||
# `dig` needs `sudo apt-get install -y -q dnsutils`
|
# `dig` needs `sudo apt-get install -y -q dnsutils`
|
||||||
sh <<~SCRIPT
|
sh <<~SCRIPT
|
||||||
|
@ -78,4 +71,4 @@ end
|
||||||
task default: [:rubocop, :spec, 'bundle:audit', :solargraph]
|
task default: [:rubocop, :spec, 'bundle:audit', :solargraph]
|
||||||
|
|
||||||
desc 'Run all tasks desired for CI'
|
desc 'Run all tasks desired for CI'
|
||||||
task ci: ['solargraph:init', :default, 'docker:lint', :build, 'docker:build', 'docker:e2e']
|
task ci: [:default, 'docker:lint', :build, 'docker:build', 'docker:e2e']
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM alpine:3.16.2
|
FROM alpine:3.20.0
|
||||||
|
|
||||||
EXPOSE 5353 8080
|
EXPOSE 5353 8080
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM alpine:3.16.2
|
FROM alpine:3.20.0
|
||||||
|
|
||||||
EXPOSE 5353 8080
|
EXPOSE 5353 8080
|
||||||
|
|
||||||
|
|
|
@ -25,15 +25,16 @@ Gem::Specification.new do |s|
|
||||||
s.executables = ['dyndnsd']
|
s.executables = ['dyndnsd']
|
||||||
s.extra_rdoc_files = Dir['README.md', 'CHANGELOG.md', 'LICENSE']
|
s.extra_rdoc_files = Dir['README.md', 'CHANGELOG.md', 'LICENSE']
|
||||||
|
|
||||||
s.required_ruby_version = '>= 2.7'
|
s.required_ruby_version = '>= 3.0'
|
||||||
|
|
||||||
s.add_runtime_dependency 'async', '~> 1.30.0'
|
s.add_runtime_dependency 'async', '~> 1.31.0'
|
||||||
s.add_runtime_dependency 'async-dns', '~> 1.3.0'
|
s.add_runtime_dependency 'async-dns', '~> 1.3.0'
|
||||||
s.add_runtime_dependency 'metriks'
|
s.add_runtime_dependency 'metriks'
|
||||||
s.add_runtime_dependency 'opentelemetry-exporter-jaeger', '~> 0.21.0'
|
s.add_runtime_dependency 'opentelemetry-exporter-jaeger', '~> 0.22.0'
|
||||||
s.add_runtime_dependency 'opentelemetry-instrumentation-rack', '~> 0.20.0'
|
s.add_runtime_dependency 'opentelemetry-instrumentation-rack', '~> 0.22.0'
|
||||||
s.add_runtime_dependency 'opentelemetry-sdk', '~> 1.0.0.rc2'
|
s.add_runtime_dependency 'opentelemetry-sdk', '~> 1.2.0'
|
||||||
s.add_runtime_dependency 'rack', '~> 2.0'
|
s.add_runtime_dependency 'rack', '~> 3.0'
|
||||||
|
s.add_runtime_dependency 'rackup', '~> 2'
|
||||||
s.add_runtime_dependency 'webrick', '>= 1.6.1'
|
s.add_runtime_dependency 'webrick', '>= 1.6.1'
|
||||||
|
|
||||||
s.add_development_dependency 'bundler'
|
s.add_development_dependency 'bundler'
|
||||||
|
@ -41,8 +42,8 @@ Gem::Specification.new do |s|
|
||||||
s.add_development_dependency 'rack-test'
|
s.add_development_dependency 'rack-test'
|
||||||
s.add_development_dependency 'rake'
|
s.add_development_dependency 'rake'
|
||||||
s.add_development_dependency 'rspec'
|
s.add_development_dependency 'rspec'
|
||||||
s.add_development_dependency 'rubocop', '~> 1.34.1'
|
s.add_development_dependency 'rubocop', '~> 1.64.0'
|
||||||
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
||||||
s.add_development_dependency 'rubocop-rspec', '~> 2.12.0'
|
s.add_development_dependency 'rubocop-rspec', '~> 2.29.2'
|
||||||
s.add_development_dependency 'solargraph', '~> 0.45.0'
|
s.add_development_dependency 'solargraph', '~> 0.49.0'
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,7 @@ require 'ipaddr'
|
||||||
require 'json'
|
require 'json'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'rack'
|
require 'rack'
|
||||||
|
require 'rackup'
|
||||||
require 'metriks'
|
require 'metriks'
|
||||||
require 'opentelemetry/instrumentation/rack'
|
require 'opentelemetry/instrumentation/rack'
|
||||||
require 'opentelemetry/sdk'
|
require 'opentelemetry/sdk'
|
||||||
|
@ -106,7 +107,7 @@ module Dyndnsd
|
||||||
puts "DynDNSd version #{Dyndnsd::VERSION}"
|
puts "DynDNSd version #{Dyndnsd::VERSION}"
|
||||||
puts "Using config file #{config_file}"
|
puts "Using config file #{config_file}"
|
||||||
|
|
||||||
config = YAML.safe_load(File.read(config_file))
|
config = YAML.safe_load_file(config_file)
|
||||||
|
|
||||||
setup_logger(config)
|
setup_logger(config)
|
||||||
|
|
||||||
|
@ -214,10 +215,11 @@ module Dyndnsd
|
||||||
invalid_hostnames = hostnames.select { |h| !Helper.fqdn_valid?(h, @domain) }
|
invalid_hostnames = hostnames.select { |h| !Helper.fqdn_valid?(h, @domain) }
|
||||||
return [422, {'X-DynDNS-Response' => 'hostname_malformed'}, []] if invalid_hostnames.any?
|
return [422, {'X-DynDNS-Response' => 'hostname_malformed'}, []] if invalid_hostnames.any?
|
||||||
|
|
||||||
|
# we can trust this information since user was authorized by middleware
|
||||||
user = env['REMOTE_USER']
|
user = env['REMOTE_USER']
|
||||||
|
|
||||||
# check for hostnames that the user does not own
|
# check for hostnames that the user does not own
|
||||||
forbidden_hostnames = hostnames - @users[user]['hosts']
|
forbidden_hostnames = hostnames - @users[user].fetch('hosts', [])
|
||||||
return [422, {'X-DynDNS-Response' => 'host_forbidden'}, []] if forbidden_hostnames.any?
|
return [422, {'X-DynDNS-Response' => 'host_forbidden'}, []] if forbidden_hostnames.any?
|
||||||
|
|
||||||
if params['offline'] == 'YES'
|
if params['offline'] == 'YES'
|
||||||
|
@ -259,10 +261,10 @@ module Dyndnsd
|
||||||
# @return [void]
|
# @return [void]
|
||||||
private_class_method def self.setup_traps
|
private_class_method def self.setup_traps
|
||||||
Signal.trap('INT') do
|
Signal.trap('INT') do
|
||||||
Rack::Handler::WEBrick.shutdown
|
Rackup::Handler::WEBrick.shutdown
|
||||||
end
|
end
|
||||||
Signal.trap('TERM') do
|
Signal.trap('TERM') do
|
||||||
Rack::Handler::WEBrick.shutdown
|
Rackup::Handler::WEBrick.shutdown
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -350,7 +352,7 @@ module Dyndnsd
|
||||||
|
|
||||||
app = OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware.new(app)
|
app = OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware.new(app)
|
||||||
|
|
||||||
Rack::Handler::WEBrick.run app, Host: config['host'], Port: config['port']
|
Rackup::Handler::WEBrick.run app, Host: config['host'], Port: config['port']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Dyndnsd
|
module Dyndnsd
|
||||||
VERSION = '3.6.2'
|
VERSION = '3.9.2'
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,9 @@ describe Dyndnsd::Daemon do
|
||||||
'test' => {
|
'test' => {
|
||||||
'password' => 'secret',
|
'password' => 'secret',
|
||||||
'hosts' => ['foo.example.org', 'bar.example.org']
|
'hosts' => ['foo.example.org', 'bar.example.org']
|
||||||
|
},
|
||||||
|
'test2' => {
|
||||||
|
'password' => 'ihavenohosts'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,6 +102,14 @@ describe Dyndnsd::Daemon do
|
||||||
expect(last_response.body).to eq('notfqdn')
|
expect(last_response.body).to eq('notfqdn')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'rejects request if user does not own any hostnames' do
|
||||||
|
authorize 'test2', 'ihavenohosts'
|
||||||
|
|
||||||
|
get '/nic/update?hostname=doesnotexisthost.example.org'
|
||||||
|
expect(last_response).to be_ok
|
||||||
|
expect(last_response.body).to eq('nohost')
|
||||||
|
end
|
||||||
|
|
||||||
it 'rejects request if user does not own one hostname' do
|
it 'rejects request if user does not own one hostname' do
|
||||||
authorize 'test', 'secret'
|
authorize 'test', 'secret'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user