We don't know Obama's opinion because Obama was a community organizer when the war started. Second, Obama helped throw out the leader of Egypt to install the Muslim brotherhood, and he invaded Libya which was a huge debacle.
He also claimed he was going to close Gitmo. I love how the media went radio silent about Gitmo too.
He was a State Senator running for US Senator.
In May 2002, Obama commissioned a poll to assess his prospects in a 2004 U.S. Senate race. He created a campaign committee, began raising funds, and lined up political media consultant David Axelrod by August 2002. Obama formally announced his candidacy in January 2003.[126]
Obama was an early opponent of the George W. Bush administration's 2003 invasion of Iraq.[127] On October 2, 2002, the day President Bush and Congress agreed on the joint resolution authorizing the Iraq War,[128] Obama addressed the first high-profile Chicago anti-Iraq War rally,[129] and spoke out against the war.[130] He addressed another anti-war rally in March 2003 and told the crowd "it's not too late" to stop the war.[131]