Major tinc and permissions refactorings