Distributed Framework for Cybersecurity of Critical Infrastructures