You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "xuepingyang@cienet.com.cn" <xu...@cienet.com.cn> on 2016/03/29 11:29:26 UTC
Configuring User Authentication failed
Hi,
We installed drill-1.6 in distributed mode.
We are trying to config a custom authenticator ,we do the steps as the document shows,but it failed.
1,Build the following Java file into a JAR file:
package myorg.dept.drill.security;
import java.io.IOException;
import org.apache.drill.common.config.DrillConfig;
import org.apache.drill.exec.exception.DrillbitStartupException;
import org.apache.drill.exec.rpc.user.security.UserAuthenticationException;
import org.apache.drill.exec.rpc.user.security.UserAuthenticator;
import org.apache.drill.exec.rpc.user.security.UserAuthenticatorTemplate;
/*
* Implement {@link org.apache.drill.exec.rpc.user.security.UserAuthenticator} for illustrating how to develop a custom authenticator and use it in Drill
*/
@UserAuthenticatorTemplate(type = "myCustomAuthenticatorType")
public class MyCustomDrillUserAuthenticatorImpl implements UserAuthenticator {
public static final String USER_1 = "user1";
public static final String USER_2 = "user2";
public static final String PWD_1 = "pwd1";
public static final String PWD_2 = "pwd2";
/**
* Setup for authenticating user credentials.
*/
@Override
public void setup(DrillConfig drillConfig) throws DrillbitStartupException {
// If the authenticator has any setup such as making sure authenticator
// provider servers are up and running or
// needed libraries are available, it should be added here.
}
/**
* Authenticate the given <i>user</i> and <i>password</i> combination.
*
* @param userName
* @param password
* @throws UserAuthenticationException
* if authentication fails for given user and password.
*/
@Override
public void authenticate(String userName, String password)
throws UserAuthenticationException {
System.out.println("==========enter==========");
if (!(USER_1.equals(userName) && PWD_1.equals(password))
&& !(USER_2.equals(userName) && PWD_2.equals(password))) {
throw new UserAuthenticationException(
"custom failure message if the admin wants to show it to user");
}
}
/**
* Close the authenticator. Used to release resources. Ex. LDAP
* authenticator opens connections to LDAP server, such connections
* resources are released in a safe manner as part of close.
*
* @throws IOException
*/
@Override
public void close() throws IOException {
// Any clean up such as releasing files/network resources should be done
// here
}
}
2,Add the jar file to the path: <drill-install-path>/jars
3,Create a file named drill-module.conf with the following configuration code,and add it to :<drill-install-path>/jars
drill {
classpath.scanning {
packages += "myorg.dept.drill.security"
}
}
4,modify the drill-override.conf,add the following configuration code in drill.exec block:
security.user.auth {
enabled: true,
packages += "myorg.dept.drill.security",
impl: "myCustomAuthenticatorType"
}
5,restart the drill again.
Then we find that we can't start the drill successfully.Here is the log:
2016-03-29 16:49:32,392 [main] ERROR o.a.d.e.r.u.s.UserAuthenticatorFactory - Failed to find the implementation of 'org.apache.drill.exe
c.rpc.user.security.UserAuthenticator' for type 'myCustomAuthenticatorType'
Can you give me some advice?
Thank you very much.
Best Wishes
Xueping Yang
xuepingyang@cienet.com.cn
Re: Configuring User Authentication failed
Posted by Chunhui Shi <cs...@maprtech.com>.
Hi Xueping,
The drill-module.conf should be put into the your jar file. The logic about
what jar to scan(thus to extract the class) during startup is based on if
there is a drill-module.conf in that jar file. Hope this helps.
Thanks,
Chunhui
On Tue, Mar 29, 2016 at 2:29 AM, xuepingyang@cienet.com.cn <
xuepingyang@cienet.com.cn> wrote:
> Hi,
> We installed drill-1.6 in distributed mode.
> We are trying to config a custom authenticator ,we do the steps as the
> document shows,but it failed.
> 1,Build the following Java file into a JAR file:
> package myorg.dept.drill.security;
>
> import java.io.IOException;
>
> import org.apache.drill.common.config.DrillConfig;
> import org.apache.drill.exec.exception.DrillbitStartupException;
> import org.apache.drill.exec.rpc.user.security.UserAuthenticationException;
> import org.apache.drill.exec.rpc.user.security.UserAuthenticator;
> import org.apache.drill.exec.rpc.user.security.UserAuthenticatorTemplate;
>
>
> /*
> * Implement {@link
> org.apache.drill.exec.rpc.user.security.UserAuthenticator} for illustrating
> how to develop a custom authenticator and use it in Drill
> */
> @UserAuthenticatorTemplate(type = "myCustomAuthenticatorType")
> public class MyCustomDrillUserAuthenticatorImpl implements
> UserAuthenticator {
>
> public static final String USER_1 = "user1";
> public static final String USER_2 = "user2";
> public static final String PWD_1 = "pwd1";
> public static final String PWD_2 = "pwd2";
>
> /**
> * Setup for authenticating user credentials.
> */
> @Override
> public void setup(DrillConfig drillConfig) throws
> DrillbitStartupException {
> // If the authenticator has any setup such as making sure authenticator
> // provider servers are up and running or
> // needed libraries are available, it should be added here.
> }
>
> /**
> * Authenticate the given <i>user</i> and <i>password</i> combination.
> *
> * @param userName
> * @param password
> * @throws UserAuthenticationException
> * if authentication fails for given user and password.
> */
> @Override
> public void authenticate(String userName, String password)
> throws UserAuthenticationException {
> System.out.println("==========enter==========");
> if (!(USER_1.equals(userName) && PWD_1.equals(password))
> && !(USER_2.equals(userName) && PWD_2.equals(password))) {
> throw new UserAuthenticationException(
> "custom failure message if the admin wants to show it to user");
> }
>
>
> }
>
> /**
> * Close the authenticator. Used to release resources. Ex. LDAP
> * authenticator opens connections to LDAP server, such connections
> * resources are released in a safe manner as part of close.
> *
> * @throws IOException
> */
> @Override
> public void close() throws IOException {
> // Any clean up such as releasing files/network resources should be done
> // here
> }
>
>
> }
> 2,Add the jar file to the path: <drill-install-path>/jars
> 3,Create a file named drill-module.conf with the following configuration
> code,and add it to :<drill-install-path>/jars
> drill {
> classpath.scanning {
> packages += "myorg.dept.drill.security"
> }
> }
> 4,modify the drill-override.conf,add the following configuration code in
> drill.exec block:
> security.user.auth {
> enabled: true,
> packages += "myorg.dept.drill.security",
> impl: "myCustomAuthenticatorType"
> }
> 5,restart the drill again.
> Then we find that we can't start the drill successfully.Here is the log:
> 2016-03-29 16:49:32,392 [main] ERROR
> o.a.d.e.r.u.s.UserAuthenticatorFactory - Failed to find the implementation
> of 'org.apache.drill.exe
> c.rpc.user.security.UserAuthenticator' for type 'myCustomAuthenticatorType'
> Can you give me some advice?
> Thank you very much.
>
>
> Best Wishes
> Xueping Yang
>
> xuepingyang@cienet.com.cn
>
Re: drill support
Posted by Abdel Hakim Deneche <ad...@maprtech.com>.
Do you mean you want to count how many queries were run and how many of
them succeeded ?
If yes, then you can query the query audit logs [1] that should give you
all the information you need. Please note that if you are running Drill on
a cluster, each drillbit will have it's own query log, so you'll have to
aggregate the information from all drillbits.
Hope this helps
[1] https://drill.apache.org/docs/query-audit-logging/
On Mon, Apr 11, 2016 at 10:01 AM, hongwang@cienet.com.cn <
hongwang@cienet.com.cn> wrote:
> Hi,
>
> I got a requirement, we should record the total number of times and the
> success number of times for the operation "Query".
>
> But I have no idea to implemant it, can you give me some suggestions?
>
> Thanks!
>
> Wang Hong
>
>
--
Abdelhakim Deneche
Software Engineer
<http://www.mapr.com/>
Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>
drill support
Posted by "hongwang@cienet.com.cn" <ho...@cienet.com.cn>.
Hi,
I got a requirement, we should record the total number of times and the success number of times for the operation "Query".
But I have no idea to implemant it, can you give me some suggestions?
Thanks!
Wang Hong