It is right to speak out in respect for one's teacher. People ought not to be thankful to a person for any knowledge he or she has, but to the master who taught them. This can be learned from what our venerable sages, of blessed memory, said about the verse "Now Joshua son of Nun was filled with the spirit of wisdom because Moses had laid his hands upon him". To what can this be compared? To a river that supplies water to the entire city and is praised by everyone. Someone said to them, 'Praise the spring that feeds it.' Similarly, when they praised Joshua who supplied the entire nation of Israel with his wisdom, the Holy One, blessed be He, said, 'Praise Moses for having thus taught' "because Moses had laid his hands upon him".
Drushei MehaRaSHa"SH Serero, Part 2, p. 431, HaRav David Ovadia Publishing, Jerusalem, 1991