Giter VIP home page Giter VIP logo

Comments (1)

codename00047 avatar codename00047 commented on June 10, 2024

I created kube secret:

kubectl create secret tls mail-tls --key=cert.key --cert=cert.crt

and deployed app with next deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: smtp4dev
spec:
  replicas: 1
  selector:
    matchLabels:
      app: smtp4dev
  template:
    metadata:
      labels:
        app: smtp4dev
    spec:
      containers:
      - name: smtp4dev
        image: rnwood/smtp4dev
        env:
          - name: ServerOptions__TlsMode
            value: "StartTls"
          - name: ServerOptions__TlsCertificate
            valueFrom:
              secretKeyRef:
                name: mail-tls
                key: tls.crt
          - name: ServerOptions__TlsCertificatePrivateKey
            valueFrom:
              secretKeyRef:
                name: mail-tls
                key: tls.key
        ports:
        - containerPort: 25
          name: smtp
        - containerPort: 80
          name: http
        volumeMounts:
          - name: tls-volume
            mountPath: /tls
      volumes:
        - name: tls-volume
          secret:
            secretName: mail-tls

after that I got an error:

The SMTP server failed to start: System.IO.DirectoryNotFoundException: Could not find a part of the path '/smtp4dev/-----BEGIN PRIVATE KEY-----
.
.
.
-----END PRIVATE KEY-----'.
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at Rnwood.Smtp4dev.Server.CertificateHelper.LoadCertificateWithKey(String certificatePath, String certificateKeyPath) in /app/Rnwood.Smtp4dev/Server/CertificateHelper.cs:line 20
   at Rnwood.Smtp4dev.Server.Smtp4devServer.GetTlsCertificate() in /app/Rnwood.Smtp4dev/Server/Smtp4devServer.cs:line 102
   at Rnwood.Smtp4dev.Server.Smtp4devServer.CreateSmtpServer() in /app/Rnwood.Smtp4dev/Server/Smtp4devServer.cs:line 61
   at Rnwood.Smtp4dev.Server.Smtp4devServer.TryStart() in /app/Rnwood.Smtp4dev/Server/Smtp4devServer.cs:line 396
System.IO.DirectoryNotFoundException: Could not find a part of the path '/smtp4dev/-----BEGIN PRIVATE KEY-----
.
.
.
-----END PRIVATE KEY-----'.
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding)
   at System.IO.File.ReadAllText(String path)
   at Rnwood.Smtp4dev.Server.CertificateHelper.LoadCertificateWithKey(String certificatePath, String certificateKeyPath) in /app/Rnwood.Smtp4dev/Server/CertificateHelper.cs:line 20
   at Rnwood.Smtp4dev.Server.Smtp4devServer.GetTlsCertificate() in /app/Rnwood.Smtp4dev/Server/Smtp4devServer.cs:line 102
   at Rnwood.Smtp4dev.Server.Smtp4devServer.CreateSmtpServer() in /app/Rnwood.Smtp4dev/Server/Smtp4devServer.cs:line 61
   at Rnwood.Smtp4dev.Server.Smtp4devServer.TryStart() in /app/Rnwood.Smtp4dev/Server/Smtp4devServer.cs:line 396

how to fix it?
help, please

from smtp4dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.