summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mount_portalfs/mount_portalfs.8
blob: b6ca9cc70656325ebce11bac685ed1d4b81b8637 (plain)
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
.\"
.\" Copyright (c) 1993, 1994
.\"	The Regents of the University of California.  All rights reserved.
.\" All rights reserved.
.\"
.\" This code is derived from software donated to Berkeley by
.\" Jan-Simon Pendry.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"	@(#)mount_portal.8	8.3 (Berkeley) 3/27/94
.\" $FreeBSD$
.\"
.Dd March 11, 2005
.Dt MOUNT_PORTALFS 8
.Os
.Sh NAME
.Nm mount_portalfs
.Nd mount the portal daemon
.Sh SYNOPSIS
.Nm
.Op Fl o Ar options
.Ar /etc/portal.conf
.Ar mount_point
.Sh DESCRIPTION
The
.Nm
utility attaches an instance of the portal daemon
to the global file system namespace.
The conventional mount point is
.Pa /p .
.\" .PA /dev .
This command is normally executed by
.Xr mount 8
at boot time.
.Pp
The options are as follows:
.Bl -tag -width indent
.It Fl o
Options are specified with a
.Fl o
flag followed by a comma separated string of options.
See the
.Xr mount 8
man page for possible options and their meanings.
.El
.Pp
The portal daemon provides an
.Em open
service.
Objects opened under the portal mount point are
dynamically created by the portal daemon according
to rules specified in the named configuration file.
Using this mechanism allows descriptors such as sockets
to be made available in the file system namespace.
.Pp
The portal daemon works by being passed the full pathname
of the object being opened.
The daemon creates an appropriate descriptor according
to the rules in the configuration file, and then passes the descriptor back
to the calling process as the result of the open system call.
.Sh NAMESPACE
By convention, the portal daemon divides the namespace into sub-namespaces,
each of which handles objects of a particular type.
.Pp
The following sub-namespaces are currently implemented:
.Pa fs ,
.Pa pipe ,
.Pa tcp ,
and
.Pa tcplisten .
.Pp
The
.Pa fs
namespace opens the named file, starting back at the root directory.
This can be used to provide a controlled escape path from
a chrooted environment.
.Pp
The
.Pa pipe
namespace executes the named command, starting back at the root directory.
The command's arguments can be provided after the command's name,
by separating them with spaces or tabs.
Files opened for reading in the
.Pa pipe
namespace will receive their input from the command's standard output;
files opened for writing will send the data of write operations
to the command's standard input.
.Pp
The
.Pa tcp
namespace takes a slash separated hostname and a port and
creates an open TCP/IP connection.
.Pp
The
.Pa tcplisten
namespace takes a slash separated hostname and port and creates a TCP/IP
socket bound to the given hostname-port pair.
The hostname may be
specified as "ANY" to allow any other host to connect to the socket.
A
port number of 0 will dynamically allocate a port, this can be
discovered by calling
.Xr getsockname 2
with the returned file descriptor.
Privileged ports can only be bound to
by the super-user.
.Sh "CONFIGURATION FILE"
The configuration file contains a list of rules.
Each rule takes one line and consists of two or more
whitespace separated fields.
A hash (``#'') character causes the remainder of a line to
be ignored.
Blank lines are ignored.
.Pp
The first field is a pathname prefix to match
against the requested pathname.
If a match is found, the second field
tells the daemon what type of object to create.
Subsequent fields are passed to the creation function.
.Bd -literal
# @(#)portal.conf	5.1 (Berkeley) 7/13/92
tcplisten/	tcplisten tcplisten/
tcp/		tcp tcp/
fs/		file fs/
pipe/		pipe pipe/
.Ed
.Sh FILES
.Bl -tag -width /p/* -compact
.It Pa /p/*
.El
.Sh EXAMPLES
Display the greeting of the
.Fx
.Tn SMTP
server.
.Pp
.Dl "head -1 /p/tcp/mx1.freebsd.org/smtp"
.Pp
Implement a (single-threaded) echo server:
.Bd -literal -offset indent
while :
do
    (exec 3<>/p/tcplisten/ANY/echo && cat -u <&3 >&3)
done
.Ed
.Pp
Gather data from two sources.
Verify that two remote files are identical:
.Bd -literal -offset indent
diff -q '/p/pipe/usr/bin/fetch -o - \\
        ftp://ftp1.freebsd.org/pub/FreeBSD/README.TXT' \\
    '/p/pipe/usr/bin/fetch -o - \\
        ftp://ftp2.freebsd.org/pub/FreeBSD/README.TXT'
.Ed
.Pp
Scatter data to two sinks.
Record a remote
.Tn CD
.Tn ISO
image and calculate its checksum:
.Bd -literal -offset indent
fetch -o - ftp://ftp5.freebsd.org/.../disc.iso |
tee '/p/pipe/usr/local/bin/cdrecord -' |
md5
.Ed
.Pp
Create an
.Tn XML
view of the password file:
.Bd -literal -offset indent
ln -s '/p/pipe/usr/local/bin/passwd2xml /etc/passwd' \\
    /etc/passwd.xml"
.Ed
.Sh SEE ALSO
.Xr mount 2 ,
.Xr unmount 2 ,
.Xr fstab 5 ,
.Xr mount 8
.Rs
.%A "W. Richard Stevens"
.%A "Jan-Simon Pendry"
.%T "Portals in 4.4BSD"
.%B "USENIX 1995 Technical Conference Proceedings"
.%O "Berkeley, CA"
.%I "Peter Honeyman"
.Re
.Sh HISTORY
The
.Nm
utility first appeared in
.Bx 4.4 .
.Sh CAVEATS
This file system may not be NFS-exported.
OpenPOWER on IntegriCloud