Pārlūkot izejas kodu

Merge pull request #370 from slingamn/identify

four small changes
tags/v1.0.0-rc1
Daniel Oaks 5 gadus atpakaļ
vecāks
revīzija
d804dddda5
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
6 mainītis faili ar 39 papildinājumiem un 14 dzēšanām
  1. 1
    1
      README.md
  2. 9
    2
      docs/MANUAL.md
  3. 6
    1
      irc/accounts.go
  4. 8
    6
      irc/handlers.go
  5. 13
    3
      irc/nickserv.go
  6. 2
    1
      oragono.yaml

+ 1
- 1
README.md Parādīt failu

@@ -94,7 +94,7 @@ You can use the `--conf` parameter when launching Oragono to control where it lo
94 94
 
95 95
 ### Logs
96 96
 
97
-By default, logs are stored in the file `ircd.log`. The configuration format of logs is designed to be easily pluggable, and is inspired by the logging config provided by InspIRCd.
97
+By default, logs go to stderr only. They can be configured to go to a file, or you can use systemd to direct the stderr to the system journal (see the manual for details). The configuration format of logs is designed to be easily pluggable, and is inspired by the logging config provided by InspIRCd.
98 98
 
99 99
 ### Passwords
100 100
 

+ 9
- 2
docs/MANUAL.md Parādīt failu

@@ -103,9 +103,16 @@ To get started with Oragono on macOS, Linux, or on a Raspberry Pi:
103 103
 
104 104
 To start the server, type `./oragono run` and hit enter, and the server should be ready to use!
105 105
 
106
-If you're using Arch Linux, you can also install the [`oragono` package](https://aur.archlinux.org/packages/oragono/) from the AUR. This lets you bypass the above process and bundles a systemd service file for easily starting the server.
106
+If you're using Arch Linux, you can also install the [`oragono` package](https://aur.archlinux.org/packages/oragono/) from the AUR.
107 107
 
108
-If you're rolling your own deployment, here's another [example](https://github.com/darwin-network/slash/blob/master/etc/systemd/system/ircd.service) of a systemd unit file that can be used to run Oragono as an unprivileged role user.
108
+
109
+## Running oragono as a service on Linux
110
+
111
+The recommended way to operate oragono as a service on Linux is via systemd. This provides a standard interface for starting, stopping, and rehashing (via `systemctl reload`) the service. It also captures oragono's loglines (sent to stderr in the default configuration) and writes them to the system journal.
112
+
113
+If you're using Arch, the abovementioned AUR package bundles a systemd file for starting and stopping the server. If you're rolling your own deployment, here's an [example](https://github.com/darwin-network/slash/blob/master/etc/systemd/system/ircd.service) of a systemd unit file that can be used to run Oragono as an unprivileged role user.
114
+
115
+On a non-systemd system, oragono can be configured to log to a file and used [logrotate(8)](https://linux.die.net/man/8/logrotate), since it will reopen its log files (as well as rehashing the config file) upon receiving a SIGHUP.
109 116
 
110 117
 
111 118
 --------------------------------------------------------------------------------------------

+ 6
- 1
irc/accounts.go Parādīt failu

@@ -311,7 +311,7 @@ func (am *AccountManager) Register(client *Client, account string, callbackNames
311 311
 	// as an account; this prevents "land-grab" situations where someone else
312 312
 	// registers your nick out from under you and then NS GHOSTs you
313 313
 	// n.b. client is nil during a SAREGISTER:
314
-	if config.NickReservation.Enabled && client != nil && client.Nick() != account {
314
+	if config.NickReservation.Enabled && client != nil && client.NickCasefolded() != casefoldedAccount {
315 315
 		return errAccountMustHoldNick
316 316
 	}
317 317
 
@@ -593,6 +593,11 @@ func (am *AccountManager) Verify(client *Client, account string, code string) er
593 593
 		return err
594 594
 	}
595 595
 
596
+	nick := "[server admin]"
597
+	if client != nil {
598
+		nick = client.Nick()
599
+	}
600
+	am.server.logger.Info("accounts", "client", nick, "registered account", casefoldedAccount)
596 601
 	raw.Verified = true
597 602
 	clientAccount, err := am.deserializeRawAccount(raw)
598 603
 	if err != nil {

+ 8
- 6
irc/handlers.go Parādīt failu

@@ -201,21 +201,23 @@ func sendSuccessfulRegResponse(client *Client, rb *ResponseBuffer, forNS bool) {
201 201
 
202 202
 // sendSuccessfulSaslAuth means that a SASL auth attempt completed successfully, and is used to dispatch messages.
203 203
 func sendSuccessfulSaslAuth(client *Client, rb *ResponseBuffer, forNS bool) {
204
-	account := client.AccountName()
204
+	details := client.Details()
205 205
 
206 206
 	if forNS {
207
-		rb.Notice(fmt.Sprintf(client.t("You're now logged in as %s"), client.AccountName()))
207
+		rb.Notice(fmt.Sprintf(client.t("You're now logged in as %s"), details.accountName))
208 208
 	} else {
209
-		rb.Add(nil, client.server.name, RPL_LOGGEDIN, client.nick, client.nickMaskString, account, fmt.Sprintf(client.t("You are now logged in as %s"), account))
210
-		rb.Add(nil, client.server.name, RPL_SASLSUCCESS, client.nick, client.t("Authentication successful"))
209
+		rb.Add(nil, client.server.name, RPL_LOGGEDIN, details.nick, details.nickMask, details.accountName, fmt.Sprintf(client.t("You are now logged in as %s"), details.accountName))
210
+		rb.Add(nil, client.server.name, RPL_SASLSUCCESS, details.nick, client.t("Authentication successful"))
211 211
 	}
212 212
 
213 213
 	// dispatch account-notify
214 214
 	for friend := range client.Friends(caps.AccountNotify) {
215
-		friend.Send(nil, client.nickMaskString, "ACCOUNT", account)
215
+		friend.Send(nil, details.nickMask, "ACCOUNT", details.accountName)
216 216
 	}
217 217
 
218
-	client.server.snomasks.Send(sno.LocalAccounts, fmt.Sprintf(ircfmt.Unescape("Client $c[grey][$r%s$c[grey]] logged into account $c[grey][$r%s$c[grey]]"), client.nickMaskString, account))
218
+	client.server.snomasks.Send(sno.LocalAccounts, fmt.Sprintf(ircfmt.Unescape("Client $c[grey][$r%s$c[grey]] logged into account $c[grey][$r%s$c[grey]]"), details.nickMask, details.accountName))
219
+
220
+	client.server.logger.Info("accounts", "client", details.nick, "logged into account", details.accountName)
219 221
 }
220 222
 
221 223
 // ACC VERIFY <accountname> <auth_code>

+ 13
- 3
irc/nickserv.go Parādīt failu

@@ -256,9 +256,18 @@ func nsIdentifyHandler(server *Server, client *Client, command string, params []
256 256
 
257 257
 	loginSuccessful := false
258 258
 
259
-	username := params[0]
260
-	var passphrase string
261
-	if len(params) > 1 {
259
+	var username, passphrase string
260
+	if len(params) == 1 {
261
+		if client.certfp != "" {
262
+			username = params[0]
263
+		} else {
264
+			// XXX undocumented compatibility mode with other nickservs, allowing
265
+			// /msg NickServ identify passphrase
266
+			username = client.NickCasefolded()
267
+			passphrase = params[0]
268
+		}
269
+	} else {
270
+		username = params[0]
262 271
 		passphrase = params[1]
263 272
 	}
264 273
 
@@ -454,6 +463,7 @@ func nsUnregisterHandler(server *Server, client *Client, command string, params
454 463
 		nsNotice(rb, client.t("Error while unregistering account"))
455 464
 	} else {
456 465
 		nsNotice(rb, fmt.Sprintf(client.t("Successfully unregistered account %s"), cfname))
466
+		server.logger.Info("accounts", "client", client.Nick(), "unregistered account", cfname)
457 467
 	}
458 468
 }
459 469
 

+ 2
- 1
oragono.yaml Parādīt failu

@@ -372,7 +372,8 @@ logging:
372 372
         #   channels        channel creation and operations
373 373
         #   commands        command calling and operations
374 374
         #   opers           oper actions, authentication, etc
375
-        #   password        password hashing and comparing
375
+        #   services        actions related to NickServ, ChanServ, etc.
376
+        #   internal        unexpected runtime behavior, including potential bugs
376 377
         #   userinput       raw lines sent by users
377 378
         #   useroutput      raw lines sent to users
378 379
         type: "* -userinput -useroutput"

Notiek ielāde…
Atcelt
Saglabāt