ipa_init.c revision a3c8390d19593b1e5277d95bfb4ab206d4785150
/*
SSSD
IPA Provider Initialization functions
Authors:
Simo Sorce <ssorce@redhat.com>
Copyright (C) 2009 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <unistd.h>
#include <fcntl.h>
#include "util/child_common.h"
#include "providers/ipa/ipa_common.h"
#include "providers/krb5/krb5_auth.h"
#include "providers/krb5/krb5_init_shared.h"
#include "providers/ipa/ipa_auth.h"
#include "providers/ipa/ipa_access.h"
#include "providers/ipa/ipa_hostid.h"
#include "providers/ipa/ipa_dyndns.h"
#include "providers/ipa/ipa_selinux.h"
#include "providers/ldap/sdap_access.h"
#include "providers/ldap/sdap_idmap.h"
#include "providers/ipa/ipa_subdomains.h"
#include "providers/dp_dyndns.h"
/* Id Handler */
struct bet_ops ipa_id_ops = {
};
struct bet_ops ipa_auth_ops = {
};
struct bet_ops ipa_chpass_ops = {
};
struct bet_ops ipa_access_ops = {
};
struct bet_ops ipa_selinux_ops = {
};
#ifdef BUILD_SSH
struct bet_ops ipa_hostid_ops = {
};
#endif
static bool srv_in_server_list(const char *servers)
{
int ret = 0;
bool has_srv = false;
if (!tmp_ctx) {
return false;
}
/* split server parm into a list */
goto done;
}
for (int i = 0; list[i]; i++) {
if (has_srv == true) {
break;
}
}
done:
return has_srv;
}
{
const char *ipa_servers;
const char *ipa_backup_servers;
int ret;
return ret;
}
&ipa_options->service);
DEBUG(0, "Failed to init IPA failover service!\n");
return ret;
}
return EOK;
}
void **pvt_data)
{
struct ipa_id_ctx *ipa_ctx;
struct sdap_id_ctx *sdap_ctx;
const char *hostname;
const char *ipa_domain;
const char *ipa_servers;
struct ipa_srv_plugin_ctx *srv_ctx;
bool server_mode;
int ret;
if (!ipa_options) {
return ret;
}
}
if (ipa_options->id_ctx) {
/* already initialized */
*ops = &ipa_id_ops;
return EOK;
}
if (!ipa_ctx) {
return ENOMEM;
}
return ENOMEM;
}
goto done;
}
goto done;
}
/* Perform automatic DNS updates when the
* IP address changes.
* Register a callback for successful LDAP
* reconnections. This is the easiest way to
* identify that we have gone online.
*/
"Dynamic DNS updates are on. Checking for nsupdate..\n");
ret = be_nsupdate_check();
/* nsupdate is available. Dynamic updates
* are supported
*/
/* We will continue without DNS updating */
}
}
}
goto done;
}
/* Set up the ID mapping object */
goto done;
}
ret = sdap_setup_child();
goto done;
}
/* setup SRV lookup plugin */
if (server_mode == true) {
if (srv_in_server_list(ipa_servers) == true
IPA_ENABLE_DNS_SITES) == true) {
"on the IPA server. Site discovery of trusted AD servers "
"might not work\n");
/* If SRV discovery is enabled on the server and
* dns_discovery_domain is set explicitly, then
* the current failover code would use the dns_discovery
* domain to try to find AD servers and fail
*/
"server while using custom dns_discovery_domain. "
"DNS discovery of trusted AD domain will likely fail. "
"It is recommended not to use SRV discovery or the "
"dns_discovery_domain option for the IPA domain while "
"running on the server itself\n"));
"server while using custom dns_discovery_domain. "
"DNS discovery of trusted AD domain will likely fail. "
"It is recommended not to use SRV discovery or the "
"dns_discovery_domain option for the IPA domain while "
"running on the server itself\n");
}
goto done;
}
} else {
/* In server mode we need to ignore the dns_discovery_domain if set
* and only discover servers based on AD domains
*/
NULL);
"dns_discovery_domain, trusted AD domains discovery "
"might fail. Please remove dns_discovery_domain "
"from the config file and restart the SSSD\n");
} else {
"will be ignored in ipa_server_mode\n");
}
}
/* use IPA plugin */
goto done;
}
} else {
/* fall back to standard plugin on clients. */
goto done;
}
}
/* setup periodical refresh of expired records */
sdap_ctx);
}
*ops = &ipa_id_ops;
done:
}
return ret;
}
void **pvt_data)
{
struct ipa_auth_ctx *ipa_auth_ctx;
struct ipa_id_ctx *id_ctx;
struct krb5_ctx *krb5_auth_ctx;
struct sdap_auth_ctx *sdap_auth_ctx;
int ret;
if (!ipa_options) {
return ret;
}
}
if (ipa_options->auth_ctx) {
/* already initialized */
*ops = &ipa_auth_ops;
return EOK;
}
if (!ipa_auth_ctx) {
return ENOMEM;
}
goto done;
}
goto done;
}
if (!krb5_auth_ctx) {
goto done;
}
IPA_SERVER_MODE) == true) {
} else {
}
&krb5_auth_ctx->opts);
goto done;
}
if (!sdap_auth_ctx) {
goto done;
}
goto done;
}
goto done;
}
/* Initialize features needed by the krb5_child */
"Could not initialize krb5_child settings: [%s]\n",
goto done;
}
*ops = &ipa_auth_ops;
*pvt_data = ipa_auth_ctx;
done:
}
return ret;
}
void **pvt_data)
{
int ret;
*ops = &ipa_chpass_ops;
return ret;
}
void **pvt_data)
{
int ret;
struct ipa_access_ctx *ipa_access_ctx;
struct ipa_id_ctx *id_ctx;
if (ipa_access_ctx == NULL) {
return ENOMEM;
}
goto done;
}
goto done;
}
* accounts.
*/
*ops = &ipa_access_ops;
done:
}
return ret;
}
void **pvt_data)
{
int ret;
struct ipa_selinux_ctx *selinux_ctx;
struct ipa_options *opts;
if (selinux_ctx == NULL) {
return ENOMEM;
}
goto done;
}
*ops = &ipa_selinux_ops;
*pvt_data = selinux_ctx;
done:
}
return ret;
}
#ifdef BUILD_SSH
void **pvt_data)
{
int ret;
struct ipa_hostid_ctx *hostid_ctx;
struct ipa_id_ctx *id_ctx;
if (hostid_ctx == NULL) {
return ENOMEM;
}
goto done;
}
*ops = &ipa_hostid_ops;
*pvt_data = hostid_ctx;
done:
}
return ret;
}
#endif
void **pvt_data)
{
#ifdef BUILD_AUTOFS
struct ipa_id_ctx *id_ctx;
int ret;
return ret;
}
#else
"built without autofs support, ignoring\n");
return EOK;
#endif
}
void **pvt_data)
{
int ret;
struct ipa_id_ctx *id_ctx;
return ret;
}
return ret;
}
return ret;
}
return EOK;
}
void **pvt_data)
{
#ifdef BUILD_SUDO
struct ipa_id_ctx *id_ctx;
int ret;
return ret;
}
#else
"built without sudo support, ignoring\n");
return EOK;
#endif
}