xref: /titanic_44/usr/src/cmd/idmap/idmapd/idmap_config.h (revision 1ed6b69a5ca1ca3ee5e9a4931f74e2237c7e1c9f)
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*1ed6b69aSGordon Ross  * Copyright 2013 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>
34c5c4113dSnw141292 
35c5c4113dSnw141292 #ifdef __cplusplus
36c5c4113dSnw141292 extern "C" {
37c5c4113dSnw141292 #endif
38c5c4113dSnw141292 
39c5c4113dSnw141292 #define	MAX_POLICY_SIZE 1023
40c5c4113dSnw141292 
41e3f2c991SKeyur Desai #define	DIRECTORY_MAPPING_NONE	0
42e3f2c991SKeyur Desai #define	DIRECTORY_MAPPING_NAME	1
43e3f2c991SKeyur Desai #define	DIRECTORY_MAPPING_IDMU	2
44e3f2c991SKeyur Desai 
45e3f2c991SKeyur Desai struct enum_lookup_map {
46e3f2c991SKeyur Desai 	int value;
47e3f2c991SKeyur Desai 	char *string;
48e3f2c991SKeyur Desai };
49e3f2c991SKeyur Desai 
50e3f2c991SKeyur Desai extern struct enum_lookup_map directory_mapping_map[];
51e3f2c991SKeyur Desai extern const char *enum_lookup(int value, struct enum_lookup_map *map);
52e3f2c991SKeyur Desai 
53c8e26105Sjp151216 /* SMF and auto-discovery context handles */
54c8e26105Sjp151216 typedef struct idmap_cfg_handles {
55c8e26105Sjp151216 	pthread_mutex_t		mutex;
56c5c4113dSnw141292 	scf_handle_t		*main;
57c5c4113dSnw141292 	scf_instance_t		*instance;
58c5c4113dSnw141292 	scf_service_t		*service;
59c5c4113dSnw141292 	scf_propertygroup_t	*config_pg;
60148c5f43SAlan Wright 	scf_propertygroup_t	*debug_pg;
61c8e26105Sjp151216 	ad_disc_t		ad_ctx;
62c8e26105Sjp151216 } idmap_cfg_handles_t;
63c5c4113dSnw141292 
64c8e26105Sjp151216 /*
65c8e26105Sjp151216  * This structure stores AD and AD-related configuration
66c8e26105Sjp151216  */
674d61c878SJulian Pullen typedef struct idmap_trustedforest {
684d61c878SJulian Pullen 	char		*forest_name;
694d61c878SJulian Pullen 	idmap_ad_disc_ds_t
704d61c878SJulian Pullen 			*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;
80c5c4113dSnw141292 	char		*machine_sid;		/* machine sid */
814d61c878SJulian Pullen 	char		*default_domain;	/* default domain name */
824d61c878SJulian Pullen 	char		*domain_name;		/* AD domain name */
837a8a68f5SJulian Pullen 	boolean_t		domain_name_auto_disc;
844d61c878SJulian Pullen 	idmap_ad_disc_ds_t
854d61c878SJulian Pullen 			*domain_controller;	/* domain controller hosts */
867a8a68f5SJulian Pullen 	boolean_t	domain_controller_auto_disc;
87c8e26105Sjp151216 	char		*forest_name;		/* forest name */
887a8a68f5SJulian Pullen 	boolean_t	forest_name_auto_disc;
89c8e26105Sjp151216 	char		*site_name;		/* site name */
907a8a68f5SJulian Pullen 	boolean_t	site_name_auto_disc;
914d61c878SJulian Pullen 	idmap_ad_disc_ds_t
924d61c878SJulian Pullen 			*global_catalog;	/* global catalog hosts */
937a8a68f5SJulian Pullen 	boolean_t	global_catalog_auto_disc;
944d61c878SJulian Pullen 	ad_disc_domainsinforest_t
954d61c878SJulian Pullen 			*domains_in_forest;
964d61c878SJulian Pullen 	ad_disc_trusteddomains_t
974d61c878SJulian Pullen 			*trusted_domains;	/* Trusted Domains */
984d61c878SJulian Pullen 	int		num_trusted_forests;
994d61c878SJulian Pullen 	idmap_trustedforest_t
1004d61c878SJulian Pullen 			*trusted_forests;	/* Array of trusted forests */
1014d61c878SJulian Pullen 
102e8c27ec8Sbaban 	/*
103e8c27ec8Sbaban 	 * Following properties are associated with directory-based
104e8c27ec8Sbaban 	 * name-mappings.
105e8c27ec8Sbaban 	 */
106e8c27ec8Sbaban 	char		*ad_unixuser_attr;
107e8c27ec8Sbaban 	char		*ad_unixgroup_attr;
108e8c27ec8Sbaban 	char		*nldap_winname_attr;
109e3f2c991SKeyur Desai 	int		directory_based_mapping;	/* enum */
1107a8a68f5SJulian Pullen 	boolean_t	eph_map_unres_sids;
111*1ed6b69aSGordon Ross 	boolean_t	use_ads;
112148c5f43SAlan Wright 	boolean_t	use_lsa;
113148c5f43SAlan Wright 	boolean_t	disable_cross_forest_trusts;
114c5c4113dSnw141292 } idmap_pg_config_t;
115c5c4113dSnw141292 
116c5c4113dSnw141292 typedef struct idmap_cfg {
117c8e26105Sjp151216 	idmap_pg_config_t	pgcfg;	    /* live AD/ID mapping config */
118c8e26105Sjp151216 	idmap_cfg_handles_t	handles;
119349d5d8fSnw141292 	int			initialized;
120c5c4113dSnw141292 } idmap_cfg_t;
121c5c4113dSnw141292 
122c8e26105Sjp151216 
123c8e26105Sjp151216 extern void 		idmap_cfg_unload(idmap_pg_config_t *);
124349d5d8fSnw141292 extern int		idmap_cfg_load(idmap_cfg_t *, int);
125c8e26105Sjp151216 extern idmap_cfg_t	*idmap_cfg_init(void);
126c5c4113dSnw141292 extern int		idmap_cfg_fini(idmap_cfg_t *);
127e3f2c991SKeyur Desai extern int		idmap_cfg_upgrade(idmap_cfg_t *);
1280dcc7149Snw141292 extern int		idmap_cfg_start_updates(void);
1290dcc7149Snw141292 extern void		idmap_cfg_poke_updates(void);
1300dcc7149Snw141292 extern void		idmap_cfg_hup_handler(int);
131c5c4113dSnw141292 
132349d5d8fSnw141292 #define	CFG_DISCOVER		0x1
133349d5d8fSnw141292 #define	CFG_LOG			0x2
134349d5d8fSnw141292 
135c5c4113dSnw141292 #ifdef __cplusplus
136c5c4113dSnw141292 }
137c5c4113dSnw141292 #endif
138c5c4113dSnw141292 
139c5c4113dSnw141292 #endif /* _IDMAP_CONFIG_H */
140