“Do you deny that Lincoln and the Union goverment thought it was illegal?”
You can’t apply the concept of “legal” or “illegal” to war, it simply makes no sense. Laws apply to individual men, while it is nations (or similar bodies of men) that go to war. That’s why there is no law on the books against war, because it wouldn’t make any sense, because you can’t prosecute a nation.
You could talk about whether a war is “just” or not, but not whether it is “legal” or not.
Now, there are certain modern treaties that define circumstances where its member states can go to war and penalties for going to war outside those circumstances. In those cases, you could talk about an “illegal war”, but those treaties aren’t applicable here, because this war predates them.
Would you consider an act illegal if it was specifically prohibited in the US Constitution? Article III, Section 3 of the Constitution specifically addresses Treason. It says “”Treason against the United States shall consist only in levying war against them, or in adhering to their enemies, giving them aid and comfort.” I think that the South’s action would safely fall under the “levying war” part of this article. Now if you want to quibble and say the war was not illegal, only the actions of those people waging (or “levying” to use the words of the Constitution)it, go ahead, but it’s the same thing.