summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-06 17:38:31 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-06 17:38:31 -0500
commit372cfda98cce196428a250ef9a60df64c0f7296e (patch)
treedfe88937f13e7d148aa063be06b00aafd2119013
parent0792d5408516a0a4c04e56cabefa7d1ffc440899 (diff)
downloadkcmldap-372cfda9.tar.gz
kcmldap-372cfda9.zip
Write cert and sudoers files
-rw-r--r--src/Makefile.am2
-rw-r--r--src/ldapbonding.cpp39
-rw-r--r--src/ldapbonding.h1
3 files changed, 21 insertions, 21 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 90c6ea3..0242555 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,7 @@ METASOURCES = AUTO
kde_module_LTLIBRARIES = kcm_ldap.la
kcm_ldap_la_SOURCES = ldapbonding.cpp ldapconfigbase.ui realmpropertiesdialog.cpp bondintropage.cpp bondintropagedlg.ui bondrealmpage.cpp bondrealmpagedlg.ui bondfinishpage.cpp bondfinishpagedlg.ui bondwizard.cpp ldappasswddlg.cpp
-kcm_ldap_la_LIBADD = -lkio $(LIB_TDEUI)
+kcm_ldap_la_LIBADD = -lkio $(LIB_TDEUI) -ltdeldap
kcm_ldap_la_LDFLAGS = -avoid-version -module -no-undefined \
$(all_libraries)
diff --git a/src/ldapbonding.cpp b/src/ldapbonding.cpp
index d0d5346..4d939b3 100644
--- a/src/ldapbonding.cpp
+++ b/src/ldapbonding.cpp
@@ -54,7 +54,6 @@
#define PAMD_DIRECTORY "/etc/pam.d/"
#define PAMD_COMMON_ACCOUNT "common-account"
#define PAMD_COMMON_AUTH "common-auth"
-#define CRON_UPDATE_NSS_FILE "/etc/cron.daily/upd-local-nss-db"
typedef KGenericFactory<LDAPConfig, TQWidget> ldapFactory;
@@ -243,6 +242,8 @@ void LDAPConfig::defaults() {
}
void LDAPConfig::save() {
+ TQString errorstring;
+
// Write system configuration
systemconfig->setGroup(NULL);
systemconfig->writeEntry("EnableLDAP", base->systemEnableSupport->isChecked());
@@ -285,9 +286,24 @@ void LDAPConfig::save() {
// Write the PAM configuration files
writePAMFiles();
// Write the cron files
- writeCronFiles();
- // RAJA FIXME
- // Update the SUDOERS file with the domain-wide computer local admin group!
+ LDAPManager::writeCronFiles();
+
+ // Bind anonymously to LDAP
+ LDAPCredentials* credentials = new LDAPCredentials;
+ credentials->username = "";
+ credentials->password = "";
+ credentials->realm = m_defaultRealm.upper();
+ LDAPManager* ldap_mgr = new LDAPManager(m_defaultRealm.upper(), "ldap://", credentials);
+
+ // Add the domain-wide computer local admin group to local sudoers
+ ldap_mgr->writeSudoersConfFile(&errorstring);
+ // Get and install the CA root certificate from LDAP
+ mkdir(TDE_CERTIFICATE_DIR, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
+ mkdir(KERBEROS_PKI_PUBLICDIR, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
+ ldap_mgr->getTDECertificate("publicRootCertificate", KERBEROS_PKI_PUBLICDIR + m_realms[m_defaultRealm].admin_server + ".ldap.crt", &errorstring);
+
+ delete ldap_mgr;
+ delete credentials;
}
load();
@@ -664,21 +680,6 @@ void LDAPConfig::writePAMFiles() {
}
}
-void LDAPConfig::writeCronFiles() {
- TQFile file(CRON_UPDATE_NSS_FILE);
- if (file.open(IO_WriteOnly)) {
- TQTextStream stream( &file );
-
- stream << "# This file was automatically generated by TDE\n";
- stream << "# All changes will be lost!\n";
- stream << "\n";
- stream << "#!/bin/sh" << "\n";
- stream << "/usr/sbin/nss_updatedb ldap" << "\n";
-
- file.close();
- }
-}
-
int LDAPConfig::buttons() {
return KCModule::Apply|KCModule::Help;
}
diff --git a/src/ldapbonding.h b/src/ldapbonding.h
index ebe4973..7a86edd 100644
--- a/src/ldapbonding.h
+++ b/src/ldapbonding.h
@@ -72,7 +72,6 @@ class LDAPConfig: public KCModule
void writeLDAPConfFile();
void writeNSSwitchFile();
void writePAMFiles();
- void writeCronFiles();
private:
KAboutData *myAboutData;