security: avoid race between file creation and chmod(2)

Also:
- salt.utils.check_ipc_path_max_len() on master pull socket
- change mode from 0700 to 0600 for socket files
- added debug logging

TODO: move file creation with specified mode to separate utils function.
Merge pull request #10442 from SaveTheRbtz/security

security: avoid race between file creation and chmod(2)