What is an embassy/consulate allowed to do in self defense?

Legally or unspoken rules wise if people invade the embassy? Just to avoid this veering into arguments about machine gunning crowds lets keep it to people that have breeched the perimeter fence or actually inside the embassy.

The duty of defense of the embassy lies with the nation hosting it, but if that nation makes no attempt to defend it then legally the invaders of the embassy could be judged to be de facto agents of the state and the embassy would be entitled to use all its own power and the power of its parent state in defense.

Also I don’t believe anything can restrict the individual’s right to defend his or her own life.

The Marine Security Guard has a duty to protect the Ambassador and classified materials. Using deadly force is an absolute last resort, however, and they usually provide delaying actions to allow destruction/securing of material, or for the ambo to find safety. Few embassies are equipped for extended armed resistance. Since an embassy is technically US soil, they are within their rights under SOFA agreements to defend their lives, but it’s the host nation that is supposed to provide protection.