xref: /titanic_52/usr/src/cmd/idmap/idmapd/idmap_config.h (revision b3700b074e637f8c6991b70754c88a2cfffb246b)
1c5c4113dSnw141292 /*
2c5c4113dSnw141292  * CDDL HEADER START
3c5c4113dSnw141292  *
4c5c4113dSnw141292  * The contents of this file are subject to the terms of the
5c5c4113dSnw141292  * Common Development and Distribution License (the "License").
6c5c4113dSnw141292  * You may not use this file except in compliance with the License.
7c5c4113dSnw141292  *
8c5c4113dSnw141292  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9c5c4113dSnw141292  * or http://www.opensolaris.org/os/licensing.
10c5c4113dSnw141292  * See the License for the specific language governing permissions
11c5c4113dSnw141292  * and limitations under the License.
12c5c4113dSnw141292  *
13c5c4113dSnw141292  * When distributing Covered Code, include this CDDL HEADER in each
14c5c4113dSnw141292  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15c5c4113dSnw141292  * If applicable, add the following below this CDDL HEADER, with the
16c5c4113dSnw141292  * fields enclosed by brackets "[]" replaced with your own identifying
17c5c4113dSnw141292  * information: Portions Copyright [yyyy] [name of copyright owner]
18c5c4113dSnw141292  *
19c5c4113dSnw141292  * CDDL HEADER END
20c5c4113dSnw141292  */
21c5c4113dSnw141292 /*
22148c5f43SAlan Wright  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23*b3700b07SGordon Ross  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
24c5c4113dSnw141292  */
25c5c4113dSnw141292 
26c5c4113dSnw141292 #ifndef _IDMAP_CONFIG_H
27c5c4113dSnw141292 #define	_IDMAP_CONFIG_H
28c5c4113dSnw141292 
29c5c4113dSnw141292 
30c5c4113dSnw141292 #include "idmap.h"
31c8e26105Sjp151216 #include "addisc.h"
32c5c4113dSnw141292 #include <libscf.h>
33c5c4113dSnw141292 #include <synch.h>
34*b3700b07SGordon Ross #include <sys/uuid.h>
35c5c4113dSnw141292 
36c5c4113dSnw141292 #ifdef __cplusplus
37c5c4113dSnw141292 extern "C" {
38c5c4113dSnw141292 #endif
39c5c4113dSnw141292 
40c5c4113dSnw141292 #define	MAX_POLICY_SIZE 1023
41c5c4113dSnw141292 
42e3f2c991SKeyur Desai #define	DIRECTORY_MAPPING_NONE	0
43e3f2c991SKeyur Desai #define	DIRECTORY_MAPPING_NAME	1
44e3f2c991SKeyur Desai #define	DIRECTORY_MAPPING_IDMU	2
45e3f2c991SKeyur Desai 
46e3f2c991SKeyur Desai struct enum_lookup_map {
47e3f2c991SKeyur Desai 	int value;
48e3f2c991SKeyur Desai 	char *string;
49e3f2c991SKeyur Desai };
50e3f2c991SKeyur Desai 
51e3f2c991SKeyur Desai extern struct enum_lookup_map directory_mapping_map[];
52e3f2c991SKeyur Desai extern const char *enum_lookup(int value, struct enum_lookup_map *map);
53e3f2c991SKeyur Desai 
54c8e26105Sjp151216 /* SMF and auto-discovery context handles */
55c8e26105Sjp151216 typedef struct idmap_cfg_handles {
56c8e26105Sjp151216 	pthread_mutex_t		mutex;
57c5c4113dSnw141292 	scf_handle_t		*main;
58c5c4113dSnw141292 	scf_instance_t		*instance;
59c5c4113dSnw141292 	scf_service_t		*service;
60c5c4113dSnw141292 	scf_propertygroup_t	*config_pg;
61148c5f43SAlan Wright 	scf_propertygroup_t	*debug_pg;
62c8e26105Sjp151216 	ad_disc_t		ad_ctx;
63c8e26105Sjp151216 } idmap_cfg_handles_t;
64c5c4113dSnw141292 
65c8e26105Sjp151216 /*
66c8e26105Sjp151216  * This structure stores AD and AD-related configuration
67c8e26105Sjp151216  */
684d61c878SJulian Pullen typedef struct idmap_trustedforest {
694d61c878SJulian Pullen 	char		*forest_name;
70*b3700b07SGordon Ross 	ad_disc_ds_t	*global_catalog;	/* global catalog hosts */
714d61c878SJulian Pullen 	ad_disc_domainsinforest_t
724d61c878SJulian Pullen 			*domains_in_forest;
734d61c878SJulian Pullen } idmap_trustedforest_t;
744d61c878SJulian Pullen 
754d61c878SJulian Pullen 
76c5c4113dSnw141292 typedef struct idmap_pg_config {
77c5c4113dSnw141292 	uint64_t	list_size_limit;
7848cd229bSGordon Ross 	uint64_t	id_cache_timeout;
7948cd229bSGordon Ross 	uint64_t	name_cache_timeout;
80*b3700b07SGordon Ross 	uint64_t	rediscovery_interval;
8112b65585SGordon Ross 	char		*machine_uuid;		/* machine uuid */
82c5c4113dSnw141292 	char		*machine_sid;		/* machine sid */
834d61c878SJulian Pullen 	char		*default_domain;	/* default domain name */
844d61c878SJulian Pullen 	char		*domain_name;		/* AD domain name */
857a8a68f5SJulian Pullen 	boolean_t	domain_name_auto_disc;
86*b3700b07SGordon Ross 	char		*domain_guid;		/* GUID (string) */
87*b3700b07SGordon Ross 	boolean_t	domain_guid_auto_disc;
88*b3700b07SGordon Ross 	ad_disc_ds_t	*domain_controller;	/* domain controller hosts */
897a8a68f5SJulian Pullen 	boolean_t	domain_controller_auto_disc;
90c8e26105Sjp151216 	char		*forest_name;		/* forest name */
917a8a68f5SJulian Pullen 	boolean_t	forest_name_auto_disc;
92c8e26105Sjp151216 	char		*site_name;		/* site name */
937a8a68f5SJulian Pullen 	boolean_t	site_name_auto_disc;
94*b3700b07SGordon Ross 	ad_disc_ds_t	*global_catalog;	/* global catalog hosts */
957a8a68f5SJulian Pullen 	boolean_t	global_catalog_auto_disc;
964d61c878SJulian Pullen 	ad_disc_domainsinforest_t
974d61c878SJulian Pullen 			*domains_in_forest;
984d61c878SJulian Pullen 	ad_disc_trusteddomains_t
994d61c878SJulian Pullen 			*trusted_domains;	/* Trusted Domains */
1004d61c878SJulian Pullen 	int		num_trusted_forests;
1014d61c878SJulian Pullen 	idmap_trustedforest_t
1024d61c878SJulian Pullen 			*trusted_forests;	/* Array of trusted forests */
1034d61c878SJulian Pullen 
104*b3700b07SGordon Ross 	ad_disc_ds_t	*preferred_dc;
105*b3700b07SGordon Ross 	boolean_t	preferred_dc_auto_disc;
106*b3700b07SGordon Ross 
107e8c27ec8Sbaban 	/*
108e8c27ec8Sbaban 	 * Following properties are associated with directory-based
109e8c27ec8Sbaban 	 * name-mappings.
110e8c27ec8Sbaban 	 */
111e8c27ec8Sbaban 	char		*ad_unixuser_attr;
112e8c27ec8Sbaban 	char		*ad_unixgroup_attr;
113e8c27ec8Sbaban 	char		*nldap_winname_attr;
114e3f2c991SKeyur Desai 	int		directory_based_mapping;	/* enum */
1157a8a68f5SJulian Pullen 	boolean_t	eph_map_unres_sids;
1161ed6b69aSGordon Ross 	boolean_t	use_ads;
117148c5f43SAlan Wright 	boolean_t	use_lsa;
118148c5f43SAlan Wright 	boolean_t	disable_cross_forest_trusts;
119c5c4113dSnw141292 } idmap_pg_config_t;
120c5c4113dSnw141292 
121c5c4113dSnw141292 typedef struct idmap_cfg {
122c8e26105Sjp151216 	idmap_pg_config_t	pgcfg;	    /* live AD/ID mapping config */
123c8e26105Sjp151216 	idmap_cfg_handles_t	handles;
124349d5d8fSnw141292 	int			initialized;
125c5c4113dSnw141292 } idmap_cfg_t;
126c5c4113dSnw141292 
127c8e26105Sjp151216 
128c8e26105Sjp151216 extern void 		idmap_cfg_unload(idmap_pg_config_t *);
129349d5d8fSnw141292 extern int		idmap_cfg_load(idmap_cfg_t *, int);
130c8e26105Sjp151216 extern idmap_cfg_t	*idmap_cfg_init(void);
131c5c4113dSnw141292 extern int		idmap_cfg_fini(idmap_cfg_t *);
132e3f2c991SKeyur Desai extern int		idmap_cfg_upgrade(idmap_cfg_t *);
1330dcc7149Snw141292 extern int		idmap_cfg_start_updates(void);
1340dcc7149Snw141292 extern void		idmap_cfg_poke_updates(void);
135*b3700b07SGordon Ross extern void		idmap_cfg_force_rediscovery(void);
1360dcc7149Snw141292 extern void		idmap_cfg_hup_handler(int);
137c5c4113dSnw141292 
138*b3700b07SGordon Ross #define	CFG_DISCOVER		0x1	/* Run discovery */
139*b3700b07SGordon Ross #define	CFG_FORGET_DC		0x2	/* Forget current DC. */
140*b3700b07SGordon Ross #define	CFG_LOG			0x4
141349d5d8fSnw141292 
142c5c4113dSnw141292 #ifdef __cplusplus
143c5c4113dSnw141292 }
144c5c4113dSnw141292 #endif
145c5c4113dSnw141292 
146c5c4113dSnw141292 #endif /* _IDMAP_CONFIG_H */
147