Skip to content
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

Rpz #73

Merged
merged 59 commits into from
Jan 30, 2020
Merged

Rpz #73

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
b43b8d4
Merge pull request #3 from NLnetLabs/master
ralphdolmans Apr 5, 2019
9274d26
Initial RPZ commit
ralphdolmans Apr 5, 2019
c66e47c
Initial RPZ commit - now with all files
ralphdolmans Apr 5, 2019
edcf2dd
- Fix locking issue
ralphdolmans Apr 10, 2019
74f11b8
- apply chroot to auth-zone zonefile in unbound-checkconf
ralphdolmans Apr 11, 2019
186c9e8
Merge pull request #5 from NLnetLabs/master
ralphdolmans Apr 25, 2019
ba67920
- IXFR/AXFR support for RPZ
ralphdolmans Apr 25, 2019
46acf0f
Merge branch 'feature/rpz' of github.com:ralphdolmans/unbound into fe…
ralphdolmans Apr 25, 2019
83bf2fd
- locking issues
ralphdolmans Apr 25, 2019
8dac8c0
- Don't attempt an RPZ delete for unsupported actions
ralphdolmans Apr 25, 2019
a7f6886
- Make IXFR deletion more robust
ralphdolmans Apr 25, 2019
b0b6932
- Added RPZ action overrides
ralphdolmans May 16, 2019
268580f
Added RPZ log name and stats
ralphdolmans Jun 3, 2019
bc83e0b
fix double free issue
ralphdolmans Jun 4, 2019
a77c35e
Add RPZ config options to unbound.conf man page.
ralphdolmans Jun 4, 2019
3021e32
Only strdup rpz_log_name when configured
ralphdolmans Jun 5, 2019
395d83c
Procedures to parse RPZ ip address notation.
ralphdolmans Jun 24, 2019
a8d6147
- Added RPZ response IP support
ralphdolmans Jul 16, 2019
9ce7045
- Fix doxygen issue
ralphdolmans Jul 16, 2019
1c5d081
- Add RPZ response IP override option, logging, and statistics
ralphdolmans Aug 1, 2019
0987a82
Add statistics support for disabled (action override) response IP RPZ
ralphdolmans Aug 7, 2019
abbb5c0
Update RPZ man page and example.conf
ralphdolmans Aug 7, 2019
4eb7771
- Added RPZ/QNAME trigger test
ralphdolmans Aug 8, 2019
401fc15
- Extend RPZ/QNAME trigger test
ralphdolmans Aug 8, 2019
7180284
- Add RPZ/QNAME override test
ralphdolmans Aug 8, 2019
88fce79
- Add RPZ respip test
ralphdolmans Aug 12, 2019
4cbf4f4
- Add RPZ response IP override test
ralphdolmans Aug 12, 2019
965f16c
- Add RPZ AXFR test
ralphdolmans Aug 13, 2019
a16111d
Prevent potential double free
ralphdolmans Aug 16, 2019
ccb576f
- add always_deny action, use this one for RPZ
ralphdolmans Aug 23, 2019
bc39217
Don't pass along unused parameter
ralphdolmans Aug 23, 2019
2b5cd8e
Merge remote-tracking branch 'ralph/feature/rpz' into rpz
ralphdolmans Sep 9, 2019
4ac33aa
- Merge clean up
ralphdolmans Sep 9, 2019
9843b83
Merge branch 'master' into rpz
ralphdolmans Sep 9, 2019
f3dfb4d
Typo fix, reported by jpmens
ralphdolmans Sep 9, 2019
bbb737c
processing RPZ review feedback
ralphdolmans Nov 22, 2019
ae4f6a2
Proccess more review feedback
ralphdolmans Dec 23, 2019
2abaca7
- Fix dname_has_label() code review changes
ralphdolmans Dec 23, 2019
e098285
- Implement RPZ CNAME target wildcard synthesis
ralphdolmans Jan 15, 2020
14913d7
- processed RPZ review feedback
ralphdolmans Jan 15, 2020
344f12d
- fix compiler warnings
ralphdolmans Jan 15, 2020
1654373
- Fix doxygen issue
ralphdolmans Jan 15, 2020
627285a
- Fix faulty assert
ralphdolmans Jan 15, 2020
9877e52
Merge branch 'master' of github.com:NLnetLabs/unbound into rpz
ralphdolmans Jan 15, 2020
53d85f9
try to understand travis
ralphdolmans Jan 15, 2020
fd6456d
attemp to get more info out of travis
ralphdolmans Jan 15, 2020
72c4c6b
- Fix the dname_has_label fix
ralphdolmans Jan 16, 2020
24131ca
Revert travis verbosity
ralphdolmans Jan 16, 2020
b783732
- Add cname target wc synth. to testbound test
ralphdolmans Jan 16, 2020
bda4c4a
- improve dname_has_label(), add unit test
ralphdolmans Jan 16, 2020
e00ce7e
- extend rpz_respip.rpl with ipv6 without zz label case
ralphdolmans Jan 16, 2020
9df07b4
- Address review feedback
ralphdolmans Jan 28, 2020
ef12073
- Fix RPZ's get_tld_label maxdnamelen check
ralphdolmans Jan 29, 2020
1d91852
- Make dname_has_label's dnamelen check work with 0 length
ralphdolmans Jan 29, 2020
7da16fe
- Use consistent dname buffer sizes for RPZ
ralphdolmans Jan 29, 2020
88a706a
- Add extra dnamelen checks to ipdnametoaddr and netblockdnametoaddr
ralphdolmans Jan 29, 2020
3609287
- Fix RPZ stats RPZ_NO_OVERRIDE_ACTION check
ralphdolmans Jan 30, 2020
833c4b1
- Revert addition of cscope.out to project .gitignore, should be in
ralphdolmans Jan 30, 2020
b9c9fc0
- Fix RPZ locking issues on error conditions
ralphdolmans Jan 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion daemon/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ server_stats_compile(struct worker* worker, struct ub_stats_info* s, int reset)
s->svr.ans_secure += (long long)worker->env.mesh->ans_secure;
s->svr.ans_bogus += (long long)worker->env.mesh->ans_bogus;
s->svr.ans_rcode_nodata += (long long)worker->env.mesh->ans_nodata;
for(i=0; i<16; i++)
for(i=0; i<UB_STATS_RCODE_NUM; i++)
s->svr.ans_rcode[i] += (long long)worker->env.mesh->ans_rcode[i];
for(i=0; i<UB_STATS_RPZ_ACTION_NUM; i++)
s->svr.rpz_action[i] += (long long)worker->env.mesh->rpz_action[i];
Expand Down
6 changes: 4 additions & 2 deletions services/authzone.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,8 +1176,10 @@ az_insert_rr(struct auth_zone* z, uint8_t* rr, size_t rr_len,
return 0;
}
if(z->rpz) {
rpz_insert_rr(z->rpz, z->namelen, dname, dname_len, rr_type, rr_class, rr_ttl, rdata,
rdatalen, rr, rr_len);
if(!(rpz_insert_rr(z->rpz, z->namelen, dname, dname_len,
rr_type, rr_class, rr_ttl, rdata, rdatalen, rr,
rr_len)))
return 0;
}
return 1;
}
Expand Down
10 changes: 5 additions & 5 deletions services/localzone.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,17 +399,18 @@ rrset_insert_rr(struct regional* region, struct packed_rrset_data* pd,
int
local_rrset_remove_rr(struct packed_rrset_data* pd, size_t index)
{
log_assert(pd->count > 0);
if(index >= pd->count) {
log_warn("Trying to remove RR with out of bound index");
return 0;
}
if(index - 1 < pd->count) {
if(index + 1 < pd->count) {
/* not removing last element */
size_t nexti = index + 1;
size_t num = pd->count - nexti;
memcpy(pd->rr_len+index, pd->rr_len+nexti, sizeof(*pd->rr_len)*num);
memcpy(pd->rr_ttl+index, pd->rr_ttl+nexti, sizeof(*pd->rr_ttl)*num);
memcpy(pd->rr_data+index, pd->rr_data+nexti, sizeof(*pd->rr_data)*num);
memmove(pd->rr_len+index, pd->rr_len+nexti, sizeof(*pd->rr_len)*num);
memmove(pd->rr_ttl+index, pd->rr_ttl+nexti, sizeof(*pd->rr_ttl)*num);
memmove(pd->rr_data+index, pd->rr_data+nexti, sizeof(*pd->rr_data)*num);
}
pd->count--;
return 1;
Expand Down Expand Up @@ -1354,7 +1355,6 @@ find_tag_datas(struct query_info* qinfo, struct config_strlist* list,
return result;
}

/** answer local data match */
int
local_data_answer(struct local_zone* z, struct module_env* env,
struct query_info* qinfo, struct edns_data* edns,
Expand Down
33 changes: 33 additions & 0 deletions services/localzone.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,25 @@ enum respip_action {
respip_invalid = local_zone_invalid,
};

/**
* Get local data from local zone and encode answer.
* @param z: local zone to use
* @param env: module env
* @param qinfo: qinfo
* @param edns: edns data, for message encoding
* @param repinfo: reply info, for message encoding
* @param buf: commpoint buffer
* @param temp: scratchpad region
* @param labs: number of labels in qname
* @param ldp: where to store local data
* @param lzt: type of local zone
* @param tag: matching tag index
* @param tag_datas: alc specific tag data list
* @param tag_datas_size: size of tag_datas
* @param tagname: list of names of tags, for logging purpose
* @param num_tags: number of tags
* @return 1 on success
*/
int
local_data_answer(struct local_zone* z, struct module_env* env,
struct query_info* qinfo, struct edns_data* edns,
Expand All @@ -580,6 +599,20 @@ local_data_answer(struct local_zone* z, struct module_env* env,
enum localzone_type lz_type, int tag, struct config_strlist** tag_datas,
size_t tag_datas_size, char** tagname, int num_tags);

/**
* Add RR to local zone.
* @param z: local zone to add RR to
* @param nm: dname of RR
* @param nmlen: length of nm
* @param nmlabs: number of labels of nm
* @param rrtype: RR type
* @param rrclass: RR class
* @param ttl: TTL of RR to add
* @param rdata: RDATA of RR to add
* @param rdata_len: length of rdata
* @param rrstr: RR in string format, for logging
* @return: 1 on success
*/
int
local_zone_enter_rr(struct local_zone* z, uint8_t* nm, size_t nmlen,
int nmlabs, uint16_t rrtype, uint16_t rrclass, time_t ttl,
Expand Down
4 changes: 2 additions & 2 deletions services/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1592,8 +1592,8 @@ mesh_stats_clear(struct mesh_area* mesh)
timehist_clear(mesh->histogram);
mesh->ans_secure = 0;
mesh->ans_bogus = 0;
memset(&mesh->ans_rcode[0], 0, sizeof(size_t)*16);
memset(&mesh->rpz_action[0], 0, sizeof(size_t)*10);
memset(&mesh->ans_rcode[0], 0, sizeof(size_t)*UB_STATS_RCODE_NUM);
memset(&mesh->rpz_action[0], 0, sizeof(size_t)*UB_STATS_RPZ_ACTION_NUM);
mesh->ans_nodata = 0;
}

Expand Down
5 changes: 3 additions & 2 deletions services/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "util/module.h"
#include "services/modstack.h"
#include "services/rpz.h"
#include "libunbound/unbound.h"
struct sldns_buffer;
struct mesh_state;
struct mesh_reply;
Expand Down Expand Up @@ -122,11 +123,11 @@ struct mesh_area {
/** (extended stats) bogus replies */
size_t ans_bogus;
/** (extended stats) rcodes in replies */
size_t ans_rcode[16];
size_t ans_rcode[UB_STATS_RCODE_NUM];
/** (extended stats) rcode nodata in replies */
size_t ans_nodata;
/** (extended stats) type of applied RPZ action */
size_t rpz_action[10];
size_t rpz_action[UB_STATS_RPZ_ACTION_NUM];

/** backup of query if other operations recurse and need the
* network buffers */
Expand Down
Loading