Kathir bin Abdullah al-Muzani narrates from his father, and he from his grandfather (may Allah be pleased with him), that the Messenger of Allah (peace and blessings be upon him) said: "Muslims abide by their conditions, except a condition that makes the lawful unlawful or a condition that makes the unlawful lawful."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشركة / 11430