summaryrefslogtreecommitdiffstats
path: root/src/providers/ipa/ipa_init.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-05-02 07:48:26 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-05-07 17:14:32 -0400
commit973b7c27c0b294b8b2f120296f64c6a3a36e44b7 (patch)
tree657daeb7e60b8710f73fe6215407becc3c7f5b22 /src/providers/ipa/ipa_init.c
parent66da80489c0114878043b40592c5f47d41eb0ffd (diff)
downloadsssd-973b7c27c0b294b8b2f120296f64c6a3a36e44b7.tar.gz
sssd-973b7c27c0b294b8b2f120296f64c6a3a36e44b7.tar.xz
sssd-973b7c27c0b294b8b2f120296f64c6a3a36e44b7.zip
Add dynamic DNS updates to FreeIPA
This adds two new options: ipa_dyndns_update: Boolean value to select whether this client should automatically update its IP address in FreeIPA DNS. ipa_dyndns_iface: Choose an interface manually to use for updating dynamic DNS. Default is to use the interface associated with the LDAP connection to FreeIPA. This patch supports A and AAAA records. It relies on the presence of the nsupdate tool from the bind-utils package to perform the actual update step. The location of this utility is set at build time, but its availability is determined at runtime (so clients that do not require dynamic update capability do not need to meet this dependency).
Diffstat (limited to 'src/providers/ipa/ipa_init.c')
-rw-r--r--src/providers/ipa/ipa_init.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c
index 596aecfbd..9c30d9736 100644
--- a/src/providers/ipa/ipa_init.c
+++ b/src/providers/ipa/ipa_init.c
@@ -33,6 +33,7 @@
#include "providers/ipa/ipa_auth.h"
#include "providers/ipa/ipa_access.h"
#include "providers/ipa/ipa_timerules.h"
+#include "providers/ipa/ipa_dyndns.h"
struct ipa_options *ipa_options = NULL;
@@ -96,6 +97,8 @@ int sssm_ipa_id_init(struct be_ctx *bectx,
void **pvt_data)
{
struct sdap_id_ctx *ctx;
+ struct stat stat_buf;
+ errno_t err;
int ret;
if (!ipa_options) {
@@ -127,6 +130,44 @@ int sssm_ipa_id_init(struct be_ctx *bectx,
goto done;
}
+ if(dp_opt_get_bool(ipa_options->basic, IPA_DYNDNS_UPDATE)) {
+ /* 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.
+ */
+
+ /* Ensure that nsupdate exists */
+ errno = 0;
+ ret = stat(NSUPDATE_PATH, &stat_buf);
+ if (ret == -1) {
+ err = errno;
+ if (err == ENOENT) {
+ DEBUG(0, ("%s does not exist. Dynamic DNS updates disabled\n",
+ NSUPDATE_PATH));
+ }
+ else {
+ DEBUG(0, ("Could not set up dynamic DNS updates: [%d][%s]\n",
+ err, strerror(err)));
+ }
+ }
+ else {
+ /* nsupdate is available. Dynamic updates
+ * are supported
+ */
+ ret = be_add_online_cb(ctx, ctx->be,
+ ipa_dyndns_update,
+ ipa_options, NULL);
+ if (ret != EOK) {
+ DEBUG(1,("Failure setting up automatic DNS update\n"));
+ /* We will continue without DNS updating */
+ }
+ }
+ }
+
+
+
ret = setup_tls_config(ctx->opts->basic);
if (ret != EOK) {
DEBUG(1, ("setup_tls_config failed [%d][%s].\n",