# saslauthd for the virtual mailhost guide error

## Slynix

I just did a emerge of the new cyrus-sasl

When i restart saslauthd i get:

```

 * Starting saslauthd...

/usr/sbin/saslauthd: invalid option -- H

usage: saslauthd [options]

option information:

  -a <authmech>  Selects the authentication mechanism to use.

  -c             Enable credential caching.

  -d             Debugging (don't detach from tty, implies -V)

  -O <option>    Optional argument to pass to the authentication

                 mechanism.

  -l             Disable accept() locking. Increases performance, but

                 may not be compatible with some operating systems.

  -m <path>      Alternate path for the sslauthd working directory,

                 must be absolute.

  -n <procs>     Number of worker processes to create.

  -s <kilobytes> Size of the credential cache (in kilobytes)

  -t <seconds>   Timeout for items in the credential cache (in seconds)

  -v             Display version information and available

  -V             Enable verbose logging

                 authentication mechanisms and exit.

  -h             Dispaly this message.

saslauthd 2.1.13

authentication mechanisms: getpwent pam rimap shadow ldap

```

Im looking into this and will post my results, if anyone got any info on this please share

----------

## Slynix

edit:

I used version cyrus-sasl-2.1.10-r2.ebuild

and the new not working is: cyrus-sasl-2.1.13

----------

## sieter

hi,

check for an "-M "option in /etc/conf.d/saslauthd

mine looks like this

```

# Authentications mechanism (for list see saslauthd -v)

SASL_AUTHMECH=pam

# Hostname for remote IMAP server (if rimap auth mech is used)

SASL_RIMAP_HOSTNAME=""

# Honour time-of-day login restrictions (if shadow auth mech is used)

# Make this ="" to turn it off.  Putting =no will turn it on!

SASL_TIME_OF_DAY_LOGIN_RESTRICTIONS=yes

# Tack the above options together

[ -n ${SASL_AUTHMECH} ] && \

        SASLAUTHD_OPTS="-a ${SASL_AUTHMECH}"

[ -n ${SASL_RIMAP_HOSTNAME} ] && \

        SASLAUTHD_OPTS="${SASLAUTHD_OPTS} -H ${SASL_RIMAP_HOSTNAME}"

[ -n ${SASL_TIME_OF_DAY_LOGIN_RESTRICTIONS} ] && \

        SASLAUTHD_OPTS="${SASLAUTHD_OPTS} -T"

```

it's 2.1.12, though,

but maybe it works...

AND, did you etc-update?

 :Wink: 

----------

## voidx

Sorru for this long post but there are many strange things with new cyrus-sasl:

I had cyrus-sasl 2.1.12 working and yesterday I emerged new (marked as stable) cyrus-sasl 2.1.13 and I have same problem.

I did etc-udpate, I think this is a bug.... 

When you try to start sasauthd and it ends with that -H option error, saslauthd is not started but gentoo thinks that it was started. see this:

```

bender root # /etc/init.d/saslauthd start

 * Starting saslauthd...

/usr/sbin/saslauthd: invalid option -- H

usage: saslauthd [options]

option information:

  -a <authmech>  Selects the authentication mechanism to use.

  -c             Enable credential caching.

  -d             Debugging (don't detach from tty, implies -V)

  -O <option>    Optional argument to pass to the authentication

                 mechanism.

  -l             Disable accept() locking. Increases performance, but

                 may not be compatible with some operating systems.

  -m <path>      Alternate path for the sslauthd working directory,

                 must be absolute.

  -n <procs>     Number of worker processes to create.

  -s <kilobytes> Size of the credential cache (in kilobytes)

  -t <seconds>   Timeout for items in the credential cache (in seconds)

  -v             Display version information and available

  -V             Enable verbose logging

                 authentication mechanisms and exit.

  -h             Dispaly this message.

saslauthd 2.1.13 

authentication mechanisms: getpwent pam rimap shadow          [ ok ]

```

as you see there is [ok] and i think it shouldnt be here because saslauthd was not started (checked with #ps -A and ps -C saslauthd) !! (and there is one more problem with stopping it even if it is running as you'll see)

in this situation you must reboot because you cant restart saslautd to try different settings because:

```

bender root # /etc/init.d/saslauthd stop

 * Stopping saslauthd...

start-stop-daemon: warning: failed to kill 2372: No such process                                                                           [ !!

bender root # /etc/init.d/saslauthd start

 * WARNING:  "saslauthd" has already been started.

```

So I did backup of config and started "bughunt"  :Smile: 

First I tried to manualy delete -H option from /etv/conf.d/saslauthd (this option is useless for me so I can do it).   But then when I tried to start saslauthd, it ends with error again, now that it doesn't know -T option  :Smile:  So I deleted this option too and now i can start saslauthd... (but I dont know what this -T option mean so I cant be sure that this is unimportant change...)

Now I have saslauthd running but there is one one other - i think small -  bug in /etc/init.d/saslauthd - saslauthd cant be stopped via # /etc/init.d/saslauthd stop because this startup script is looking for saslauthd PID in /var/lib/sasl2/mux.pid but the PID (maybee is it new thing in this new version that was overlooked) is now stored in /lib/sasl2/saslauthd.pid so this script has to be modified to get it to work... maybee this is not bug, maybee it is cause by my modifications of config file, god knows but I think someone should look at this ebuild if there isnt something screwed up...

It looks like bugs in new build for me...

Now I have working saslauthd, here is my small howto:

1. delete -H and -T options from /etc/conf.d/saslauthd

2. modify /etc/init.d/saslauthd - replace start-stop-daemon --stop --pidfile /var/lib/sasl2/mux.pid with start-stop-daemon --stop --pidfile /var/lib/sasl2/saslauthd.pid

probably you have --quiet option there, I deleted it to see more things...

Only bad thing is that I dont know nothing about that -T option, but I hope this is temporary solution  :Wink: 

----------

## All-StaR

All you have to do is change '-H' from:

```

[ -n ${SASL_RIMAP_HOSTNAME} ] && \

        SASLAUTHD_OPTS="${SASLAUTHD_OPTS} -H ${SASL_RIMAP_HOSTNAME}"

```

To '-O'. Thus making it:

```

[ -n ${SASL_RIMAP_HOSTNAME} ] && \

        SASLAUTHD_OPTS="${SASLAUTHD_OPTS} -O ${SASL_RIMAP_HOSTNAME}"

```

Worked for me. '-H' option was removed and no one changed the init script.

Tom

----------

## FuzzeX

If you want to kill a dead service that still thinks it's alive you could use for example:

```
#/etc/init.d/saslauthd zap
```

Save you a reboot at least. Hope it helps in the future.

----------

## Slynix

sweet sweet I havent had time to look into this much at all. The file should been updated throught emerge, anyone submited a correction?

Btw does this work correctly? have you gotten your clients to be able to send mail etc?

To get the startup of the program to work you can either change to -O or remove both flags. the init.d/saslauthd needs to be edited as above either way to get the stop to work properly.

However I get relay access denied by my clients. weird hmm

edit: I think this must have to do with something else but still i cant remember me changing anything regarding this

----------

