The US and Iran agreed (Point 4 and 5) on, for the next 60 days, Iran is "chief of traffic" in the strait.
Iran say now, ships have to take the route close to Iran. But some ships like to take the route close to Oman. Iran is just shooting on these ships.
Furthermore, if they want to deal with the US or Israel, then they should target American or Israeli assets. Not third party ships manned by citizens of neutral nations who just want to get to port and remit cash to their families back home.
Those ships are bearing goods from (or taking goods to) countries that are hosting US forces attacking them. They’re valid targets, and blockading their shipping… I mean, the US does that to countries that haven’t even helped attack us, seems insane to suggest it’s somehow a foul to do that to countries that are helping attack you.
A lot of these "neutral" countries either host US military bases, US companies, or are otherwise aligned generally with the US.