A Near-Optimal Redundancy Allocation Strategy that Minimizes a System's Vulnerability to Hazardous Events and Malicious Attacks