Skip to content

Features/rfc7844 - #6436

Merged
poettering merged 8 commits into
systemd:masterfrom
juga0:features/rfc7844
Sep 7, 2017
Merged

poettering merged 8 commits into
systemd:masterfrom
juga0:features/rfc7844

Conversation

@juga0

@juga0 juga0 commented Jul 24, 2017

Copy link
Copy Markdown
Contributor

networkd: implement the Anonymity Profiles specified in RFC7844

This PR is not intended to be accepted as it is, but to show how the
code would change implementing the RFC7844 Anonymity Profiles and to
obtain comments on what would be the prefered way to implement them.
There could be a configuration variable to enable or disable the
Anonymity Profiles.

Comment thread src/libsystemd-network/sd-dhcp-client.c Outdated
*/
/* NOTE: sending PRL options that Windows 10 RFC7844 implementation sends,
* ordered by code number, which in hexadecimal is:
* 37 0d 01 03 06 0f 1f 21 2b 2c 2e 2f 79 f9 fc */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of hiding in the crowd ;)

I don't get the comment though: 37 0d 01 ... is not the same as 1 3 6 ... below.

@juga0 juga0 Jul 25, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of hiding in the crowd ;)

:) i think what technically is called "bigger anonymity set"

I don't get the comment though: 37 0d 01 ... is not the same as 1 3 6 ... below.

It is: 0x35 = 55 (PRL), 0x0d = 15 (option length), and " 01 03 06 0f 1f 21 2b 2c 2e 2f 79 f9 fc" the actual options, iirc. It was useful to me when checking the tcpdump hex dump.
I think i should remove that comment, or use that hex string in a test, but i'm not sure how to create the test with it.

client->req_opts_size, client->req_opts);
if (r < 0)
return r;
/* NOTE: in case that there would be an option to do not send

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"to do not send any PRL" → "to send no PRLs"

Also a space between if and (.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment thread src/systemd/sd-dhcp-client.h Outdated
SD_DHCP_OPTION_INTERFACE_MTU_AGING_TIMEOUT = 24,
SD_DHCP_OPTION_INTERFACE_MTU = 26,
SD_DHCP_OPTION_BROADCAST = 28,
/* RFC7844, Windows 10 option */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by this comment? RFC7844 does not seem to define DHCP options.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, useful to me when doing grep, to find all my changes related to the RFC, but i should remove it.

@keszybz

keszybz commented Jul 25, 2017

Copy link
Copy Markdown
Member

I think it's something that we want, even though I imagine that getting things to the point where our DHCP implementation is hard to distinguish from others' will be a lot of work. Doesn't mean that we should start somewhere.

How do you envision this should work at the high level? We certainly want to keep current non-anonymous default which are suitable for servers and virtualized systems. I'd imagine that we add a single option: [DHCP] Anonymize=yes|no (no by default). When set, it'd flip the relevant settings. The order of options would matter, and e.g. DUIDType=foobar Anonymize=yes would be different than Anonymize=yes DUIDType=foobar. That would be the simplest to implement, and relatively straightforward to understand.

By default Anonymize=yes should give the best options as recommended by RFC 7844 (and mimicking Win10 when reasonable). If the user needs to deviate from that, they can do that by following with some tweaks like DUIDType= and so on.

@juga0

juga0 commented Jul 25, 2017 •

Copy link
Copy Markdown
Contributor Author

@keszybz: thanks a lot for your possitive comments.
In similar words to what @huitema, (one of the authors of the RFC 7844) told me, it's going to be very hard to do not fingerprint operating systems, because of many reasons, as other TCP/IP layers. But at least we could try to avoid fingerprinting a single person.
I chose to use the same options as Windows 10 because IMHO, the RFC is a bit too flexible about the options to choose, and at least choosing these: a. seem to work in most systems and b. would not make OS fingerprinting that obvious.

The order of options would matter, and e.g. DUIDType=foobar Anonymize=yes would be different than Anonymize=yes DUIDType=foobar.

Hmm, i didn't think about that possibility, i was only having in mind:

  1. When Anonymize=yes, "nullify" any other extra configuration, because most of them would deanonymize the client or even the person.
  2. When Anonymize=yes, and other options are present (like send_host_name=yes), accept them but giving a warning to the user.

According to my little experience with this code so far, i think 1. is easier to implement.
Would it help if i create another branch with an "Anonymize=yes|no" variable and modify the code according to it?.

@huitema

huitema commented Jul 25, 2017 via email

Copy link
Copy Markdown

@dkg

dkg commented Jul 26, 2017

Copy link
Copy Markdown
Contributor

Just exploring the design space, with another possible proposal:

Rather than introducing a new setting Anonymize, what if we choose whether to go with the anonymous approach based on whether the MACAddressPolicy of the underlying link is set to random (see systemd.link(5))? That would address @huitema's concern, and it would give the user a single knob to twiddle to opt into a large anonymity set, which is certainly more convenient.

If the user adds any explicit directives to the .network file, then those directives would explicitly override the anonymity defaults, of course.

@keszybz

keszybz commented Jul 26, 2017

Copy link
Copy Markdown
Member
  1. When Anonymize=yes, "nullify" any other extra configuration, because most of them would deanonymize the client or even the person.

(By "nullify" I understand you mean configuration that comes before and after this setting, as opposed to just before as in my description in #6436 (comment).)

  1. When Anonymize=yes, and other options are present (like send_host_name=yes), accept them but giving a warning to the user.

Nah, anonymity is important, but but like security, it doesn't trump all other considerations. We should never ignore configuration explicitly specified by the user. I think Anonymize=yes should be a way to conveniently use a curated set of settings, but we shouldn't forbid deviating from that if needed. So neither 1. nor 2. are useful approaches.

choose whether to go with the anonymous approach based on whether the MACAddressPolicy of the underlying link is set to "random"

This would not be backwards compatible, since MACAddressPolicy has been for a while and it would suddenly have a much larger scope. It also seems like too much magic. It's unfortunate that MACAddressPolicy is in .link files, so we can't make MACAddressPolicy controlled by Anonymize=yes.
We can think about adding a new MACAddressPolicy policy setting (like MACAddressPolicy=anonymous) that would turn on Anonymize=yes automatically, but this is better done later, when Anonymize is actually implemented.

Having a separate Anonymize= setting also make whole thing much easier to document:

Anonymize: adjust various settings to preserve anonymity as recommended by RFC7844. Currently this sets A=blah, B=foobar, and ...

@poettering

Copy link
Copy Markdown
Member

adding Anonymize= to .network files appears to be a good addition to me, and deriving too much from the MAC address opion in .link sounds a bit too magic for my taste I must say.

@poettering

Copy link
Copy Markdown
Member

let's drop the "needs-discussion" label, I think "Anonymize=BOOL" got enough support

@poettering poettering added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks and removed needs-discussion 🤔 labels Jul 31, 2017
@juga0

juga0 commented Aug 4, 2017 •

Copy link
Copy Markdown
Contributor Author

Thanks all of you for your comments.

@keszybz, if this is the code networkd-network.c#L255 where the configuration variables are loaded, i didn't see an easy way to check whether Anonymize was set before or after than other variables.

I've leave notes in the code that can be useful while reviewing this PR, probably i should remove most of them.

I did push -f so we can continue commenting in this PR, and moved the code i had so far to networkd_rfc7844_novar.

@juga0
juga0 force-pushed the features/rfc7844 branch from 833798c to 0eb8231 Compare August 4, 2017 15:02
@keszybz keszybz removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Aug 6, 2017

@poettering poettering left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some more nitpicks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this same commit should also carry the addition of the bool to the Network structure...

Comment thread man/systemd.network.xml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please write this as <varname>Anonymize=</varname>, we try to stick to the same formatting for all settings

Comment thread man/systemd.network.xml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, our docbook usage isn't entirely clean, but I think for new additions we should rally stick to using <varname>…</varname> for all configuration file settings, and not <option>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart of the format, i've changed also the content, because right now the order of other configuration variables doesn't overwrite what Anonymize sets, as i didn't see an easy way to check whether other variables are set before or after Anonymize.

Comment thread src/network/networkd-network.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the commit that adds a new prototype should also carry the implementation

Comment thread src/network/networkd-network.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd rewrite that this as:

if (!network->dhcp_anonymize)
        return;

such an early exit has the benefit that we don't have to indent as much...

Comment thread src/network/networkd-dhcp4.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant about the comment <>,
as they won't be sent using Anonymize.

Comment thread src/libsystemd-network/sd-dhcp-client.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spurious change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd pass this as "false" here... after all the compiler will make no difference anyway, as bools degrade to int automatically... In public APIs we use C89 "int" for booleans, even though we use C99 "bool" everywhere else, and I figure that means in this case writing "flase" is much nicer to read, even if the parameter is actually an int because this is part of a supposedly eventually to be made public API

Comment thread src/network/networkd-dhcp4.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cast is redundant, the C compiler does that silently and automatically anyway

Comment thread src/libsystemd-network/sd-dhcp-client.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space between if and (

@juga0
juga0 force-pushed the features/rfc7844 branch from 0eb8231 to bd8603e Compare August 10, 2017 09:58
@juga0

juga0 commented Aug 10, 2017

Copy link
Copy Markdown
Contributor Author

Thanks a lot @poettering. I think i resolved all your comments, further review would be great.

@poettering poettering left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty good. some more comments.

Sorry for the late review, many of us have been on vacation the past weeks (and some still are)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the first patch in the series, but it references a variable "anonymize" that isn't added at the same time here.

Please make sure that each individual commit remains compilable.

Comment thread man/systemd.network.xml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably say something like "Takes a boolean argument" or so, first.

Comment thread man/systemd.network.xml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe make the RFC a ulink to the RFC text online?

Comment thread src/network/networkd-network.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit really needs to come before you add it to the gperf table. I'd probably just merge the two commits into one if I were you, no need to be too finegrained on this thing

Comment thread src/network/networkd-dhcp4.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should request this only if dhcp_use_timezone is set. A patch for that would be very welcome

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created #6725 and #6726. I'll remove the note after we check that those patch are fine.

@juga0

juga0 commented Sep 1, 2017

Copy link
Copy Markdown
Contributor Author

Thanks for the comments, I agree with them and i've rebased the commits following them. I've also checked that the individual commits remain compilable.
More comments welcome.

@poettering

Copy link
Copy Markdown
Member

lgtm now, but needs a rebase, one of your own patches broke the merge ... ;-)

@poettering poettering added needs-rebase and removed reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks labels Sep 6, 2017
to enable Anonymity Profiles and document it.
to initialize Network variables when Anonymize is true.

* do not send hostname
* client identifier set to MAC
* do not send vendor class identifier
* do not send other PRL options
Add also Client variable to know when Anonymize is true.
* check that Client has reserved memory for PRL
* do not send duplicated ROUTES option when Anonymize is true
when Anonymize is enabled.

Use the Client variable to know whether it is enabled.
@juga0

juga0 commented Sep 6, 2017

Copy link
Copy Markdown
Contributor Author

Rebased, now timezone and NTP options are sent depending on their configurations (by the other merges) instead of depending on anonymize.
Thanks

@poettering

Copy link
Copy Markdown
Member

test-compress timed out during CI. I am pretty sure that's unrelated to the PR at hand. Merging.

@poettering
poettering merged commit 504cef7 into systemd:master Sep 7, 2017
mearsten referenced this pull request Nov 17, 2019
According to RFC7844 section 3 the DHCPDISCOVER message should not contain option 50 («Requested IP Address») when Anonymize is true
@mearsten

mearsten commented Nov 17, 2019 •

Copy link
Copy Markdown
Contributor

@juga0 I appreciate your work! Could you please have a look on issue #13992 (and pr #14049)? Was that case missed or somethig has been broken since the PR? Thank s a lot!

@juga0

juga0 commented Nov 17, 2019

Copy link
Copy Markdown
Contributor Author

@serge-name thanks for letting me know, i'll have a look during next week.

@juga0

juga0 commented Nov 20, 2019 •

Copy link
Copy Markdown
Contributor Author

@serge-name I looked the diff of this file in this PR with the file in your PR #14049 and i don't think anything else broke this, just that i didn't see this case. So i think your patch is correct.

Regarding the disucssion in #13992, i did not integrate the Anonymize option to check that MACAddressPolicy is True, what would be great to ensure that the MAC is being randomized, just commented on it (7585baa#diff-7fafbb4ebb0047d70a37c604a941252fR1008).
It's possible, like in your case, that the MAC is changed via other mechanism, but i don't think it matters for this bug.

This bug happens because there are not test for this case (and other possible situations in which Anonymize might not be check). It would be great to have them, i just didn't implement it cause i'm not familiar with systemd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

6 participants