mirror of
https://github.com/jpillora/chisel.git
synced 2026-10-12 02:16:57 +00:00
Reliability, security, and observability across client/server/tunnel: keepalive ping timeouts, TCP half-close propagation, dial-before-accept, graceful SIGTERM shutdown, UDP flow-cap sweep, pre-auth WS size cap, SOCKS ACL enforcement + live authfile reload, exact legacy-fingerprint match, --auth validation, session/failed-login logs, #608 panic fix, goreleaser multi-arch Docker images, and a two-stage release pipeline (draft + versioned images at tag time; latest promoted on publish). Full detail: 1.12-changes.md, the PR (34 commits), and https://jpillora.com/chisel-112-ux-review Co-Authored-By: Claude Fable 5 <[email protected]>
26 lines
715 B
Go
26 lines
715 B
Go
package chserver
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
// TestNewServerKeyErrors verifies key-loading failures are returned as
|
|
// errors rather than calling log.Fatal, which would kill processes
|
|
// embedding chisel as a library.
|
|
func TestNewServerKeyErrors(t *testing.T) {
|
|
//missing key file
|
|
if _, err := NewServer(&Config{KeyFile: "/nonexistent/key"}); err == nil {
|
|
t.Fatal("expected error for missing key file")
|
|
}
|
|
//unparseable key material
|
|
bad := filepath.Join(t.TempDir(), "bad.key")
|
|
if err := os.WriteFile(bad, []byte("not a pem key"), 0600); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, err := NewServer(&Config{KeyFile: bad}); err == nil {
|
|
t.Fatal("expected error for unparseable key file")
|
|
}
|
|
}
|