17 Commits

Author SHA1 Message Date
mik2k2
621ae1b0d3
Add /allowlist command (#399)
* move loading whitelist+ops from file to auth and save the loaded files fro reloading

* add /whitelist command with lots of open questions

* add test for /whitelist

* gofmt

* use the same auth (the tests don't seem to care, but htis is more right)

* mutex whitelistMode and remove some deferred TODOs

* s/whitelist/allowlist/ (user-facing); move helper functions outside the handler function

* check for ops in Auth.CheckPublicKey and move /allowlist handling to helper functions

* possibly fix the test timeout in HostNameCollision

* Revert "possibly fix the test timeout in HostNameCollision" (didn't work)

This reverts commit 664dbb0976f8f10ea7a673950a879591c2e7c320.

* managed to reproduce the timeout after updating, hopefully it's the same one

* remove some unimportant TODOs; add a message when reverify kicks people; add a reverify test

* add client connection with key; add test for /allowlist import AGE

* hopefully make test less racy

* s/whitelist/allowlist/

* fix crash on specifying exactly one more -v flag than the max level

* use a key loader function to move file reading out of auth

* add loader to allowlist test

* minor message changes

* add --whitelist with a warning; update tests for messages

* apparently, we have another prefix

* check names directly on the User objects in TestHostNameCollision

* not allowlisted -> not allowed

* small message change

* update test
2022-01-06 09:09:51 -05:00
mik2k2
7413539965
main, sshd: Refactor authentication, add IP throttling, improve passphrase auth
* Move password authentication handling into sshd/auth (fixes #394).

Password authentication is now completely handeled in Auth. The normal
keyboard-interactive handler checks if passwords are supported and asks
for them, removing the need to override the callbacks.

Brute force throttling is removed; I'd like to base it on IP address
banning, which requires changes to the checks.

I'm not sure, but I think timing attacks against the password are fixed:
- The hashing of the real password happens only at startup.
- The hashing of a provided password is something an attacker can do
themselves; It doesn't leak anything about the real password.
- The hash comparison is constant-time.

* refactor checks, IP-ban incorrect passphrases, renames

- s/assword/assphrase/, typo fixes
- bans are checked separately from public keys
- an incorrect passphrase results in a one-minute IP ban
- whitelists no longer override bans (i.e. you can get banned if you're 
whitelisted)

* (hopefully) final changes
2021-05-31 10:08:30 -04:00
UlisseMini
57c6abe86c Better comments 2019-02-24 09:40:47 -06:00
Andrey Petrov
903d6c9420
/ban query support (#286)
For #285 

Turns out there were some bugs in Set, and I was using it incorrectly too.

The query syntax is a little awkward but couldn't find a nicer easy to parse format that worked with quoted string values.
2018-12-25 14:29:19 -05:00
Andrey Petrov
3572c4674c main: Add /banned command to list banned entries for ops. 2018-12-15 19:04:42 -05:00
Andrey Petrov
86dae2a53e main: auth: Fix ban by IP, also improve log formatting.
Closes #284
2018-12-15 18:47:35 -05:00
Andrey Petrov
6e02b05f99 set: Improve coverage and cleanup. Switch sshchat package to use it. 2016-08-24 13:54:20 -04:00
Andrey Petrov
9bf1f53445 Fixed /kick command to actually close target 2016-07-15 16:22:25 -04:00
Matt Day
0ab31046c0 Fix go vet nitpicks.
Fixes #130:
* pass by reference into AllowAnonymous
* check return value of From() rather than value of From function
2015-08-20 04:28:52 -06:00
Andrey Petrov
8188deef30 Root sshchat package, main moved into cmd/ssh-chat/. 2015-01-21 11:47:59 -08:00
Andrey Petrov
69ea63bf88 /ban and /op now support durations, also all other auth things in the api. 2015-01-19 19:16:37 -08:00
Andrey Petrov
0c21486992 History backfill, also tests pass. 2015-01-18 18:55:47 -08:00
Andrey Petrov
3c4e6994c2 chat.Channel->chat.Room, /ban, /whois, chat.User.Identifier
- Renamed chat.Channel -> chat.Room
- /ban works, supports IP also
- /whois works
- chat.User now accepts an Identifier interface rather than name
- Tweaked rate limiting
2015-01-16 21:53:22 -08:00
Andrey Petrov
d5626b7514 Abstracted sshd.Connection; Op works now. 2015-01-10 13:46:36 -08:00
Andrey Petrov
d8d5deac1c Use authorized_keys-style public keys rather than fingerprints.
Tests for whitelisting.
2015-01-10 12:44:06 -08:00
Nick Presta
23d06faa68 Adding passphrase prompt and env var. 2015-01-03 20:06:38 -05:00
Andrey Petrov
4dd80fb822 Tests pass. 2015-01-01 18:51:34 -08:00