At least 17 people died and dozens were wounded in an attack by a student who then killed himself, said Russian authorities.