4

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

Jeff Puckett
  • 229
  • 5
  • 15

3 Answers3

6

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.

HBruijn
  • 72,524
  • 21
  • 127
  • 192
1

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.

Jeff Puckett
  • 229
  • 5
  • 15
1

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.

  • 1
    I can verify this works. My password has the colon `:` and semicolon `;` characters. It won't work if entered as is in ssmtp.config, but works with this `-ap` method. In some other Ubuntu applications, the config file allows "complicated" characters to be entered using URLENCODE. – Old Geezer Jun 13 '19 at 09:02