Hello Yannick,
I changed your thread from a Proposed Idea to a Question, since this functionality is currently SmarterTrack. To prevent anonymous users from viewing the Knowledge Base, you'll simply need to adjust that role's permissions. Log in as the System Admin and go to Settings > Manage > Roles. Double-click on the Everyone role to open it's permission settings. On the Options tab, change KB Articles and KB Comments to None. Click Save. This will remove the Knowledge Base button from your portal for any user who is not logged in.
I hope this helps!