The 35-year-old is well known to Town fans from his loan spell with the club and was available after being freed by Wembley foes Bradford City although he had been offered a new deal with the Bantams that would also have led to some coaching work.
"Matt was always our number one keeping target this summer and I'm delighted to get him," said boss Aidy Boothroyd who will be pleased to gain a player he knows plenty about to replace the departed Lee Nicholls.
And it was the prospect of linking up once again with Boothroyd that persuaded Duke to make the move.
He told the Telegraph & Argus in Bradford: “I was very impressed with how he works when I went down there on loan.
"Once I’d made up my mind to leave Bradford, it was easy in the end to decide to work with him again."