You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

server.go 39KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
  1. // Copyright (c) 2012-2014 Jeremy Latt
  2. // Copyright (c) 2014-2015 Edmund Huber
  3. // Copyright (c) 2016-2017 Daniel Oaks <daniel@danieloaks.net>
  4. // released under the MIT license
  5. package irc
  6. import (
  7. "fmt"
  8. "net"
  9. "net/http"
  10. _ "net/http/pprof"
  11. "os"
  12. "os/signal"
  13. "strconv"
  14. "strings"
  15. "sync"
  16. "syscall"
  17. "time"
  18. "unsafe"
  19. "github.com/ergochat/irc-go/ircfmt"
  20. "github.com/okzk/sdnotify"
  21. "github.com/ergochat/ergo/irc/caps"
  22. "github.com/ergochat/ergo/irc/connection_limits"
  23. "github.com/ergochat/ergo/irc/flatip"
  24. "github.com/ergochat/ergo/irc/flock"
  25. "github.com/ergochat/ergo/irc/history"
  26. "github.com/ergochat/ergo/irc/logger"
  27. "github.com/ergochat/ergo/irc/modes"
  28. "github.com/ergochat/ergo/irc/mysql"
  29. "github.com/ergochat/ergo/irc/sno"
  30. "github.com/ergochat/ergo/irc/utils"
  31. "github.com/tidwall/buntdb"
  32. )
  33. const (
  34. alwaysOnExpirationPollPeriod = time.Hour
  35. )
  36. var (
  37. // common error line to sub values into
  38. errorMsg = "ERROR :%s\r\n"
  39. // three final parameters of 004 RPL_MYINFO, enumerating our supported modes
  40. rplMyInfo1, rplMyInfo2, rplMyInfo3 = modes.RplMyInfo()
  41. // CHANMODES isupport token
  42. chanmodesToken = modes.ChanmodesToken()
  43. // whitelist of caps to serve on the STS-only listener. In particular,
  44. // never advertise SASL, to discourage people from sending their passwords:
  45. stsOnlyCaps = caps.NewSet(caps.STS, caps.MessageTags, caps.ServerTime, caps.Batch, caps.LabeledResponse, caps.EchoMessage, caps.Nope)
  46. // we only have standard channels for now. TODO: any updates to this
  47. // will also need to be reflected in CasefoldChannel
  48. chanTypes = "#"
  49. throttleMessage = "You have attempted to connect too many times within a short duration. Wait a while, and you will be able to connect."
  50. )
  51. // Server is the main Oragono server.
  52. type Server struct {
  53. accounts AccountManager
  54. channels ChannelManager
  55. channelRegistry ChannelRegistry
  56. clients ClientManager
  57. config unsafe.Pointer
  58. configFilename string
  59. connectionLimiter connection_limits.Limiter
  60. ctime time.Time
  61. dlines *DLineManager
  62. helpIndexManager HelpIndexManager
  63. klines *KLineManager
  64. listeners map[string]IRCListener
  65. logger *logger.Manager
  66. monitorManager MonitorManager
  67. name string
  68. nameCasefolded string
  69. rehashMutex sync.Mutex // tier 4
  70. rehashSignal chan os.Signal
  71. pprofServer *http.Server
  72. exitSignals chan os.Signal
  73. snomasks SnoManager
  74. store *buntdb.DB
  75. historyDB mysql.MySQL
  76. torLimiter connection_limits.TorLimiter
  77. whoWas WhoWasList
  78. stats Stats
  79. semaphores ServerSemaphores
  80. flock flock.Flocker
  81. defcon uint32
  82. }
  83. // NewServer returns a new Oragono server.
  84. func NewServer(config *Config, logger *logger.Manager) (*Server, error) {
  85. // initialize data structures
  86. server := &Server{
  87. ctime: time.Now().UTC(),
  88. listeners: make(map[string]IRCListener),
  89. logger: logger,
  90. rehashSignal: make(chan os.Signal, 1),
  91. exitSignals: make(chan os.Signal, len(utils.ServerExitSignals)),
  92. defcon: 5,
  93. }
  94. server.clients.Initialize()
  95. server.semaphores.Initialize()
  96. server.whoWas.Initialize(config.Limits.WhowasEntries)
  97. server.monitorManager.Initialize()
  98. server.snomasks.Initialize()
  99. if err := server.applyConfig(config); err != nil {
  100. return nil, err
  101. }
  102. // Attempt to clean up when receiving these signals.
  103. signal.Notify(server.exitSignals, utils.ServerExitSignals...)
  104. signal.Notify(server.rehashSignal, syscall.SIGHUP)
  105. time.AfterFunc(alwaysOnExpirationPollPeriod, server.handleAlwaysOnExpirations)
  106. return server, nil
  107. }
  108. // Shutdown shuts down the server.
  109. func (server *Server) Shutdown() {
  110. sdnotify.Stopping()
  111. server.logger.Info("server", "Stopping server")
  112. //TODO(dan): Make sure we disallow new nicks
  113. for _, client := range server.clients.AllClients() {
  114. client.Notice("Server is shutting down")
  115. if client.AlwaysOn() {
  116. client.Store(IncludeLastSeen)
  117. }
  118. }
  119. if err := server.store.Close(); err != nil {
  120. server.logger.Error("shutdown", fmt.Sprintln("Could not close datastore:", err))
  121. }
  122. server.historyDB.Close()
  123. server.logger.Info("server", fmt.Sprintf("%s exiting", Ver))
  124. }
  125. // Run starts the server.
  126. func (server *Server) Run() {
  127. defer server.Shutdown()
  128. for {
  129. select {
  130. case <-server.exitSignals:
  131. return
  132. case <-server.rehashSignal:
  133. server.logger.Info("server", "Rehashing due to SIGHUP")
  134. go server.rehash()
  135. }
  136. }
  137. }
  138. func (server *Server) checkBans(config *Config, ipaddr net.IP, checkScripts bool) (banned bool, requireSASL bool, message string) {
  139. // #671: do not enforce bans against loopback, as a failsafe
  140. // note that this function is not used for Tor connections (checkTorLimits is used instead)
  141. if ipaddr.IsLoopback() {
  142. return
  143. }
  144. if server.Defcon() == 1 {
  145. if !utils.IPInNets(ipaddr, server.Config().Server.secureNets) {
  146. return true, false, "New connections to this server are temporarily restricted"
  147. }
  148. }
  149. flat := flatip.FromNetIP(ipaddr)
  150. // check DLINEs
  151. isBanned, info := server.dlines.CheckIP(flat)
  152. if isBanned {
  153. if info.RequireSASL {
  154. server.logger.Info("connect-ip", "Requiring SASL from client due to d-line", ipaddr.String())
  155. return false, true, info.BanMessage("You must authenticate with SASL to connect from this IP (%s)")
  156. } else {
  157. server.logger.Info("connect-ip", "Client rejected by d-line", ipaddr.String())
  158. return true, false, info.BanMessage("You are banned from this server (%s)")
  159. }
  160. }
  161. // check connection limits
  162. err := server.connectionLimiter.AddClient(flat)
  163. if err == connection_limits.ErrLimitExceeded {
  164. // too many connections from one client, tell the client and close the connection
  165. server.logger.Info("connect-ip", "Client rejected for connection limit", ipaddr.String())
  166. return true, false, "Too many clients from your network"
  167. } else if err == connection_limits.ErrThrottleExceeded {
  168. server.logger.Info("connect-ip", "Client exceeded connection throttle", ipaddr.String())
  169. return true, false, throttleMessage
  170. } else if err != nil {
  171. server.logger.Warning("internal", "unexpected ban result", err.Error())
  172. }
  173. if checkScripts && config.Server.IPCheckScript.Enabled && !config.Server.IPCheckScript.ExemptSASL {
  174. output, err := CheckIPBan(server.semaphores.IPCheckScript, config.Server.IPCheckScript, ipaddr)
  175. if err != nil {
  176. server.logger.Error("internal", "couldn't check IP ban script", ipaddr.String(), err.Error())
  177. return false, false, ""
  178. }
  179. // TODO: currently no way to cache IPAccepted
  180. if (output.Result == IPBanned || output.Result == IPRequireSASL) && output.CacheSeconds != 0 {
  181. network, err := flatip.ParseToNormalizedNet(output.CacheNet)
  182. if err != nil {
  183. server.logger.Error("internal", "invalid dline net from IP ban script", ipaddr.String(), output.CacheNet)
  184. } else {
  185. dlineDuration := time.Duration(output.CacheSeconds) * time.Second
  186. err := server.dlines.AddNetwork(network, dlineDuration, output.Result == IPRequireSASL, output.BanMessage, "", "")
  187. if err != nil {
  188. server.logger.Error("internal", "couldn't set dline from IP ban script", ipaddr.String(), err.Error())
  189. }
  190. }
  191. }
  192. if output.Result == IPBanned {
  193. // XXX roll back IP connection/throttling addition for the IP
  194. server.connectionLimiter.RemoveClient(flat)
  195. server.logger.Info("connect-ip", "Rejected client due to ip-check-script", ipaddr.String())
  196. return true, false, output.BanMessage
  197. } else if output.Result == IPRequireSASL {
  198. server.logger.Info("connect-ip", "Requiring SASL from client due to ip-check-script", ipaddr.String())
  199. return false, true, output.BanMessage
  200. }
  201. }
  202. return false, false, ""
  203. }
  204. func (server *Server) checkTorLimits() (banned bool, message string) {
  205. switch server.torLimiter.AddClient() {
  206. case connection_limits.ErrLimitExceeded:
  207. return true, "Too many clients from the Tor network"
  208. case connection_limits.ErrThrottleExceeded:
  209. return true, "Exceeded connection throttle for the Tor network"
  210. default:
  211. return false, ""
  212. }
  213. }
  214. func (server *Server) handleAlwaysOnExpirations() {
  215. defer func() {
  216. // reschedule whether or not there was a panic
  217. time.AfterFunc(alwaysOnExpirationPollPeriod, server.handleAlwaysOnExpirations)
  218. }()
  219. defer server.HandlePanic()
  220. config := server.Config()
  221. deadline := time.Duration(config.Accounts.Multiclient.AlwaysOnExpiration)
  222. if deadline == 0 {
  223. return
  224. }
  225. server.logger.Info("accounts", "Checking always-on clients for expiration")
  226. for _, client := range server.clients.AllClients() {
  227. if client.IsExpiredAlwaysOn(config) {
  228. // TODO save the channels list, use it for autojoin if/when they return?
  229. server.logger.Info("accounts", "Expiring always-on client", client.AccountName())
  230. client.destroy(nil)
  231. }
  232. }
  233. }
  234. // handles server.ip-check-script.exempt-sasl:
  235. // run the ip check script at the end of the handshake, only for anonymous connections
  236. func (server *Server) checkBanScriptExemptSASL(config *Config, session *Session) (outcome AuthOutcome) {
  237. // TODO add caching for this; see related code in (*server).checkBans;
  238. // we should probably just put an LRU around this instead of using the DLINE system
  239. ipaddr := session.IP()
  240. output, err := CheckIPBan(server.semaphores.IPCheckScript, config.Server.IPCheckScript, ipaddr)
  241. if err != nil {
  242. server.logger.Error("internal", "couldn't check IP ban script", ipaddr.String(), err.Error())
  243. return authSuccess
  244. }
  245. if output.Result == IPBanned || output.Result == IPRequireSASL {
  246. server.logger.Info("connect-ip", "Rejecting unauthenticated client due to ip-check-script", ipaddr.String())
  247. if output.BanMessage != "" {
  248. session.client.requireSASLMessage = output.BanMessage
  249. }
  250. return authFailSaslRequired
  251. }
  252. return authSuccess
  253. }
  254. func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) {
  255. // XXX PROXY or WEBIRC MUST be sent as the first line of the session;
  256. // if we are here at all that means we have the final value of the IP
  257. if session.rawHostname == "" {
  258. session.client.lookupHostname(session, false)
  259. }
  260. // try to complete registration normally
  261. // XXX(#1057) username can be filled in by an ident query without the client
  262. // having sent USER: check for both username and realname to ensure they did
  263. if c.preregNick == "" || c.username == "" || c.realname == "" || session.capState == caps.NegotiatingState {
  264. return
  265. }
  266. if c.isSTSOnly {
  267. server.playSTSBurst(session)
  268. return true
  269. }
  270. // client MUST send PASS if necessary, or authenticate with SASL if necessary,
  271. // before completing the other registration commands
  272. config := server.Config()
  273. authOutcome := c.isAuthorized(server, config, session, c.requireSASL)
  274. if authOutcome == authSuccess && c.account == "" &&
  275. config.Server.IPCheckScript.Enabled && config.Server.IPCheckScript.ExemptSASL {
  276. authOutcome = server.checkBanScriptExemptSASL(config, session)
  277. }
  278. var quitMessage string
  279. switch authOutcome {
  280. case authFailPass:
  281. quitMessage = c.t("Password incorrect")
  282. c.Send(nil, server.name, ERR_PASSWDMISMATCH, "*", quitMessage)
  283. case authFailSaslRequired, authFailTorSaslRequired:
  284. quitMessage = c.requireSASLMessage
  285. if quitMessage == "" {
  286. quitMessage = c.t("You must log in with SASL to join this server")
  287. }
  288. c.Send(nil, c.server.name, "FAIL", "*", "ACCOUNT_REQUIRED", quitMessage)
  289. }
  290. if authOutcome != authSuccess {
  291. c.Quit(quitMessage, nil)
  292. return true
  293. }
  294. c.requireSASLMessage = ""
  295. rb := NewResponseBuffer(session)
  296. nickError := performNickChange(server, c, c, session, c.preregNick, rb)
  297. rb.Send(true)
  298. if nickError == errInsecureReattach {
  299. c.Quit(c.t("You can't mix secure and insecure connections to this account"), nil)
  300. return true
  301. } else if nickError != nil {
  302. c.preregNick = ""
  303. return false
  304. }
  305. if session.client != c {
  306. // reattached, bail out.
  307. // we'll play the reg burst later, on the new goroutine associated with
  308. // (thisSession, otherClient). This is to avoid having to transfer state
  309. // like nickname, hostname, etc. to show the correct values in the reg burst.
  310. return false
  311. }
  312. // Apply default user modes (without updating the invisible counter)
  313. // The number of invisible users will be updated by server.stats.Register
  314. // if we're using default user mode +i.
  315. for _, defaultMode := range config.Accounts.defaultUserModes {
  316. c.SetMode(defaultMode, true)
  317. }
  318. // count new user in statistics (before checking KLINEs, see #1303)
  319. server.stats.Register(c.HasMode(modes.Invisible))
  320. // check KLINEs (#671: ignore KLINEs for loopback connections)
  321. if !session.IP().IsLoopback() || session.isTor {
  322. isBanned, info := server.klines.CheckMasks(c.AllNickmasks()...)
  323. if isBanned {
  324. c.Quit(info.BanMessage(c.t("You are banned from this server (%s)")), nil)
  325. return true
  326. }
  327. }
  328. server.playRegistrationBurst(session)
  329. return false
  330. }
  331. func (server *Server) playSTSBurst(session *Session) {
  332. nick := utils.SafeErrorParam(session.client.preregNick)
  333. session.Send(nil, server.name, RPL_WELCOME, nick, fmt.Sprintf("Welcome to the Internet Relay Network %s", nick))
  334. session.Send(nil, server.name, RPL_YOURHOST, nick, fmt.Sprintf("Your host is %[1]s, running version %[2]s", server.name, "ergo"))
  335. session.Send(nil, server.name, RPL_CREATED, nick, fmt.Sprintf("This server was created %s", time.Time{}.Format(time.RFC1123)))
  336. session.Send(nil, server.name, RPL_MYINFO, nick, server.name, "ergo", "o", "o", "o")
  337. session.Send(nil, server.name, RPL_ISUPPORT, nick, "CASEMAPPING=ascii", "are supported by this server")
  338. session.Send(nil, server.name, ERR_NOMOTD, nick, "MOTD is unavailable")
  339. for _, line := range server.Config().Server.STS.bannerLines {
  340. session.Send(nil, server.name, "NOTICE", nick, line)
  341. }
  342. }
  343. func (server *Server) playRegistrationBurst(session *Session) {
  344. c := session.client
  345. // continue registration
  346. d := c.Details()
  347. server.logger.Info("connect", fmt.Sprintf("Client connected [%s] [u:%s] [r:%s]", d.nick, d.username, d.realname))
  348. server.snomasks.Send(sno.LocalConnects, fmt.Sprintf("Client connected [%s] [u:%s] [h:%s] [ip:%s] [r:%s]", d.nick, d.username, session.rawHostname, session.IP().String(), d.realname))
  349. if d.account != "" {
  350. server.sendLoginSnomask(d.nickMask, d.accountName)
  351. }
  352. // send welcome text
  353. //NOTE(dan): we specifically use the NICK here instead of the nickmask
  354. // see http://modern.ircdocs.horse/#rplwelcome-001 for details on why we avoid using the nickmask
  355. config := server.Config()
  356. session.Send(nil, server.name, RPL_WELCOME, d.nick, fmt.Sprintf(c.t("Welcome to the %s IRC Network %s"), config.Network.Name, d.nick))
  357. session.Send(nil, server.name, RPL_YOURHOST, d.nick, fmt.Sprintf(c.t("Your host is %[1]s, running version %[2]s"), server.name, Ver))
  358. session.Send(nil, server.name, RPL_CREATED, d.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123)))
  359. session.Send(nil, server.name, RPL_MYINFO, d.nick, server.name, Ver, rplMyInfo1, rplMyInfo2, rplMyInfo3)
  360. rb := NewResponseBuffer(session)
  361. server.RplISupport(c, rb)
  362. server.Lusers(c, rb)
  363. server.MOTD(c, rb)
  364. rb.Send(true)
  365. modestring := c.ModeString()
  366. if modestring != "+" {
  367. session.Send(nil, server.name, RPL_UMODEIS, d.nick, modestring)
  368. }
  369. c.attemptAutoOper(session)
  370. if server.logger.IsLoggingRawIO() {
  371. session.Send(nil, c.server.name, "NOTICE", d.nick, c.t("This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
  372. }
  373. }
  374. // RplISupport outputs our ISUPPORT lines to the client. This is used on connection and in VERSION responses.
  375. func (server *Server) RplISupport(client *Client, rb *ResponseBuffer) {
  376. translatedISupport := client.t("are supported by this server")
  377. nick := client.Nick()
  378. config := server.Config()
  379. for _, cachedTokenLine := range config.Server.isupport.CachedReply {
  380. length := len(cachedTokenLine) + 2
  381. tokenline := make([]string, length)
  382. tokenline[0] = nick
  383. copy(tokenline[1:], cachedTokenLine)
  384. tokenline[length-1] = translatedISupport
  385. rb.Add(nil, server.name, RPL_ISUPPORT, tokenline...)
  386. }
  387. }
  388. func (server *Server) Lusers(client *Client, rb *ResponseBuffer) {
  389. nick := client.Nick()
  390. config := server.Config()
  391. var stats StatsValues
  392. var numChannels int
  393. if !config.Server.SuppressLusers || client.HasRoleCapabs("ban") {
  394. stats = server.stats.GetValues()
  395. numChannels = server.channels.Len()
  396. }
  397. rb.Add(nil, server.name, RPL_LUSERCLIENT, nick, fmt.Sprintf(client.t("There are %[1]d users and %[2]d invisible on %[3]d server(s)"), stats.Total-stats.Invisible, stats.Invisible, 1))
  398. rb.Add(nil, server.name, RPL_LUSEROP, nick, strconv.Itoa(stats.Operators), client.t("IRC Operators online"))
  399. rb.Add(nil, server.name, RPL_LUSERUNKNOWN, nick, strconv.Itoa(stats.Unknown), client.t("unregistered connections"))
  400. rb.Add(nil, server.name, RPL_LUSERCHANNELS, nick, strconv.Itoa(numChannels), client.t("channels formed"))
  401. rb.Add(nil, server.name, RPL_LUSERME, nick, fmt.Sprintf(client.t("I have %[1]d clients and %[2]d servers"), stats.Total, 0))
  402. total := strconv.Itoa(stats.Total)
  403. max := strconv.Itoa(stats.Max)
  404. rb.Add(nil, server.name, RPL_LOCALUSERS, nick, total, max, fmt.Sprintf(client.t("Current local users %[1]s, max %[2]s"), total, max))
  405. rb.Add(nil, server.name, RPL_GLOBALUSERS, nick, total, max, fmt.Sprintf(client.t("Current global users %[1]s, max %[2]s"), total, max))
  406. }
  407. // MOTD serves the Message of the Day.
  408. func (server *Server) MOTD(client *Client, rb *ResponseBuffer) {
  409. motdLines := server.Config().Server.motdLines
  410. if len(motdLines) < 1 {
  411. rb.Add(nil, server.name, ERR_NOMOTD, client.nick, client.t("MOTD File is missing"))
  412. return
  413. }
  414. rb.Add(nil, server.name, RPL_MOTDSTART, client.nick, fmt.Sprintf(client.t("- %s Message of the day - "), server.name))
  415. for _, line := range motdLines {
  416. rb.Add(nil, server.name, RPL_MOTD, client.nick, line)
  417. }
  418. rb.Add(nil, server.name, RPL_ENDOFMOTD, client.nick, client.t("End of MOTD command"))
  419. }
  420. func (client *Client) whoisChannelsNames(target *Client, multiPrefix bool, hasPrivs bool) []string {
  421. var chstrs []string
  422. targetInvis := target.HasMode(modes.Invisible)
  423. for _, channel := range target.Channels() {
  424. if !hasPrivs && (targetInvis || channel.flags.HasMode(modes.Secret)) && !channel.hasClient(client) {
  425. // client can't see *this* channel membership
  426. continue
  427. }
  428. chstrs = append(chstrs, channel.ClientPrefixes(target, multiPrefix)+channel.name)
  429. }
  430. return chstrs
  431. }
  432. func (client *Client) getWhoisOf(target *Client, hasPrivs bool, rb *ResponseBuffer) {
  433. oper := client.Oper()
  434. cnick := client.Nick()
  435. targetInfo := target.Details()
  436. rb.Add(nil, client.server.name, RPL_WHOISUSER, cnick, targetInfo.nick, targetInfo.username, targetInfo.hostname, "*", targetInfo.realname)
  437. tnick := targetInfo.nick
  438. whoischannels := client.whoisChannelsNames(target, rb.session.capabilities.Has(caps.MultiPrefix), oper.HasRoleCapab("sajoin"))
  439. if whoischannels != nil {
  440. rb.Add(nil, client.server.name, RPL_WHOISCHANNELS, cnick, tnick, strings.Join(whoischannels, " "))
  441. }
  442. if target.HasMode(modes.Operator) && operStatusVisible(client, target, oper != nil) {
  443. tOper := target.Oper()
  444. if tOper != nil {
  445. rb.Add(nil, client.server.name, RPL_WHOISOPERATOR, cnick, tnick, tOper.WhoisLine)
  446. }
  447. }
  448. if client == target || oper.HasRoleCapab("ban") {
  449. ip, hostname := target.getWhoisActually()
  450. rb.Add(nil, client.server.name, RPL_WHOISACTUALLY, cnick, tnick, fmt.Sprintf("%s@%s", targetInfo.username, hostname), utils.IPStringToHostname(ip.String()), client.t("Actual user@host, Actual IP"))
  451. }
  452. if client == target || oper.HasRoleCapab("samode") {
  453. rb.Add(nil, client.server.name, RPL_WHOISMODES, cnick, tnick, fmt.Sprintf(client.t("is using modes +%s"), target.modes.String()))
  454. }
  455. if target.HasMode(modes.TLS) {
  456. rb.Add(nil, client.server.name, RPL_WHOISSECURE, cnick, tnick, client.t("is using a secure connection"))
  457. }
  458. if targetInfo.accountName != "*" {
  459. rb.Add(nil, client.server.name, RPL_WHOISACCOUNT, cnick, tnick, targetInfo.accountName, client.t("is logged in as"))
  460. }
  461. if target.HasMode(modes.Bot) {
  462. rb.Add(nil, client.server.name, RPL_WHOISBOT, cnick, tnick, fmt.Sprintf(ircfmt.Unescape(client.t("is a $bBot$b on %s")), client.server.Config().Network.Name))
  463. }
  464. if client == target || oper.HasRoleCapab("ban") {
  465. for _, session := range target.Sessions() {
  466. if session.certfp != "" {
  467. rb.Add(nil, client.server.name, RPL_WHOISCERTFP, cnick, tnick, fmt.Sprintf(client.t("has client certificate fingerprint %s"), session.certfp))
  468. }
  469. }
  470. }
  471. rb.Add(nil, client.server.name, RPL_WHOISIDLE, cnick, tnick, strconv.FormatUint(target.IdleSeconds(), 10), strconv.FormatInt(target.SignonTime(), 10), client.t("seconds idle, signon time"))
  472. if away, awayMessage := target.Away(); away {
  473. rb.Add(nil, client.server.name, RPL_AWAY, cnick, tnick, awayMessage)
  474. }
  475. }
  476. // rehash reloads the config and applies the changes from the config file.
  477. func (server *Server) rehash() error {
  478. // #1570; this needs its own panic handling because it can be invoked via SIGHUP
  479. defer server.HandlePanic()
  480. server.logger.Info("server", "Attempting rehash")
  481. // only let one REHASH go on at a time
  482. server.rehashMutex.Lock()
  483. defer server.rehashMutex.Unlock()
  484. sdnotify.Reloading()
  485. defer sdnotify.Ready()
  486. config, err := LoadConfig(server.configFilename)
  487. if err != nil {
  488. server.logger.Error("server", "failed to load config file", err.Error())
  489. return err
  490. }
  491. err = server.applyConfig(config)
  492. if err != nil {
  493. server.logger.Error("server", "Failed to rehash", err.Error())
  494. return err
  495. }
  496. server.logger.Info("server", "Rehash completed successfully")
  497. return nil
  498. }
  499. func (server *Server) applyConfig(config *Config) (err error) {
  500. oldConfig := server.Config()
  501. initial := oldConfig == nil
  502. if initial {
  503. server.configFilename = config.Filename
  504. server.name = config.Server.Name
  505. server.nameCasefolded = config.Server.nameCasefolded
  506. globalCasemappingSetting = config.Server.Casemapping
  507. globalUtf8EnforcementSetting = config.Server.EnforceUtf8
  508. MaxLineLen = config.Server.MaxLineLen
  509. } else {
  510. // enforce configs that can't be changed after launch:
  511. if server.name != config.Server.Name {
  512. return fmt.Errorf("Server name cannot be changed after launching the server, rehash aborted")
  513. } else if oldConfig.Datastore.Path != config.Datastore.Path {
  514. return fmt.Errorf("Datastore path cannot be changed after launching the server, rehash aborted")
  515. } else if globalCasemappingSetting != config.Server.Casemapping {
  516. return fmt.Errorf("Casemapping cannot be changed after launching the server, rehash aborted")
  517. } else if globalUtf8EnforcementSetting != config.Server.EnforceUtf8 {
  518. return fmt.Errorf("UTF-8 enforcement cannot be changed after launching the server, rehash aborted")
  519. } else if oldConfig.Accounts.Multiclient.AlwaysOn != config.Accounts.Multiclient.AlwaysOn {
  520. return fmt.Errorf("Default always-on setting cannot be changed after launching the server, rehash aborted")
  521. } else if oldConfig.Server.Relaymsg.Enabled != config.Server.Relaymsg.Enabled {
  522. return fmt.Errorf("Cannot enable or disable relaying after launching the server, rehash aborted")
  523. } else if oldConfig.Server.Relaymsg.Separators != config.Server.Relaymsg.Separators {
  524. return fmt.Errorf("Cannot change relaying separators after launching the server, rehash aborted")
  525. } else if oldConfig.Server.IPCheckScript.MaxConcurrency != config.Server.IPCheckScript.MaxConcurrency ||
  526. oldConfig.Accounts.AuthScript.MaxConcurrency != config.Accounts.AuthScript.MaxConcurrency {
  527. return fmt.Errorf("Cannot change max-concurrency for scripts after launching the server, rehash aborted")
  528. } else if oldConfig.Server.OverrideServicesHostname != config.Server.OverrideServicesHostname {
  529. return fmt.Errorf("Cannot change override-services-hostname after launching the server, rehash aborted")
  530. } else if !oldConfig.Datastore.MySQL.Enabled && config.Datastore.MySQL.Enabled {
  531. return fmt.Errorf("Cannot enable MySQL after launching the server, rehash aborted")
  532. } else if oldConfig.Server.MaxLineLen != config.Server.MaxLineLen {
  533. return fmt.Errorf("Cannot change max-line-len after launching the server, rehash aborted")
  534. }
  535. }
  536. server.logger.Info("server", "Using config file", server.configFilename)
  537. if initial {
  538. if config.LockFile != "" {
  539. server.flock, err = flock.TryAcquireFlock(config.LockFile)
  540. if err != nil {
  541. return fmt.Errorf("failed to acquire flock on %s: %w",
  542. config.LockFile, err)
  543. }
  544. }
  545. // the lock is never released until quit; we need to save a pointer
  546. // to the (*flock.Flock) object so it doesn't get GC'ed, which would
  547. // close the file and surrender the lock
  548. }
  549. // first, reload config sections for functionality implemented in subpackages:
  550. wasLoggingRawIO := !initial && server.logger.IsLoggingRawIO()
  551. err = server.logger.ApplyConfig(config.Logging)
  552. if err != nil {
  553. return err
  554. }
  555. nowLoggingRawIO := server.logger.IsLoggingRawIO()
  556. // notify existing clients if raw i/o logging was enabled by a rehash
  557. sendRawOutputNotice := !wasLoggingRawIO && nowLoggingRawIO
  558. server.connectionLimiter.ApplyConfig(&config.Server.IPLimits)
  559. tlConf := &config.Server.TorListeners
  560. server.torLimiter.Configure(tlConf.MaxConnections, tlConf.ThrottleDuration, tlConf.MaxConnectionsPerDuration)
  561. // Translations
  562. server.logger.Debug("server", "Regenerating HELP indexes for new languages")
  563. server.helpIndexManager.GenerateIndices(config.languageManager)
  564. if initial {
  565. maxIPConc := int(config.Server.IPCheckScript.MaxConcurrency)
  566. if maxIPConc != 0 {
  567. server.semaphores.IPCheckScript = utils.NewSemaphore(maxIPConc)
  568. }
  569. maxAuthConc := int(config.Accounts.AuthScript.MaxConcurrency)
  570. if maxAuthConc != 0 {
  571. server.semaphores.AuthScript = utils.NewSemaphore(maxAuthConc)
  572. }
  573. if err := overrideServicePrefixes(config.Server.OverrideServicesHostname); err != nil {
  574. return err
  575. }
  576. }
  577. if oldConfig != nil {
  578. // if certain features were enabled by rehash, we need to load the corresponding data
  579. // from the store
  580. if !oldConfig.Accounts.NickReservation.Enabled {
  581. server.accounts.buildNickToAccountIndex(config)
  582. }
  583. if !oldConfig.Channels.Registration.Enabled {
  584. server.channels.loadRegisteredChannels(config)
  585. }
  586. // resize history buffers as needed
  587. if config.historyChangedFrom(oldConfig) {
  588. for _, channel := range server.channels.Channels() {
  589. channel.resizeHistory(config)
  590. }
  591. for _, client := range server.clients.AllClients() {
  592. client.resizeHistory(config)
  593. }
  594. }
  595. if oldConfig.Accounts.Registration.Throttling != config.Accounts.Registration.Throttling {
  596. server.accounts.resetRegisterThrottle(config)
  597. }
  598. }
  599. server.logger.Info("server", "Using datastore", config.Datastore.Path)
  600. if initial {
  601. if err := server.loadDatastore(config); err != nil {
  602. return err
  603. }
  604. } else {
  605. if config.Datastore.MySQL.Enabled && config.Datastore.MySQL != oldConfig.Datastore.MySQL {
  606. server.historyDB.SetConfig(config.Datastore.MySQL)
  607. }
  608. }
  609. // now that the datastore is initialized, we can load the cloak secret from it
  610. // XXX this modifies config after the initial load, which is naughty,
  611. // but there's no data race because we haven't done SetConfig yet
  612. config.Server.Cloaks.SetSecret(LoadCloakSecret(server.store))
  613. // activate the new config
  614. server.SetConfig(config)
  615. // load [dk]-lines, registered users and channels, etc.
  616. if initial {
  617. if err := server.loadFromDatastore(config); err != nil {
  618. return err
  619. }
  620. }
  621. // burst new and removed caps
  622. addedCaps, removedCaps := config.Diff(oldConfig)
  623. var capBurstSessions []*Session
  624. added := make(map[caps.Version][]string)
  625. var removed []string
  626. if !addedCaps.Empty() || !removedCaps.Empty() {
  627. capBurstSessions = server.clients.AllWithCapsNotify()
  628. added[caps.Cap301] = addedCaps.Strings(caps.Cap301, config.Server.capValues, 0)
  629. added[caps.Cap302] = addedCaps.Strings(caps.Cap302, config.Server.capValues, 0)
  630. // removed never has values, so we leave it as Cap301
  631. removed = removedCaps.Strings(caps.Cap301, config.Server.capValues, 0)
  632. }
  633. for _, sSession := range capBurstSessions {
  634. // DEL caps and then send NEW ones so that updated caps get removed/added correctly
  635. if !removedCaps.Empty() {
  636. for _, capStr := range removed {
  637. sSession.Send(nil, server.name, "CAP", sSession.client.Nick(), "DEL", capStr)
  638. }
  639. }
  640. if !addedCaps.Empty() {
  641. for _, capStr := range added[sSession.capVersion] {
  642. sSession.Send(nil, server.name, "CAP", sSession.client.Nick(), "NEW", capStr)
  643. }
  644. }
  645. }
  646. server.setupPprofListener(config)
  647. // set RPL_ISUPPORT
  648. var newISupportReplies [][]string
  649. if oldConfig != nil {
  650. newISupportReplies = oldConfig.Server.isupport.GetDifference(&config.Server.isupport)
  651. }
  652. if len(config.Server.ProxyAllowedFrom) != 0 {
  653. server.logger.Info("server", "Proxied IPs will be accepted from", strings.Join(config.Server.ProxyAllowedFrom, ", "))
  654. }
  655. // we are now ready to receive connections:
  656. err = server.setupListeners(config)
  657. if initial && err == nil {
  658. server.logger.Info("server", "Server running")
  659. sdnotify.Ready()
  660. }
  661. if !initial {
  662. // push new info to all of our clients
  663. for _, sClient := range server.clients.AllClients() {
  664. for _, tokenline := range newISupportReplies {
  665. sClient.Send(nil, server.name, RPL_ISUPPORT, append([]string{sClient.nick}, tokenline...)...)
  666. }
  667. if sendRawOutputNotice {
  668. sClient.Notice(sClient.t("This server is in debug mode and is logging all user I/O. If you do not wish for everything you send to be readable by the server owner(s), please disconnect."))
  669. }
  670. }
  671. }
  672. // send other config warnings
  673. if config.Accounts.RequireSasl.Enabled && config.Accounts.Registration.Enabled {
  674. server.logger.Warning("server", "Warning: although require-sasl is enabled, users can still register accounts. If your server is not intended to be public, you must set accounts.registration.enabled to false.")
  675. }
  676. return err
  677. }
  678. func (server *Server) setupPprofListener(config *Config) {
  679. pprofListener := config.Debug.PprofListener
  680. if server.pprofServer != nil {
  681. if pprofListener == "" || (pprofListener != server.pprofServer.Addr) {
  682. server.logger.Info("server", "Stopping pprof listener", server.pprofServer.Addr)
  683. server.pprofServer.Close()
  684. server.pprofServer = nil
  685. }
  686. }
  687. if pprofListener != "" && server.pprofServer == nil {
  688. ps := http.Server{
  689. Addr: pprofListener,
  690. }
  691. go func() {
  692. if err := ps.ListenAndServe(); err != nil {
  693. server.logger.Error("server", "pprof listener failed", err.Error())
  694. }
  695. }()
  696. server.pprofServer = &ps
  697. server.logger.Info("server", "Started pprof listener", server.pprofServer.Addr)
  698. }
  699. }
  700. func (server *Server) loadDatastore(config *Config) error {
  701. // open the datastore and load server state for which it (rather than config)
  702. // is the source of truth
  703. _, err := os.Stat(config.Datastore.Path)
  704. if os.IsNotExist(err) {
  705. server.logger.Warning("server", "database does not exist, creating it", config.Datastore.Path)
  706. err = initializeDB(config.Datastore.Path)
  707. if err != nil {
  708. return err
  709. }
  710. }
  711. db, err := OpenDatabase(config)
  712. if err == nil {
  713. server.store = db
  714. return nil
  715. } else {
  716. return fmt.Errorf("Failed to open datastore: %s", err.Error())
  717. }
  718. }
  719. func (server *Server) loadFromDatastore(config *Config) (err error) {
  720. // load *lines (from the datastores)
  721. server.logger.Debug("server", "Loading D/Klines")
  722. server.loadDLines()
  723. server.loadKLines()
  724. server.channelRegistry.Initialize(server)
  725. server.channels.Initialize(server)
  726. server.accounts.Initialize(server)
  727. if config.Datastore.MySQL.Enabled {
  728. server.historyDB.Initialize(server.logger, config.Datastore.MySQL)
  729. err = server.historyDB.Open()
  730. if err != nil {
  731. server.logger.Error("internal", "could not connect to mysql", err.Error())
  732. return err
  733. }
  734. }
  735. return nil
  736. }
  737. func (server *Server) setupListeners(config *Config) (err error) {
  738. logListener := func(addr string, config utils.ListenerConfig) {
  739. server.logger.Info("listeners",
  740. fmt.Sprintf("now listening on %s, tls=%t, proxy=%t, tor=%t, websocket=%t.", addr, (config.TLSConfig != nil), config.RequireProxy, config.Tor, config.WebSocket),
  741. )
  742. }
  743. // update or destroy all existing listeners
  744. for addr := range server.listeners {
  745. currentListener := server.listeners[addr]
  746. newConfig, stillConfigured := config.Server.trueListeners[addr]
  747. if stillConfigured {
  748. if reloadErr := currentListener.Reload(newConfig); reloadErr == nil {
  749. logListener(addr, newConfig)
  750. } else {
  751. // stop the listener; we will attempt to replace it below
  752. currentListener.Stop()
  753. delete(server.listeners, addr)
  754. }
  755. } else {
  756. currentListener.Stop()
  757. delete(server.listeners, addr)
  758. server.logger.Info("listeners", fmt.Sprintf("stopped listening on %s.", addr))
  759. }
  760. }
  761. publicPlaintextListener := ""
  762. // create new listeners that were not previously configured,
  763. // or that couldn't be reloaded above:
  764. for newAddr, newConfig := range config.Server.trueListeners {
  765. if strings.HasPrefix(newAddr, ":") && !newConfig.Tor && !newConfig.STSOnly && newConfig.TLSConfig == nil {
  766. publicPlaintextListener = newAddr
  767. }
  768. _, exists := server.listeners[newAddr]
  769. if !exists {
  770. // make a new listener
  771. newListener, newErr := NewListener(server, newAddr, newConfig, config.Server.UnixBindMode)
  772. if newErr == nil {
  773. server.listeners[newAddr] = newListener
  774. logListener(newAddr, newConfig)
  775. } else {
  776. server.logger.Error("server", "couldn't listen on", newAddr, newErr.Error())
  777. err = newErr
  778. }
  779. }
  780. }
  781. if publicPlaintextListener != "" {
  782. server.logger.Warning("listeners", fmt.Sprintf("Warning: your server is configured with public plaintext listener %s. Consider disabling it for improved security and privacy.", publicPlaintextListener))
  783. }
  784. return
  785. }
  786. // Gets the abstract sequence from which we're going to query history;
  787. // we may already know the channel we're querying, or we may have
  788. // to look it up via a string query. This function is responsible for
  789. // privilege checking.
  790. // XXX: call this with providedChannel==nil and query=="" to get a sequence
  791. // suitable for ListCorrespondents (i.e., this function is still used to
  792. // decide whether the ringbuf or mysql is authoritative about the client's
  793. // message history).
  794. func (server *Server) GetHistorySequence(providedChannel *Channel, client *Client, query string) (channel *Channel, sequence history.Sequence, err error) {
  795. config := server.Config()
  796. // 4 cases: {persistent, ephemeral} x {normal, conversation}
  797. // with ephemeral history, target is implicit in the choice of `hist`,
  798. // and correspondent is "" if we're retrieving a channel or *, and the correspondent's name
  799. // if we're retrieving a DM conversation ("query buffer"). with persistent history,
  800. // target is always nonempty, and correspondent is either empty or nonempty as before.
  801. var status HistoryStatus
  802. var target, correspondent string
  803. var hist *history.Buffer
  804. restriction := HistoryCutoffNone
  805. channel = providedChannel
  806. if channel == nil {
  807. if strings.HasPrefix(query, "#") {
  808. channel = server.channels.Get(query)
  809. if channel == nil {
  810. return
  811. }
  812. }
  813. }
  814. var joinTimeCutoff time.Time
  815. if channel != nil {
  816. if present, cutoff := channel.joinTimeCutoff(client); present {
  817. joinTimeCutoff = cutoff
  818. } else {
  819. err = errInsufficientPrivs
  820. return
  821. }
  822. status, target, restriction = channel.historyStatus(config)
  823. switch status {
  824. case HistoryEphemeral:
  825. hist = &channel.history
  826. case HistoryPersistent:
  827. // already set `target`
  828. default:
  829. return
  830. }
  831. } else {
  832. status, target = client.historyStatus(config)
  833. if query != "" {
  834. correspondent, err = CasefoldName(query)
  835. if err != nil {
  836. return
  837. }
  838. }
  839. switch status {
  840. case HistoryEphemeral:
  841. hist = &client.history
  842. case HistoryPersistent:
  843. // already set `target`, and `correspondent` if necessary
  844. default:
  845. return
  846. }
  847. }
  848. var cutoff time.Time
  849. if config.History.Restrictions.ExpireTime != 0 {
  850. cutoff = time.Now().UTC().Add(-time.Duration(config.History.Restrictions.ExpireTime))
  851. }
  852. // #836: registration date cutoff is always enforced for DMs
  853. // either way, take the later of the two cutoffs
  854. if restriction == HistoryCutoffRegistrationTime || channel == nil {
  855. regCutoff := client.historyCutoff()
  856. if regCutoff.After(cutoff) {
  857. cutoff = regCutoff
  858. }
  859. } else if restriction == HistoryCutoffJoinTime {
  860. if joinTimeCutoff.After(cutoff) {
  861. cutoff = joinTimeCutoff
  862. }
  863. }
  864. // #836 again: grace period is never applied to DMs
  865. if !cutoff.IsZero() && channel != nil && restriction != HistoryCutoffJoinTime {
  866. cutoff = cutoff.Add(-time.Duration(config.History.Restrictions.GracePeriod))
  867. }
  868. if hist != nil {
  869. sequence = hist.MakeSequence(correspondent, cutoff)
  870. } else if target != "" {
  871. sequence = server.historyDB.MakeSequence(target, correspondent, cutoff)
  872. }
  873. return
  874. }
  875. func (server *Server) ForgetHistory(accountName string) {
  876. // sanity check
  877. if accountName == "*" {
  878. return
  879. }
  880. config := server.Config()
  881. if !config.History.Enabled {
  882. return
  883. }
  884. if cfAccount, err := CasefoldName(accountName); err == nil {
  885. server.historyDB.Forget(cfAccount)
  886. }
  887. persistent := config.History.Persistent
  888. if persistent.Enabled && persistent.UnregisteredChannels && persistent.RegisteredChannels == PersistentMandatory && persistent.DirectMessages == PersistentMandatory {
  889. return
  890. }
  891. predicate := func(item *history.Item) bool { return item.AccountName == accountName }
  892. for _, channel := range server.channels.Channels() {
  893. channel.history.Delete(predicate)
  894. }
  895. for _, client := range server.clients.AllClients() {
  896. client.history.Delete(predicate)
  897. }
  898. }
  899. // deletes a message. target is a hint about what buffer it's in (not required for
  900. // persistent history, where all the msgids are indexed together). if accountName
  901. // is anything other than "*", it must match the recorded AccountName of the message
  902. func (server *Server) DeleteMessage(target, msgid, accountName string) (err error) {
  903. config := server.Config()
  904. var hist *history.Buffer
  905. if target != "" {
  906. if target[0] == '#' {
  907. channel := server.channels.Get(target)
  908. if channel != nil {
  909. if status, _, _ := channel.historyStatus(config); status == HistoryEphemeral {
  910. hist = &channel.history
  911. }
  912. }
  913. } else {
  914. client := server.clients.Get(target)
  915. if client != nil {
  916. if status, _ := client.historyStatus(config); status == HistoryEphemeral {
  917. hist = &client.history
  918. }
  919. }
  920. }
  921. }
  922. if hist == nil {
  923. err = server.historyDB.DeleteMsgid(msgid, accountName)
  924. } else {
  925. count := hist.Delete(func(item *history.Item) bool {
  926. return item.Message.Msgid == msgid && (accountName == "*" || item.AccountName == accountName)
  927. })
  928. if count == 0 {
  929. err = errNoop
  930. }
  931. }
  932. return
  933. }
  934. func (server *Server) UnfoldName(cfname string) (name string) {
  935. if strings.HasPrefix(cfname, "#") {
  936. return server.channels.UnfoldName(cfname)
  937. }
  938. return server.clients.UnfoldNick(cfname)
  939. }
  940. // elistMatcher takes and matches ELIST conditions
  941. type elistMatcher struct {
  942. MinClientsActive bool
  943. MinClients int
  944. MaxClientsActive bool
  945. MaxClients int
  946. }
  947. // Matches checks whether the given channel matches our matches.
  948. func (matcher *elistMatcher) Matches(channel *Channel) bool {
  949. if matcher.MinClientsActive {
  950. if len(channel.Members()) < matcher.MinClients {
  951. return false
  952. }
  953. }
  954. if matcher.MaxClientsActive {
  955. if len(channel.Members()) < len(channel.members) {
  956. return false
  957. }
  958. }
  959. return true
  960. }
  961. var (
  962. infoString1 = strings.Split(`
  963. __ __ ______ ___ ______ ___
  964. __/ // /_/ ____/ __ \/ ____/ __ \
  965. /_ // __/ __/ / /_/ / / __/ / / /
  966. /_ // __/ /___/ _, _/ /_/ / /_/ /
  967. /_//_/ /_____/_/ |_|\____/\____/
  968. https://ergo.chat/
  969. https://github.com/ergochat/ergo
  970. `, "\n")[1:] // XXX: cut off initial blank line
  971. infoString2 = strings.Split(` Daniel Oakley, DanielOaks, <daniel@danieloaks.net>
  972. Shivaram Lingamneni, slingamn, <slingamn@cs.stanford.edu>
  973. `, "\n")
  974. infoString3 = strings.Split(` Jeremy Latt, jlatt
  975. Edmund Huber, edmund-huber
  976. `, "\n")
  977. )