In fact, there are agreements between the UN, the host country and the country that provides troops. Some immunity prevails during peace missions, in the field. Responsibility for prosecuting military personnel who are subject to allegations falls on the country. How are most cases settled? The accused is sent back to his country, and it is up to that country to lay charges against him. UN officials are definitely putting pressure on those countries to follow through with the judicial process, but otherwise they have no power. That is a matter of the state sovereignty of the country that provides troops.
There are various mechanisms, including a code of conduct and a code of prevention. At MONUC, for example, an officer is responsible for keeping an eye on the comings and goings of personnel and for establishing certain no-go zones, specifically to prevent violence or cases of sexual abuse by its peacekeepers.