Illegal. A military officer cannot be named Secretary of Defense until more than 7 years has passed since they left active duty.
Correct but the Congress can waive, set aside, that requirement!
Funny how we never thought of such a thing when the greatest Secretary of both Defense and State was in office; General of the Army, George C Marshall!