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