mirror of
https://github.com/D-Modem/bbs.git
synced 2026-11-28 17:38:04 -08:00
Keep retrossl sessions for old clients to resume
retrossl now resumes sessions; give the OSCAR and shared ports a cache, which spares old machines an RSA operation on every connection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRRH4kntyPfrY1bFWC3
This commit is contained in:
4 files changed
+13
-5
No files matched your search
@@ -8,7 +8,7 @@ require (
|
||||
blitiri.com.ar/go/spf v1.5.1
|
||||
github.com/D-Modem/go3270 v0.9.14-0.20261105104944-a6550eb72c38
|
||||
github.com/D-Modem/menu v0.0.0-20261106031303-853189d86fb2
|
||||
github.com/D-Modem/retrossl v0.0.0-20261111130219-1b844ee3e801
|
||||
github.com/D-Modem/retrossl v0.0.0-20261111132527-5c74d8027d9e
|
||||
github.com/coder/websocket v1.8.13
|
||||
github.com/dop251/goja v0.0.0-20260603125802-cfe4039cb6d7
|
||||
github.com/emersion/go-imap/v2 v2.0.0-beta.8
|
||||
|
||||
@@ -6,8 +6,8 @@ github.com/D-Modem/go3270 v0.9.14-0.20261105104944-a6550eb72c38 h1:fHnFrNziFJico
|
||||
github.com/D-Modem/go3270 v0.9.14-0.20261105104944-a6550eb72c38/go.mod h1:WgdusPrfmqSMltzVXhywre6YHt9XHsKhfo9nWidkoUA=
|
||||
github.com/D-Modem/menu v0.0.0-20261106031303-853189d86fb2 h1:D7hJgxHbKQzr8850CdRuDIokcgcGOSlN1zGsh/ZuZqg=
|
||||
github.com/D-Modem/menu v0.0.0-20261106031303-853189d86fb2/go.mod h1:A+lNApUdQ5HSXW07R5aRm97MkhHYTQ1DkN0m+Vgorwg=
|
||||
github.com/D-Modem/retrossl v0.0.0-20261111130219-1b844ee3e801 h1:QsbvUo6CAawdQTChTwd5wFMS7g2bYMoVL6d1OxnLFdI=
|
||||
github.com/D-Modem/retrossl v0.0.0-20261111130219-1b844ee3e801/go.mod h1:+/qpHsaYk4DslA351ZMumscq9/Iwl/K5vS4PhUVLOR8=
|
||||
github.com/D-Modem/retrossl v0.0.0-20261111132527-5c74d8027d9e h1:4v6nEr6aSiE8H/RmTpg29q+P/RFvjzUlnTFRCdvu8XQ=
|
||||
github.com/D-Modem/retrossl v0.0.0-20261111132527-5c74d8027d9e/go.mod h1:+/qpHsaYk4DslA351ZMumscq9/Iwl/K5vS4PhUVLOR8=
|
||||
github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0=
|
||||
github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
|
||||
github.com/alexbrainman/sspi v0.0.0-20180613141037-e580b900e9f5 h1:P5U+E4x5OkVEKQDklVPmzs71WM56RTTRqV4OrDC//Y4=
|
||||
|
||||
@@ -158,7 +158,7 @@ func (s *Server) Serve(ctx context.Context, ln net.Listener) error {
|
||||
// AIM 6.2 to 7.5 (an SSL 2.0-format hello) and SSL 3.0-only
|
||||
// clients, which crypto/tls can't take
|
||||
if old {
|
||||
tc = retrossl.Server(&peeked{c, r}, &retrossl.Config{GetCertificate: src.GetCertificate})
|
||||
tc = retrossl.Server(&peeked{c, r}, &retrossl.Config{GetCertificate: src.GetCertificate, SessionCache: oldSessions})
|
||||
} else {
|
||||
tc = tls.Server(&peeked{c, r}, cfg)
|
||||
}
|
||||
@@ -180,6 +180,10 @@ func (s *Server) Serve(ctx context.Context, ln net.Listener) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// oldSessions are the TLS sessions of clients served by retrossl, kept
|
||||
// for them to resume.
|
||||
var oldSessions = retrossl.NewSessionCache(0, 0)
|
||||
|
||||
// Clients is how many sessions are signed on.
|
||||
func (s *Server) Clients() int {
|
||||
s.mu.Lock()
|
||||
|
||||
@@ -115,7 +115,7 @@ func (p *Port) Handle(c net.Conn) {
|
||||
p.logf("%s: an SSL 2.0-format hello, which nothing here takes", c.RemoteAddr())
|
||||
return
|
||||
}
|
||||
tc = retrossl.Server(&peeked{c, r}, &retrossl.Config{GetCertificate: rt.Cert})
|
||||
tc = retrossl.Server(&peeked{c, r}, &retrossl.Config{GetCertificate: rt.Cert, SessionCache: oldSessions})
|
||||
} else {
|
||||
tc = tls.Server(&peeked{c, r}, legacyTLS(p.certificate))
|
||||
}
|
||||
@@ -233,6 +233,10 @@ func (p *Port) certificate(hello *tls.ClientHelloInfo) (*tls.Certificate, error)
|
||||
return nil, errors.New("no certificate")
|
||||
}
|
||||
|
||||
// oldSessions are the sessions of clients served by retrossl, kept for
|
||||
// them to resume (each goes only with its own certificate).
|
||||
var oldSessions = retrossl.NewSessionCache(0, 0)
|
||||
|
||||
func (p *Port) sslv2() *Route {
|
||||
for _, rt := range p.Routes {
|
||||
if rt.SSLv2 && rt.Cert != nil {
|
||||
|
||||
Reference in new issue
Block a user