Documentation
¶
Overview ¶
Package sshd implements the inbound (server-side) half of the bastion: listener, handshake, authentication and channel dispatch.
Index ¶
- type Route
- type Server
- func (s *Server) EnableOOB(logins *auth.Logins, timeout time.Duration)
- func (s *Server) ListenAndServe(ctx context.Context) error
- func (s *Server) LiveSessions() *proxy.Live
- func (s *Server) ProxyDeps() proxy.Deps
- func (s *Server) Records() *record.Store
- func (s *Server) Serve(ctx context.Context, l net.Listener) error
- func (s *Server) UseEventBus(p events.Publisher)
- func (s *Server) UseGroupSource(src auth.GroupSource)
- func (s *Server) UseRoleRefresher(fn func(context.Context, string) error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Route ¶
Route is the parsed form of the "user:target" SSH username convention.
func ParseUsername ¶
ParseUsername splits raw ("user:target") into a Route.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server accepts inbound SSH connections on behalf of the bastion.
func (*Server) EnableOOB ¶
EnableOOB, tarayıcı destekli girişi açar. serve, config'te oidc+http varsa çağırır; testler ve OIDC'siz kurulumlar hiç çağırmaz. timeout 0 ise varsayılan (oobTimeout) kullanılır — testler kısaltabilir.
Dinlemeye başlamadan ÖNCE çağrılmalı: alanlar kilitsiz, eşzamanlı handshake'lerle yarışmamalı.
func (*Server) ListenAndServe ¶
ListenAndServe listens on cfg.Listen.Addr and hands the listener to Serve.
func (*Server) LiveSessions ¶
* LiveSessions, akan oturum defterini döner. * * ⚠️ PANELE AYRI VERİLİYOR, ProxyDeps üzerinden DEĞİL. httpapi'nin * proxyDeps alanı yalnızca http.terminal_enabled açıkken doluyor * (serve.go). Defteri oraya asmak, kesme düğmesini varsayılan * kurulumda — terminal kapalı, yalnızca SSH — sessizce yok ederdi: * bu depodaki tekrar eden arıza sınıfının ("yazıldı, bağlanmadı") tam * olarak kendisi. O yüzden ayrı bir kapı.
func (*Server) Records ¶
Records, kayıt deposunu döner.
httpapi ile PAYLAŞILIR: panel kayıtları AYNI depodan okumalı, yoksa "hangi dizin" sorusunun iki cevabı olur.
func (*Server) Serve ¶
* Serve accepts connections from l until ctx is cancelled, then drains. * * ⚠️ KAPANIŞTA BEKLİYOR — VE BEKLEMİYORDU. ctx iptal edilince * dinleyici kapanıyor, döngü `return nil` diyordu ve bağlantıları * taşıyan goroutine'leri bekleyen HİÇBİR ŞEY yoktu: süreç ölürken o an * bağlı olan herkesin oturumu ortasından kopuyordu. Bedeli yalnızca * kullanıcının rahatsızlığı değildi — Session.Close hiç çalışmadığı * için kayıt yarım kapanıyor ve arşiv kuyruğuna hiç girmiyordu, yani * bir yeniden başlatma o oturumların kaydını hem eksik hem * yüklenemez bırakıyordu. * * Sıra: dinlemeyi bırak → açık oturumları drain süresince bekle → * kalanları SEBEBİYLE kapat → onların da bitmesini bekle.
func (*Server) UseEventBus ¶
UseEventBus, canlı izleme akışını bağlar. Çağrılmazsa olay yayınlanmaz.
func (*Server) UseGroupSource ¶
func (s *Server) UseGroupSource(src auth.GroupSource)
UseGroupSource, grup kaynağını değiştirir (LDAP için). Dinlemeye başlamadan ÖNCE çağrılmalı.
func (*Server) UseRoleRefresher ¶
ProxyDeps, oturum akışının ihtiyaç duyduğu altyapıyı döner.
httpapi ile PAYLAŞILIR: web terminali ve SSH aynı store'u, aynı kayıt dizinini ve aynı CA'yı kullanmalı — iki kapı, tek gerçek. UseRoleRefresher, oturum açılışında yetkiyi tazeleyen fonksiyonu bildirir. Dinlemeye başlamadan ÖNCE çağrılmalı: alan kilitsiz.
Aynı fonksiyon web terminaline de gidiyor (ProxyDeps paylaşılıyor) — iki kapı tek kuralı uyguluyor.