All coups are by definition “illegal”.
But the winner of the coup gets to draft new laws, a new constitution, and so on - so overthrowing the new regime would be illegal from their perspective.
As an aside, Obama should keep in mind that he has not proven that his Constitutionally able to be U.S. President. Something about a missing birth certificate...