The UN Security Council has passed a resolution permitting member countries to enter the territorial waters of Somalia to fight piracy.