The integration of synchronous generators and energy storage systems operated through communication networks introduces new challenges and vulnerabilities to the electric grid, where cyber attacks can corrupt sensor measurements or control inputs and interrupt functions such as frequency regulation. This paper proposes a defense methodology for the design of resilient operating constraints imposed on each generation and storage unit in order to prevent any attack sequence from driving the system's frequency to unsafe conditions. The resilient operating constraints are found by using ellipsoidal approximations of the reachable set of the power system, leading to a convex optimization problem with linear matrix inequalities. Numerical results in a single-area power system with synchronous generation and energy storage demonstrate how the resilient constraints provide security guarantees against any type of attack affecting frequency measurements or controller setpoints.