-
Notifications
You must be signed in to change notification settings - Fork 106
Add http ja5 filter and configuration #2320
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
Conversation
lib/ja5.h
Outdated
@@ -1,7 +1,7 @@ | |||
/** | |||
* Tempesta FW | |||
* | |||
* Copyright (C) 2024 Tempesta Technologies, Inc. | |||
* Copyright (C) 2019 Tempesta Technologies, Inc. |
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.
2025
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.
done
fw/t/unit/ja5_conf.c
Outdated
@@ -0,0 +1 @@ | |||
../../ja5_conf.c |
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.
We don't need this files here, because we don't have any unit tests for ja5. To avoid unresolved symbols please add appropriate functions to fw/t/unit/helpers.c
fw/t/unit/ja5_filter.c
Outdated
@@ -0,0 +1 @@ | |||
../../ja5_filter.c |
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.
We don't need this file (same as previous one).
INIT_LIST_HEAD(&storage->lru_list); | ||
spin_lock_init(&storage->lru_list_lock); | ||
|
||
return (storage->tdb = tdb_open( |
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.
I don't see where we call tdb_close
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.
done
fw/ja5_conf.c
Outdated
he->conns_per_sec = conns_per_sec; | ||
he->records_per_sec = recs_per_sec; | ||
INIT_HLIST_NODE(&he->hlist); | ||
refcount_set(&he->refcnt, 1); | ||
|
||
key = hash_calc((char *)&hash, sizeof(hash)); | ||
hash_add(tls_filter_cfg_reconfig->hashes, &he->hlist, key); | ||
hash_for_each_possible(filter_cfg_reconfig->hashes, iter, hlist, key) { |
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.
hash_for_each_possible_safe
should be used when entry can be removed
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.
done
int ja5_cfgop_finish(TfwCfgSpec *cs); | ||
void ja5_cfgop_cleanup(TfwCfgSpec *cs); | ||
|
||
#endif // __JA5_CONF__ |
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.
/* JA5_CONF */
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.
done
fw/ja5_filter.h
Outdated
|
||
return res; | ||
} | ||
#endif // __JA5_FILTER__ |
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.
We use /* */ for comments
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.
done
I also have a question, why we calculate hash for each |
I also see strange logic in |
5dcf9fb
to
977d5bd
Compare
We do so to have the same hash for each the same alpn sequence.
|
f51c53d
to
c7a8243
Compare
Make a unified filtering code for any ja5 type.
c7a8243
to
5e583b8
Compare
No description provided.