diff options
author | erdgeist <> | 2013-03-11 18:13:06 +0000 |
---|---|---|
committer | erdgeist <> | 2013-03-11 18:13:06 +0000 |
commit | 3ba18b4fc7acfd3f375f9e5123b9cecb20f8c221 (patch) | |
tree | a35c5cdee022d8bde1214b3ad006fbef2b1661d5 /man1 | |
parent | ec09a8dc8c25ce4f0c7f2d1539baf7a55829f761 (diff) |
Man page
Diffstat (limited to 'man1')
-rw-r--r-- | man1/jaildaemon.1 | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/man1/jaildaemon.1 b/man1/jaildaemon.1 new file mode 100644 index 0000000..69ad632 --- /dev/null +++ b/man1/jaildaemon.1 | |||
@@ -0,0 +1,163 @@ | |||
1 | .Dd March 11, 2013 | ||
2 | .Dt JAILDAEMON 1 USD | ||
3 | .Os FreeBSD | ||
4 | .Sh NAME | ||
5 | .Nm jaildaemon | ||
6 | .Nd A fixed commandline interface for FreeBSD jails to their host system | ||
7 | .Sh SYNOPSIS | ||
8 | .Nm | ||
9 | .Cm Fl D | ||
10 | .Op Fl p Ar pidfile | ||
11 | .Op Fl f Ar ipcsockpath | ||
12 | .Nm | ||
13 | .Cm Fl c Ar command Fl j Ar jid | ||
14 | .Op Fl r | ||
15 | .Op Fl t Ar proctitle | ||
16 | .Op Fl f Ar ipcsockpath | ||
17 | .Sh DESCRIPTION | ||
18 | The | ||
19 | .Nm | ||
20 | daemon awaits commands from the | ||
21 | .Nm | ||
22 | utility to spawn a probe process in a jail, optionally giving it a talking | ||
23 | proctitle. It assigns a single command to this process which is executed once | ||
24 | the associated probe receives the HUP signal, optionally respawning the probe. | ||
25 | .Pp | ||
26 | This is useful to allow scripts or users in a | ||
27 | .Xr jail 8 | ||
28 | environment to trigger some predefined actions in the host system, like | ||
29 | rebooting a jailed host, manipulating devices or taking file system snapshots. | ||
30 | .Pp | ||
31 | The options are as follows: | ||
32 | .Bl -tag -width indent | ||
33 | .It Fl D | ||
34 | Start the | ||
35 | .Nm | ||
36 | in daemon mode. It will check for other instances of jaildaemon by sending a | ||
37 | test command to the ipc socket. | ||
38 | .It Fl p Ar pidfile | ||
39 | When run in daemon mode, write the ID of the daemon process into the | ||
40 | .Ar pidfile | ||
41 | using the | ||
42 | .Xr pidfile 3 | ||
43 | functionality. Ignored in client mode. | ||
44 | .It Fl f Ar ipcsockpath | ||
45 | .Nm | ||
46 | in utility mode passes commands to the | ||
47 | .Nm | ||
48 | daemon via unix domain socket, which defaults to | ||
49 | .Pa /var/run/jaildaemon.pipe . | ||
50 | You can pass an alternative with this option. | ||
51 | .It Fl c Ar command | ||
52 | Start the | ||
53 | .Nm | ||
54 | in utility mode and pass the | ||
55 | .Ar command | ||
56 | , together with the jid and an optional proctitle to the | ||
57 | .Nm | ||
58 | daemon. When the client detects no running | ||
59 | .Nm | ||
60 | daemons, an error is reported. | ||
61 | .It Fl j Ar jid | ||
62 | The jail id of the jail | ||
63 | .Nm | ||
64 | daemon shall attach the probe process to. | ||
65 | .It Fl t Ar proctitle | ||
66 | Setting a proctitle on the probe process is useful to provide some information | ||
67 | to scripts or users in the jail, what action sending the HUP signal triggers. | ||
68 | The proctitle is visible via the | ||
69 | .Xr ps 1 | ||
70 | utility and signals can be sent to all processes matching the string with the | ||
71 | .Xr pkill 1 | ||
72 | utility when invoked with the | ||
73 | .Ar -f | ||
74 | option. (See | ||
75 | .Sx EXAMPLES | ||
76 | for more details.) | ||
77 | .It Fl r | ||
78 | Tell the | ||
79 | .Nm | ||
80 | daemon to respawn the probe process once the triggered command in the host | ||
81 | system has finished. | ||
82 | .Pp | ||
83 | By default all commands start single shot processes; to avoid race conditions | ||
84 | and multiple invocations of possibly non-reentrant scripts, probe processes | ||
85 | kill themselves after receiving the HUP signal. Respawning is meant as an | ||
86 | option for commands that do not shut down the jail. | ||
87 | .El | ||
88 | .Pp | ||
89 | Exactly one of the | ||
90 | .Fl D | ||
91 | or | ||
92 | .Fl c | ||
93 | options must be specified, in daemon mode all options for the utility mode are | ||
94 | ignored. In utility mode the | ||
95 | .Fl j | ||
96 | parameter is mandatory. | ||
97 | .Sh EXAMPLES | ||
98 | .Ss Starting the daemon | ||
99 | The | ||
100 | .Nm | ||
101 | daemon normally is run from it's | ||
102 | .Xr rc 8 | ||
103 | script on boot time. Invoke the daemon by hand using this command. | ||
104 | .Bl -tag -width indent | ||
105 | .It Nm Fl D Fl p Ar /var/run/jaildaemon.pid | ||
106 | Start the daemon and write the daemon's pid to the file | ||
107 | .Ar /var/run/jaildaemon.pid . | ||
108 | .El | ||
109 | .Ss Running the utility | ||
110 | When the | ||
111 | .Nm | ||
112 | daemon is alive, you can start attaching probe commands to running jails. | ||
113 | .Pp | ||
114 | While the first examples show you what is possible, the most simple way of | ||
115 | scripting an action is to write a small wrapper script as shown in the third | ||
116 | example. | ||
117 | .Bl -tag -width indent | ||
118 | .It Nm Fl c Ar 'ezjail-admin restart foo.com' Fl j Ar 23 Fl t Ar EZJAIL_REBOOT | ||
119 | Start a probe in jail with jid 23 (presumably a jail with the name | ||
120 | .Dq foo.com ) | ||
121 | and assign it the command | ||
122 | .Bd -literal -offset indent | ||
123 | ezjail-admin restart foo.com | ||
124 | .Ed | ||
125 | .Pp | ||
126 | The proctitle | ||
127 | .Dq EZJAIL_REBOOT | ||
128 | will be visible from within the jail, and a reboot can be triggered from a | ||
129 | script inside the jail with the command | ||
130 | .Bd -literal -offset indent | ||
131 | pkill -HUP -f EZJAIL_REBOOT | ||
132 | .Ed | ||
133 | .It Nm Fl c Ar 'zfs snapshot jails/foo.com@`date +%s`' Fl j Ar 42 Fl r Fl t Ar ZFS_SNAPSHOT | ||
134 | Start a probe in jail with jid 42 (presumably a jail with the name | ||
135 | .Dq foo.com ) | ||
136 | and assign it the command | ||
137 | .Bd -literal -offset indent | ||
138 | zfs snapshot jails/foo.com@`date +%s` | ||
139 | .Ed | ||
140 | .Pp | ||
141 | The proctitle | ||
142 | .Dq ZFS_SNAPSHOT | ||
143 | will be visible from within the jail and taking a zfs snapshot of the jail's | ||
144 | file system can be triggered from a script inside the jail with the command | ||
145 | .Bd -literal -offset indent | ||
146 | pkill -HUP -f ZFS_SNAPSHOT | ||
147 | .Ed | ||
148 | .Pp | ||
149 | After the zfs snapshot command finished, a new probe with identical paramters is | ||
150 | spawned and attached to the jail. | ||
151 | .It Nm Fl c Ar 'reload_routing_table.sh foo.com' Fl j Ar 1 Fl r Fl t Ar UPDATE_ROUTING | ||
152 | .El | ||
153 | .Sh FILES | ||
154 | .Pa /var/run/jaildaemon.pipe | ||
155 | .Sh SEE ALSO | ||
156 | .Xr jail 8 , | ||
157 | .Xr signal 3 , | ||
158 | .Xr ps 1 , | ||
159 | .Xr pgrep 1 , | ||
160 | .Xr pkill 1 | ||
161 | .Sh AUTHOR | ||
162 | .An Dirk Engling | ||
163 | .Aq erdgeist@erdgeist.org . | ||