Attacking the canal was probably pretty risky, since the Canal was heavily defended, but I wanted to know if an enterprising u-boat captain ever attempted to enter the Canal. I have not found any examples, but absence of evidence and all that...
No U-boats to my knowledge tried to penetrate the Suez canal during WW2, but Luftwaffe aircraft did carry out a mining campaign against it, using magnetic mines dropped by bombers at night. This represented a serious threat to maritime traffic through the canal, so strong mine-warfare countermeasures were put in place to clear them. One simple but very effective measure was to place Egyptian soldiers at positions along the canal, armed with simple pointing devices consisting of a length of wood fixed to a board in way that allowed it to swivel. When Luftwaffe bombers dropped mines in the canal, the soldiers in positions near the mined location would use these devices to point at the rough location of were they heard or saw the mine enter the water. By triangulating the position from several of these posts navy minesweepers could get a rough but effective location of where mines had been dropped and deal with them accordingly. Another beneficial effect was that the Egyptian soldiers would often blaze away with all arms available when they heard German aircraft flying down the canal on mining runs. This didn't often shoot down aircraft, but sometimes spoiled mining attempts by causing mines to be dropped too low or even miss the canal all together.
Suez minesweeper units also received new technology quickly for the clearance of magnetic mines, such the Double L sweep for ships, and even aircraft adapted for the purpose, such as this Vickers Wellington, equipped with a large magnetic field generator to detonate mines as it flew over them, which apparently required nerves of steel for the crew and damaged the aircraft on several occasions.