Optimal placement of security resources for the internet of things