File: ch-notes.html

package info (click to toggle)
userv 1.0.1.1potato
  • links: PTS
  • area: main
  • in suites: potato
  • size: 900 kB
  • ctags: 963
  • sloc: ansic: 4,128; lex: 281; makefile: 185; sh: 134
file content (225 lines) | stat: -rw-r--r-- 7,597 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<html>

<head>

<title>User service daemon and client specification - Applications and notes on use</title>

</head>

<body>

<hr>

[<a href="ch-ipass.html">back</a>]
 [<a href="index.html#abstract">Abstract</a>]
 [<a href="index.html#copyright">Copyright Notice</a>]
 [<a href="index.html#contents">Contents</a>]

<hr>

<h1>
User service daemon and client specification - Chapter 6<br>
Applications and notes on use
</h1>

<hr>

<h2>
<a name="s-standards">6.1 Standard services and directory management</a>
</h2>

<p>
In later versions of this specification standard service names and
interfaces for common services such as mail delivery and WWW CGI
scripts will be specified.
</p>

<p>
<code>userv</code>-using applications and system services which hide
<code>userv</code> behind wrapper scripts may need to store information in
the user's filespace to preserve the correct placement of the security
perimiters.  Such applications should usually do so in a directory
(created by them) <samp>~/.userv/.servdata/<var>service</var></samp>, where
<var>service</var> is the service name or application in question.
</p>

<p>
The use of a dot-directory inside <samp>~/.userv</samp> will hopefully avoid
the user becoming confused by finding parts of a semi-privileged
application's internal state in their filespace, and or discourage
them from fiddling with and thus corrupting it.  (Note that such
applications should of course not rely for their global integrity on
the integrity of the data on the user's side of the security
boundary.)
</p>

<hr>

<h2>
<a name="s-reducepriv">6.2 Reducing the number of absolutely privileged subsystems</a>
</h2>

<p>
Currently most Unix systems have many components which need to run as
root, even though most of their activity does not strictly require
it.  This gives rise to a large and complex body of code which must be
trusted with the security of the system.
</p>

<p>
Using <code>userv</code> many of these subsystems no longer need any unusual
privilege.
</p>

<p>
<code>cron</code> and <code>at</code>, <code>lpr</code> and the system's mail transfer
agent (<code>sendmail</code>, <code>smail</code>, <code>exim</code> or the like) all
fall into this category.
</p>

<hr>

<h2>
<a name="s-noexcess">6.3 Do not give away excessive privilege to <code>userv</code>-using facilities</a>
</h2>

<p>
There is a danger that people reimplementing the facilities I mention
above using <code>userv</code> will discard much of the security benefit by
using a naive implementation technique.  This will become clearer with
an example:
</p>

<p>
Consider the <code>lpr</code> program.  In current systems this needs to
have an absolutely privileged component in order to support delayed
printing without copying: when the user queues a file to be printed
the filename is stored in the print queue, rather than a copy of it,
and the printer daemon accesses the file directly when it is ready to
print the job.  In order that the user can print files which are not
world-readable the daemon is given root privilege so that it can open
the file in the context of the user, rather than its own.
</p>

<p>
A simple-minded approach to converting this scheme to use <code>userv</code>
might involve giving the printer daemon (the <code>lp</code> user) the
ability to read the file by allowing them to run <code>cat</code> (or a
special-purpose file-reading program) as any user.  The <code>lpr</code>
program would use a <code>userv</code> service to store the filename in the
printer daemon's queues, and the daemon would read the file later when
it felt like it.
</p>

<p>
However, this would allow the printer daemon to read any file on the
system, whether or not someone had asked for it to be printed.  Since
many files will contain passwords and other security-critical
information this is nearly as bad as giving the daemon root access in
the first place.  Any security holes in the print server which allow a
user to execute commands as the <code>lp</code> user will give the user the
ability to read any file on the system.
</p>

<p>
Instead, it is necessary to keep a record of which files the daemon
has been asked to print <em>outside</em> the control of the print daemon.
This record could be kept by a new root-privileged component, but this
is not necessary: the record of which files a user has asked to be
printed can be kept under the control of the user in question.  The
submission program <code>lpr</code> will make a record in an area under the
user's control before communicating with the print server, and the
print server would be given the ability to run a special file-reading
program which would only allow files to be read which were listed in
the user's file of things they'd asked to print.
</p>

<p>
Now security holes in most of the printing system do not critically
affect the security of the entire system: they only allow the attacker
to read and interfere with print jobs.  Bugs in the programs run by the
print server to read users' files (and to remove entries from the list
of files when it has done with them) will still be serious, but this
program can be quite simple.
</p>

<p>
Similar considerations apply to many <code>userv</code>-based versions of
facilities which currently run as root.
</p>

<p>
It is debatable whether the user-controlled state should be kept in
the user's filespace (in dotfiles, say) or kept in a separate area set
aside for the purpose; however, using the user's home directory (and
probably creating a separate subdirectory of it as a dotfile to
contain many subsystems' state) has fewer implications for the rest of
the system and makes it entirely clear where the security boundaries
lie.
</p>

<hr>

<h2>
<a name="s-notreally">6.4 <code>userv</code> is not a replacement for <code>really</code> and <code>sudo</code></a>
</h2>

<p>
<code>userv</code> is not intended as a general-purpose system
administration tool with which system administrators can execute
privileged programs when they need to.  It is unsuitable for this
purpose precisely because it enforces a strong separation between the
calling and the called program, which is undesirable in this context.
</p>

<p>
Its facilities for restricting activities to running certain programs
may at first glance seem to provide similar functionality to
<code>sudo</code><a href="footnotes.html#2" name="fr2">[2]</a>.  However, the
separation mentioned above is a problem here too, particular for
interaction - it can be hard for a <code>userv</code> service program to
interact with its real caller or the user in question.
</p>

<hr>

<h2>
<a name="s-nogeneral">6.5 Don't give access to general-purpose utilities</a>
</h2>

<p>
Do not specify general purpose programs like <code>mv</code> or <code>cat</code>
in <code>execute-</code> directives without careful thought about their
arguments, and certainly not if <code>no-suppress-args</code> is specified.
If you do so it will give the caller much more privilige than you
probably intend.
</p>

<p>
It is a shame that I have to say this here, but inexperienced
administrators have made similar mistakes with programs like
<code>sudo</code>.
</p>

<hr>

[<a href="ch-ipass.html">back</a>]
 [<a href="index.html#abstract">Abstract</a>]
 [<a href="index.html#copyright">Copyright Notice</a>]
 [<a href="index.html#contents">Contents</a>]

<hr>

User service daemon and client specification<br>

<address>
1.0.1<br>
Ian Jackson <a href="mailto:ian@davenant.greenend.org.uk">ian@davenant.greenend.org.uk</a>
</address>

</body>

</html>