It is not illegal, but make sure you get one that is pretty discreet. A lot of entities here may look at it as a threat, so there are a lot of dashcam kits which are pretty discrete (ie, cameras don't look like cameras and hidden wiring).which you can use. My neighbor has a dashcam which is NOT discrete installed on his little kia---he got in a accident a couple of years ago when a school bus was driving on the wrong side of the road and hit him. Anyhow, bus driver blamed him and the dashcam got that driver fired--so it works out for the good sometimes.
Russia had issues with insurance fraud where drivers would get targeted and then claim insurance money. It got so bad that everyone was encouraged to install dashcams in their cars and as a result, insurance fraud was reduced. Also, a lot of cool dashcam footage has come out of Russia of this
meteorite a few years ago.