The short answer to the title question is: they were not. They had a multi-tiered defense, designed by a superhumanly powerful mind, Thufir Hawat, around a small innermost circle of VIP's who were arguably the very essence of House Atreides rather than, say, its titular head plus courtly parasites of questionable faithfulness.
It is not true that Duke Leto "was even aware that there was a traitor in their ranks" the moment he was ordered to Arrakis; if, that is, "their ranks" include the innermost circle. At this time, Hawat's computations included every possibility of a traitor without, not within it. This changed later in the novel; the Harkonnen Mentat had anticipated it, so that they were able to misdirect his suspicions long enough for the real traitor to act.
It is not true that "a complete stranger" could access the shield generators: only s/one as well-known and trustworthy as the Duke himself could and did do it. It is true that "a single person could eliminate the guards"; this was not just anyone though, it was a person who routinely protected them from poisoning attempts and kept them supremely fit to fight.
I'll also point out almost no-one, not even the Emperor and his Mentats and, most importantly, not even the Baron Harkonnen, could describe a practical way to recruit a traitor from this innermost circle: this is why the Fenrings could only warn that the Baron was convinced a traitor of his would do the job, not guess who the traitor was. Arguably, only the Bene Tleilax had any concrete plan to this effect and Piter De Vries was the only person in the entire Dune universe who knew the Tleilaxu plan had actually succeeded.