Changeset 823 in code
- Timestamp:
- Sep 15, 2023, 4:20:11 AM (21 months ago)
- Location:
- trunk
- Files:
-
- 8 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.gitignore
r817 r823 1 1 /suika 2 /suika ctl2 /suikadb 3 3 /suika-znc-import 4 4 /suika.db -
trunk/Makefile
r822 r823 17 17 GOOS ?= linux 18 18 19 all: suika suika ctlsuika-znc-import19 all: suika suikadb suika-znc-import 20 20 21 21 suika: 22 22 $(GO) build $(GOFLAGS) ./cmd/suika 23 strip -s suika24 suika ctl:25 $(GO) build $(GOFLAGS) ./cmd/suika ctl26 strip -s suikactl23 @strip -s suika 24 suikadb: 25 $(GO) build $(GOFLAGS) ./cmd/suikadb 26 @strip -s suikadb 27 27 suika-znc-import: 28 28 $(GO) build $(GOFLAGS) ./cmd/suika-znc-import 29 strip -s suika-znc-import29 @strip -s suika-znc-import 30 30 clean: 31 $(RM) -f suika suikactl suika-znc-import 31 $(RM) -f suika suikadb suikactl suika-znc-import 32 docs: 33 asciidoctor -b manpage doc/suika.adoc -o doc/suika.1 34 asciidoctor -b manpage doc/suikadb.adoc -o doc/suikadb.1 35 asciidoctor -b manpage doc/suika-config.adoc -o doc/suika-config.5 36 asciidoctor -b manpage doc/suika-bouncerserv.adoc -o doc/suika-bouncerserv.7 32 37 install: 33 38 $(MKDIR) -p $(DESTDIR)$(PREFIX)/$(BINDIR) … … 37 42 $(MKDIR) -p $(DESTDIR)${SYSCONFDIR}/suika 38 43 $(MKDIR) -p $(DESTDIR)/var/lib/suika 39 $(CP) -f suika suika ctlsuika-znc-import $(DESTDIR)$(PREFIX)/$(BINDIR)44 $(CP) -f suika suikadb suika-znc-import $(DESTDIR)$(PREFIX)/$(BINDIR) 40 45 $(CP) -f doc/suika.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1 46 $(CP) -f doc/suikadb.1 $(DESTDIR)$(PREFIX)/$(MANDIR)/man1 47 $(CP) -f doc/suika-znc-import.1 $(DESTDIR)/$(MANDIR)/man1 41 48 $(CP) -f doc/suika-config.5 $(DESTDIR)$(PREFIX)/$(MANDIR)/man5 42 49 $(CP) -f doc/suika-bouncerserv.7 $(DESTDIR)$(PREFIX)/$(MANDIR)/man7 … … 44 51 test: 45 52 go test 46 .PHONY: suika suikactl suika-znc-import clean install 53 vendor: 54 go mod vendor 55 .PHONY: suika suikadb suika-znc-import clean install -
trunk/doc.go
r811 r823 2 2 // 3 3 // # Copyright (C) 2020 The soju Contributors 4 // # Copyright (C) 2023-present Aoi Koizumiet al.4 // # Copyright (C) 2023-present Izuru Yakumo et al. 5 5 // 6 6 // suika is covered by the AGPLv3 license: -
trunk/doc/suika-bouncerserv.7
r817 r823 1 .Dd $Mdocdate$ 2 .Dt SUIKA-BOUNCERSERV 7 3 .Os 4 .Sh NAME 5 .Nm suika-bouncerserv 6 .Nd Service bot exposed by suika to control the bouncer 7 .Sh DESCRIPTION 8 suika exposes an IRC service called BouncerServ to manage the bouncer. 9 Commands can be sent via regular private messages 10 (/msg BouncerServ <command> [args...]). Commands may be written in full or 11 abbreviated form, for instance network can be abbreviated as net or just 12 n. 13 .Ss COMMANDS 14 .Bl -tag -width 11n 15 .It help [command] 16 Show a list of commands. If command is specified, show a help message for 17 the command. 18 .It network create -addr <addr> [options...] 19 Connect to a new network at addr. -addr is mandatory. 20 1 '\" t 2 .\" Title: suika-bouncerserv 3 .\" Author: Simon Ser and contributors / Izuru Yakumo 4 .\" Generator: Asciidoctor 2.0.20 5 .\" Date: 2023-09-15 6 .\" Manual: Suika IRC Bouncer 7 .\" Source: SUIKA-BOUNCERSERV 8 .\" Language: English 9 .\" 10 .TH "SUIKA\-BOUNCERSERV" "7" "2023-09-15" "SUIKA\-BOUNCERSERV" "Suika IRC Bouncer" 11 .ie \n(.g .ds Aq \(aq 12 .el .ds Aq ' 13 .ss \n[.ss] 0 14 .nh 15 .ad l 16 .de URL 17 \fI\\$2\fP <\\$1>\\$3 18 .. 19 .als MTO URL 20 .if \n[.g] \{\ 21 . mso www.tmac 22 . am URL 23 . ad l 24 . . 25 . am MTO 26 . ad l 27 . . 28 . LINKSTYLE blue R < > 29 .\} 30 .SH "NAME" 31 suika-bouncerserv \- Service bot exposed by suika(1) to control the bouncer 32 .SH "DESCRIPTION" 33 .sp 34 suika(1) exposes an IRC service called BouncerServ to manage the bouncer. 35 Commands can be sent via regular private messages. 36 Commands may be written in full or abbreviated form, for instance network 37 can be abbreviated as net or just n. 38 .SH "COMMANDS" 39 .SS "help [command]" 40 .sp 41 Show a list of commands. 42 If command is specified, show a help message for the command. 43 .SS "network\-create \-addr <addr> [options...]" 44 .sp 45 Connect to a new network at addr. 46 The option \-addr is mandatory. 47 .sp 21 48 addr supports several connection types: 22 23 .Bl -tag -width 5n 24 .It [ircs://]<host>[:port] 25 connects with TLS over TCP 26 .It irc+insecure://<host>[:port] 27 connects with plain-text TCP 28 .It irc+unix:///<path> 29 connects to a Unix socket 30 .El 31 49 * ircs://<host>:port \- connects with TLS over TCP 50 * irc+insecure://<host>:port \- connects with plain\-text over TCP 51 * irc+unix://<path> \- connects to a Unix domain socket 52 .sp 32 53 Other options are: 33 34 -name <name> 35 Short network name. This will be used instead of addr to refer to the 36 network. 37 38 -username <username> 39 Connect with the specified username. By default, the nickname is used. 40 41 -pass <pass> 42 Connect with the specified server password. 43 44 -realname <realname> 45 Connect with the specified real name. By default, the account's realname 46 is used if set, otherwise the network's nickname is used. 47 48 -nick <nickname> 49 Connect with the specified nickname. By default, the account's username 50 is used. 51 52 -enabled true|false 53 Enable or disable the network. If the network is disabled, the bouncer 54 won't connect to it. By default, the network is enabled. 55 56 -connect-command <command> 57 Send the specified command as a raw IRC message right after connecting 58 to the server. This can be used to identify to an account when the 59 server doesn't support SASL. 60 61 .It network update [name] [options...] 62 Update an existing network. The options are the same as the 63 network create command. 64 65 When this command is executed, suika will disconnect and re-connect to the 66 network. 67 54 .sp 55 .RS 4 56 .ie n \{\ 57 \h'-04'\(bu\h'+03'\c 58 .\} 59 .el \{\ 60 . sp -1 61 . IP \(bu 2.3 62 .\} 63 \-name <name> 64 Short network name, this will be used instead of addr to refer to the network 65 .RE 66 .sp 67 .RS 4 68 .ie n \{\ 69 \h'-04'\(bu\h'+03'\c 70 .\} 71 .el \{\ 72 . sp -1 73 . IP \(bu 2.3 74 .\} 75 \-username <username> 76 Connect with the specified username, by default, the nickname is used 77 .RE 78 .sp 79 .RS 4 80 .ie n \{\ 81 \h'-04'\(bu\h'+03'\c 82 .\} 83 .el \{\ 84 . sp -1 85 . IP \(bu 2.3 86 .\} 87 \-pass <pass> 88 Connect with the specified server password 89 .RE 90 .sp 91 .RS 4 92 .ie n \{\ 93 \h'-04'\(bu\h'+03'\c 94 .\} 95 .el \{\ 96 . sp -1 97 . IP \(bu 2.3 98 .\} 99 \-realname <realname> 100 Connect with the specified real name, by default, the account\(cqs realname is used if set, otherwise the network\(cqs nickname is used 101 .RE 102 .sp 103 .RS 4 104 .ie n \{\ 105 \h'-04'\(bu\h'+03'\c 106 .\} 107 .el \{\ 108 . sp -1 109 . IP \(bu 2.3 110 .\} 111 \-nick <nick> 112 Connect with the specified nickname, by default, the account\(cqs username is used 113 .RE 114 .sp 115 .RS 4 116 .ie n \{\ 117 \h'-04'\(bu\h'+03'\c 118 .\} 119 .el \{\ 120 . sp -1 121 . IP \(bu 2.3 122 .\} 123 \-enabled [bool] 124 Enable or disable the network, if the network is disabled, the bouncer won\(cqt connect to it, by default, the network is enabled 125 .RE 126 .sp 127 .RS 4 128 .ie n \{\ 129 \h'-04'\(bu\h'+03'\c 130 .\} 131 .el \{\ 132 . sp -1 133 . IP \(bu 2.3 134 .\} 135 \-connect\-command <command> 136 Send the specified command as a raw IRC message right after connecting to the server, this can be used to identify to an account if a server does not support SASL 137 .RE 138 .SS "network update [options...]" 139 .sp 140 Update an existing network. The options are the same as the network create command. 141 When this command is executed, suika(1) will disconnect and re\-connect to the network. 68 142 If name is not specified, the current network is updated. 69 70 . It network delete [name]143 .SS "network delete [name]" 144 .sp 71 145 Disconnect and delete a network. 72 73 146 If name is not specified, the current network is deleted. 74 75 .It network quote [name] <command> 76 Send a raw IRC line as-is to a network. 77 147 .SS "network quote [name] <command>" 148 .sp 149 Send a raw IRC line as\-is to a network. 78 150 If name is not specified, the command is sent to the current network. 79 .It network status 151 .SS "network status" 152 .sp 80 153 Show a list of saved networks and their current status. 81 .It channel status [options...] 154 .SS "channel status [options...]" 155 .sp 82 156 Show a list of saved channels and their current status. 83 157 Options: 84 85 -network <name> 86 158 .sp 159 .RS 4 160 .ie n \{\ 161 \h'-04'\(bu\h'+03'\c 162 .\} 163 .el \{\ 164 . sp -1 165 . IP \(bu 2.3 166 .\} 167 \-network <network> 87 168 Only show channels for the specified network. By default, only the channels in the current network are displayed. 88 channel update <name> [options...] 89 169 .RE 170 .SS "channel update <name> [options...]" 171 .sp 90 172 Update the options of an existing channel. 91 173 Options are: 92 93 -detached true|false 94 174 .sp 175 \-detached [bool] 95 176 Attach or detach this channel. 96 A detached channel is joined but is hidden by the bouncer. This is useful to e.g. collect logs and highlights in low-interest or high-traffic channels. 97 98 -relay-detached <mode> 99 100 Set when to relay messages from detached channels to the user with a BouncerServ NOTICE. 101 Modes are: 102 103 message 104 105 Relay any message from this channel when detached. 106 highlight 107 108 Relay only messages mentioning you when detached. 109 none 110 111 Don't relay any messages from this channel when detached. 112 default 113 114 Currently same as highlight. This is the default behaviour. 115 -reattach-on <mode> 116 117 Set when to automatically reattach to detached channels. 118 Modes are: 119 120 message 121 122 Reattach to this channel when any message is received. 123 highlight 124 125 Reattach to this channel when any message mentioning you is received. 126 none 127 128 Never automatically reattach to this channel. 129 default 130 131 Currently same as none. This is the default behaviour. 132 -detach-after <duration> 133 134 Automatically detach this channel after the specified duration has elapsed without receving any message corresponding to -detach-on. 135 Example duration values: 1h30m, 30s, 2.5h. 136 137 Setting this value to 0 will disable this behaviour, i.e. this channel will never be automatically detached. This is the default behaviour. 138 139 -detach-on <mode> 140 141 Set when to reset the auto-detach timer used by -detach-after, causing it to wait again for the auto-detach duration timer before detaching. Joining, reattaching, sending a message, or changing any channel option will reset the timer, in addition to the messages specified by the mode. 142 Modes are: 143 144 message 145 146 Receiving any message from this channel will reset the auto-detach timer. 147 highlight 148 149 Receiving any message mentioning you from this channel will reset the auto-detach timer. 150 none 151 152 Receiving messages from this channel will not reset the auto-detach timer. Sending messages or joining the channel will still reset the timer. 153 default 154 155 Currently same as message. This is the default behaviour. 156 .It channel delete <name> 157 Leave and forget a channel. 158 .It certfp generate [options...] 159 Generate self-signed certificate and use it for authentication (via SASL EXTERNAL). 160 Generates a 3072-bit RSA private key by default. 161 162 Options are: 163 164 -network <name> 165 177 A detached channel is joined but is hidden by the bouncer. 178 This is useful to e.g. collect logs and highlights in low\-interest or high\-traffic channels. 179 .sp 180 \-relay\-detached [mode] \- Set when to relay messages from detached channels to the user with a BouncerServ NOTICE 181 * message \- Relay any message from this channel when detached. 182 * highlight \- Relay only messages mentioning you when detached. 183 * none \- Do not relay any messages from this channel when detached. 184 * default \- Currently same as highlight. This is the default behaviour. 185 .sp 186 \-reattach\-on [mode] \- Set when to automatically reattach to detached channels. 187 .sp 188 .RS 4 189 .ie n \{\ 190 \h'-04'\(bu\h'+03'\c 191 .\} 192 .el \{\ 193 . sp -1 194 . IP \(bu 2.3 195 .\} 196 message \- Reattach to this channel when any message is received. 197 .RE 198 .sp 199 .RS 4 200 .ie n \{\ 201 \h'-04'\(bu\h'+03'\c 202 .\} 203 .el \{\ 204 . sp -1 205 . IP \(bu 2.3 206 .\} 207 highlight \- Reattach to this channel when any message mentioning you is received. 208 .RE 209 .sp 210 .RS 4 211 .ie n \{\ 212 \h'-04'\(bu\h'+03'\c 213 .\} 214 .el \{\ 215 . sp -1 216 . IP \(bu 2.3 217 .\} 218 none \- Never automatically reattach to this channel. 219 .RE 220 .sp 221 .RS 4 222 .ie n \{\ 223 \h'-04'\(bu\h'+03'\c 224 .\} 225 .el \{\ 226 . sp -1 227 . IP \(bu 2.3 228 .\} 229 default \- Currently same as none. This is the default behaviour. 230 .RE 231 .sp 232 \-detach\-after [duration] 233 .sp 234 Automatically detach this channel after the specified duration has elapsed without receving any message corresponding to \-detach\-on. Example duration values: 1h30m, 30s, 2.5h. Setting this value to 0 will disable this behaviour, i.e. this channel will never be automatically detached. This is the default behaviour. 235 .sp 236 \-detach\-on [mode] 237 Set when to reset the auto\-detach timer used by \-detach\-after, causing it to wait again for the auto\-detach duration timer before detaching. Joining, reattaching, sending a message, or changing any channel option will reset the timer, in addition to the messages specified by the mode. 238 .sp 239 .RS 4 240 .ie n \{\ 241 \h'-04'\(bu\h'+03'\c 242 .\} 243 .el \{\ 244 . sp -1 245 . IP \(bu 2.3 246 .\} 247 message \- Receiving any message from this channel will reset the auto\-detach timer. 248 .RE 249 .sp 250 .RS 4 251 .ie n \{\ 252 \h'-04'\(bu\h'+03'\c 253 .\} 254 .el \{\ 255 . sp -1 256 . IP \(bu 2.3 257 .\} 258 highlight \- Receiving any message mentioning you from this channel will reset the auto\-detach timer. 259 .RE 260 .sp 261 .RS 4 262 .ie n \{\ 263 \h'-04'\(bu\h'+03'\c 264 .\} 265 .el \{\ 266 . sp -1 267 . IP \(bu 2.3 268 .\} 269 none \- Receiving messages from this channel will not reset the auto\-detach timer. Sending messages or joining the channel will still reset the timer. 270 .RE 271 .sp 272 .RS 4 273 .ie n \{\ 274 \h'-04'\(bu\h'+03'\c 275 .\} 276 .el \{\ 277 . sp -1 278 . IP \(bu 2.3 279 .\} 280 default \- Currently same as message. This is the default behaviour. 281 .RE 282 .SS "certfp generate [options...]" 283 .sp 284 Generate self\-signed certificate and use it for authentication (via SASL EXTERNAL). Generates a 3072\-bit RSA private key by default. 285 Options are: 286 .sp 287 .RS 4 288 .ie n \{\ 289 \h'-04'\(bu\h'+03'\c 290 .\} 291 .el \{\ 292 . sp -1 293 . IP \(bu 2.3 294 .\} 295 \-network <network> 166 296 Select a network. By default, the current network is selected, if any. 167 -key-type <type> 168 169 Private key algorithm to use. Valid values are: rsa, ecdsa and ed25519. ecdsa uses the NIST P-521 curve. 170 -bits <bits> 171 297 .RE 298 .sp 299 .RS 4 300 .ie n \{\ 301 \h'-04'\(bu\h'+03'\c 302 .\} 303 .el \{\ 304 . sp -1 305 . IP \(bu 2.3 306 .\} 307 \-key\-type <type> 308 Private key algorithm to use. Valid values are: rsa, ecdsa and ed25519. ecdsa uses the NIST P\-521 curve. 309 .RE 310 .sp 311 .RS 4 312 .ie n \{\ 313 \h'-04'\(bu\h'+03'\c 314 .\} 315 .el \{\ 316 . sp -1 317 . IP \(bu 2.3 318 .\} 319 \-bits <bits> 172 320 Size of RSA key to generate. Ignored for other key types. 173 certfp fingerprint [options...] 174 175 Show SHA-1 and SHA-256 fingerprints for the certificate currently used with the network. 176 Options are: 177 178 -network <name> 179 321 .RE 322 .SS "certfp fingerprint [options...]" 323 .sp 324 Show SHA\-1 and SHA\-256 fingerprints for the certificate currently used with the network. 325 Options are: 326 .sp 327 .RS 4 328 .ie n \{\ 329 \h'-04'\(bu\h'+03'\c 330 .\} 331 .el \{\ 332 . sp -1 333 . IP \(bu 2.3 334 .\} 335 \-network <network> 180 336 Select a network. By default, the current network is selected, if any. 181 sasl status [options...] 182 337 .RE 338 .SS "sasl status [options...]" 339 .sp 183 340 Show current SASL status. 184 341 Options are: 185 186 -network <name> 187 342 .sp 343 .RS 4 344 .ie n \{\ 345 \h'-04'\(bu\h'+03'\c 346 .\} 347 .el \{\ 348 . sp -1 349 . IP \(bu 2.3 350 .\} 351 \-network <network> 188 352 Select a network. By default, the current network is selected, if any. 189 .It sasl set-plain [options...] <username> <password> 353 .RE 354 .SS "sasl set\-plain [options...] <username> <password>" 355 .sp 190 356 Set SASL PLAIN credentials. 191 357 Options are: 192 193 -network <name> 194 358 .sp 359 .RS 4 360 .ie n \{\ 361 \h'-04'\(bu\h'+03'\c 362 .\} 363 .el \{\ 364 . sp -1 365 . IP \(bu 2.3 366 .\} 367 \-network <network> 195 368 Select a network. By default, the current network is selected, if any. 196 .It sasl reset [options...] 369 .RE 370 .SS "sasl reset [options...]" 371 .sp 197 372 Disable SASL authentication and remove stored credentials. 198 373 Options are: 199 200 -network <name> 201 374 .sp 375 .RS 4 376 .ie n \{\ 377 \h'-04'\(bu\h'+03'\c 378 .\} 379 .el \{\ 380 . sp -1 381 . IP \(bu 2.3 382 .\} 383 \-network <network> 202 384 Select a network. By default, the current network is selected, if any. 203 .It user status 385 .RE 386 .SS "user status" 387 .sp 204 388 Show a list of users on this server. Only admins can query this information. 205 user create -username <username> -password <password> [options...] 206 207 Create a new suika user. Only admin users can create new accounts. The -username and -password flags are mandatory. 208 Options are: 209 210 -username <username> 211 212 The bouncer username. This cannot be changed after the user has been created. 213 -password <password> 214 215 The bouncer password. 216 -disable-password 217 218 Disable password authentication. The user will be unable to login. 219 -admin true|false 220 221 Make the new user an administrator. 222 -nick <nick> 223 224 Set the user's nickname. This is used as a fallback if there is no nickname set for a network. 225 -realname <realname> 226 227 Set the user's realname. This is used as a fallback if there is no realname set for a network. 228 -enabled true|false 229 230 Enable or disable the user. If the user is disabled, the bouncer will not connect to any of their networks, and downstream connections will be immediately closed. By default, users are enabled. 231 .It user update [username] [options...] 232 Update a user. The options are the same as the user create command. 233 If username is omitted, the current user is updated. Only admins can update other users. 234 389 .SS "user create \-username <username> \-password <password> [options...]" 390 .sp 391 Create a new suika user. Only admin users can create new accounts. The \-username and \-password flags are mandatory. 392 Options are: 393 .sp 394 .RS 4 395 .ie n \{\ 396 \h'-04'\(bu\h'+03'\c 397 .\} 398 .el \{\ 399 . sp -1 400 . IP \(bu 2.3 401 .\} 402 \-username <username> \- The bouncer username. This cannot be changed after the user has been created. 403 .RE 404 .sp 405 .RS 4 406 .ie n \{\ 407 \h'-04'\(bu\h'+03'\c 408 .\} 409 .el \{\ 410 . sp -1 411 . IP \(bu 2.3 412 .\} 413 \-password <password> \- The bouncer password. 414 .RE 415 .sp 416 .RS 4 417 .ie n \{\ 418 \h'-04'\(bu\h'+03'\c 419 .\} 420 .el \{\ 421 . sp -1 422 . IP \(bu 2.3 423 .\} 424 \-disable\-password \- Disable password authentication. The user will be unable to login. 425 .RE 426 .sp 427 .RS 4 428 .ie n \{\ 429 \h'-04'\(bu\h'+03'\c 430 .\} 431 .el \{\ 432 . sp -1 433 . IP \(bu 2.3 434 .\} 435 \-admin [bool] \- Make the new user an administrator. 436 .RE 437 .sp 438 .RS 4 439 .ie n \{\ 440 \h'-04'\(bu\h'+03'\c 441 .\} 442 .el \{\ 443 . sp -1 444 . IP \(bu 2.3 445 .\} 446 \-nick <nick> \- Set the user\(cqs nickname. This is used as a fallback if there is no nickname set for a network. 447 .RE 448 .sp 449 .RS 4 450 .ie n \{\ 451 \h'-04'\(bu\h'+03'\c 452 .\} 453 .el \{\ 454 . sp -1 455 . IP \(bu 2.3 456 .\} 457 \-realname <realname> \- Set the user\(cqs realname. This is used as a fallback if there is no realname set for a network. 458 .RE 459 .sp 460 .RS 4 461 .ie n \{\ 462 \h'-04'\(bu\h'+03'\c 463 .\} 464 .el \{\ 465 . sp -1 466 . IP \(bu 2.3 467 .\} 468 \-enabled [bool] \- Enable or disable the user. If the user is disabled, the bouncer will not connect to any of their networks, and downstream connections will be immediately closed. By default, users are enabled. 469 .RE 470 .SS "user update [username] [options...]" 471 .sp 472 Update a user. The options are the same as the user create command. If username is omitted, the current user is updated. Only admins can update other users. 473 .sp 235 474 Not all flags are valid in all contexts: 236 237 •The -username flag is never valid, usernames are immutable. 238 •The -nick and -realname flag are only valid when updating the current user. 239 •The -admin and -enabled flags are only valid when updating another user. 240 .It user delete <username> [confirmation token] 241 Delete a suika user. 242 Only admins can delete other users. 243 .It user run <username> <command...> 244 Execute a command as another user. 245 Only admins can use this command. 246 .It server status 475 .sp 476 .RS 4 477 .ie n \{\ 478 \h'-04'\(bu\h'+03'\c 479 .\} 480 .el \{\ 481 . sp -1 482 . IP \(bu 2.3 483 .\} 484 The \-username flag is never valid, usernames are immutable. 485 .RE 486 .sp 487 .RS 4 488 .ie n \{\ 489 \h'-04'\(bu\h'+03'\c 490 .\} 491 .el \{\ 492 . sp -1 493 . IP \(bu 2.3 494 .\} 495 The \-nick and \-realname flag are only valid when updating the current user. 496 .RE 497 .sp 498 .RS 4 499 .ie n \{\ 500 \h'-04'\(bu\h'+03'\c 501 .\} 502 .el \{\ 503 . sp -1 504 . IP \(bu 2.3 505 .\} 506 The \-admin and \-enabled flags are only valid when updating another user. 507 .RE 508 .SS "user delete <username> [confirmation token]" 509 .sp 510 Delete a suika user. Only admins can delete other users. 511 === user run <username> <command...> 512 Execute a command as another user. Only admins can use this command. 513 === server status 247 514 Show some bouncer statistics. Only admins can query this information. 248 .Itserver notice <message>515 === server notice <message> 249 516 Broadcast a notice. All currently connected bouncer users will receive the message from the special BouncerServ service. Only admins can broadcast a notice. 250 . El251 . Sh SEE ALSO252 .Xr suika 1 253 .Xr suika-config 5 254 .Sh AUTHORS 255 .An Simon Ser and contributors 256 . Lk https://emersion.fr257 . Pp258 .An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja 517 .SH "SEE ALSO" 518 .sp 519 suika(1) 520 suikadb(1) 521 suika\-znc\-import(1) 522 suika\-config(5) 523 .SH "AUTHOR" 524 .sp 525 Simon Ser and contributors / Izuru Yakumo -
trunk/doc/suika-config.5
r817 r823 1 .Dd $Mdocdate$ 2 .Dt SUIKA-CONFIG 5 3 .Os 4 .Sh NAME 5 .Nm suika-config 6 .Nd Configuration file for suika IRC bouncer 7 .Sh DESCRIPTION 1 '\" t 2 .\" Title: suika-config 3 .\" Author: Simon Ser and contributors / Izuru Yakumo 4 .\" Generator: Asciidoctor 2.0.20 5 .\" Date: 2023-09-15 6 .\" Manual: Suika IRC Bouncer 7 .\" Source: SUIKA-CONFIG 8 .\" Language: English 9 .\" 10 .TH "SUIKA\-CONFIG" "5" "2023-09-15" "SUIKA\-CONFIG" "Suika IRC Bouncer" 11 .ie \n(.g .ds Aq \(aq 12 .el .ds Aq ' 13 .ss \n[.ss] 0 14 .nh 15 .ad l 16 .de URL 17 \fI\\$2\fP <\\$1>\\$3 18 .. 19 .als MTO URL 20 .if \n[.g] \{\ 21 . mso www.tmac 22 . am URL 23 . ad l 24 . . 25 . am MTO 26 . ad l 27 . . 28 . LINKSTYLE blue R < > 29 .\} 30 .SH "NAME" 31 suika-config \- Configuration file for suika(1) 32 .SH "DESCRIPTION" 33 .sp 8 34 The config file has one directive per line 9 35 .sp 10 36 Example: 11 37 .sp 12 38 listen ircs:// 13 .Pp14 39 tls cert.pem key.pem 15 .Pp16 40 hostname example.org 17 41 .sp 18 42 The following directives are supported: 19 20 .Bl -tag -width 7n -compact 21 .It listen <uri> 22 Listening URI (default: ":6697") 23 43 .sp 44 .RS 4 45 .ie n \{\ 46 \h'-04'\(bu\h'+03'\c 47 .\} 48 .el \{\ 49 . sp -1 50 . IP \(bu 2.3 51 .\} 52 listen <uri> 53 Listening URI (default ":6697") 54 .RE 55 .sp 24 56 The following URIs are supported: 25 .Bl -tag -width 11n -compact 26 .It ircs://[host]:[port] 27 listens with TLS over TCP 28 .It irc+insecure://[host]:[port] 29 listens with plain-text over TCP 30 .It unix:///<path> 31 listens on a Unix domain socket 32 .It wss://[host]:[port] 33 listens for WebSocket connections over 34 TLS 35 .It ws+insecure://[host]:[port] 36 listens for plain-text WebSocket 37 connections 38 .It ident://[host]:[port] 39 listens for plain-text ident 40 connections 41 .It http+prometheus://[host]:[port] 42 listens for plain-text HTTP 43 connections and serves Prometheus 44 metrics (host must be "localhost") 45 .It http+pprof://[host]:[port] 46 listens for plain-text HTTP 47 connections and serves pprof 48 runtime profiling data 49 (host must be "localhost"). 50 For more information, see: 51 <https://pkg.go.dev/net/http/pprof>. 52 .El 53 54 If the scheme is omitted, "ircs" is assumed. 55 If multiple "listen" directives are specified, 56 suika will listen on each of them. 57 58 .It hostname <name> 57 .sp 58 .RS 4 59 .ie n \{\ 60 \h'-04'\(bu\h'+03'\c 61 .\} 62 .el \{\ 63 . sp -1 64 . IP \(bu 2.3 65 .\} 66 ircs://host:port 67 Listens with TLS over TCP 68 .RE 69 .sp 70 .RS 4 71 .ie n \{\ 72 \h'-04'\(bu\h'+03'\c 73 .\} 74 .el \{\ 75 . sp -1 76 . IP \(bu 2.3 77 .\} 78 irc+insecure://host:port 79 Listens with plain\-text over TCP 80 .RE 81 .sp 82 .RS 4 83 .ie n \{\ 84 \h'-04'\(bu\h'+03'\c 85 .\} 86 .el \{\ 87 . sp -1 88 . IP \(bu 2.3 89 .\} 90 unix:///<path> 91 Listens on a Unix domain socket 92 .RE 93 .sp 94 .RS 4 95 .ie n \{\ 96 \h'-04'\(bu\h'+03'\c 97 .\} 98 .el \{\ 99 . sp -1 100 . IP \(bu 2.3 101 .\} 102 unix+admin:///<path> 103 Listens on a Unix domain socket for use with suikactl(1) 104 .RE 105 .sp 106 .RS 4 107 .ie n \{\ 108 \h'-04'\(bu\h'+03'\c 109 .\} 110 .el \{\ 111 . sp -1 112 . IP \(bu 2.3 113 .\} 114 wss://host:port 115 Listens for WebSocket connections over TLS 116 .RE 117 .sp 118 .RS 4 119 .ie n \{\ 120 \h'-04'\(bu\h'+03'\c 121 .\} 122 .el \{\ 123 . sp -1 124 . IP \(bu 2.3 125 .\} 126 ws+insecure://host:port 127 Listens for plain\-text WebSocket connections 128 .RE 129 .sp 130 .RS 4 131 .ie n \{\ 132 \h'-04'\(bu\h'+03'\c 133 .\} 134 .el \{\ 135 . sp -1 136 . IP \(bu 2.3 137 .\} 138 ident://host:port 139 Listens for plain\-text ident connections 140 .RE 141 .sp 142 .RS 4 143 .ie n \{\ 144 \h'-04'\(bu\h'+03'\c 145 .\} 146 .el \{\ 147 . sp -1 148 . IP \(bu 2.3 149 .\} 150 http+prometheus://host:port 151 Listens for plain\-text HTTP connections and serves Prometheus metrics (host must be "localhost") 152 .RE 153 .sp 154 .RS 4 155 .ie n \{\ 156 \h'-04'\(bu\h'+03'\c 157 .\} 158 .el \{\ 159 . sp -1 160 . IP \(bu 2.3 161 .\} 162 http+pprof://host:port 163 Listens for plain\-text HTTP connections and serves pprof runtime profiling data (host must be "localhost") 164 For more information, see: \c 165 .URL "https://pkg.go.dev/net/http/pprof" "" "." 166 .RE 167 .sp 168 .RS 4 169 .ie n \{\ 170 \h'-04'\(bu\h'+03'\c 171 .\} 172 .el \{\ 173 . sp -1 174 . IP \(bu 2.3 175 .\} 176 hostname <name> 59 177 Server hostname 60 61 .It title <title> 62 Server title. This will be sent as 63 the ISUPPORT NETWORK value when 64 clients don't select a specific 65 network. 66 67 .It tls <cert> <key> 68 Enable TLS support. The certificate 69 and key files must be PEM-encoded. 70 71 .It db <driver> <source> 72 Set the database location for user, 73 network and channel storage. By 74 default, a sqlite3 database is 75 opened in ./suika.db. 76 178 .RE 179 .sp 180 .RS 4 181 .ie n \{\ 182 \h'-04'\(bu\h'+03'\c 183 .\} 184 .el \{\ 185 . sp -1 186 . IP \(bu 2.3 187 .\} 188 title <title> 189 Server title. This will be sent as the ISUPPORT NETWORK value when clients don\(cqt select a specific network. 190 .RE 191 .sp 192 .RS 4 193 .ie n \{\ 194 \h'-04'\(bu\h'+03'\c 195 .\} 196 .el \{\ 197 . sp -1 198 . IP \(bu 2.3 199 .\} 200 tls <cert> <key> 201 Enable TLS support. The certificate and key files must be PEM\-encoded. 202 .RE 203 .sp 204 .RS 4 205 .ie n \{\ 206 \h'-04'\(bu\h'+03'\c 207 .\} 208 .el \{\ 209 . sp -1 210 . IP \(bu 2.3 211 .\} 212 db <driver> <source> 213 Set the database location for user, network and channel storage. 214 By default, a sqlite3 database is opened in ./suika.db. 215 .RE 216 .sp 77 217 Supported drivers: 78 79 .Bl tag -width 7n -compact 80 .It sqlite3 81 expects source to be a path to 82 the SQLite file 83 .It postgres 84 expects source to be a space- 85 separated list of key=value 86 parameters, e.g. db postgres 87 host=/run/postgresql 88 dbname=suika. Note that 89 sslmode defaults to require. 90 For more information on 91 connection strings, see: 92 <https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters> 93 .El 94 95 .It log fs <path> 96 Path to the bouncer logs directory, or empty to 97 disable logging. By default, logging is disabled. 98 99 .It http-origin <patterns> 100 List of allowed HTTP origins for WebSocket listeners. 101 The parameters are interpreted as shell patterns, see *glob*(7). 102 103 By default, only the request host is authorized. 104 Use this directive to enable cross-origin WebSockets. 105 106 .It accept-proxy-ip <cidr..> 107 Allow the specified IPs to act as a proxy. Proxys have the ability to 108 overwrite the remote and local connection addresses (via the PROXY protocol, 109 the Forwarded HTTP header field defined in RFC 7239 or the X-Forwarded-\* 110 HTTP header fields). The special name "localhost" accepts the loopback 111 addresses 127.0.0.0/8 and ::1/128. 112 218 * sqlite3: expects source to be a path to the SQLite file 219 * postgres: expects source to be a space\- separated list of key=value parameters, e.g. db postgres host=/run/postgresql dbname=suika. 220 Note that sslmode defaults to require. 221 For more information on connection strings, see: \c 222 .URL "https://pkg.go.dev/github.com/lib/pq#hdr\-Connection_String_Parameters" "" "" 223 .sp 224 .RS 4 225 .ie n \{\ 226 \h'-04'\(bu\h'+03'\c 227 .\} 228 .el \{\ 229 . sp -1 230 . IP \(bu 2.3 231 .\} 232 log fs <path> 233 Path to the bouncer logs directory, or empty to disable logging. 234 By default, logging is disabled. 235 .RE 236 .sp 237 .RS 4 238 .ie n \{\ 239 \h'-04'\(bu\h'+03'\c 240 .\} 241 .el \{\ 242 . sp -1 243 . IP \(bu 2.3 244 .\} 245 http\-origin <patterns> 246 List of allowed HTTP origins for WebSocket listeners. The parameters are interpreted as shell patterns, see glob(3) 247 By default, only the request host is authorized. Use this directive to enable cross\-origin WebSockets. 248 .RE 249 .sp 250 .RS 4 251 .ie n \{\ 252 \h'-04'\(bu\h'+03'\c 253 .\} 254 .el \{\ 255 . sp -1 256 . IP \(bu 2.3 257 .\} 258 accept\-proxy\-ip <cidr..> 259 Allow the specified IPs to act as a proxy. 260 Proxies have the ability to overwrite the remote and local connection addresses (via the PROXY protocol, the Forwarded HTTP header field defined in RFC 7239 or the X\-Forwarded\- HTTP header fields). 261 The special name "localhost" accepts the loopback addresses 127.0.0.0/8 and ::1/128. 113 262 By default, all IPs are rejected. 114 115 .It max-user-networks <limit> 263 .RE 264 .sp 265 .RS 4 266 .ie n \{\ 267 \h'-04'\(bu\h'+03'\c 268 .\} 269 .el \{\ 270 . sp -1 271 . IP \(bu 2.3 272 .\} 273 max\-user\-networks <limit> 116 274 Maximum number of networks per user. By default, there is no limit. 117 118 .It motd <path> 119 Path to the MOTD file. The bouncer MOTD is sent to clients which aren't 120 bound to a specific network. By default, no MOTD is sent. 121 122 .It multi-upstream-mode <true|false> 123 Globally enable or disable multi-upstream mode. 124 By default, multi-upstream mode is enabled. 125 126 .It upstream-user-ip <cidr...> 127 Enable per-user IP addresses. 128 One IPv4 range and/or one IPv6 range can be 129 specified in CIDR notation. 130 One IP address per range will be assigned to 131 each user and will be used as the source address when connecting to an 132 upstream network. 133 134 This can be useful to avoid having the whole bouncer banned from an upstream 135 network because of one malicious user. 136 .El 137 .Sh SEE ALSO 138 .Xr suika 1 139 .Xr suika-bouncerserv 7 140 .Sh AUTHORS 141 .An Simon Ser and contributors Aq https://emersion.fr 142 .An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja 275 .RE 276 .sp 277 .RS 4 278 .ie n \{\ 279 \h'-04'\(bu\h'+03'\c 280 .\} 281 .el \{\ 282 . sp -1 283 . IP \(bu 2.3 284 .\} 285 motd <path> 286 Path to the MOTD file. 287 The bouncer MOTD is sent to clients which aren\(cqt bound to a specific network. 288 By default, no MOTD is sent. 289 .RE 290 .sp 291 .RS 4 292 .ie n \{\ 293 \h'-04'\(bu\h'+03'\c 294 .\} 295 .el \{\ 296 . sp -1 297 . IP \(bu 2.3 298 .\} 299 multi\-upstream\-mode <true|false> 300 Globally enable or disable multi\-upstream mode. 301 By default, multi\-upstream mode is enabled. 302 .RE 303 .sp 304 .RS 4 305 .ie n \{\ 306 \h'-04'\(bu\h'+03'\c 307 .\} 308 .el \{\ 309 . sp -1 310 . IP \(bu 2.3 311 .\} 312 upstream\-user\-ip <cidr...> 313 Enable per\-user IP addresses. 314 One IPv4 range and/or one IPv6 range can be specified in CIDR notation. 315 One IP address per range will be assigned to each user and will be used as the source address when connecting to an upstream network. 316 This can be useful to avoid having the whole bouncer banned from an upstream network because of one malicious user. 317 .RE 318 .SH "SEE ALSO" 319 .sp 320 suika(1) 321 suikadb(1) 322 suika\-znc\-import(1) 323 suika\-bouncerserv(7) 324 .SH "AUTHOR" 325 .sp 326 Simon Ser and contributors / Izuru Yakumo -
trunk/doc/suika.1
r817 r823 1 .Dd $Mdocdate$ 2 .Dt SUIKA 1 3 .Os 4 .Sh NAME 5 .Nm suika 6 .Nd Drunk as hell IRC bouncer oni. 7 .Sh SYNOPSIS 8 .Nm 9 .Op Fl options 10 .Ar ... 11 .Sh DESCRIPTION 12 suika is an user-friendly IRC bouncer. 13 It connects to upstream IRC servers on 14 behalf of the user to provide extra 15 features. 16 17 .Bl -tag -width 10n -compact 18 .It * 19 Multiple separate users sharing the same 20 bouncer, each with their own upstream 21 servers 22 .It * 23 Clients connecting to multiple upstream 24 servers via a single connection to the 25 bouncer 26 .It * 27 Sending the backlog (messages received 28 while the user was disconnected from 29 the bouncer), with per-client buffers 30 .El 31 32 When joining a channel, the channel will 33 be saved and automatically joined on 34 the next connection. When registering 35 or authenticating with NickServ, the 36 credentials will be saved and 37 automatically used on the next 38 connection if the server supports 39 SASL. When parting a channel with 40 the reason "detach", the channel 41 will be detached instead of being 42 left. 43 44 When all clients are disconnected 45 from the bouncer, the user is 46 automatically marked as away. 47 1 '\" t 2 .\" Title: suika 3 .\" Author: Simon Ser and contributors / Izuru Yakumo 4 .\" Generator: Asciidoctor 2.0.20 5 .\" Date: 2023-09-15 6 .\" Manual: Suika IRC Bouncer 7 .\" Source: SUIKA 8 .\" Language: English 9 .\" 10 .TH "SUIKA" "1" "2023-09-15" "SUIKA" "Suika IRC Bouncer" 11 .ie \n(.g .ds Aq \(aq 12 .el .ds Aq ' 13 .ss \n[.ss] 0 14 .nh 15 .ad l 16 .de URL 17 \fI\\$2\fP <\\$1>\\$3 18 .. 19 .als MTO URL 20 .if \n[.g] \{\ 21 . mso www.tmac 22 . am URL 23 . ad l 24 . . 25 . am MTO 26 . ad l 27 . . 28 . LINKSTYLE blue R < > 29 .\} 30 .SH "NAME" 31 suika \- Drunk as hell IRC bouncer, named after Suika Ibuki from Touhou Project 32 .SH "SYNOPSIS" 33 .sp 34 suika [\-options] ... 35 .SH "DESCRIPTION" 36 .sp 37 suika is an user\-friendly IRC bouncer. 38 It connects to upstream IRC servers on behalf of the user to provide extra features. 39 .sp 40 .RS 4 41 .ie n \{\ 42 \h'-04'\(bu\h'+03'\c 43 .\} 44 .el \{\ 45 . sp -1 46 . IP \(bu 2.3 47 .\} 48 Multiple separate users sharing the same bouncer, each with their own upstream servers 49 .RE 50 .sp 51 .RS 4 52 .ie n \{\ 53 \h'-04'\(bu\h'+03'\c 54 .\} 55 .el \{\ 56 . sp -1 57 . IP \(bu 2.3 58 .\} 59 Clients connecting to multiple upstream servers via a single connection to the bouncer 60 .RE 61 .sp 62 .RS 4 63 .ie n \{\ 64 \h'-04'\(bu\h'+03'\c 65 .\} 66 .el \{\ 67 . sp -1 68 . IP \(bu 2.3 69 .\} 70 Sending the backlog (messages received while the user was disconnected from the bouncer), with per\-client buffers 71 .RE 72 .sp 73 When joining a channel, the channel will be saved and automatically joined on the next connection. 74 When registering or authenticating with NickServ, the credentials will be saved and automatically used on the next connection if the server supports SASL. 75 When parting a channel with the reason "detach", the channel will be detached instead of being left. 76 When all clients are disconnected from the bouncer, the user is automatically marked as away. 77 .sp 48 78 suika supports two connection modes: 49 50 .Bl -tag -width 10n -compact 51 .It Single upstream mode 52 one downstream connection maps to one upstream 53 connection. To enable this mode, 54 connect to the bouncer with the username 55 "<username>/<network>". 56 If the bouncer isn't connected to the upstream 57 server, it will get automatically added. 58 Then channels can be joined and 59 parted as if you were directly 60 connected to the upstream server. 61 .It Multiple upstream mode 62 one downstream connection maps to multiple upstream 63 connections. 64 Channels and nicks are suffixed 65 with the network name. To join 66 a channel, you need to use 67 the suffix too: 68 /join #channel/network. 69 Same applies to messages 70 sent to users. 71 .El 72 73 For per-client history to work, clients need to indicate their name. This can 74 be done by adding a "@<client>" suffix to the username. 75 76 suika will reload the configuration file, the TLS certificate/key and the MOTD 77 file when it receives the HUP signal. The configuration options listen, db 78 and log cannot be reloaded. 79 80 Administrators can broadcast a message to all bouncer users via /notice 81 $<hostname> <text>, or via /notice $\* <text> in multi-upstream mode. All 82 currently connected bouncer users will receive the message from the special 83 BouncerServ service. 84 85 .Sh OPTIONS 86 .Bl -tag -width 11n -compact 87 .It -h, -help 79 .sp 80 Single upstream mode: one downstream connection maps to one upstream connection. To enable this mode, connect to the bouncer with the username "<username>/<network>". 81 If the bouncer isn\(cqt connected to the upstream server, it will get automatically added. 82 Then channels can be joined and parted as if you were directly connected to the upstream server. 83 .sp 84 Multiple upstream mode: one downstream connection maps to multiple upstream connections. 85 Channels and nicks are suffixed with the network name. 86 To join a channel, you need to use the suffix too: /join #channel/network. 87 Same applies to messages sent to users. 88 .sp 89 For per\-client history to work, clients need to indicate their name. 90 This can be done by adding a "@<client>" suffix to the username. 91 .sp 92 suika will reload the configuration file, the TLS certificate/key and the MOTD file when it receives the HUP signal. 93 The configuration options listen, db and log cannot be reloaded. 94 .sp 95 Administrators can broadcast a message to all bouncer users via /notice $<hostname> <text>, or via /notice $<text> in multi\-upstream mode. 96 All currently connected bouncer users will receive the message from the special BouncerServ service. 97 .SH "OPTIONS" 98 .sp 99 .RS 4 100 .ie n \{\ 101 \h'-04'\(bu\h'+03'\c 102 .\} 103 .el \{\ 104 . sp -1 105 . IP \(bu 2.3 106 .\} 107 \-h, \-help 88 108 Show help message and quit 89 .It -config <path> 109 .RE 110 .sp 111 .RS 4 112 .ie n \{\ 113 \h'-04'\(bu\h'+03'\c 114 .\} 115 .el \{\ 116 . sp -1 117 . IP \(bu 2.3 118 .\} 119 \-config <path> 90 120 Path to the config file. If unset, a default config file is used. 91 .It -debug 92 Enable debug logging (this will leak sensitive information 93 such as passwords) 94 .It -listen <uri> 121 .RE 122 .sp 123 .RS 4 124 .ie n \{\ 125 \h'-04'\(bu\h'+03'\c 126 .\} 127 .el \{\ 128 . sp -1 129 . IP \(bu 2.3 130 .\} 131 \-debug 132 Enable debug logging (this will leak sensitive information such as passwords) 133 .RE 134 .sp 135 .RS 4 136 .ie n \{\ 137 \h'-04'\(bu\h'+03'\c 138 .\} 139 .el \{\ 140 . sp -1 141 . IP \(bu 2.3 142 .\} 143 \-listen <uri> 95 144 Listening URI (default ":6697"). Can be specified multiple times. 96 .El 97 .Sh SEE ALSO 98 .Xr suika-config 5 99 .Xr suika-bouncerserv 7 100 .Sh AUTHORS 101 .An Simon Ser and contributors https://emersion.fr 102 .An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja 145 .RE 146 .SH "SEE ALSO" 147 .sp 148 suikadb(1) 149 suika\-znc\-import(1) 150 suika\-config(5) 151 suika\-bouncerserv(7) 152 .SH "AUTHOR" 153 .sp 154 Simon Ser and contributors / Izuru Yakumo -
trunk/service.go
r818 r823 1108 1108 return nil 1109 1109 } 1110 1111 1110 func handleServiceServerStatus(ctx context.Context, dc *downstreamConn, params []string) error { 1112 1111 dbStats, err := dc.user.srv.db.Stats(ctx)
Note:
See TracChangeset
for help on using the changeset viewer.