Oh dear, not this old chestnut again. Let's be clear people, there is no international law that defines the circumstances of "legal warfare". The entire notion of an "illegal war" is a complete fabrication.
The closest we have is a prohibition on "Wars of Aggression", however there is no internationally established definition of what constitutes a "War of Aggression", making this prohibition completely meaningless.
As such, there is only one way, currently, in which a war can be determined to be illegal, and that is by the UNSC declaring it to be illegal under Chapter VII of the UN Charter.
Further, you cannot simply talk of the "Iraq War". There are two distinct stages to the Iraq War, and each has enormously different legal status.
Firstly, there is the invasion stage, which in my opinion should be considered a War of Aggression, and therefore illegal. However lacking a definition for a War of Aggression, such a legal finding cannot be made. I'd like to see an international treaty drafted up which defines such an act in specific terms.
Secondly, there is the occupation stage of the Iraq War, which constitutes the overwhelming majority of the duration of the conflict, the overwhelming majority of the casualties (on both sides) and draws the overwhelming majority of criticism.
The occupation of Iraq is mandated by the UN Security Council, and is not illegal.
Let that sink in, for a moment, please.
The occupation is a legal military operation sanctioned by the International Community. Indeed, the authorisation for this operation is itself international law.