config.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. /*
  2. * Copyright (c) 2016, Psiphon Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. */
  19. package server
  20. import (
  21. "crypto/rand"
  22. "crypto/rsa"
  23. "crypto/x509"
  24. "encoding/base64"
  25. "encoding/json"
  26. "encoding/pem"
  27. "errors"
  28. "fmt"
  29. "net"
  30. "strconv"
  31. "strings"
  32. "time"
  33. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon"
  34. "golang.org/x/crypto/nacl/box"
  35. "golang.org/x/crypto/ssh"
  36. )
  37. const (
  38. SERVER_CONFIG_FILENAME = "psiphond.config"
  39. SERVER_TRAFFIC_RULES_FILENAME = "psiphond-traffic-rules.config"
  40. SERVER_ENTRY_FILENAME = "server-entry.dat"
  41. DEFAULT_SERVER_IP_ADDRESS = "127.0.0.1"
  42. WEB_SERVER_SECRET_BYTE_LENGTH = 32
  43. DISCOVERY_VALUE_KEY_BYTE_LENGTH = 32
  44. WEB_SERVER_READ_TIMEOUT = 10 * time.Second
  45. WEB_SERVER_WRITE_TIMEOUT = 10 * time.Second
  46. SSH_USERNAME_SUFFIX_BYTE_LENGTH = 8
  47. SSH_PASSWORD_BYTE_LENGTH = 32
  48. SSH_RSA_HOST_KEY_BITS = 2048
  49. SSH_HANDSHAKE_TIMEOUT = 30 * time.Second
  50. SSH_CONNECTION_READ_DEADLINE = 5 * time.Minute
  51. SSH_TCP_PORT_FORWARD_DIAL_TIMEOUT = 30 * time.Second
  52. SSH_TCP_PORT_FORWARD_COPY_BUFFER_SIZE = 8192
  53. SSH_OBFUSCATED_KEY_BYTE_LENGTH = 32
  54. GEOIP_SESSION_CACHE_TTL = 60 * time.Minute
  55. )
  56. // Config specifies the configuration and behavior of a Psiphon
  57. // server.
  58. type Config struct {
  59. // LogLevel specifies the log level. Valid values are:
  60. // panic, fatal, error, warn, info, debug
  61. LogLevel string
  62. // LogFilename specifies the path of the file to log
  63. // to. When blank, logs are written to stderr.
  64. LogFilename string
  65. // DiscoveryValueHMACKey is the network-wide secret value
  66. // used to determine a unique discovery strategy.
  67. DiscoveryValueHMACKey string
  68. // GeoIPDatabaseFilenames ares paths of GeoIP2/GeoLite2
  69. // MaxMind database files. When empty, no GeoIP lookups are
  70. // performed. Each file is queried, in order, for the
  71. // logged fields: country code, city, and ISP. Multiple
  72. // file support accomodates the MaxMind distribution where
  73. // ISP data in a separate file.
  74. GeoIPDatabaseFilenames []string
  75. // PsinetDatabaseFilename is the path of the Psiphon automation
  76. // jsonpickle format Psiphon API data file.
  77. PsinetDatabaseFilename string
  78. // HostID is the ID of the server host; this is used for API
  79. // event logging.
  80. HostID string
  81. // ServerIPAddress is the public IP address of the server.
  82. ServerIPAddress string
  83. // WebServerPort is the listening port of the web server.
  84. // When <= 0, no web server component is run.
  85. WebServerPort int
  86. // WebServerSecret is the unique secret value that the client
  87. // must supply to make requests to the web server.
  88. WebServerSecret string
  89. // WebServerCertificate is the certificate the client uses to
  90. // authenticate the web server.
  91. WebServerCertificate string
  92. // WebServerPrivateKey is the private key the web server uses to
  93. // authenticate itself to clients.
  94. WebServerPrivateKey string
  95. // TunnelProtocolPorts specifies which tunnel protocols to run
  96. // and which ports to listen on for each protocol. Valid tunnel
  97. // protocols include: "SSH", "OSSH", "UNFRONTED-MEEK-OSSH",
  98. // "UNFRONTED-MEEK-HTTPS-OSSH", "FRONTED-MEEK-OSSH",
  99. // "FRONTED-MEEK-HTTP-OSSH".
  100. TunnelProtocolPorts map[string]int
  101. // SSHPrivateKey is the SSH host key. The same key is used for
  102. // all protocols, run by this server instance, which use SSH.
  103. SSHPrivateKey string
  104. // SSHServerVersion is the server version presented in the
  105. // identification string. The same value is used for all
  106. // protocols, run by this server instance, which use SSH.
  107. SSHServerVersion string
  108. // SSHUserName is the SSH user name to be presented by the
  109. // the tunnel-core client. The same value is used for all
  110. // protocols, run by this server instance, which use SSH.
  111. SSHUserName string
  112. // SSHPassword is the SSH password to be presented by the
  113. // the tunnel-core client. The same value is used for all
  114. // protocols, run by this server instance, which use SSH.
  115. SSHPassword string
  116. // ObfuscatedSSHKey is the secret key for use in the Obfuscated
  117. // SSH protocol. The same secret key is used for all protocols,
  118. // run by this server instance, which use Obfuscated SSH.
  119. ObfuscatedSSHKey string
  120. // MeekCookieEncryptionPrivateKey is the NaCl private key used
  121. // to decrypt meek cookie payload sent from clients. The same
  122. // key is used for all meek protocols run by this server instance.
  123. MeekCookieEncryptionPrivateKey string
  124. // MeekObfuscatedKey is the secret key used for obfuscating
  125. // meek cookies sent from clients. The same key is used for all
  126. // meek protocols run by this server instance.
  127. MeekObfuscatedKey string
  128. // MeekCertificateCommonName is the value used for the hostname
  129. // in the self-signed certificate generated and used for meek
  130. // HTTPS modes. The same value is used for all HTTPS meek
  131. // protocols.
  132. MeekCertificateCommonName string
  133. // MeekProhibitedHeaders is a list of HTTP headers to check for
  134. // in client requests. If one of these headers is found, the
  135. // request fails. This is used to defend against abuse.
  136. MeekProhibitedHeaders []string
  137. // MeekProxyForwardedForHeaders is a list of HTTP headers which
  138. // may be added by downstream HTTP proxies or CDNs in front
  139. // of clients. These headers supply the original client IP
  140. // address, which is geolocated for stats purposes. Headers
  141. // include, for example, X-Forwarded-For. The header's value
  142. // is assumed to be a comma delimted list of IP addresses where
  143. // the client IP is the first IP address in the list. Meek protocols
  144. // look for these headers and use the client IP address from
  145. // the header if any one is present and the value is a valid
  146. // IP address; otherwise the direct connection remote address is
  147. // used as the client IP.
  148. MeekProxyForwardedForHeaders []string
  149. // UDPInterceptUdpgwServerAddress specifies the network address of
  150. // a udpgw server which clients may be port forwarding to. When
  151. // specified, these TCP port forwards are intercepted and handled
  152. // directly by this server, which parses the SSH channel using the
  153. // udpgw protocol. Handling includes udpgw transparent DNS: tunneled
  154. // UDP DNS packets are rerouted to the host's DNS server.
  155. UDPInterceptUdpgwServerAddress string
  156. // DNSResolverIPAddress specifies the IP address of a DNS server
  157. // to be used when "/etc/resolv.conf" doesn't exist or fails to
  158. // parse. When blank, "/etc/resolv.conf" must contain a usable
  159. // "nameserver" entry.
  160. DNSResolverIPAddress string
  161. // LoadMonitorPeriodSeconds indicates how frequently to log server
  162. // load information (number of connected clients per tunnel protocol,
  163. // number of running goroutines, amount of memory allocated, etc.)
  164. // The default, 0, disables load logging.
  165. LoadMonitorPeriodSeconds int
  166. // TrafficRulesFilename is the path of a file containing a
  167. // JSON-encoded TrafficRulesSet, the traffic rules to apply to
  168. // Psiphon client tunnels.
  169. TrafficRulesFilename string
  170. }
  171. // RunWebServer indicates whether to run a web server component.
  172. func (config *Config) RunWebServer() bool {
  173. return config.WebServerPort > 0
  174. }
  175. // RunLoadMonitor indicates whether to monitor and log server load.
  176. func (config *Config) RunLoadMonitor() bool {
  177. return config.LoadMonitorPeriodSeconds > 0
  178. }
  179. // LoadConfig loads and validates a JSON encoded server config.
  180. func LoadConfig(configJSON []byte) (*Config, error) {
  181. var config Config
  182. err := json.Unmarshal(configJSON, &config)
  183. if err != nil {
  184. return nil, psiphon.ContextError(err)
  185. }
  186. if config.ServerIPAddress == "" {
  187. return nil, errors.New("ServerIPAddress is missing from config file")
  188. }
  189. if config.WebServerPort > 0 && (config.WebServerSecret == "" || config.WebServerCertificate == "" ||
  190. config.WebServerPrivateKey == "") {
  191. return nil, errors.New(
  192. "Web server requires WebServerSecret, WebServerCertificate, WebServerPrivateKey")
  193. }
  194. for tunnelProtocol, _ := range config.TunnelProtocolPorts {
  195. if psiphon.TunnelProtocolUsesSSH(tunnelProtocol) ||
  196. psiphon.TunnelProtocolUsesObfuscatedSSH(tunnelProtocol) {
  197. if config.SSHPrivateKey == "" || config.SSHServerVersion == "" ||
  198. config.SSHUserName == "" || config.SSHPassword == "" {
  199. return nil, fmt.Errorf(
  200. "Tunnel protocol %s requires SSHPrivateKey, SSHServerVersion, SSHUserName, SSHPassword",
  201. tunnelProtocol)
  202. }
  203. }
  204. if psiphon.TunnelProtocolUsesObfuscatedSSH(tunnelProtocol) {
  205. if config.ObfuscatedSSHKey == "" {
  206. return nil, fmt.Errorf(
  207. "Tunnel protocol %s requires ObfuscatedSSHKey",
  208. tunnelProtocol)
  209. }
  210. }
  211. if psiphon.TunnelProtocolUsesMeekHTTP(tunnelProtocol) ||
  212. psiphon.TunnelProtocolUsesMeekHTTPS(tunnelProtocol) {
  213. if config.MeekCookieEncryptionPrivateKey == "" || config.MeekObfuscatedKey == "" {
  214. return nil, fmt.Errorf(
  215. "Tunnel protocol %s requires MeekCookieEncryptionPrivateKey, MeekObfuscatedKey",
  216. tunnelProtocol)
  217. }
  218. }
  219. if psiphon.TunnelProtocolUsesMeekHTTPS(tunnelProtocol) {
  220. if config.MeekCertificateCommonName == "" {
  221. return nil, fmt.Errorf(
  222. "Tunnel protocol %s requires MeekCertificateCommonName",
  223. tunnelProtocol)
  224. }
  225. }
  226. }
  227. validateNetworkAddress := func(address string) error {
  228. host, port, err := net.SplitHostPort(address)
  229. if err == nil && net.ParseIP(host) == nil {
  230. err = errors.New("Host must be an IP address")
  231. }
  232. if err == nil {
  233. _, err = strconv.Atoi(port)
  234. }
  235. return err
  236. }
  237. if config.UDPInterceptUdpgwServerAddress != "" {
  238. if err := validateNetworkAddress(config.UDPInterceptUdpgwServerAddress); err != nil {
  239. return nil, fmt.Errorf("UDPInterceptUdpgwServerAddress is invalid: %s", err)
  240. }
  241. }
  242. if config.DNSResolverIPAddress != "" {
  243. if net.ParseIP(config.DNSResolverIPAddress) == nil {
  244. return nil, fmt.Errorf("DNSResolverIPAddress is invalid")
  245. }
  246. }
  247. return &config, nil
  248. }
  249. // GenerateConfigParams specifies customizations to be applied to
  250. // a generated server config.
  251. type GenerateConfigParams struct {
  252. LogFilename string
  253. ServerIPAddress string
  254. WebServerPort int
  255. EnableSSHAPIRequests bool
  256. TunnelProtocolPorts map[string]int
  257. TrafficRulesFilename string
  258. }
  259. // GenerateConfig creates a new Psiphon server config. It returns JSON
  260. // encoded configs and a client-compatible "server entry" for the server. It
  261. // generates all necessary secrets and key material, which are emitted in
  262. // the config file and server entry as necessary.
  263. // GenerateConfig uses sample values for many fields. The intention is for
  264. // generated configs to be used for testing or as a template for production
  265. // setup, not to generate production-ready configurations.
  266. func GenerateConfig(params *GenerateConfigParams) ([]byte, []byte, []byte, error) {
  267. // Input validation
  268. if net.ParseIP(params.ServerIPAddress) == nil {
  269. return nil, nil, nil, psiphon.ContextError(errors.New("invalid IP address"))
  270. }
  271. if len(params.TunnelProtocolPorts) == 0 {
  272. return nil, nil, nil, psiphon.ContextError(errors.New("no tunnel protocols"))
  273. }
  274. usedPort := make(map[int]bool)
  275. if params.WebServerPort != 0 {
  276. usedPort[params.WebServerPort] = true
  277. }
  278. usingMeek := false
  279. for protocol, port := range params.TunnelProtocolPorts {
  280. if !psiphon.Contains(psiphon.SupportedTunnelProtocols, protocol) {
  281. return nil, nil, nil, psiphon.ContextError(errors.New("invalid tunnel protocol"))
  282. }
  283. if usedPort[port] {
  284. return nil, nil, nil, psiphon.ContextError(errors.New("duplicate listening port"))
  285. }
  286. usedPort[port] = true
  287. if psiphon.TunnelProtocolUsesMeekHTTP(protocol) ||
  288. psiphon.TunnelProtocolUsesMeekHTTPS(protocol) {
  289. usingMeek = true
  290. }
  291. }
  292. // Web server config
  293. var webServerSecret, webServerCertificate, webServerPrivateKey string
  294. if params.WebServerPort != 0 {
  295. var err error
  296. webServerSecret, err = psiphon.MakeRandomStringHex(WEB_SERVER_SECRET_BYTE_LENGTH)
  297. if err != nil {
  298. return nil, nil, nil, psiphon.ContextError(err)
  299. }
  300. webServerCertificate, webServerPrivateKey, err = GenerateWebServerCertificate("")
  301. if err != nil {
  302. return nil, nil, nil, psiphon.ContextError(err)
  303. }
  304. }
  305. // SSH config
  306. // TODO: use other key types: anti-fingerprint by varying params
  307. rsaKey, err := rsa.GenerateKey(rand.Reader, SSH_RSA_HOST_KEY_BITS)
  308. if err != nil {
  309. return nil, nil, nil, psiphon.ContextError(err)
  310. }
  311. sshPrivateKey := pem.EncodeToMemory(
  312. &pem.Block{
  313. Type: "RSA PRIVATE KEY",
  314. Bytes: x509.MarshalPKCS1PrivateKey(rsaKey),
  315. },
  316. )
  317. signer, err := ssh.NewSignerFromKey(rsaKey)
  318. if err != nil {
  319. return nil, nil, nil, psiphon.ContextError(err)
  320. }
  321. sshPublicKey := signer.PublicKey()
  322. sshUserNameSuffix, err := psiphon.MakeRandomStringHex(SSH_USERNAME_SUFFIX_BYTE_LENGTH)
  323. if err != nil {
  324. return nil, nil, nil, psiphon.ContextError(err)
  325. }
  326. sshUserName := "psiphon_" + sshUserNameSuffix
  327. sshPassword, err := psiphon.MakeRandomStringHex(SSH_PASSWORD_BYTE_LENGTH)
  328. if err != nil {
  329. return nil, nil, nil, psiphon.ContextError(err)
  330. }
  331. // TODO: vary version string for anti-fingerprint
  332. sshServerVersion := "SSH-2.0-Psiphon"
  333. // Obfuscated SSH config
  334. obfuscatedSSHKey, err := psiphon.MakeRandomStringHex(SSH_OBFUSCATED_KEY_BYTE_LENGTH)
  335. if err != nil {
  336. return nil, nil, nil, psiphon.ContextError(err)
  337. }
  338. // Meek config
  339. var meekCookieEncryptionPublicKey, meekCookieEncryptionPrivateKey, meekObfuscatedKey string
  340. if usingMeek {
  341. rawMeekCookieEncryptionPublicKey, rawMeekCookieEncryptionPrivateKey, err :=
  342. box.GenerateKey(rand.Reader)
  343. if err != nil {
  344. return nil, nil, nil, psiphon.ContextError(err)
  345. }
  346. meekCookieEncryptionPublicKey = base64.StdEncoding.EncodeToString(rawMeekCookieEncryptionPublicKey[:])
  347. meekCookieEncryptionPrivateKey = base64.StdEncoding.EncodeToString(rawMeekCookieEncryptionPrivateKey[:])
  348. meekObfuscatedKey, err = psiphon.MakeRandomStringHex(SSH_OBFUSCATED_KEY_BYTE_LENGTH)
  349. if err != nil {
  350. return nil, nil, nil, psiphon.ContextError(err)
  351. }
  352. }
  353. // Other config
  354. discoveryValueHMACKey, err := psiphon.MakeRandomStringBase64(DISCOVERY_VALUE_KEY_BYTE_LENGTH)
  355. if err != nil {
  356. return nil, nil, nil, psiphon.ContextError(err)
  357. }
  358. // Assemble configs and server entry
  359. // Note: this config is intended for either testing or as an illustrative
  360. // example or template and is not intended for production deployment.
  361. config := &Config{
  362. LogLevel: "info",
  363. LogFilename: params.LogFilename,
  364. GeoIPDatabaseFilenames: nil,
  365. HostID: "example-host-id",
  366. ServerIPAddress: params.ServerIPAddress,
  367. DiscoveryValueHMACKey: discoveryValueHMACKey,
  368. WebServerPort: params.WebServerPort,
  369. WebServerSecret: webServerSecret,
  370. WebServerCertificate: webServerCertificate,
  371. WebServerPrivateKey: webServerPrivateKey,
  372. SSHPrivateKey: string(sshPrivateKey),
  373. SSHServerVersion: sshServerVersion,
  374. SSHUserName: sshUserName,
  375. SSHPassword: sshPassword,
  376. ObfuscatedSSHKey: obfuscatedSSHKey,
  377. TunnelProtocolPorts: params.TunnelProtocolPorts,
  378. DNSResolverIPAddress: "8.8.8.8",
  379. UDPInterceptUdpgwServerAddress: "127.0.0.1:7300",
  380. MeekCookieEncryptionPrivateKey: meekCookieEncryptionPrivateKey,
  381. MeekObfuscatedKey: meekObfuscatedKey,
  382. MeekCertificateCommonName: "www.example.org",
  383. MeekProhibitedHeaders: nil,
  384. MeekProxyForwardedForHeaders: []string{"X-Forwarded-For"},
  385. LoadMonitorPeriodSeconds: 300,
  386. TrafficRulesFilename: params.TrafficRulesFilename,
  387. }
  388. encodedConfig, err := json.MarshalIndent(config, "\n", " ")
  389. if err != nil {
  390. return nil, nil, nil, psiphon.ContextError(err)
  391. }
  392. trafficRulesSet := &TrafficRulesSet{
  393. DefaultRules: TrafficRules{
  394. DefaultLimits: RateLimits{
  395. DownstreamUnlimitedBytes: 0,
  396. DownstreamBytesPerSecond: 0,
  397. UpstreamUnlimitedBytes: 0,
  398. UpstreamBytesPerSecond: 0,
  399. },
  400. IdleTCPPortForwardTimeoutMilliseconds: 30000,
  401. IdleUDPPortForwardTimeoutMilliseconds: 30000,
  402. MaxTCPPortForwardCount: 1024,
  403. MaxUDPPortForwardCount: 32,
  404. AllowTCPPorts: nil,
  405. AllowUDPPorts: nil,
  406. DenyTCPPorts: nil,
  407. DenyUDPPorts: nil,
  408. },
  409. }
  410. encodedTrafficRulesSet, err := json.MarshalIndent(trafficRulesSet, "\n", " ")
  411. if err != nil {
  412. return nil, nil, nil, psiphon.ContextError(err)
  413. }
  414. capabilities := []string{}
  415. if params.EnableSSHAPIRequests {
  416. capabilities = append(capabilities, psiphon.CAPABILITY_SSH_API_REQUESTS)
  417. }
  418. if params.WebServerPort != 0 {
  419. capabilities = append(capabilities, psiphon.CAPABILITY_UNTUNNELED_WEB_API_REQUESTS)
  420. }
  421. for protocol, _ := range params.TunnelProtocolPorts {
  422. capabilities = append(capabilities, psiphon.GetCapability(protocol))
  423. }
  424. sshPort := params.TunnelProtocolPorts["SSH"]
  425. obfuscatedSSHPort := params.TunnelProtocolPorts["OSSH"]
  426. // Meek port limitations
  427. // - fronted meek protocols are hard-wired in the client to be port 443 or 80.
  428. // - only one other meek port may be specified.
  429. meekPort := params.TunnelProtocolPorts["UNFRONTED-MEEK-OSSH"]
  430. if meekPort == 0 {
  431. meekPort = params.TunnelProtocolPorts["UNFRONTED-MEEK-HTTPS-OSSH"]
  432. }
  433. // Note: fronting params are a stub; this server entry will exercise
  434. // client and server fronting code paths, but not actually traverse
  435. // a fronting hop.
  436. serverEntryWebServerPort := ""
  437. strippedWebServerCertificate := ""
  438. if params.WebServerPort != 0 {
  439. serverEntryWebServerPort = fmt.Sprintf("%d", params.WebServerPort)
  440. // Server entry format omits the BEGIN/END lines and newlines
  441. lines := strings.Split(webServerCertificate, "\n")
  442. strippedWebServerCertificate = strings.Join(lines[1:len(lines)-2], "")
  443. }
  444. serverEntry := &psiphon.ServerEntry{
  445. IpAddress: params.ServerIPAddress,
  446. WebServerPort: serverEntryWebServerPort,
  447. WebServerSecret: webServerSecret,
  448. WebServerCertificate: strippedWebServerCertificate,
  449. SshPort: sshPort,
  450. SshUsername: sshUserName,
  451. SshPassword: sshPassword,
  452. SshHostKey: base64.RawStdEncoding.EncodeToString(sshPublicKey.Marshal()),
  453. SshObfuscatedPort: obfuscatedSSHPort,
  454. SshObfuscatedKey: obfuscatedSSHKey,
  455. Capabilities: capabilities,
  456. Region: "US",
  457. MeekServerPort: meekPort,
  458. MeekCookieEncryptionPublicKey: meekCookieEncryptionPublicKey,
  459. MeekObfuscatedKey: meekObfuscatedKey,
  460. MeekFrontingHosts: []string{params.ServerIPAddress},
  461. MeekFrontingAddresses: []string{params.ServerIPAddress},
  462. MeekFrontingDisableSNI: false,
  463. }
  464. encodedServerEntry, err := psiphon.EncodeServerEntry(serverEntry)
  465. if err != nil {
  466. return nil, nil, nil, psiphon.ContextError(err)
  467. }
  468. return encodedConfig, encodedTrafficRulesSet, []byte(encodedServerEntry), nil
  469. }