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

TODO: move file creation with specified mode to separate utils function.