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