mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-11 20:16:27 +00:00
Honor deployment.useinsecureprotocols for ProxyDHCP boot
reply_dhcp4 declines to answer a PXE boot request unless deployment.useinsecureprotocols is set to firmware or always, but proxydhcp had no such check. A node left at the default of never was therefore still offered a TFTP bootfile and a plain http boot.ipxe URL whenever the request arrived on port 4011 rather than port 67, so the attribute silently did nothing in ProxyDHCP deployments alongside an independent DHCP server. Apply the same gate, including the UEFI HTTP boot exemption, and log the same remediation hint. The node attributes are now fetched once and passed through to get_deployment_profile instead of being looked up again there. Requests whose architecture could not be determined are ignored rather than falling through to the reply. opts_to_dict stops parsing before the client architecture option whenever the message type is not a request, and such a packet would otherwise reach the iPXE branch and be handed a plain http boot.ipxe URL without ever passing the gate.
This commit is contained in:
@@ -313,10 +313,27 @@ async def proxydhcp(handler, nodeguess):
|
||||
disco.get('uuid', 'unknown'), disco.get('hwaddr', 'unknown')
|
||||
)})
|
||||
continue
|
||||
cfd = cfg.get_node_attributes(
|
||||
node, ('deployment.*', 'collective.managercandidates'))
|
||||
if disco['arch'] is None:
|
||||
continue
|
||||
insecuremode = cfd.get(node, {}).get('deployment.useinsecureprotocols',
|
||||
{}).get('value', 'never')
|
||||
if not insecuremode:
|
||||
insecuremode = 'never'
|
||||
if insecuremode == 'never' and disco['arch'] != 'uefi-httpboot':
|
||||
if not skiplogging:
|
||||
log.log(
|
||||
{'info': 'Boot attempt by {0} detected in insecure mode, but '
|
||||
'insecure mode is disabled. Set the attribute '
|
||||
'`deployment.useinsecureprotocols` to `firmware` or '
|
||||
'`always` to enable support, or use UEFI HTTP boot '
|
||||
'with HTTPS.'.format(node)})
|
||||
continue
|
||||
profile = None
|
||||
if not myipn:
|
||||
myipn = socket.inet_aton(recv)
|
||||
profile, stgprofile = get_deployment_profile(node, cfg)
|
||||
profile, stgprofile = get_deployment_profile(node, cfg, cfd)
|
||||
if profile:
|
||||
log.log({
|
||||
'info': 'Offering proxyDHCP boot from {0} to {1} ({2})'.format(recv, node, client[0])})
|
||||
@@ -326,7 +343,7 @@ async def proxydhcp(handler, nodeguess):
|
||||
continue
|
||||
if opts.get(77, None) == b'iPXE':
|
||||
if not profile:
|
||||
profile, stgprofile = get_deployment_profile(node, cfg)
|
||||
profile, stgprofile = get_deployment_profile(node, cfg, cfd)
|
||||
if not profile:
|
||||
log.log({'info': 'No pending profile for {0}, skipping proxyDHCP reply'.format(node)})
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user