Md Shadab Ali
Md Shadab Ali

Reputation: 23

How to pass keytab file to application which is being deployed on pcf

I am trying to develop kafka client application with kerberos integration . I have to deploy this application to PCF environment .I need to pass absolute path of keytab file in jaas.conf for kerberos integration . I have kept keytab file in resource folder of an application . The problem is jaas.conf take absolute path of keytab file. So how to provide absolute path of keytab file location in PCF.

Upvotes: 1

Views: 1392

Answers (1)

Daniel Mikusa
Daniel Mikusa

Reputation: 15051

If you are pushing the file as a part of your app, then it will reside under /home/vcap/app, so you could just prepend that onto the relative path under your app.

Ex: /home/vcap/app + resources/my.keytab

While it's unlikely to change, if you don't want to hard code a path you could resolve the value of the HOME environment variable at runtime. $HOME will refer to the location of your app, which again, resolves to /home/vcap/app.

You could resolve the environment in your app when it starts, or you could include a .profile file, which is a script that runs prior to your app starting up. It is a little tricky to get this to work right with Java apps though, as you have to put the .profile script at the root of your JAR/WAR file.

Hope that helps!

Upvotes: 1

Related Questions