secmodel_bsd44.c revision 1.4.2.2 1 1.4.2.2 ad /* $NetBSD: secmodel_bsd44.c,v 1.4.2.2 2006/11/18 21:39:46 ad Exp $ */
2 1.4.2.2 ad /*-
3 1.4.2.2 ad * Copyright (c) 2006 Elad Efrat <elad (at) NetBSD.org>
4 1.4.2.2 ad * All rights reserved.
5 1.4.2.2 ad *
6 1.4.2.2 ad * Redistribution and use in source and binary forms, with or without
7 1.4.2.2 ad * modification, are permitted provided that the following conditions
8 1.4.2.2 ad * are met:
9 1.4.2.2 ad * 1. Redistributions of source code must retain the above copyright
10 1.4.2.2 ad * notice, this list of conditions and the following disclaimer.
11 1.4.2.2 ad * 2. Redistributions in binary form must reproduce the above copyright
12 1.4.2.2 ad * notice, this list of conditions and the following disclaimer in the
13 1.4.2.2 ad * documentation and/or other materials provided with the distribution.
14 1.4.2.2 ad * 3. All advertising materials mentioning features or use of this software
15 1.4.2.2 ad * must display the following acknowledgement:
16 1.4.2.2 ad * This product includes software developed by Elad Efrat.
17 1.4.2.2 ad * 4. The name of the author may not be used to endorse or promote products
18 1.4.2.2 ad * derived from this software without specific prior written permission.
19 1.4.2.2 ad *
20 1.4.2.2 ad * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.4.2.2 ad * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.4.2.2 ad * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.4.2.2 ad * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.4.2.2 ad * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.4.2.2 ad * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.4.2.2 ad * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.4.2.2 ad * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.4.2.2 ad * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.4.2.2 ad * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.4.2.2 ad */
31 1.4.2.2 ad
32 1.4.2.2 ad #include <sys/cdefs.h>
33 1.4.2.2 ad __KERNEL_RCSID(0, "$NetBSD: secmodel_bsd44.c,v 1.4.2.2 2006/11/18 21:39:46 ad Exp $");
34 1.4.2.2 ad
35 1.4.2.2 ad #include <sys/types.h>
36 1.4.2.2 ad #include <sys/param.h>
37 1.4.2.2 ad #include <sys/kauth.h>
38 1.4.2.2 ad
39 1.4.2.2 ad #include <sys/sysctl.h>
40 1.4.2.2 ad
41 1.4.2.2 ad #include <secmodel/secmodel.h>
42 1.4.2.2 ad
43 1.4.2.2 ad #include <secmodel/bsd44/bsd44.h>
44 1.4.2.2 ad #include <secmodel/bsd44/suser.h>
45 1.4.2.2 ad #include <secmodel/bsd44/securelevel.h>
46 1.4.2.2 ad
47 1.4.2.2 ad SYSCTL_SETUP(sysctl_security_bsd44_setup,
48 1.4.2.2 ad "sysctl security bsd44 setup")
49 1.4.2.2 ad {
50 1.4.2.2 ad const struct sysctlnode *rnode;
51 1.4.2.2 ad
52 1.4.2.2 ad sysctl_createv(clog, 0, NULL, &rnode,
53 1.4.2.2 ad CTLFLAG_PERMANENT,
54 1.4.2.2 ad CTLTYPE_NODE, "security", NULL,
55 1.4.2.2 ad NULL, 0, NULL, 0,
56 1.4.2.2 ad CTL_SECURITY, CTL_EOL);
57 1.4.2.2 ad
58 1.4.2.2 ad sysctl_createv(clog, 0, &rnode, NULL,
59 1.4.2.2 ad CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
60 1.4.2.2 ad CTLTYPE_INT, "curtain", NULL,
61 1.4.2.2 ad NULL, 0, &secmodel_bsd44_curtain, 0,
62 1.4.2.2 ad CTL_CREATE, CTL_EOL);
63 1.4.2.2 ad
64 1.4.2.2 ad sysctl_createv(clog, 0, &rnode, &rnode,
65 1.4.2.2 ad CTLFLAG_PERMANENT,
66 1.4.2.2 ad CTLTYPE_NODE, "models", NULL,
67 1.4.2.2 ad NULL, 0, NULL, 0,
68 1.4.2.2 ad CTL_CREATE, CTL_EOL);
69 1.4.2.2 ad
70 1.4.2.2 ad sysctl_createv(clog, 0, &rnode, &rnode,
71 1.4.2.2 ad CTLFLAG_PERMANENT,
72 1.4.2.2 ad CTLTYPE_NODE, "bsd44",
73 1.4.2.2 ad SYSCTL_DESCR("Traditional NetBSD Security model, " \
74 1.4.2.2 ad "derived from 4.4BSD"),
75 1.4.2.2 ad NULL, 0, NULL, 0,
76 1.4.2.2 ad CTL_CREATE, CTL_EOL);
77 1.4.2.2 ad
78 1.4.2.2 ad sysctl_createv(clog, 0, &rnode, NULL,
79 1.4.2.2 ad CTLFLAG_PERMANENT,
80 1.4.2.2 ad CTLTYPE_STRING, "name", NULL,
81 1.4.2.2 ad NULL, 0, __UNCONST("Traditional NetBSD (4.4BSD)"), 0,
82 1.4.2.2 ad CTL_CREATE, CTL_EOL);
83 1.4.2.2 ad
84 1.4.2.2 ad sysctl_createv(clog, 0, &rnode, NULL,
85 1.4.2.2 ad CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
86 1.4.2.2 ad CTLTYPE_INT, "securelevel",
87 1.4.2.2 ad SYSCTL_DESCR("System security level"),
88 1.4.2.2 ad secmodel_bsd44_sysctl_securelevel, 0, &securelevel, 0,
89 1.4.2.2 ad CTL_CREATE, CTL_EOL);
90 1.4.2.2 ad
91 1.4.2.2 ad sysctl_createv(clog, 0, &rnode, NULL,
92 1.4.2.2 ad CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
93 1.4.2.2 ad CTLTYPE_INT, "curtain",
94 1.4.2.2 ad SYSCTL_DESCR("Curtain information about objects to "
95 1.4.2.2 ad "users not owning them."),
96 1.4.2.2 ad NULL, 0, &secmodel_bsd44_curtain, 0,
97 1.4.2.2 ad CTL_CREATE, CTL_EOL);
98 1.4.2.2 ad }
99 1.4.2.2 ad
100 1.4.2.2 ad /*
101 1.4.2.2 ad * Start the traditional NetBSD security model.
102 1.4.2.2 ad */
103 1.4.2.2 ad void
104 1.4.2.2 ad secmodel_start(void)
105 1.4.2.2 ad {
106 1.4.2.2 ad secmodel_bsd44_init();
107 1.4.2.2 ad
108 1.4.2.2 ad secmodel_bsd44_suser_start();
109 1.4.2.2 ad secmodel_bsd44_securelevel_start();
110 1.4.2.2 ad }
111