Traditionally, critical systems have been deployed in isolation, that is, in closed environments where the access control was easily managed. However, the increasing complexity and connectivity of these systems make them vulnerable to cyberattacks,
malfunctioning or any kind of uncontrolled events. In this work, we propose a framework that is capable of automatically adapt its configuration for addressing the challenges of an environmental change. To this end, we model the critical system as a Petri net which is enriched with product lines that implement actions for different scenarios. The execution traces are then continuously monitored and provide information to the control logic responsible for achieving the critical system goals by means of the product lines.This work was supported by the Spanish Ministry of Science and Innovation under projects FAME (RTI2018- 093608-B-C31), MASSIVE (RTI2018-095255-B-I00) and the Comunidad de Madrid under project FORTE-CM (S2018/TCS-4314) co-funded by EIE Funds of the European Union