What characters are illegal in password in ssmtp.conf?

I'm running Ubuntu Server 16.04 with the ssmtp package for sendmail. I've read from a variety of places that you cannot use "special" characters in the password, and I've discovered it's true that I cannot escape nor quote the password. I have only been able to verify alphanumeric passwords in ssmtp.conf to work, but I cannot find this documented anywhere. My question is, what are the allowed/forbidden characters for a password?

Alternatively, is there any other method of escaping? I've tried backslash, single, and double quotes to no avail.

Thanks


Solution 1:

There seem to be a number of outstanding bugs listed here with regards to problematic characters in the AuthPass directive:

  • bug report 768129: the hash/pound character #
  • bug report 463196: the equals = and the colon : characters

and I don't know if that would be the case for ssmtp specifically but generally bad characters to use in passwords are spaces, extended ASCII: è é ê ë etc. and UNICODE. Stick to a-z A-Z 0-9 .- and make passwords longer rather than more complex.

Solution 2:

Looking at the read_config() method on line 883 of the current blob af4d1e58d28fa9450bfc6a80fbacc75ca28c2220 it appears as though an equals sign = or a pound hash sign # would cause it to silently continue and skip parsing that line of the config file.

    /* Make comments invisible */
    if((p = strchr(buf, '#'))) {
        *p = (char)NULL;
    }

    /* Ignore malformed lines and comments */
    if(strchr(buf, '=') == (char *)NULL) continue;

I would still like to see an authoritative answer on the subject or a definitive reference to documentation.

Solution 3:

You can use the following workaround:

  • feed the password directly in the command line argument
ssmtp -ap "Hash#Password" ...
  • alternatively put the password in an environment variable.
ssmtp -ap $PASSWD ...

Hope it helped.