Updated shell messages, added dir
This commit is contained in:
parent
0828218a59
commit
71d8934d46
@ -26,15 +26,16 @@ FROM alpine:3.18
|
||||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
RUN apk add --no-cache bash bind-tools coreutils krb5 tcpdump
|
||||
RUN apk add --no-cache zsh bash bind-tools coreutils krb5 tcpdump
|
||||
COPY ./config/zsh.sh /root/.zshrc
|
||||
COPY ./config/bash.sh /root/.bashrc
|
||||
#COPY ./config/krb5.conf /etc
|
||||
RUN chown -R root:root /root/.bashrc && \
|
||||
/bin/bash /root/.bashrc
|
||||
RUN chown -R root:root /root/.zshrc && \
|
||||
chown -R root:root /root/.bashrc && \
|
||||
/bin/zsh /root/.zshrc
|
||||
RUN apk add --no-cache alpine-conf && \
|
||||
setup-timezone -z Africa/Johannesburg
|
||||
# chmod 0644 /etc/krb5.conf
|
||||
COPY config/resolv.sh /etc/resolv.conf
|
||||
|
||||
ENV RUNNING_IN_DOCKER true
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
@ -19,6 +19,7 @@ alias ll='ls -laFo'
|
||||
alias l='ls -l'
|
||||
alias g='egrep -i'
|
||||
alias dnsupd=/acme/updatedns.sh
|
||||
alias acmesh=/acme/acmeauth.sh
|
||||
#
|
||||
# Some more alias to avoid making mistakes:
|
||||
# alias rm='rm -i'
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
search ix-sthome-webhook2.svc.cluster.local svc.cluster.local cluster.local sthome.lan
|
||||
nameserver 10.0.0.15
|
||||
nameserver 172.17.0.10
|
||||
options ndots:5
|
||||
@ -26,6 +26,7 @@ alias ll='ls -laFo'
|
||||
alias l='ls -l'
|
||||
alias g='egrep -i'
|
||||
alias dnsupd=/acme/updatedns.sh
|
||||
alias acmesh=/acme/acmeauth.sh
|
||||
|
||||
# # be paranoid
|
||||
# alias cp='cp -ip'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: v0.0.5-alpha.54
|
||||
appVersion: v0.0.5-alpha.77
|
||||
description: Cert-Manager webhook for sthome
|
||||
name: sthome-webhook
|
||||
version: 0.0.5-alpha.54
|
||||
version: 0.0.5-alpha.77
|
||||
|
||||
@ -31,7 +31,7 @@ clusterIssuer:
|
||||
image:
|
||||
repository: stuurmcp/cert-manager-webhook-sthome
|
||||
#repository: wstat.sthome.net:5000/cert-manager-webhook-sthome
|
||||
tag: 0.0.5-alpha.54
|
||||
tag: 0.0.5-alpha.77
|
||||
#pullPolicy should be IfNotPresent. Set to Always for testing purposes
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
|
||||
@ -13,8 +13,11 @@ const (
|
||||
SthomeSecretKeyEnv = "STHOME_SECRET_KEY"
|
||||
|
||||
ProviderName = "sthome"
|
||||
Shell = "/bin/bash"
|
||||
AcmeAuthCmd = "/acme/acmeauth.sh"
|
||||
bashShell = "/bin/bash"
|
||||
zshShell = "/bin/zsh"
|
||||
AcmeDir = "/acme"
|
||||
Shell = bashShell
|
||||
AcmeAuthCmd = AcmeDir + "/acmeauth.sh"
|
||||
|
||||
Dnsserver_net = "10.0.0.15"
|
||||
Dnsserver_lan = "192.168.2.1"
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
@ -11,18 +12,23 @@ import (
|
||||
func Execute(shell string, arg ...string) (bool, error) {
|
||||
var outb, errb bytes.Buffer
|
||||
cmd := exec.Command(shell, arg...)
|
||||
cmd.Dir = AcmeDir
|
||||
cmd.Stdout = &outb
|
||||
cmd.Stderr = &errb
|
||||
klog.Infof("cmd: %s\n", cmd.String())
|
||||
err := cmd.Run()
|
||||
klog.Infof("out:\n%s\n", outb.String())
|
||||
outstr := strings.TrimSuffix(outb.String(), "\n")
|
||||
errstr := strings.TrimSuffix(errb.String(), "\n")
|
||||
klog.Infof("out:\n%s\n", outstr)
|
||||
if err != nil {
|
||||
klog.Errorf("Script returned error:\nerr:\n")
|
||||
klog.Errorf("%s\n============\n", err)
|
||||
return false, err
|
||||
}
|
||||
if errb.String() != "" {
|
||||
klog.Errorf("stderr:\n%s============\n", errb.String())
|
||||
return false, fmt.Errorf("stderr:\n%q", errb.String())
|
||||
klog.Infof("stderr:\n")
|
||||
klog.Errorf("%s\n============\n", errstr)
|
||||
return false, fmt.Errorf("stderr:\n%q", errstr)
|
||||
}
|
||||
klog.Infof("Script returned success\n")
|
||||
return true, nil
|
||||
|
||||
@ -54,6 +54,7 @@ func (loc *LocalDNSProviderSolver) Present(ch *v1alpha1.ChallengeRequest) error
|
||||
//localip := GetOutboundIP(Dnsserver_net)
|
||||
success, err := Execute(
|
||||
Shell,
|
||||
// "-c",
|
||||
AcmeAuthCmd,
|
||||
"set",
|
||||
ch.DNSName,
|
||||
@ -82,6 +83,7 @@ func (loc *LocalDNSProviderSolver) CleanUp(ch *v1alpha1.ChallengeRequest) error
|
||||
//localip := GetOutboundIP(Dnsserver_net)
|
||||
success, err := Execute(
|
||||
Shell,
|
||||
// "-c",
|
||||
AcmeAuthCmd,
|
||||
"unset",
|
||||
ch.DNSName,
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
0.0.5-alpha.54
|
||||
20240412-2211
|
||||
54
|
||||
0.0.5-alpha.77
|
||||
20240414-1206
|
||||
77
|
||||
Loading…
Reference in New Issue
Block a user