Teaching cybersecurity is very challenging as it requires coverage of many different technologies, protocols, tools, and systems. This paper presents SERA, a modular and highly customizable framework specifically designed for the definition of cybersecurity exercises with automatic evaluation and feedback. The framework defines a simple yet powerful language for the specification of lab exercises, which are instantiated at runtime into personalized tasks for each student. The language supports the definition of checks that should be passed for considering that the exercise is complete. Moreover, it is possible to associate some feedback to the checks with the goal of guiding the student towards the solution in case it is necessary, thus promoting self-learning and students’ autonomy. SERA also keeps information regarding students’ submissions in order to track students’ progress and identify potential difficulties and limitations. Finally, the SERA framework has been integrated with the Moodle learning platform and is currently under beta testing in several computer security courses at the University of Malaga.