A ransomware attack in January in New Britain, Conn., and an attempted “interruption” in Meriden in February highlight the ongoing cybersecurity threat to municipalities and others.