A method for enabling security in an electrical system, the method comprising: examining, by a controller device in an electrical substation, a configuration file for the substation, wherein the substation includes an electrical device (110c, 116a, 116b) and a network device (118a, 118b) in an electrical system, wherein communication associated with the electrical device (110c, 116a, 116b) is transmitted using the network device (118a, 118b), and wherein one or more roles that are allowed for the electrical device are specified by the configuration file; based on examining the configuration file, determining, by the controller device, characteristics of the electrical device (1 10c, 116a, 116b), the characteristics comprising allowed communication patterns for the electrical device, wherein the determining comprises: determining the allowed communication patterns associated with the electrical device based on an allowed role of the electrical device, wherein the allowed role of the electrical device is selected from a group including a current transformer, a voltage transformer, a circuit breaker, an isolator and an insulation monitor; generating, by the controller device and based on the determined characteristics of the electrical device (110c, 116a, 116b), a rule for the electrical device (110c, 116a, 116b) that conforms to the determined characteristics; and configuring, by the controller device, a security policy in the network device (118a, 118b) in the substation to incorporate the generated rule, the security policy configured to allow only the allowed communication patterns for the electrical device (110c, 116a, 116b). examining, by a controller device in an electrical substation, a configuration file for the substation, wherein the substation includes an electrical device (110c, 116a, 116b) and a network device (118a, 118b) in an electrical system, wherein communication associated with the electrical device (110c, 116a, 116b) is transmitted using the network device (118a, 118b), and wherein one or more roles that are allowed for the electrical device are specified by the configuration file; based on examining the configuration file, determining, by the controller device, characteristics of the electrical device (1 10c, 116a, 116b), the characteristics comprising allowed communication patterns for the electrical device, wherein the determining comprises: determining the allowed communication patterns associated with the electrical device based on an allowed role of the electrical device, wherein the allowed role of the electrical device is selected from a group including a current transformer, a voltage transformer, a circuit breaker, an isolator and an insulation monitor; generating, by the controller device and based on the determined characteristics of the electrical device (110c, 116a, 116b), a rule for the electrical device (110c, 116a, 116b) that conforms to the determined characteristics; and configuring, by the controller device, a security policy in the network device (118a, 118b) in the substation to incorporate the generated rule, the security policy configured to allow only the allowed communication patterns for the electrical device (110c, 116a, 116b).