• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

Makefile.amH A D17-Dec-20211.7 KiB5024

README.mdH A D17-Dec-20212 KiB6243

addr_lib.cH A D17-Dec-202115.2 KiB649496

addr_lib.hH A D17-Dec-20211.5 KiB4515

cfnet.hH A D17-Dec-20213.7 KiB13170

classic.cH A D17-Dec-20214.9 KiB16990

classic.hH A D17-Dec-20211.2 KiB336

client_code.cH A D17-Dec-202127.1 KiB910686

client_code.hH A D17-Dec-20212 KiB5820

client_protocol.cH A D17-Dec-202117.3 KiB562390

client_protocol.hH A D17-Dec-20211.3 KiB399

communication.cH A D17-Dec-20217.1 KiB252180

communication.hH A D17-Dec-20211.6 KiB4812

conn_cache.cH A D17-Dec-20217.7 KiB243163

conn_cache.hH A D17-Dec-20211.7 KiB5219

connection_info.cH A D17-Dec-20213.6 KiB170119

connection_info.hH A D17-Dec-20214.9 KiB16235

key.cH A D17-Dec-20212.6 KiB11980

key.hH A D17-Dec-20212.6 KiB9314

misc.cH A D17-Dec-20211.5 KiB5525

net.cH A D17-Dec-202122 KiB712463

net.hH A D17-Dec-20211.8 KiB5513

policy_server.cH A D17-Dec-202110 KiB356201

policy_server.hH A D17-Dec-20211.8 KiB5214

protocol.cH A D17-Dec-20218.5 KiB303233

protocol.hH A D17-Dec-20215.9 KiB15813

protocol_version.cH A D17-Dec-2021998 4136

protocol_version.hH A D17-Dec-20213.5 KiB12464

server_code.cH A D17-Dec-20219.3 KiB304228

server_code.hH A D17-Dec-2021205 106

stat_cache.cH A D17-Dec-202112.1 KiB407301

stat_cache.hH A D17-Dec-20212.8 KiB7544

tls_client.cH A D17-Dec-202110.8 KiB380252

tls_client.hH A D17-Dec-20211.5 KiB4713

tls_generic.cH A D17-Dec-202133.5 KiB1,066755

tls_generic.hH A D17-Dec-20211.8 KiB5318

README.md

1# libcfnet - CFEngine Network protocol
2
3Generally, details about the protocol are explained in comments / code.
4However, some explanations don't naturally fit in one part / file of the codebase.
5So, they are provided here.
6
7
8## Network protocol versioning
9
10
11### Protocol versions
12
13Names of protocol versions:
14
151. `"classic"` - Legacy, pre-TLS, protocol. Not enabled or allowed by default.
162. `"tls"` - TLS Protocol using OpenSSL. Encrypted and 2-way authentication.
173. `"cookie"` - TLS Protocol with cookie command for duplicate host detection.
18
19Wanted protocol version can be specified from policy:
20
21```
22body copy_from protocol_latest
23{
24  protocol_version => "latest";
25}
26```
27
28Additionally, numbers can also be used:
29
30```
31body copy_from protocol_three
32{
33  protocol_version => "3";
34}
35```
36
37
38### Version negotiation
39
40Client side (`cf-agent`, `cf-hub`, `cf-runagent`, `cf-net`) uses `ServerConnection()` function to connect to a server.
41Server side (`cf-serverd`, `cf-testd`) uses `ServerTLSPeek()` to check if the connection is TLS or not, distinguishing version 1 and 2.
42Protocol version 1 is not allowed by default, but can be allowed using `allowlegacyconnects`.
43Version negotiation then happens inside `ServerIdentificationDialog()` (server side) and `ServerConnection()` (client side).
44Client requests a wanted version, by sending a version string, for example:
45
46```
47CFE_v3
48```
49
50The version requested is usually the latest supported, unless specified in policy (`body copy_from`).
51Then, the server responds with the highest supported version (but not higher than the requested version).
52For a 3.12 server, this would be:
53
54```
55CFE_v2
56```
57
58Both server and client will then set `conn_info->protocol` to `2`, and use protocol version 2.
59There is currently no way to require a specific version number (only allow / disallow version 1).
60This is because version 2 and 3 are practically identical.
61Downgrade from version 3 to 2 happens seamlessly, but crucially, it doesn't downgrade to version 1 inside the TLS code.
62