1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2025-08-08 08:33:56 +02:00

Compare commits

..

66 Commits

Author SHA1 Message Date
Christian Nicolai
0e700e8b7b release: 3.6.1 2022-07-21 07:20:42 +02:00
depfu[bot]
d256c86420 gems: update opentelemetry-exporter-jaeger to version 0.21.0 2022-07-21 07:13:58 +02:00
renovate[bot]
a589148d9e docker: update alpine to v3.16.1 2022-07-21 07:13:05 +02:00
renovate[bot]
232b3f32a2 project: update aquasecurity/trivy to v0.30.1 2022-07-21 07:12:52 +02:00
depfu[bot]
3c83eb4347 gems: update rubocop-rspec to version 2.12.0 2022-07-03 14:28:37 +02:00
depfu[bot]
800618f434 gems: update rubocop to version 1.31.0 2022-06-28 11:02:48 +02:00
renovate[bot]
1e61a12b48 project: update aquasecurity/trivy to v0.29.2 2022-06-23 08:12:04 +02:00
Christian Nicolai
7bcaf18f7e release: 3.6.0 2022-06-02 13:39:01 +02:00
Renovate Bot
c0d69f591f project: update aquasecurity/trivy to v0.28.1 2022-06-02 08:44:54 +02:00
Renovate Bot
2228e742cf docker: update alpine to v3.16.0 2022-05-29 17:14:18 +02:00
depfu[bot]
e7f528377b gems: update solargraph to version 0.45.0 2022-05-28 17:40:09 +02:00
depfu[bot]
537682804f gems: update rubocop to version 1.30.0 2022-05-28 17:02:03 +02:00
depfu[bot]
7ffab915ac gems: update rubocop-rspec to version 2.11.1 2022-05-22 19:05:16 +02:00
Renovate Bot
d515a87640 project: update aquasecurity/trivy to v0.28.0 2022-05-19 08:32:36 +02:00
Renovate Bot
4a7eba5ad6 ci: update docker/build-push-action action to v3 2022-05-12 09:40:28 +02:00
Renovate Bot
52bb8ee9d2 ci: update docker/setup-buildx-action action to v2 2022-05-12 09:40:07 +02:00
Renovate Bot
eb1d88807b ci: update docker/login-action action to v2 2022-05-12 09:39:47 +02:00
depfu[bot]
7c2104b0ce gems: update rubocop to version 1.29.0 2022-05-08 16:54:07 +02:00
cn
4237d35fcc gem: drop support for Rubies < 2.7 2022-05-08 16:36:20 +02:00
Christian Nicolai
451ed20f5d gem: fix Renovate for GHA updates 2022-05-05 10:16:00 +02:00
Christian Nicolai
a2879c6c9a release: 3.5.3 2022-05-05 08:20:35 +02:00
Renovate Bot
f882381f9d project: update aquasecurity/trivy to v0.27.1 2022-04-28 09:03:03 +02:00
depfu[bot]
fb536da665 gems: update rubocop to version 1.28.1 2022-04-22 21:28:22 +02:00
Renovate Bot
49b7b07b52 project: update aquasecurity/trivy to v0.26.0 2022-04-21 08:38:14 +02:00
depfu[bot]
2854155db2 gems: update rubocop-rspec to version 2.10.0 2022-04-20 10:50:04 +02:00
Renovate Bot
b40c6f8c30 project: update aquasecurity/trivy to v0.25.4 2022-04-14 09:07:08 +02:00
depfu[bot]
44605f0f04 gems: update rubocop to version 1.27.0 2022-04-09 11:59:05 +02:00
Christian Nicolai
63bf4123bd release: 3.5.2 2022-04-07 08:51:07 +02:00
Renovate Bot
990d4617e8 project: update aquasecurity/trivy to v0.25.3 2022-04-07 08:47:04 +02:00
Renovate Bot
0030e41a8d project: update hadolint/hadolint to v2.10.0 2022-04-07 08:46:42 +02:00
Renovate Bot
97a913f97c docker: update alpine to v3.15.4 2022-04-07 08:46:28 +02:00
Renovate Bot
b1ff774a55 docker: update alpine to v3.15.3 2022-04-01 00:43:50 +02:00
Renovate Bot
683767ed8c project: update hadolint/hadolint to v2.9.3 2022-04-01 00:43:41 +02:00
Renovate Bot
a45c1cca82 docker: update alpine to v3.15.2 2022-03-24 09:53:09 +01:00
Renovate Bot
0a053ad577 project: update aquasecurity/trivy to v0.24.4 2022-03-24 09:53:00 +01:00
Renovate Bot
51eae6da2f project: update hadolint/hadolint to v2.9.2 2022-03-24 09:52:40 +01:00
Renovate Bot
fa1d9c7e30 docker: update alpine to v3.15.1 2022-03-17 09:04:14 +01:00
Renovate Bot
b56adc8b79 project: update aquasecurity/trivy to v0.24.3 2022-03-17 08:45:35 +01:00
Renovate Bot
88c8bcefeb project: update hadolint/hadolint to v2.9.1 2022-03-17 08:45:23 +01:00
depfu[bot]
6c8510910a gems: update rubocop to version 1.26.0 2022-03-10 20:44:12 +01:00
Renovate Bot
6faae0d0fd project: update aquasecurity/trivy to v0.24.2 2022-03-10 08:58:39 +01:00
Renovate Bot
3b34e00fc3 project: update actions/checkout action to v3 2022-03-03 17:31:17 +01:00
Renovate Bot
d1463cc790 project: update aquasecurity/trivy to v0.24.1 2022-03-03 08:33:57 +01:00
depfu[bot]
aea182efcb gems: update rubocop-rspec to version 2.9.0 2022-03-01 14:07:08 +01:00
Renovate Bot
990dc14a48 project: update aquasecurity/trivy to v0.24.0 2022-02-24 08:39:35 +01:00
cn
558445af2e release: 3.5.1 2022-02-17 10:09:17 +01:00
cn
3f784ccaa1 ci: fix Trivy command after update 2022-02-17 10:06:51 +01:00
cn
dbc61d72fb ci: use actionlint on GHA workflows
- https://github.com/rhysd/actionlint is cool
2022-02-16 00:05:40 +01:00
cn
2838ad9eae ci: use JSON schema for GHA workflows 2022-02-11 01:29:46 +01:00
Christian Nicolai
84e513b4a2 ci: trivy 0.23.0 deprecated the light DB 2022-02-03 09:03:08 +01:00
Renovate Bot
0a4a052cc9 project: update aquasecurity/trivy to v0.23.0 2022-02-03 09:02:03 +01:00
depfu[bot]
b9f0a07aba gems: update rubocop-rspec to version 2.8.0 2022-01-25 13:37:46 +01:00
depfu[bot]
cb9f6f7027 gems: update rubocop to version 1.25.0 2022-01-19 11:38:22 +01:00
cn
12dcc3eb42 release: 3.5.0 2022-01-08 11:14:35 +01:00
cn
90f4442e94 docs: update changelog 2022-01-08 11:13:32 +01:00
Renovate Bot
193997958f docker: update alpine Docker tag to v3.15.0 2022-01-08 11:09:27 +01:00
9eb9849004 project: allow upgrade to Alpine 3.14 and above
Beware of https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2
2022-01-08 11:07:00 +01:00
Christian Nicolai
4df5b8fa63 gem: add Ruby 3.1 support 2022-01-07 09:28:12 +01:00
Renovate Bot
45b522f7cc project: update aquasecurity/trivy to v0.22.0 2021-12-30 11:06:14 +01:00
depfu[bot]
817dd810e3 gems: update rubocop-rspec to version 2.7.0 2021-12-28 11:24:18 +01:00
cn
09461aa013 gems: pin async dependency to pre v2 version
- https://rubygems.org/gems/async-io/versions/1.32.2 does not limit the version range
- async v2 required very modern Ruby versions
2021-12-28 11:22:43 +01:00
depfu[bot]
367a542f74 gems: update rubocop to version 1.24.0 2021-12-24 16:19:13 +01:00
Renovate Bot
6642d9a7a2 project: update aquasecurity/trivy to v0.21.3 2021-12-23 12:50:02 +01:00
cn
9580f1478f ci: add Docker E2E tests 2021-12-13 00:51:28 +01:00
cn
6c91c46378 release: 3.4.8 2021-12-11 22:16:58 +01:00
cn
e622ab292a ci: use rake to build Docker image 2021-12-11 22:14:25 +01:00
17 changed files with 186 additions and 45 deletions

17
.github/actionlint-matcher.json vendored Normal file
View File

@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "actionlint",
"pattern": [
{
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
}
]
}

View File

@@ -20,19 +20,13 @@
matchManagers: ["bundler"],
enabled: false,
},
// prevent minor updates to Alpine 3.14 due to https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2
{
matchManagers: ["dockerfile"],
matchUpdateTypes: ["minor"],
enabled: false,
},
// Commit message formats
{
matchDatasources: ["docker"],
commitMessagePrefix: "docker: ",
},
{
matchDatasources: ["github-actions"],
matchManagers: ["github-actions"],
commitMessagePrefix: "ci: ",
},
],

View File

@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: cd
@@ -10,11 +11,11 @@ jobs:
release-dockerimage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Extract dyndnsd version from tag name
run: |
echo "DYNDNSD_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
echo "DYNDNSD_VERSION=${GITHUB_REF#refs/*/v}" >> "$GITHUB_ENV"
- name: Wait for dyndnsd ${{ env.DYNDNSD_VERSION }} gem to be available
run: |
@@ -22,6 +23,7 @@ jobs:
for retry in $(seq 1 5); do
echo "Checking if dyndnsd $DYNDNSD_VERSION gem is retrievable from rubygems.org (try #$retry)..."
sudo gem install dyndnsd -v "$DYNDNSD_VERSION"
# shellcheck disable=SC2181
if [ $? -eq 0 ]; then
exit 0
fi
@@ -31,16 +33,16 @@ jobs:
# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: cmur2
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker image for dyndnsd ${{ env.DYNDNSD_VERSION }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
context: docker
build-args: |

View File

@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: ci
@@ -16,12 +17,11 @@ jobs:
strategy:
matrix:
ruby-version:
- '2.5'
- '2.6'
- '2.7'
- '3.0'
- '3.1'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
@@ -32,12 +32,12 @@ jobs:
run: |
bundle exec rake ci
# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Test building Docker image for dyndnsd
uses: docker/build-push-action@v2
with:
context: .
file: docker/ci/Dockerfile
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check workflow files
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint

View File

@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: dockerhub

View File

@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: vulnscan
@@ -10,15 +11,14 @@ jobs:
scan-released-dockerimages:
runs-on: ubuntu-latest
env:
TRIVY_LIGHT: 'true'
TRIVY_IGNORE_UNFIXED: 'true'
TRIVY_REMOVED_PKGS: 'true'
steps:
- name: Install Trivy
run: |
mkdir -p $GITHUB_WORKSPACE/bin
mkdir -p "$GITHUB_WORKSPACE/bin"
echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH"
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b $GITHUB_WORKSPACE/bin
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b "$GITHUB_WORKSPACE/bin"
- name: Download Trivy DB
run: |
trivy image --download-db-only

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@
pkg/*
.yardoc
hadolint
trivy

View File

@@ -3,7 +3,7 @@ require:
- rubocop-rspec
AllCops:
TargetRubyVersion: '2.5'
TargetRubyVersion: '2.7'
NewCops: enable
Gemspec/RequireMFA:

View File

@@ -1,5 +1,55 @@
# Changelog
## 3.6.1 (July 21st, 2022)
OTHER:
- update base of Docker image to Alpine 3.16.1 (from 3.16.0 before)
## 3.6.0 (June 2nd, 2022)
IMPROVEMENTS:
- Drop EOL Ruby 2.6 and lower support, now minimum version supported is Ruby 2.7
OTHER:
- update base of Docker image to Alpine 3.16 (from 3.15.7 before)
## 3.5.3 (May 5th, 2022)
OTHER:
- re-release 3.5.2 to rebuild Docker image with security vulnerabilities fixes
## 3.5.2 (April 7th, 2022)
OTHER:
- re-release 3.5.1 to rebuild Docker image with security vulnerabilities fixes
## 3.5.1 (February 17th, 2022)
OTHER:
- re-release 3.5.0 to rebuild Docker image with security vulnerabilities fixes
## 3.5.0 (January 8th, 2022)
IMPROVEMENTS:
- add Ruby 3.1 support
OTHER:
- update base of Docker image to Alpine 3.15 (from 3.13.7 before, **Note:** please be aware of the quirks around [Alpine 3.14](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2))
## 3.4.8 (December 11th, 2021)
OTHER:
- re-release 3.4.7 to rebuild Docker image with security vulnerabilities fixes
## 3.4.7 (November 19th, 2021)
OTHER:

View File

@@ -22,16 +22,60 @@ namespace :solargraph do
end
# renovate: datasource=github-tags depName=hadolint/hadolint
hadolint_version = 'v2.8.0'
hadolint_version = 'v2.10.0'
desc 'Run hadolint for Dockerfile linting'
task :hadolint do
sh "wget -q -O ./hadolint https://github.com/hadolint/hadolint/releases/download/#{hadolint_version}/hadolint-Linux-x86_64"
sh 'chmod a+x ./hadolint'
sh './hadolint --ignore DL3018 docker/Dockerfile'
# renovate: datasource=github-tags depName=aquasecurity/trivy
trivy_version = 'v0.30.1'
namespace :docker do
ci_image = 'cmur2/dyndnsd:ci'
desc 'Lint Dockerfile'
task :lint do
sh "if [ ! -e ./hadolint ]; then wget -q -O ./hadolint https://github.com/hadolint/hadolint/releases/download/#{hadolint_version}/hadolint-Linux-x86_64; fi"
sh 'chmod a+x ./hadolint'
sh './hadolint --ignore DL3018 docker/Dockerfile'
sh './hadolint --ignore DL3018 --ignore DL3028 docker/ci/Dockerfile'
end
desc 'Build CI Docker image'
task :build do
sh 'docker build -t cmur2/dyndnsd:ci -f docker/ci/Dockerfile .'
end
desc 'Scan CI Docker image for vulnerabilities'
task :scan do
ver = trivy_version.gsub('v', '')
sh "if [ ! -e ./trivy ]; then wget -q -O - https://github.com/aquasecurity/trivy/releases/download/v#{ver}/trivy_#{ver}_Linux-64bit.tar.gz | tar -xzf - trivy; fi"
sh "./trivy image #{ci_image}"
end
desc 'End-to-end test the CI Docker image'
task :e2e do
sh <<~SCRIPT
echo -n '{}' > e2e/db.json
chmod a+w e2e/db.json
SCRIPT
sh "docker run -d --name=dyndnsd-ci -v $(pwd)/e2e:/etc/dyndnsd -p 8080:8080 -p 5353:5353 #{ci_image}"
sh 'sleep 1'
puts '----------------------------------------'
# `dig` needs `sudo apt-get install -y -q dnsutils`
sh <<~SCRIPT
curl -s -o /dev/null -w '%{http_code}' 'http://localhost:8080/' | grep -q '401'
curl -s 'http://foo:secret@localhost:8080/nic/update?hostname=foo.dyn.example.org&myip=1.2.3.4' | grep -q 'good'
curl -s 'http://foo:secret@localhost:8080/nic/update?hostname=foo.dyn.example.org&myip=1.2.3.4' | grep -q 'nochg'
dig +short AXFR 'dyn.example.org' @127.0.0.1 -p 5353 | grep -q '1.2.3.4'
SCRIPT
puts '----------------------------------------'
sh <<~SCRIPT
docker logs dyndnsd-ci
docker container rm -f -v dyndnsd-ci
rm e2e/db.json
SCRIPT
end
end
task default: [:rubocop, :spec, 'bundle:audit', :solargraph]
desc 'Run all tasks desired for CI'
task ci: ['solargraph:init', :default, :hadolint, :build]
task ci: ['solargraph:init', :default, 'docker:lint', :build, 'docker:build', 'docker:e2e']

View File

@@ -1,4 +1,4 @@
FROM alpine:3.13.7
FROM alpine:3.16.1
EXPOSE 5353 8080

View File

@@ -1,4 +1,4 @@
FROM alpine:3.13.7
FROM alpine:3.16.1
EXPOSE 5353 8080

View File

@@ -25,11 +25,12 @@ Gem::Specification.new do |s|
s.executables = ['dyndnsd']
s.extra_rdoc_files = Dir['README.md', 'CHANGELOG.md', 'LICENSE']
s.required_ruby_version = '>= 2.5'
s.required_ruby_version = '>= 2.7'
s.add_runtime_dependency 'async', '~> 1.30.0'
s.add_runtime_dependency 'async-dns', '~> 1.3.0'
s.add_runtime_dependency 'metriks'
s.add_runtime_dependency 'opentelemetry-exporter-jaeger', '~> 0.20.0'
s.add_runtime_dependency 'opentelemetry-exporter-jaeger', '~> 0.21.0'
s.add_runtime_dependency 'opentelemetry-instrumentation-rack', '~> 0.20.0'
s.add_runtime_dependency 'opentelemetry-sdk', '~> 1.0.0.rc2'
s.add_runtime_dependency 'rack', '~> 2.0'
@@ -40,8 +41,8 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rack-test'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
s.add_development_dependency 'rubocop', '~> 1.23.0'
s.add_development_dependency 'rubocop', '~> 1.31.0'
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
s.add_development_dependency 'rubocop-rspec', '~> 2.6.0'
s.add_development_dependency 'solargraph', '~> 0.44.0'
s.add_development_dependency 'rubocop-rspec', '~> 2.12.0'
s.add_development_dependency 'solargraph', '~> 0.45.0'
end

31
e2e/config.yml Normal file
View File

@@ -0,0 +1,31 @@
---
host: "0.0.0.0"
port: 8080
db: /etc/dyndnsd/db.json
debug: false
domain: dyn.example.org
#responder: RestStyle
updater:
name: zone_transfer_server
params:
server_listens:
- 0.0.0.0@5353
#send_notifies:
#- 10.0.2.15@53
zone_ttl: 300 # 5m
zone_nameservers:
- dns1.example.org.
- dns2.example.org.
zone_email_address: admin.example.org.
zone_additional_ips:
- "127.0.0.1"
- "::1"
users:
foo:
password: "secret"
hosts:
- foo.dyn.example.org
- bar.dyn.example.org

View File

@@ -106,7 +106,7 @@ module Dyndnsd
puts "DynDNSd version #{Dyndnsd::VERSION}"
puts "Using config file #{config_file}"
config = YAML.safe_load(File.open(config_file, 'r', &:read))
config = YAML.safe_load(File.read(config_file))
setup_logger(config)

View File

@@ -21,7 +21,7 @@ module Dyndnsd
span.set_attribute('dyndnsd.updater.name', self.class.name&.split('::')&.last || 'None')
# write zone file in bind syntax
File.open(@zone_file, 'w') { |f| f.write(@generator.generate(db)) }
File.write(@zone_file, @generator.generate(db))
# call user-defined command
pid = fork do
exec @command

View File

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Dyndnsd
VERSION = '3.4.7'
VERSION = '3.6.1'
end