Virtual Host External authentication

I have successfully setup the server and it works flawless. However I have run into a problem

How do i configure one of the virtual hosts to use and external authentication script without affecting the other
virtual hosts. this is what i have in the authentication section

%%% ==============
%%% AUTHENTICATION

%%
%% auth_method: Method used to authenticate the users.
%% The default method is the internal.
%% If you want to use a different method,
%% comment this line and enable the correct ones.
%%
{auth_method, internal}.

%%
%% Authentication using external script
%% Make sure the script is executable by ejabberd.
%%
%%{auth_method, external}.
%%{extauth_program, "/path/to/authentication/script"}.

%%
%% Authentication using ODBC
%% Remember to setup a database in the next section.
%%
%%{auth_method, odbc}.

%%
%% Authentication using PAM
%%
%%{auth_method, pam}.
%%{pam_service, "pamservicename"}.

%%
%% Authentication using LDAP
%%
%%{auth_method, ldap}.
%%
%% List of LDAP servers:
%%{ldap_servers, ["server.virtualhost.com"]}.
%%
%% LDAP attribute that holds user ID:
%%{ldap_uids, [{"mail", "%u@mail.example.org"}]}.
%%
%% Search base of LDAP directory:
%%{ldap_base, "dc=example,dc=com"}.
%%
%% LDAP manager:
%%{ldap_rootdn, "dc=example,dc=com"}.
%%
%% Password to LDAP manager:
%%{ldap_password, "******"}.

%%
%% Anonymous login support:
%% auth_method: anonymous
%% anonymous_protocol: sasl_anon | login_anon | both
%% allow_multiple_connections: true | false
%%
%%{host_config, "public.example.org", [{auth_method, anonymous},
%% {allow_multiple_connections, false},
%% {anonymous_protocol, sasl_anon}]}.
%%
%% To use both anonymous and internal authentication:
%%
%%{host_config, "public.example.org", [{auth_method, [internal, anonymous]}]}.
{host_config, "virtualhost2.com",[{auth_method, external}]}.
{extauth_program, "php /opt/ejabberd-2.0.5/auth/ssc_ext_auth.php"}.

at the top it has auth_method internal and the bottom i have the host config for the second host as external
Do I need to define all virtual hosts or will the auto internal at the top control all others

Thanks in advance

Your config looks good

nightsbird wrote:
{auth_method, internal}.

{host_config, "virtualhost2.com", [ 
    {auth_method, external}
]}.

{extauth_program, "php /opt/ejabberd-2.0.5/auth/ssc_ext_auth.php"}.

will the auto internal at the top control all others

The config file is read in order, and options are overwritten. In your case, first 'internal' is set to all, and later 'external' is set for virtualhost2.com. The result is like this:

  • virtualhost1.com will use internal
  • virtualhost2.com will use external
  • virtualhost3.com will use internal
  • ... use internal

Your configuration should work as you wanted.

If it does not work correctly, try including the extauth_program option inside the host_config, like this:

{auth_method, internal}.

{host_config, "virtualhost2.com", [ 
    {extauth_program, "php /opt/ejabberd-2.0.5/auth/ssc_ext_auth.php"},
    {auth_method, external}
]}.

Hmm it fails both ways

I tried with psi-im it says

there was an error communicating with the server
Details: Disconnected

The ejabberd error log says

** Reason for termination =
** {badarg,[{extauth,call_port,2},
{ejabberd_auth,check_password_loop,2},
{cyrsasl_plain,mech_step,2},
{cyrsasl,server_step,2},
{ejabberd_c2s,wait_for_feature_request,2},
{gen_fsm,handle_msg,7},
{proc_lib,init_p,5}]}

I figured it out lol had an

I figured it out lol had an error in my php was missing a ")"

Thanks for the help

When a user is added to your

When a user is added to your friends list it crashes ejabberd is this due to the external authentication or should i have a file that pulls your friends from the site its integrated with as well

Thanks again
Jeff

Syndicate content