Ensure correct permissions on .ssh and authorized_keys file

One of our admins noted that the .ssh directory created by gogs for our git user, as well as the authorized_keys file inside were accessible by anyone. This patch makes sure that if gogs has to create .ssh, it does so with 0700 permissions (rwx to owner only) and keep the authorized_keys file on 0600 (logging if it is found to have greater perms).

This probably needs some beautification in order to be acceptable but I hope I've identified all the causes.
This line should be moved up between line 157 and 158, so there are no returns between the check if f could be opened and the defer statement. Otherwise, if we get an error, the file won't be closed until the GC kicks in.