The best way is a cable where you can attach the 25 pin D to after bringing the cable through a 1/2" conduit strain relief, these have a rubber grommet that tightens down on to the cable.
The down side is you have to attach a 25 pin D plug on one end yourself, there are solder types, but the easy way is to borrow a crimper.
Otherwise you could cut a D shape in the enclosure and fit threaded standoffs to secure the internal cable end , this requires two cables. One inside, one outside.
If you need heatsink material, look for a supplier that sells heatsink extrusion by the foot.
Or you can use thin sections of 80/20.
I have also found some large surplus Intel processor heatsinks that were 4"x3" by 1.5" high.