Hostname support in cchost configs
Currently, cchost configs like rpc-address node-address target-rpc-address require IP address and do not support hostname. k8s StatefulSet support stable identities to pods with hostname rather than ephemeral IP address.
In such cases, if cchost supports hostname inherently, it will easier to lift and shift ccf applications.
Alternatives considered: when the IP address changes due to a reschedule to a k8s node, the pod has to rejoin the network as if it were a new node.
Error reported when supplied with hostname:port :
./cchost --enclave-file=libloggingenc.so.signed --consensus raft --enclave-type=debug --ledger-file=ccf4q.ledger --node-cert-file=node_cert.pem --quote-file=quote.bin --host-log-level=info --raft-election-timeout-ms=100000 --raft-timeout-ms=500 --node-address=ccf-0.ccf.default.svc.cluster.local:3100 --rpc-address=ccf-0.ccf.default.svc.cluster.local:3200 start --network-cert-file=network_cert.pem --gov-script=input/gov.lua --member-cert=input/member1_cert.pem
2020-01-28T10:06:00.298705Z [info ] /tmp/CCF/src/host/main.cpp:369 | Creating new node: new network (with 1 initial member(s))
2020-01-28T10:06:00.310855Z [(H)ERROR] tid(0x7fbc2915f780) | :OE_ENCLAVE_ABORTING [../host/calls.c:oe_call_enclave_function_by_table_id:91]
2020-01-28T10:06:00.310874Z [fatal] /tmp/CCF/src/host/enclave.h:109 | Failed to call in enclave_create_node: OE_ENCLAVE_ABORTING
terminate called after throwing an instance of 'std::logic_error'
what(): Fatal: 2020-01-28T10:06:00.310874Z [fatal] /tmp/CCF/src/host/enclave.h:109 | Failed to call in enclave_create_node: OE_ENCLAVE_ABORTING
This feature can help in rejoining scenarios as well.
Currently, a node cannot restart with the same IP:port combination #375
But with hostnames, these scenarios can help identify a restarting node as a existing node, instead of retire -> rejoin.
@iqsarv I'm not sure I understand what you mean. Each node has a unique identity (ie. public/private key-pair), regardless of the network address(es) it's accessible from.
If an instance of a CCF node was listening on an address, and it shuts down, any other instance is distinct and a new node, regardless of whether it's listening to the same address and port.
In any case, we want to support using hostnames for those values, and @jumaffre is looking at this now.
@achamayou thanks for pointing out.
It will be more user-friendly if we can provide a mechanism of re-joining the network without needing to retire from the network. This is because of the fact that the grace-period we get during a shutdown-hook (or other termination-hooks) are not reliable to make this retire call. And in such case of a abrupt node failure, i believe we are having those zombie nodes contributing to f
Let me know if I missing something.
As a corollary to above point, if the user wants a desired fault tolerance setting N(2f+1), does it make sense to cleanup these zombie nodes periodically with a timeout by re-configuring the network.
Allowing more than one instance of a node to use that node's identity has very unpleasant security implications, it really is something we want to avoid.
I understand termination hooks are awkward, but it seems to me that there's bound to be something monitoring the health of the nodes and perhaps that could be proposing retirement (reliably)? A node may be dead for all intents and purposes (for example because of a network partition) even though the pod/VM hasn't shut down, and this is also a concern, so I think the best path is to have external monitoring retire (and spin up) as necessary.
@iqsarv shall I book a meeting on Monday so we can discuss this more in depth? Separately from hostname support (which is going to happen), it sounds like something we could try and improve.
The cchost command used above to start on ccf-0.ccf.default.svc.cluster.local requires the --domain= argument (e.g. --domain=ccf-0.ccf.default.svc.cluster.local). Otherwise, CCF assumes that the host part of --rpc-address is an IP address.
@iqsarv: Could you try this to see if it fixes your issue? I will make sure that the error message is clearer, instead of the enclave crashing abruptly.
@jumaffre --domain fixed the issue. thanks
i missed the documentation. I will close the issue
@iqsarv No worries at all. I will make the documentation clearer and update cchost to display a useful error message.