-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GanneffServ: make it possible to not kill irccloud #50
base: develop
Are you sure you want to change the base?
Conversation
aca1729
to
6fe3639
Compare
01f5a1c
to
08ed923
Compare
Without this, anyone using irccloud (or a similar service) can get all other users k:lined by tripping on a trap (J). With this, they should be treated like a tor user (getting themselves killed).
08ed923
to
9458c5b
Compare
@@ -326,7 +391,7 @@ def BADSERV(client, parv = []) | |||
debug(LOG_DEBUG, "#{client.name} called BADSERV and the parms are #{parv.join(",")}") | |||
server = parv[1].downcase | |||
|
|||
if server =~ /.*\.oftc.net$/ | |||
if server =~ /.*\.oftc\.net$/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated, but included because I was thinking about regular expressions while working on this file. It's an outlier in this file, everything else included the \
.
Add a unique index so Postgres will enforce unique constraints Co-authored-by: Doug Freed <[email protected]>
ret = akill_add("*@#{host}", reason, @akill_duration) | ||
if client.host =~ /#{@protected_patterns}/i # if protected hosts | ||
debug(LOG_DEBUG, "Using /kill instead of AKILL for protected user #{client.name}") | ||
ret = kill_user(client, reason) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This leaks the oper reason; kills don't hide oper reasons like akills do; easy fix is to just put this section as a branch in the enclosing if
pattern = irc_pattern_to_regex(requested_pattern) | ||
reason = parv[2] | ||
|
||
ret = DB.execute_nonquery(@dbq['INSERT_PROTECT'], 'iiss', client.nick.account_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the original pattern in the DB, rather than the regex. This is important for the listing later, as looking at IRC masks is nicer than regexes, unless we've specifically given a regex.
@dbq['DELETE_PROTECT'] = DB.prepare('DELETE FROM ganneffprotect WHERE | ||
irc_lower(pattern) = irc_lower($1)') | ||
@dbq['GET_PROTECTED_PATTERNS'] = DB.prepare('SELECT pattern, reason FROM ganneffprotect') | ||
@dbq['GET_PROTECTED_PATTERNS_DETAILED'] = DB.prepare('SELECT pattern, setter, time, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setter
here will be an ID, not a name. Look at GET_ALL_CHANNELS
for a simple way to get the primary nick of the setting account.
Without this, anyone using irccloud (or a similar service) can get all other users k:lined
by tripping on a trap (J).
Goal: they should be treated like a tor user (getting themselves killed).
Background: I'm an irccloud user, and today someone managed to trip on a
J
trap which got my connection to oftc k:lined.@dwfreed said that we could add some sort of pattern/mask support to enable users like me not to suffer when other irccloud users do harmless stupid things.
Implementation:
PROTECT
andUNPROTECT
-- I'm not attached to the command names (or anything else really). Both take irc masks or regular expressions (the former being converted into the latter).akill
is called, after checking if the user is on tor, the code tries to check to see if the host would match a protected pattern -- if so, the kill is downgraded to the user just as for tor users.