package services import "fmt" type Service struct { Name string Port int Subdomain string Protocol string BackendPort int SNIRequired bool Config map[string]interface{} } func GetDefaultServices(domain string) []Service { return []Service{ { Name: "ssh", Port: 22, Subdomain: "ssh", Protocol: "ssh", BackendPort: 22, SNIRequired: false, Config: map[string]interface{}{}, }, { Name: "https", Port: 443, Subdomain: "", Protocol: "tls", BackendPort: 8444, SNIRequired: false, Config: map[string]interface{}{ "alpn_protocols": []string{"h2", "http/1.1"}, }, }, { Name: "smb", Port: 445, Subdomain: "smb", Protocol: "regex", BackendPort: 445, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\x00\\x00\\x00"}, }, }, } } func GetAdditionalServices(domain string) []Service { return []Service{ { Name: "ldap", Port: 389, Subdomain: "ldap", Protocol: "regex", BackendPort: 389, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\x30"}, }, }, { Name: "ldaps", Port: 636, Subdomain: "ldaps", Protocol: "tls", BackendPort: 636, SNIRequired: true, Config: map[string]interface{}{}, }, { Name: "rdp", Port: 3389, Subdomain: "rdp", Protocol: "regex", BackendPort: 3389, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\x03\\x00\\x00"}, }, }, { Name: "mysql", Port: 3306, Subdomain: "mysql", Protocol: "regex", BackendPort: 3306, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^[\\x00-\\xff]{4}\\x0a"}, }, }, { Name: "postgres", Port: 5432, Subdomain: "postgres", Protocol: "regex", BackendPort: 5432, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\x00\\x00\\x00\\x08"}, }, }, } } func GetStandardServices(domain string) []Service { return []Service{ { Name: "ssh", Port: 22, Subdomain: "ssh", Protocol: "ssh", BackendPort: 22, SNIRequired: false, Config: map[string]interface{}{}, }, { Name: "https", Port: 443, Subdomain: "", Protocol: "tls", BackendPort: 8444, SNIRequired: false, Config: map[string]interface{}{ "alpn_protocols": []string{"h2", "http/1.1"}, }, }, { Name: "ldap", Port: 389, Subdomain: "ldap", Protocol: "regex", BackendPort: 389, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\x30"}, }, }, { Name: "ldaps", Port: 636, Subdomain: "ldaps", Protocol: "tls", BackendPort: 636, SNIRequired: true, Config: map[string]interface{}{}, }, { Name: "smb", Port: 445, Subdomain: "smb", Protocol: "regex", BackendPort: 445, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\x00\\x00\\x00"}, }, }, { Name: "rdp", Port: 3389, Subdomain: "rdp", Protocol: "regex", BackendPort: 3389, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\x03\\x00\\x00"}, }, }, { Name: "mysql", Port: 3306, Subdomain: "mysql", Protocol: "regex", BackendPort: 3306, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^[\\x00-\\xff]{4}\\x0a"}, }, }, { Name: "postgres", Port: 5432, Subdomain: "postgres", Protocol: "regex", BackendPort: 5432, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\x00\\x00\\x00\\x08"}, }, }, { Name: "redis", Port: 6379, Subdomain: "redis", Protocol: "regex", BackendPort: 6379, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\*[0-9]"}, }, }, { Name: "mongodb", Port: 27017, Subdomain: "mongo", Protocol: "regex", BackendPort: 27017, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^[\\x3d\\xdb]\\x00\\x00\\x00"}, }, }, { Name: "vnc", Port: 5900, Subdomain: "vnc", Protocol: "regex", BackendPort: 5900, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^RFB"}, }, }, { Name: "ftp", Port: 21, Subdomain: "ftp", Protocol: "regex", BackendPort: 21, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^220"}, }, }, { Name: "ftps", Port: 990, Subdomain: "ftps", Protocol: "tls", BackendPort: 990, SNIRequired: true, Config: map[string]interface{}{}, }, { Name: "smtp", Port: 25, Subdomain: "smtp", Protocol: "regex", BackendPort: 25, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^220"}, }, }, { Name: "smtps", Port: 465, Subdomain: "smtps", Protocol: "tls", BackendPort: 465, SNIRequired: true, Config: map[string]interface{}{}, }, { Name: "imap", Port: 143, Subdomain: "imap", Protocol: "regex", BackendPort: 143, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\* OK"}, }, }, { Name: "imaps", Port: 993, Subdomain: "imaps", Protocol: "tls", BackendPort: 993, SNIRequired: true, Config: map[string]interface{}{}, }, { Name: "pop3", Port: 110, Subdomain: "pop3", Protocol: "regex", BackendPort: 110, SNIRequired: false, Config: map[string]interface{}{ "regex_patterns": []string{"^\\+OK"}, }, }, { Name: "pop3s", Port: 995, Subdomain: "pop3s", Protocol: "tls", BackendPort: 995, SNIRequired: true, Config: map[string]interface{}{}, }, } } func (s *Service) GetFQDN(domain string) string { return fmt.Sprintf("%s.%s", s.Subdomain, domain) }