python-3.xdicompynetdicom

Best way to validate DICOM connection request with pynetdicom


What is the preferred way to validate requested DICOM connection against a list of known hosts? I can connect to the EVT_CONN_OPEN event. But in that, the event.assoc.requestor.info.ae_title element is always empty (b''). I see from a TCP network analysis, that the name is transmitted. So, where is it? What is the right way to validate the requesting host?


Solution

  • You could try using EVT_REQUESTED instead, it gets triggered after an association request is received/sent and the AE title information should be available at that point. Unfortunately EVT_CONN_OPEN is triggered on TCP connection which occurs prior to the association request.

    If you don't like the host's details you can use the handler to send an association rejection message using event.assoc.acse.send_reject() or abort with event.assoc.abort().

    If you're only interested in validating against the AE title you can use the AE.require_calling_aet property to restrict associations to those with matching AE titles.