welcome: please sign in

Diff for "RunningUnattendedCommandsWithoutRunInPagsh"

Differences between revisions 8 and 9
Revision 8 as of 2008-06-02 16:58:58
Size: 2842
Editor: AdamMegacz
Comment:
Revision 9 as of 2008-06-02 17:02:33
Size: 2990
Editor: AdamMegacz
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#pragma section-numbers off


[[TableOfContents]]
Line 31: Line 36:
   1. Make sure that you're starting the daemon properly; {{{k5start}}} should appear as the parent of your daemon process. To check this, try === Make sure that you're starting the daemon properly ===

Make sure that you're starting the daemon properly; {{{k5start}}} should appear as the parent of your daemon process. To check this, try
Line 37: Line 44:
   2. Add a {{{-v}}} to the {{{k5start}}} command and capture the output: === Capture Logs ===

Add a {{{-v}}} to the {{{k5start}}} command and capture the output:
Line 43: Line 52:
 Note that the logs need to go into {{{/tmp}}} because you don't need tokens to write there. Note that the logs need to go into {{{/tmp}}} because you don't need tokens to write there.
Line 45: Line 54:
   3. Figure out when your tokens are expiring (almost always exactly 10 hours after launching your daemon) and ask the root admins to check the KDC logs to see if there is even an ''attempt'' to renew the tickets at approximately that time. === Check the KDC ===

Figure out when your tokens are expiring (almost always exactly 10 hours after launching your daemon) and ask the root admins to check the KDC logs to see if there is even an ''attempt'' to renew the tickets at approximately that time.

TableOfContents

The run-in-pagsh script was written with the best intentions, but it tries to do many, many things (process backgrounding, pidfile management, etc), all in one script, and all in a black box. Moreover, it is currently not supported by its author. Lastly, its name does not actually describe what it does (you're already in a pagsh when you ssh in to mire!)

If run-in-pagsh works for you, great. If you encounter problems, please first try running your daemon using "explicit" methods described below before filing a bug against AFS. This is to ensure that the problem you've run into is actually a problem with AFS and not a problem with run-in-pagsh.

Explicit Token Management

This is really simple. You have two userids: your normal userid (we'll call this "fred") and your "daemon" userid (we'll call this "fred.daemon"). The first userid is "high security"; if one of our shellservers is broken into, it's unlikely that this account would be compromised. The second userid is "low security": if there is a security breach on any of our machines, then all daemon accounts are instantly compromised. It is extremely important to understand this before you take the steps outlined below.

First, you must grant your "daemon" userid permissions on any files that the background task needs. For example,

  fsr sa ~/my_daemon_workspace/ fred.daemon all

Second, you need to start your daemon process via k5start. Use the following command:

  k5start -qtUf /etc/keytabs/user.daemon/fred -- XXX YYY ZZZ

Where XXX YYY ZZZ is the command you want to run in the background.

This command will run your task in the foreground, but with all the proper token magic you need. Now all you need to do is apply the normal techniques (crontab, at, nohup, screen, etc) to run the command above in the background. However, token management and backgrounding are separate issues; this page only deals with token management.

That's it! Simple, huh?

Troubleshooting

Here are some things to try if you find out that your tokens are expiring:

Make sure that you're starting the daemon properly

Make sure that you're starting the daemon properly; k5start should appear as the parent of your daemon process. To check this, try

pstree -Gap `whoami`

Capture Logs

Add a -v to the k5start command and capture the output:

k5start -vqtUf /etc/keytabs/user.daemon/fred -- mydaemon &> /tmp/my-log

Note that the logs need to go into /tmp because you don't need tokens to write there.

Check the KDC

Figure out when your tokens are expiring (almost always exactly 10 hours after launching your daemon) and ask the root admins to check the KDC logs to see if there is even an attempt to renew the tickets at approximately that time.

RunningUnattendedCommandsWithoutRunInPagsh (last edited 2014-04-29 05:40:01 by c-50-148-186-167)