Compare commits
7 Commits
e7074bc840
...
21925ce833
Author | SHA1 | Date |
---|---|---|
CSRBot | 21925ce833 | |
Markus Pesch | a83055cedb | |
Markus Pesch | c4ff3a7018 | |
Markus Pesch | 17f4d13196 | |
Markus Pesch | ffa8f99d67 | |
Markus Pesch | 0388cf11bc | |
Markus Pesch | c582a66b01 |
|
@ -22,8 +22,8 @@ steps:
|
|||
image: docker.io/golangci/golangci-lint:v1.44.2-alpine
|
||||
resources:
|
||||
limits:
|
||||
cpu: 100
|
||||
memory: 250M
|
||||
cpu: 250
|
||||
memory: 500M
|
||||
|
||||
- name: email-notification
|
||||
environment:
|
||||
|
@ -69,7 +69,7 @@ steps:
|
|||
resources:
|
||||
limits:
|
||||
cpu: 250
|
||||
memory: 250M
|
||||
memory: 500M
|
||||
|
||||
- name: email-notification
|
||||
environment:
|
||||
|
@ -195,4 +195,4 @@ trigger:
|
|||
event:
|
||||
- push
|
||||
repo:
|
||||
- volker-raschek/dyndns-client
|
||||
- volker.raschek/dyndns-client
|
27
Dockerfile
27
Dockerfile
|
@ -1,27 +0,0 @@
|
|||
ARG BASE_IMAGE
|
||||
ARG BUILD_IMAGE
|
||||
|
||||
# BUILD
|
||||
# ===========================================
|
||||
FROM ${BUILD_IMAGE} AS build
|
||||
ADD . /workspace
|
||||
|
||||
ARG EXECUTABLE
|
||||
ARG GONOPROXY
|
||||
ARG GONOSUMDB
|
||||
ARG GOPRIVATE
|
||||
ARG GOPROXY
|
||||
ARG GOSUMDB
|
||||
ARG VERSION
|
||||
|
||||
RUN make bin/linux/amd64/${EXECUTABLE}
|
||||
|
||||
# TARGET CONTAINER
|
||||
# ===========================================
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
ARG EXECUTABLE
|
||||
|
||||
RUN apk add --update bind-tools
|
||||
COPY --from=build /workspace/bin/linux/amd64/${EXECUTABLE} /usr/bin/${EXECUTABLE}
|
||||
ENTRYPOINT [ "/usr/bin/dyndns-client" ]
|
|
@ -1,6 +1,6 @@
|
|||
# dyndns-client
|
||||
|
||||
[![Build Status](https://drone.cryptic.systems/api/badges/dyndns-client/dyndns-client/status.svg)](https://drone.cryptic.systems/dyndns-client/dyndns-client)
|
||||
[![Build Status](https://drone.cryptic.systems/api/badges/volker.raschek/dyndns-client/status.svg)](https://drone.cryptic.systems/volker.raschek/dyndns-client)
|
||||
|
||||
dyndns-client is a Daemon to listen on interface notifications produced by the linux
|
||||
kernel of a client machine to update one or more DNS zones.
|
||||
|
|
|
@ -39,6 +39,7 @@ func GetDefaultConfiguration() (*types.Config, error) {
|
|||
func Read(cnfFile string) (*types.Config, error) {
|
||||
// Load burned in configuration if config not available
|
||||
if _, err := os.Stat(cnfFile); os.IsNotExist(err) {
|
||||
// #nosec G301
|
||||
if err := os.MkdirAll(filepath.Dir(cnfFile), 0755); err != nil {
|
||||
return nil, fmt.Errorf("failed to create directory: %w", err)
|
||||
}
|
||||
|
@ -57,11 +58,12 @@ func Read(cnfFile string) (*types.Config, error) {
|
|||
return cnf, nil
|
||||
}
|
||||
|
||||
// #nosec G304
|
||||
f, err := os.Open(cnfFile)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open file: %w", err)
|
||||
}
|
||||
defer f.Close()
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
cnf := new(types.Config)
|
||||
jsonDecoder := json.NewDecoder(f)
|
||||
|
@ -97,17 +99,19 @@ func Read(cnfFile string) (*types.Config, error) {
|
|||
// Write config into a file
|
||||
func Write(cnf *types.Config, cnfFile string) error {
|
||||
if _, err := os.Stat(filepath.Dir(cnfFile)); os.IsNotExist(err) {
|
||||
// #nosec G301
|
||||
err := os.MkdirAll(filepath.Dir(cnfFile), 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// #nosec G304
|
||||
f, err := os.Create(cnfFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create file %v: %v", cnfFile, err)
|
||||
}
|
||||
defer f.Close()
|
||||
defer func() { _ = f.Close() }()
|
||||
|
||||
jsonEncoder := json.NewEncoder(f)
|
||||
jsonEncoder.SetIndent("", " ")
|
||||
|
|
|
@ -46,6 +46,7 @@ func (u *NSUpdate) execute(ctx context.Context, nsUpdateCmd string) error {
|
|||
|
||||
errBuffer := new(bytes.Buffer)
|
||||
|
||||
// #nosec G204
|
||||
cmd := exec.CommandContext(ctx, "nsupdate", "-y", fmt.Sprintf("%v:%v:%v", u.tsigKey.Algorithm, u.tsigKey.Name, u.tsigKey.Secret))
|
||||
// cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = bufio.NewWriter(errBuffer)
|
||||
|
|
Loading…
Reference in New Issue