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

Compare commits

..

19 Commits

Author SHA1 Message Date
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
15 changed files with 120 additions and 20 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,12 +20,6 @@
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"],

View File

@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: cd
@@ -14,7 +15,7 @@ jobs:
- 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

View File

@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: ci
@@ -20,6 +21,7 @@ jobs:
- '2.6'
- '2.7'
- '3.0'
- '3.1'
steps:
- uses: actions/checkout@v2
- name: Set up Ruby ${{ matrix.ruby-version }}
@@ -31,3 +33,13 @@ jobs:
- name: Lint and Test
run: |
bundle exec rake ci
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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

View File

@@ -1,5 +1,21 @@
# Changelog
## 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:

View File

@@ -25,9 +25,11 @@ end
hadolint_version = 'v2.8.0'
# renovate: datasource=github-tags depName=aquasecurity/trivy
trivy_version = 'v0.21.2'
trivy_version = 'v0.23.0'
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"
@@ -45,11 +47,35 @@ namespace :docker do
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 cmur2/dyndnsd:ci'
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, 'docker:lint', :build, 'docker: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.15.0
EXPOSE 5353 8080

View File

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

View File

@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.5'
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'
@@ -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.25.0'
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
s.add_development_dependency 'rubocop-rspec', '~> 2.6.0'
s.add_development_dependency 'rubocop-rspec', '~> 2.8.0'
s.add_development_dependency 'solargraph', '~> 0.44.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.8'
VERSION = '3.5.1'
end