From ec23f4b717dc7e47e9000d2d135ac4914cc2180b Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 11 Jun 2012 14:09:06 -0500 Subject: Move primary realm wizard sources to separate directory Add cert-updater --- src/Makefile.am | 8 +- src/certconfigpage.cpp | 147 ------------ src/certconfigpage.h | 54 ----- src/certconfigpagedlg.ui | 319 --------------------------- src/ldapcontroller.cpp | 36 ++- src/ldapcontroller.h | 3 +- src/primaryrealmwizard/Makefile.am | 5 + src/primaryrealmwizard/certconfigpage.cpp | 147 ++++++++++++ src/primaryrealmwizard/certconfigpage.h | 54 +++++ src/primaryrealmwizard/certconfigpagedlg.ui | 319 +++++++++++++++++++++++++++ src/primaryrealmwizard/realmconfigpage.cpp | 90 ++++++++ src/primaryrealmwizard/realmconfigpage.h | 50 +++++ src/primaryrealmwizard/realmconfigpagedlg.ui | 293 ++++++++++++++++++++++++ src/primaryrealmwizard/realmfinishpage.cpp | 77 +++++++ src/primaryrealmwizard/realmfinishpage.h | 49 ++++ src/primaryrealmwizard/realmfinishpagedlg.ui | 181 +++++++++++++++ src/primaryrealmwizard/realmintropage.cpp | 45 ++++ src/primaryrealmwizard/realmintropage.h | 39 ++++ src/primaryrealmwizard/realmintropagedlg.ui | 119 ++++++++++ src/primaryrealmwizard/realmwizard.cpp | 293 ++++++++++++++++++++++++ src/primaryrealmwizard/realmwizard.h | 87 ++++++++ src/realmconfigpage.cpp | 90 -------- src/realmconfigpage.h | 50 ----- src/realmconfigpagedlg.ui | 293 ------------------------ src/realmfinishpage.cpp | 77 ------- src/realmfinishpage.h | 49 ---- src/realmfinishpagedlg.ui | 181 --------------- src/realmintropage.cpp | 45 ---- src/realmintropage.h | 39 ---- src/realmintropagedlg.ui | 119 ---------- src/realmwizard.cpp | 290 ------------------------ src/realmwizard.h | 87 -------- 32 files changed, 1886 insertions(+), 1849 deletions(-) delete mode 100644 src/certconfigpage.cpp delete mode 100644 src/certconfigpage.h delete mode 100644 src/certconfigpagedlg.ui create mode 100644 src/primaryrealmwizard/Makefile.am create mode 100644 src/primaryrealmwizard/certconfigpage.cpp create mode 100644 src/primaryrealmwizard/certconfigpage.h create mode 100644 src/primaryrealmwizard/certconfigpagedlg.ui create mode 100644 src/primaryrealmwizard/realmconfigpage.cpp create mode 100644 src/primaryrealmwizard/realmconfigpage.h create mode 100644 src/primaryrealmwizard/realmconfigpagedlg.ui create mode 100644 src/primaryrealmwizard/realmfinishpage.cpp create mode 100644 src/primaryrealmwizard/realmfinishpage.h create mode 100644 src/primaryrealmwizard/realmfinishpagedlg.ui create mode 100644 src/primaryrealmwizard/realmintropage.cpp create mode 100644 src/primaryrealmwizard/realmintropage.h create mode 100644 src/primaryrealmwizard/realmintropagedlg.ui create mode 100644 src/primaryrealmwizard/realmwizard.cpp create mode 100644 src/primaryrealmwizard/realmwizard.h delete mode 100644 src/realmconfigpage.cpp delete mode 100644 src/realmconfigpage.h delete mode 100644 src/realmconfigpagedlg.ui delete mode 100644 src/realmfinishpage.cpp delete mode 100644 src/realmfinishpage.h delete mode 100644 src/realmfinishpagedlg.ui delete mode 100644 src/realmintropage.cpp delete mode 100644 src/realmintropage.h delete mode 100644 src/realmintropagedlg.ui delete mode 100644 src/realmwizard.cpp delete mode 100644 src/realmwizard.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index da959c7..518370c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,13 +1,13 @@ INCLUDES = $(all_includes) $(KDE_INCLUDES)/tde METASOURCES = AUTO +SUBDIRS = primaryrealmwizard # Install this plugin in the KDE modules directory kde_module_LTLIBRARIES = kcm_ldapcontroller.la -kcm_ldapcontroller_la_SOURCES = ldapcontroller.cpp ldapcontrollerconfigbase.ui realmwizard.cpp realmintropagedlg.ui certconfigpagedlg.ui certconfigpage.cpp realmintropage.cpp realmconfigpagedlg.ui realmconfigpage.cpp realmfinishpagedlg.ui realmfinishpage.cpp processingdialog.cpp sha1.cc -kcm_ldapcontroller_la_LIBADD = -lkio $(LIB_TDEUI) -ltdeldap -kcm_ldapcontroller_la_LDFLAGS = -avoid-version -module -no-undefined \ - $(all_libraries) +kcm_ldapcontroller_la_SOURCES = ldapcontroller.cpp ldapcontrollerconfigbase.ui processingdialog.cpp sha1.cc +kcm_ldapcontroller_la_LIBADD = primaryrealmwizard/libprimaryrealmwizard.la -lkio $(LIB_TDEUI) -ltdeldap +kcm_ldapcontroller_la_LDFLAGS = -avoid-version -module -no-undefined $(all_libraries) xdg_apps_DATA = ldapcontroller.desktop diff --git a/src/certconfigpage.cpp b/src/certconfigpage.cpp deleted file mode 100644 index 2a5b6e6..0000000 --- a/src/certconfigpage.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "certconfigpage.h" - -CertConfigPage::CertConfigPage(TQWidget *parent, const char *name ) : CertConfigPageDlg(parent,name) { - - px_introSidebar->setPixmap(UserIcon("step2.png")); - - connect(generateKeysEnabled, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(setUseGeneratedKeys(int))); - connect(generateKeysDisabled, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(setUseProvidedKeys(int))); - - connect(kerberosPEM, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(kerberosPEMKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(kerberosCRT, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(kerberosKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(ldapCRT, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(ldapKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - - connect(organizationName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(orgUnitName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(commonName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(localityName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(stateOrProvinceName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(countryName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(emailAddress, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - - m_parentWizard = dynamic_cast(parent); - m_parentDialog = dynamic_cast(parent); -} - -CertConfigPage::~CertConfigPage() { - // -} - -void CertConfigPage::setUseGeneratedKeys(int state) { - if (state == TQButton::On) { - generateKeysDisabled->setChecked(false); - - processLockouts(); - validateEntries(); - } -} - -void CertConfigPage::setUseProvidedKeys(int state) { - if (state == TQButton::On) { - generateKeysEnabled->setChecked(false); - - processLockouts(); - validateEntries(); - } -} - -void CertConfigPage::processLockouts() { - kerberosPEM->setEnabled(generateKeysDisabled->isOn()); - kerberosPEMKEY->setEnabled(generateKeysDisabled->isOn()); - kerberosCRT->setEnabled(generateKeysDisabled->isOn()); - kerberosKEY->setEnabled(generateKeysDisabled->isOn()); - ldapCRT->setEnabled(generateKeysDisabled->isOn()); - ldapKEY->setEnabled(generateKeysDisabled->isOn()); - - organizationName->setEnabled(generateKeysEnabled->isOn()); - orgUnitName->setEnabled(generateKeysEnabled->isOn()); - commonName->setEnabled(generateKeysEnabled->isOn()); - localityName->setEnabled(generateKeysEnabled->isOn()); - stateOrProvinceName->setEnabled(generateKeysEnabled->isOn()); - countryName->setEnabled(generateKeysEnabled->isOn()); - emailAddress->setEnabled(generateKeysEnabled->isOn()); -} - -void CertConfigPage::validateEntries() { - if (m_parentWizard) { - if (generateKeysEnabled->isOn()) { - if ((organizationName->text() != "") && (orgUnitName->text() != "") && (commonName->text() != "") && (localityName->text() != "") && (stateOrProvinceName->text() != "") && (countryName->text() != "") && (emailAddress->text() != "")) { - m_parentWizard->nextButton()->setEnabled(true); - } - else { - m_parentWizard->nextButton()->setEnabled(false); - } - } - else { - if ((kerberosPEM->url() != "") && (kerberosPEMKEY->url() != "") && (kerberosCRT->url() != "") && (kerberosKEY->url() != "") && (ldapCRT->url() != "") && (ldapKEY->url() != "")) { - m_parentWizard->nextButton()->setEnabled(true); - } - else { - m_parentWizard->nextButton()->setEnabled(false); - } - } - } - if (m_parentDialog) { - if (generateKeysEnabled->isOn()) { - if ((organizationName->text() != "") && (orgUnitName->text() != "") && (commonName->text() != "") && (localityName->text() != "") && (stateOrProvinceName->text() != "") && (countryName->text() != "") && (emailAddress->text() != "")) { - m_parentDialog->enableButton(KDialogBase::Ok, true); - } - else { - m_parentDialog->enableButton(KDialogBase::Ok, false); - } - } - else { - if ((kerberosPEM->url() != "") && (kerberosPEMKEY->url() != "") && (kerberosCRT->url() != "") && (kerberosKEY->url() != "") && (ldapCRT->url() != "") && (ldapKEY->url() != "")) { - m_parentDialog->enableButton(KDialogBase::Ok, true); - } - else { - m_parentDialog->enableButton(KDialogBase::Ok, false); - } - } - } -} - -#include "certconfigpage.moc" diff --git a/src/certconfigpage.h b/src/certconfigpage.h deleted file mode 100644 index 57259fc..0000000 --- a/src/certconfigpage.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef CERTCONFIGPAGE_H -#define CERTCONFIGPAGE_H - -#include - -#include "certconfigpagedlg.h" - -class TQStringList; - -/**Abstract class for the first wizard page. Sets the according selection on save() - *@author Timothy Pearson - */ - -class CertConfigPage : public CertConfigPageDlg { - Q_OBJECT - -public: - CertConfigPage(TQWidget *parent=0, const char *name=0); - ~CertConfigPage(); - -public slots: - void validateEntries(); - void processLockouts(); - -private slots: - void setUseGeneratedKeys(int state); - void setUseProvidedKeys(int state); - -private: - KWizard* m_parentWizard; - KDialogBase* m_parentDialog; -}; - -#endif diff --git a/src/certconfigpagedlg.ui b/src/certconfigpagedlg.ui deleted file mode 100644 index 0fad03d..0000000 --- a/src/certconfigpagedlg.ui +++ /dev/null @@ -1,319 +0,0 @@ - - CertConfigPageDlg - - - CertConfigPageDlg - - - - 0 - 0 - 678 - 452 - - - - - unnamed - - - - px_introSidebar - - - - 0 - 0 - 0 - 0 - - - - - 170 - 430 - - - - Panel - - - Sunken - - - true - - - 0 - - - - - groupCertInfo - - - Realm Certificate Information (required) - - - - unnamed - - - - generateKeysEnabled - - - Generate New Certificates and Keys - - - - - unnamed - - - Organization - - - - - organizationName - - - - - unnamed - - - Division/Unit - - - - - orgUnitName - - - - - unnamed - - - Certificate Owner - - - - - commonName - - - - - unnamed - - - City/Locality - - - - - localityName - - - - - unnamed - - - State/Province - - - - - stateOrProvinceName - - - - - unnamed - - - Country - - - - - countryName - - - 2 - - - - - unnamed - - - Administrative Email - - - - - emailAddress - - - - - generateKeysDisabled - - - Install Provided Certificates and Keys - - - - - unnamed - - - Kerberos PKI CA Public Certificate - - - - - kerberosPEM - - - 25 - - - *.pem|PKI Certificate Files (*.pem) - - - - - unnamed - - - Kerberos PKI CA Private Key - - - - - kerberosPEMKEY - - - 25 - - - *.key|Private Key (*.key) - - - - - unnamed - - - Kerberos Public Certificate - - - - - kerberosCRT - - - 25 - - - *.crt|Public Certificate (*.crt) - - - - - unnamed - - - Kerberos Private Key - - - - - kerberosKEY - - - 25 - - - *.key|Private Key (*.key) - - - - - unnamed - - - LDAP TLS Public Certificate - - - - - ldapCRT - - - 25 - - - *.crt|Public Certificate (*.crt) - - - - - unnamed - - - LDAP TLS Private Key - - - - - ldapKEY - - - 25 - - - *.key|Private Key (*.key) - - - - - - - Spacer6 - - - Vertical - - - Fixed - - - - 20 - 30 - - - - - - Spacer5 - - - Vertical - - - Expanding - - - - - - - diff --git a/src/ldapcontroller.cpp b/src/ldapcontroller.cpp index 4f7ff1b..ff716aa 100644 --- a/src/ldapcontroller.cpp +++ b/src/ldapcontroller.cpp @@ -51,9 +51,11 @@ #include "sha1.h" #include "ldapcontroller.h" -#include "realmwizard.h" +#include "primaryrealmwizard/realmwizard.h" #include "processingdialog.h" +#include "ldapcontrollerconfigbase.h" + // FIXME // Connect this to CMake/Automake #define KDE_CONFDIR "/etc/trinity" @@ -76,6 +78,9 @@ #define KEY_STRENGTH 2048 +// RAJA FIXME +// Certificate manager/updater (CLI, callable from crontab) still needs to be written... + typedef KGenericFactory ldapFactory; K_EXPORT_COMPONENT_FACTORY( kcm_ldapcontroller, ldapFactory("kcmldapcontroller")) @@ -345,7 +350,7 @@ void LDAPController::load() { void LDAPController::updateCertDisplay() { TQDateTime certExpiry; TQDateTime now = TQDateTime::currentDateTime(); - TQDateTime soon = now.addDays(7); + TQDateTime soon = now.addDays(7); // Keep in sync with cert-updater/main.cpp TQString kdc_certfile = KERBEROS_PKI_KDC_FILE; kdc_certfile.replace("@@@KDCSERVER@@@", m_realmconfig[m_defaultRealm].kdc); @@ -397,7 +402,7 @@ void LDAPController::updateCertDisplay() { } // LDAP - if (TQFile::exists(kdc_certfile)) { + if (TQFile::exists(ldap_certfile)) { certExpiry = LDAPManager::getCertificateExpiration(ldap_certfile); if (certExpiry >= now) { m_base->ldapExpiryString->setText("Expires " + certExpiry.toString()); @@ -435,6 +440,8 @@ void LDAPController::btncaRegenerate() { KMessageBox::error(0, i18n("Unable to upload new certificate to LDAP server!

%1").arg(errorstring), i18n("Internal Failure")); } + delete ldap_mgr; + load(); } @@ -1173,6 +1180,19 @@ int LDAPController::uploadKerberosCAFileToLDAP(LDAPManager* ldap_mgr, TQString* return -1; } +int LDAPController::uploadKerberosCAKeyFileToLDAP(LDAPManager* ldap_mgr, TQString* errstr) { + // Upload the contents of KERBEROS_PKI_PEMKEY_FILE to the LDAP server + TQFile cafile(KERBEROS_PKI_PEMKEY_FILE); + if (cafile.open(IO_ReadOnly)) { + TQByteArray cafiledata = cafile.readAll(); + if (ldap_mgr->writeCertificateFileIntoDirectory(cafiledata, "privateRootCertificateKey", errstr) != 0) { + return -1; + } + return 0; + } + return -1; +} + // #define STRICT_SETUP 1 int LDAPController::createNewLDAPRealm(TQWidget* dialogparent, LDAPRealmConfig realmconfig, TQString adminUserName, TQString adminGroupName, TQString machineAdminGroupName, TQString standardUserGroupName, const char * adminPassword, TQString rootUserName, const char * rootPassword, TQString adminRealm, LDAPCertConfig certinfo, TQString *errstr) { @@ -1201,7 +1221,6 @@ int LDAPController::createNewLDAPRealm(TQWidget* dialogparent, LDAPRealmConfig r KTempDir configTempDir; configTempDir.setAutoDelete(true); -configTempDir.setAutoDelete(false); // RAJA DEBUG ONLY FIXME TQString destDir = "/etc/"; pdialog.setStatusMessage(i18n("Stopping servers...")); @@ -1486,6 +1505,15 @@ configTempDir.setAutoDelete(false); // RAJA DEBUG ONLY FIXME return -1; } + // Upload the contents of KERBEROS_PKI_PEMKEY_FILE to the LDAP server + if (uploadKerberosCAKeyFileToLDAP(ldap_mgr, &errorstring) != 0) { + delete ldap_mgr; + delete credentials; + if (errstr) *errstr = errorstring; + pdialog.closeDialog(); + return -1; + } + // Set @@@ADMINUSER@@@ password in kadmin LDAPCredentials adminuser; adminuser.username = adminUserName; diff --git a/src/ldapcontroller.h b/src/ldapcontroller.h index da41004..9f5e504 100644 --- a/src/ldapcontroller.h +++ b/src/ldapcontroller.h @@ -34,7 +34,7 @@ #include -#include "ldapcontrollerconfigbase.h" +class LDAPControllerConfigBase; enum sc_command { SC_START, @@ -92,6 +92,7 @@ class LDAPController: public KCModule int setKerberosPasswordForUser(LDAPCredentials user, TQString *errstr); int createRealmCertificates(LDAPCertConfig certinfo, LDAPRealmConfig realmconfig, uid_t ldap_uid, gid_t ldap_gid); int uploadKerberosCAFileToLDAP(LDAPManager* ldap_mgr, TQString* errstr=0); + int uploadKerberosCAKeyFileToLDAP(LDAPManager* ldap_mgr, TQString* errstr=0); private: KAboutData *myAboutData; diff --git a/src/primaryrealmwizard/Makefile.am b/src/primaryrealmwizard/Makefile.am new file mode 100644 index 0000000..fd2c48a --- /dev/null +++ b/src/primaryrealmwizard/Makefile.am @@ -0,0 +1,5 @@ +INCLUDES = $(all_includes) $(KDE_INCLUDES)/tde -I$(top_srcdir)/src +METASOURCES = AUTO + +noinst_LTLIBRARIES = libprimaryrealmwizard.la +libprimaryrealmwizard_la_SOURCES = realmwizard.cpp realmintropagedlg.ui certconfigpagedlg.ui certconfigpage.cpp realmintropage.cpp realmconfigpagedlg.ui realmconfigpage.cpp realmfinishpagedlg.ui realmfinishpage.cpp \ No newline at end of file diff --git a/src/primaryrealmwizard/certconfigpage.cpp b/src/primaryrealmwizard/certconfigpage.cpp new file mode 100644 index 0000000..2a5b6e6 --- /dev/null +++ b/src/primaryrealmwizard/certconfigpage.cpp @@ -0,0 +1,147 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "certconfigpage.h" + +CertConfigPage::CertConfigPage(TQWidget *parent, const char *name ) : CertConfigPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step2.png")); + + connect(generateKeysEnabled, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(setUseGeneratedKeys(int))); + connect(generateKeysDisabled, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(setUseProvidedKeys(int))); + + connect(kerberosPEM, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(kerberosPEMKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(kerberosCRT, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(kerberosKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapCRT, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + + connect(organizationName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(orgUnitName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(commonName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(localityName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(stateOrProvinceName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(countryName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(emailAddress, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + + m_parentWizard = dynamic_cast(parent); + m_parentDialog = dynamic_cast(parent); +} + +CertConfigPage::~CertConfigPage() { + // +} + +void CertConfigPage::setUseGeneratedKeys(int state) { + if (state == TQButton::On) { + generateKeysDisabled->setChecked(false); + + processLockouts(); + validateEntries(); + } +} + +void CertConfigPage::setUseProvidedKeys(int state) { + if (state == TQButton::On) { + generateKeysEnabled->setChecked(false); + + processLockouts(); + validateEntries(); + } +} + +void CertConfigPage::processLockouts() { + kerberosPEM->setEnabled(generateKeysDisabled->isOn()); + kerberosPEMKEY->setEnabled(generateKeysDisabled->isOn()); + kerberosCRT->setEnabled(generateKeysDisabled->isOn()); + kerberosKEY->setEnabled(generateKeysDisabled->isOn()); + ldapCRT->setEnabled(generateKeysDisabled->isOn()); + ldapKEY->setEnabled(generateKeysDisabled->isOn()); + + organizationName->setEnabled(generateKeysEnabled->isOn()); + orgUnitName->setEnabled(generateKeysEnabled->isOn()); + commonName->setEnabled(generateKeysEnabled->isOn()); + localityName->setEnabled(generateKeysEnabled->isOn()); + stateOrProvinceName->setEnabled(generateKeysEnabled->isOn()); + countryName->setEnabled(generateKeysEnabled->isOn()); + emailAddress->setEnabled(generateKeysEnabled->isOn()); +} + +void CertConfigPage::validateEntries() { + if (m_parentWizard) { + if (generateKeysEnabled->isOn()) { + if ((organizationName->text() != "") && (orgUnitName->text() != "") && (commonName->text() != "") && (localityName->text() != "") && (stateOrProvinceName->text() != "") && (countryName->text() != "") && (emailAddress->text() != "")) { + m_parentWizard->nextButton()->setEnabled(true); + } + else { + m_parentWizard->nextButton()->setEnabled(false); + } + } + else { + if ((kerberosPEM->url() != "") && (kerberosPEMKEY->url() != "") && (kerberosCRT->url() != "") && (kerberosKEY->url() != "") && (ldapCRT->url() != "") && (ldapKEY->url() != "")) { + m_parentWizard->nextButton()->setEnabled(true); + } + else { + m_parentWizard->nextButton()->setEnabled(false); + } + } + } + if (m_parentDialog) { + if (generateKeysEnabled->isOn()) { + if ((organizationName->text() != "") && (orgUnitName->text() != "") && (commonName->text() != "") && (localityName->text() != "") && (stateOrProvinceName->text() != "") && (countryName->text() != "") && (emailAddress->text() != "")) { + m_parentDialog->enableButton(KDialogBase::Ok, true); + } + else { + m_parentDialog->enableButton(KDialogBase::Ok, false); + } + } + else { + if ((kerberosPEM->url() != "") && (kerberosPEMKEY->url() != "") && (kerberosCRT->url() != "") && (kerberosKEY->url() != "") && (ldapCRT->url() != "") && (ldapKEY->url() != "")) { + m_parentDialog->enableButton(KDialogBase::Ok, true); + } + else { + m_parentDialog->enableButton(KDialogBase::Ok, false); + } + } + } +} + +#include "certconfigpage.moc" diff --git a/src/primaryrealmwizard/certconfigpage.h b/src/primaryrealmwizard/certconfigpage.h new file mode 100644 index 0000000..57259fc --- /dev/null +++ b/src/primaryrealmwizard/certconfigpage.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef CERTCONFIGPAGE_H +#define CERTCONFIGPAGE_H + +#include + +#include "certconfigpagedlg.h" + +class TQStringList; + +/**Abstract class for the first wizard page. Sets the according selection on save() + *@author Timothy Pearson + */ + +class CertConfigPage : public CertConfigPageDlg { + Q_OBJECT + +public: + CertConfigPage(TQWidget *parent=0, const char *name=0); + ~CertConfigPage(); + +public slots: + void validateEntries(); + void processLockouts(); + +private slots: + void setUseGeneratedKeys(int state); + void setUseProvidedKeys(int state); + +private: + KWizard* m_parentWizard; + KDialogBase* m_parentDialog; +}; + +#endif diff --git a/src/primaryrealmwizard/certconfigpagedlg.ui b/src/primaryrealmwizard/certconfigpagedlg.ui new file mode 100644 index 0000000..0fad03d --- /dev/null +++ b/src/primaryrealmwizard/certconfigpagedlg.ui @@ -0,0 +1,319 @@ + + CertConfigPageDlg + + + CertConfigPageDlg + + + + 0 + 0 + 678 + 452 + + + + + unnamed + + + + px_introSidebar + + + + 0 + 0 + 0 + 0 + + + + + 170 + 430 + + + + Panel + + + Sunken + + + true + + + 0 + + + + + groupCertInfo + + + Realm Certificate Information (required) + + + + unnamed + + + + generateKeysEnabled + + + Generate New Certificates and Keys + + + + + unnamed + + + Organization + + + + + organizationName + + + + + unnamed + + + Division/Unit + + + + + orgUnitName + + + + + unnamed + + + Certificate Owner + + + + + commonName + + + + + unnamed + + + City/Locality + + + + + localityName + + + + + unnamed + + + State/Province + + + + + stateOrProvinceName + + + + + unnamed + + + Country + + + + + countryName + + + 2 + + + + + unnamed + + + Administrative Email + + + + + emailAddress + + + + + generateKeysDisabled + + + Install Provided Certificates and Keys + + + + + unnamed + + + Kerberos PKI CA Public Certificate + + + + + kerberosPEM + + + 25 + + + *.pem|PKI Certificate Files (*.pem) + + + + + unnamed + + + Kerberos PKI CA Private Key + + + + + kerberosPEMKEY + + + 25 + + + *.key|Private Key (*.key) + + + + + unnamed + + + Kerberos Public Certificate + + + + + kerberosCRT + + + 25 + + + *.crt|Public Certificate (*.crt) + + + + + unnamed + + + Kerberos Private Key + + + + + kerberosKEY + + + 25 + + + *.key|Private Key (*.key) + + + + + unnamed + + + LDAP TLS Public Certificate + + + + + ldapCRT + + + 25 + + + *.crt|Public Certificate (*.crt) + + + + + unnamed + + + LDAP TLS Private Key + + + + + ldapKEY + + + 25 + + + *.key|Private Key (*.key) + + + + + + + Spacer6 + + + Vertical + + + Fixed + + + + 20 + 30 + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + + + + diff --git a/src/primaryrealmwizard/realmconfigpage.cpp b/src/primaryrealmwizard/realmconfigpage.cpp new file mode 100644 index 0000000..03df77d --- /dev/null +++ b/src/primaryrealmwizard/realmconfigpage.cpp @@ -0,0 +1,90 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "realmconfigpage.h" + +RealmConfigPage::RealmConfigPage(TQWidget *parent, const char *name ) : RealmConfigPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step2.png")); + + connect(txtRealmName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(txtKDC, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(txtAdminServer, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + + connect(txtRealmName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(realmNameChanged())); + + m_parentWizard = dynamic_cast(parent); + m_parentDialog = dynamic_cast(parent); +} + +RealmConfigPage::~RealmConfigPage() { + // +} + +void RealmConfigPage::validateEntries() { + if (m_parentWizard) { + if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) { + m_parentWizard->nextButton()->setEnabled(true); + } + else { + m_parentWizard->nextButton()->setEnabled(false); + } + } + if (m_parentDialog) { + if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) { + m_parentDialog->enableButton(KDialogBase::Ok, true); + } + else { + m_parentDialog->enableButton(KDialogBase::Ok, false); + } + } +} + +void RealmConfigPage::realmNameChanged() { + TQString realmName = txtRealmName->text(); + txtRealmName->setText(realmName.upper()); + + TQString defaultDomainAliases; + defaultDomainAliases = realmName.lower(); + defaultDomainAliases += "\n"; + defaultDomainAliases += "."; + defaultDomainAliases += realmName.lower(); + txtDomains->setText(defaultDomainAliases); +} + +#include "realmconfigpage.moc" diff --git a/src/primaryrealmwizard/realmconfigpage.h b/src/primaryrealmwizard/realmconfigpage.h new file mode 100644 index 0000000..99ff81f --- /dev/null +++ b/src/primaryrealmwizard/realmconfigpage.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef REALMCONFIGPAGE_H +#define REALMCONFIGPAGE_H + +#include + +#include "realmconfigpagedlg.h" + +class TQStringList; + +/**Abstract class for the first wizard page. Sets the according selection on save() + *@author Timothy Pearson + */ + +class RealmConfigPage : public RealmConfigPageDlg { + Q_OBJECT + +public: + RealmConfigPage(TQWidget *parent=0, const char *name=0); + ~RealmConfigPage(); + +public slots: + void validateEntries(); + void realmNameChanged(); + +private: + KWizard* m_parentWizard; + KDialogBase* m_parentDialog; +}; + +#endif diff --git a/src/primaryrealmwizard/realmconfigpagedlg.ui b/src/primaryrealmwizard/realmconfigpagedlg.ui new file mode 100644 index 0000000..1661407 --- /dev/null +++ b/src/primaryrealmwizard/realmconfigpagedlg.ui @@ -0,0 +1,293 @@ + + RealmConfigPageDlg + + + RealmConfigPageDlg + + + + 0 + 0 + 678 + 452 + + + + + unnamed + + + + px_introSidebar + + + + 0 + 0 + 0 + 0 + + + + + 170 + 430 + + + + Panel + + + Sunken + + + true + + + 0 + + + + + groupRealmInfo + + + Basic Realm Information (required) + + + + unnamed + + + + unnamed + + + Realm Name + + + + + txtRealmName + + + + + unnamed + + + Key Distribution Server [KDC] + + + + + txtKDC + + + + + unnamed + + + port + + + + + txtKDCPort + + + 1 + + + 99999 + + + + + unnamed + + + Administration Server + + + + + txtAdminServer + + + + + unnamed + + + port + + + + + txtAdminServerPort + + + 1 + + + 99999 + + + + + labelUIDOffset + + + UID offset + + + true + + + + + txtUIDOffset + + + 100 + + + 99999 + + + true + + + + + labelGIDOffset + + + GID offset + + + true + + + + + txtGIDOffset + + + 100 + + + 99999 + + + true + + + + + + + groupDomainAliases + + + Realm Domain Aliases (optional) + + + + unnamed + + + + unnamed + + + Enter each domain alias on a new line below + + + + + txtDomains + + + + + + + groupAdvancedPKInit + + + Advanced PKInit Settings (optional) + + + + unnamed + + + + checkRequireEKU + + + Require EKU + + + + + checkRequireKrbtgtOtherName + + + Require KRB TGT Other Name + + + + + checkWin2k + + + Windows 2000 Compatibility + + + + + checkWin2kPkinitRequireBinding + + + Require Windows 2000 Binding + + + + + + + Spacer6 + + + Vertical + + + Fixed + + + + 20 + 30 + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + + + + diff --git a/src/primaryrealmwizard/realmfinishpage.cpp b/src/primaryrealmwizard/realmfinishpage.cpp new file mode 100644 index 0000000..ec5b8de --- /dev/null +++ b/src/primaryrealmwizard/realmfinishpage.cpp @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "realmfinishpage.h" + +RealmFinishPage::RealmFinishPage(TQWidget *parent, const char *name ) : RealmFinishPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step3.png")); + + connect(ldapAdminUsername, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapAdminGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapMachineAdminGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapStandardUserGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + + m_parentWizard = dynamic_cast(parent); + m_parentDialog = dynamic_cast(parent); +} + +RealmFinishPage::~RealmFinishPage(){ + // +} + +void RealmFinishPage::validateEntries() { + if (m_parentWizard) { + if ((ldapAdminUsername->text() != "") && (ldapAdminGroupname->text() != "") && (ldapMachineAdminGroupname->text() != "") && (ldapStandardUserGroupname->text() != "")) { + m_parentWizard->finishButton()->setEnabled(true); + } + else { + m_parentWizard->finishButton()->setEnabled(false); + } + } + if (m_parentDialog) { + if ((ldapAdminUsername->text() != "") && (ldapAdminGroupname->text() != "") && (ldapMachineAdminGroupname->text() != "") && (ldapStandardUserGroupname->text() != "")) { + m_parentDialog->enableButton(KDialogBase::Ok, true); + } + else { + m_parentDialog->enableButton(KDialogBase::Ok, false); + } + } +} + +#include "realmfinishpage.moc" diff --git a/src/primaryrealmwizard/realmfinishpage.h b/src/primaryrealmwizard/realmfinishpage.h new file mode 100644 index 0000000..969d13b --- /dev/null +++ b/src/primaryrealmwizard/realmfinishpage.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef REALMFINISHPAGE_H +#define REALMFINISHPAGE_H + +#include + +#include "realmfinishpagedlg.h" + +class TQStringList; + +/**Abstract class for the first wizard page. Sets the according selection on save() + *@author Timothy Pearson + */ + +class RealmFinishPage : public RealmFinishPageDlg { + Q_OBJECT + + public: + RealmFinishPage(TQWidget *parent=0, const char *name=0); + ~RealmFinishPage(); + + public slots: + void validateEntries(); + + private: + KWizard* m_parentWizard; + KDialogBase* m_parentDialog; +}; + +#endif diff --git a/src/primaryrealmwizard/realmfinishpagedlg.ui b/src/primaryrealmwizard/realmfinishpagedlg.ui new file mode 100644 index 0000000..514bbc7 --- /dev/null +++ b/src/primaryrealmwizard/realmfinishpagedlg.ui @@ -0,0 +1,181 @@ + + RealmFinishPageDlg + + + RealmFinishPageDlg + + + + unnamed + + + + px_introSidebar + + + + 0 + 0 + 0 + 0 + + + + + 170 + 430 + + + + Panel + + + Sunken + + + true + + + 0 + + + + + yad_string + + + <h3>You're almost done!</h3> + + + + + passprompt + + + Please provide new LDAP realm administrator credentials below to finish setup + + + + + unnamed + + + Username + + + + + ldapAdminUsername + + + + + unnamed + + + Password + + + + + ldapAdminPassword + + + + + unnamed + + + Confirm Password + + + + + ldapConfirmAdminPassword + + + + + unnamed + + + Realm Administration Group + + + + + ldapAdminGroupname + + + + + unnamed + + + Machine Administration Group + + + + + ldapMachineAdminGroupname + + + + + unnamed + + + Standard User Group + + + + + ldapStandardUserGroupname + + + + + unnamed + + + LDAP Realm + + + + + ldapAdminRealm + + + + + Spacer6 + + + Vertical + + + Fixed + + + + 20 + 30 + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + + + + diff --git a/src/primaryrealmwizard/realmintropage.cpp b/src/primaryrealmwizard/realmintropage.cpp new file mode 100644 index 0000000..a1f2450 --- /dev/null +++ b/src/primaryrealmwizard/realmintropage.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "realmintropage.h" + +RealmIntroPage::RealmIntroPage(TQWidget *parent, const char *name ) : RealmIntroPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step1.png")); +} + +RealmIntroPage::~RealmIntroPage(){ + // +} + +#include "realmintropage.moc" diff --git a/src/primaryrealmwizard/realmintropage.h b/src/primaryrealmwizard/realmintropage.h new file mode 100644 index 0000000..1c5a9e0 --- /dev/null +++ b/src/primaryrealmwizard/realmintropage.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef REALMINTROPAGE_H +#define REALMINTROPAGE_H + +#include "realmintropagedlg.h" + +class TQStringList; + +/**Abstract class for the first wizard page. Sets the according selection on save() + *@author Timothy Pearson + */ + +class RealmIntroPage : public RealmIntroPageDlg { + Q_OBJECT +public: + RealmIntroPage(TQWidget *parent=0, const char *name=0); + ~RealmIntroPage(); +}; + +#endif diff --git a/src/primaryrealmwizard/realmintropagedlg.ui b/src/primaryrealmwizard/realmintropagedlg.ui new file mode 100644 index 0000000..fabd670 --- /dev/null +++ b/src/primaryrealmwizard/realmintropagedlg.ui @@ -0,0 +1,119 @@ + +RealmIntroPageDlg + + + RealmIntroPageDlg + + + + 0 + 0 + 678 + 452 + + + + + unnamed + + + + px_introSidebar + + + + 0 + 0 + 0 + 0 + + + + + 170 + 430 + + + + Panel + + + Sunken + + + true + + + 0 + + + + + txt_welcome + + + <h3>Welcome to the TDE LDAP Realm Setup Wizard!</h3> + + + + + TextLabel6 + + + + 1 + 1 + 0 + 0 + + + + <p>This Wizard will help you create a new LDAP realm in four quick, easy steps.</p> + <p>Please note that this Wizard will overwrite any existing LDAP realms and data.</p> + <p>If you wish to quit the Wizard, click <b>Cancel</b> at any time.</p> + <p><b>NOTE:</b> Kerberos and LDAP rely heavily on proper DNS resolution in order to function correctly. Therefore, you must have functional forward and reverse DNS entries for this system in order to complete this Wizard.</p> + + + RichText + + + WordBreak|AlignTop|AlignLeft + + + + + + + + + Spacer6 + + + Vertical + + + Fixed + + + + 20 + 30 + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + + + + diff --git a/src/primaryrealmwizard/realmwizard.cpp b/src/primaryrealmwizard/realmwizard.cpp new file mode 100644 index 0000000..2b10dc5 --- /dev/null +++ b/src/primaryrealmwizard/realmwizard.cpp @@ -0,0 +1,293 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "realmintropage.h" +#include "realmconfigpage.h" +#include "certconfigpage.h" +#include "realmfinishpage.h" + +#include "realmwizard.h" +#include "realmwizard.moc" + +RealmWizard::RealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget *parent, const char *name) + : KWizard(parent, name, true), m_controller(controller), m_fqdn(fqdn), m_certconfig(certinfo) { + + setCaption(i18n("LDAP Realm Wizard")); + + intropage = new RealmIntroPage(this); + addPage (intropage, i18n( "Step 1: Introduction" ) ); + setHelpEnabled(TQWizard::page(0), false); + + realmpage = new RealmConfigPage(this); + addPage (realmpage, i18n( "Step 2: Set Up New Realm" ) ); + setHelpEnabled(TQWizard::page(1), false); + + certpage = new CertConfigPage(this); + addPage (certpage, i18n( "Step 3: Set Up Certificates" ) ); + setHelpEnabled(TQWizard::page(2), false); + + finishpage = new RealmFinishPage(this); + addPage (finishpage, i18n( "Step 4: Initialize New Realm" ) ); + setHelpEnabled(TQWizard::page(3), false); + + // Set up some defaults + realmpage->txtKDCPort->setValue(88); + realmpage->txtAdminServerPort->setValue(749); + realmpage->txtUIDOffset->setValue(5000); + realmpage->txtGIDOffset->setValue(5000); + realmpage->txtGIDOffset->setValue(5000); + TQString domainGuess = m_fqdn; + int firstDot = domainGuess.find("."); + if (firstDot >= 0) { + domainGuess.remove(0, firstDot+1); + } + realmpage->txtRealmName->setText(domainGuess); + realmpage->txtKDC->setText(m_fqdn); + realmpage->txtAdminServer->setText(m_fqdn); + realmpage->realmNameChanged(); + certpage->generateKeysEnabled->setChecked(true); + finishpage->ldapAdminGroupname->setText("realmadmins"); + finishpage->ldapMachineAdminGroupname->setText("machineadmins"); + finishpage->ldapStandardUserGroupname->setText("standardusers"); + + // Load certificate info + certpage->organizationName->setText(m_certconfig.organizationName); + certpage->orgUnitName->setText(m_certconfig.orgUnitName); + certpage->commonName->setText(m_certconfig.commonName); + certpage->localityName->setText(m_certconfig.localityName); + certpage->stateOrProvinceName->setText(m_certconfig.stateOrProvinceName); + certpage->countryName->setText(m_certconfig.countryName); + certpage->emailAddress->setText(m_certconfig.emailAddress); + + // Other setup + finishpage->ldapAdminRealm->setEnabled(false); + + // Kerberos won't work unless the DNS suffix matches the realm name + realmpage->txtRealmName->setEnabled(false); + + setFinishEnabled(TQWizard::page(3), true); + + setPosition(); +} + +RealmWizard::~RealmWizard() { +} + + +void RealmWizard::next() { + if (currentPage()==intropage) { + TQWizard::next(); + realmpage->validateEntries(); + } + else if (currentPage()==realmpage) { + // Save realm information + m_realmconfig.name = realmpage->txtRealmName->text(); + m_realmconfig.bonded = false; + m_realmconfig.uid_offset = realmpage->txtUIDOffset->value(); + m_realmconfig.gid_offset = realmpage->txtGIDOffset->value(); + m_realmconfig.domain_mappings = TQStringList::split("\n", realmpage->txtDomains->text(), FALSE); + m_realmconfig.kdc = realmpage->txtKDC->text(); + m_realmconfig.kdc_port = realmpage->txtKDCPort->value(); + m_realmconfig.admin_server = realmpage->txtAdminServer->text(); + m_realmconfig.admin_server_port = realmpage->txtAdminServerPort->value(); + m_realmconfig.pkinit_require_eku = realmpage->checkRequireEKU->isChecked(); + m_realmconfig.pkinit_require_krbtgt_otherName = realmpage->checkRequireKrbtgtOtherName->isChecked(); + m_realmconfig.win2k_pkinit = realmpage->checkWin2k->isChecked(); + m_realmconfig.win2k_pkinit_require_binding = realmpage->checkWin2kPkinitRequireBinding->isChecked(); + + finishpage->ldapAdminRealm->setText(realmpage->txtRealmName->text()); + TQWizard::next(); + certpage->processLockouts(); + certpage->validateEntries(); + } + else if (currentPage()==certpage) { + // Save certificate information + // RAJA FIXME + // If generate_certs == false, we need to load m_certconfig structure with data from the provided certificate! + // If this is not done, the automatic certificate updater will fail!!! + m_certconfig.generate_certs = certpage->generateKeysEnabled->isOn(); + m_certconfig.provided_kerberos_pem = certpage->kerberosPEM->url(); + m_certconfig.provided_kerberos_pemkey = certpage->kerberosPEMKEY->url(); + m_certconfig.provided_kerberos_crt = certpage->kerberosCRT->url(); + m_certconfig.provided_kerberos_key = certpage->kerberosKEY->url(); + m_certconfig.provided_ldap_crt = certpage->ldapCRT->url(); + m_certconfig.provided_ldap_key = certpage->ldapKEY->url(); + m_certconfig.organizationName = certpage->organizationName->text(); + m_certconfig.orgUnitName = certpage->orgUnitName->text(); + m_certconfig.commonName = certpage->commonName->text(); + m_certconfig.localityName = certpage->localityName->text(); + m_certconfig.stateOrProvinceName = certpage->stateOrProvinceName->text(); + m_certconfig.countryName = certpage->countryName->text(); + m_certconfig.emailAddress = certpage->emailAddress->text(); + + TQWizard::next(); + finishpage->validateEntries(); + } + if (currentPage()==finishpage) { + finishButton()->setFocus(); + } +} + +void RealmWizard::slotNext() { + TQWizard::next(); +} + +void RealmWizard::back() { + TQWizard::back(); +} + +bool RealmWizard::askClose(){ + TQString text; + if (currentPage()==intropage) { + return true; + } + else { + if ((currentPage()==certpage) || (currentPage()==finishpage)) { + text = i18n("

Are you sure you want to quit the LDAP Realm Wizard?

" + "

If yes, click Quit and all changes will be lost." + "
If not, click Cancel to return and finish your setup.

"); + } + else { + text = i18n("

Are you sure you want to quit the LDAP Realm Wizard?

" + "

If not, click Cancel to return and finish setup.

"); + } + int status = KMessageBox::warningContinueCancel(this, text, i18n("All Changes Will Be Lost"), KStdGuiItem::quit()); + if(status==KMessageBox::Continue){ + setDefaults(); + return true; + } else { + return false; + } + } +} + +/** the cancel button is connected to the reject() slot of TQDialog, + * so we have to reimplement this here to add a dialogbox to ask if we + * really want to quit the wizard. + */ +void RealmWizard::reject() { + if (askClose()){ + done(-1); + } +} + +void RealmWizard::closeEvent(TQCloseEvent* e){ + if ( askClose() ) + done(0); + else + e->ignore(); +} + +/** maybe call a dialog that the wizard has finished. */ +void RealmWizard::accept() { + // Validate entries + if (TQString(finishpage->ldapAdminPassword->password()) != TQString(finishpage->ldapConfirmAdminPassword->password())) { + KMessageBox::error(this, i18n("Passwords do not match!

Please re-enter the new administration account password"), i18n("Input Error")); + return; + } + if (TQString(finishpage->ldapAdminPassword->password()) == "") { + KMessageBox::error(this, i18n("Password required!

Please enter the new administration account password"), i18n("Input Error")); + return; + } + + // Try to create realm + TQString errorString; + // FIXME + // root account should not be locked to "admin"! + // when fixing, please fix the other instance of locked "admin" in ldapcontroller.cpp ::load() + backButton()->setEnabled(false); + nextButton()->setEnabled(false); + finishButton()->setEnabled(false); + cancelButton()->setEnabled(false); + if (m_controller->createNewLDAPRealm(this, m_realmconfig, finishpage->ldapAdminUsername->text(), finishpage->ldapAdminGroupname->text(), finishpage->ldapMachineAdminGroupname->text(), finishpage->ldapStandardUserGroupname->text(), finishpage->ldapAdminPassword->password(), "admin", finishpage->ldapAdminPassword->password(), finishpage->ldapAdminRealm->text(), m_certconfig, &errorString) == 0) { + done(0); + } + else { + KMessageBox::error(this, i18n("Unable to create new realm!

Details: %1").arg(errorString), i18n("Unable to create new realm")); + } + + backButton()->setEnabled(true); + finishButton()->setEnabled(true); + cancelButton()->setEnabled(true); +} + +/** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */ +void RealmWizard::setDefaults() { +// if(realm_dirty) +// realmpage->save(false); +} + +/** there seems to be a bug in TQWizard, that makes this evil hack necessary */ +void RealmWizard::setPosition() { + TQSize hint = intropage->sizeHint(); + TQSize realm_size = realmpage->sizeHint(); + TQSize finish_size = finishpage->sizeHint(); + + // get the width of the broadest child-widget + if ( hint.width() < realm_size.width() ) + hint.setWidth(realm_size.width()); + if ( hint.width() < finish_size.width() ) + hint.setWidth(finish_size.width()); + + // get the height of the highest child-widget + if ( hint.height() < realm_size.height() ) + hint.setHeight(realm_size.height()); + if ( hint.height() < finish_size.height() ) + hint.setHeight(finish_size.height()); + + // set the position + TQRect rect = KGlobalSettings::desktopGeometry(TQCursor::pos()); + int w = rect.x() + (rect.width() - hint.width())/2 - 9; + int h = rect.y() + (rect.height() - hint.height())/2; + move(w, h); +} diff --git a/src/primaryrealmwizard/realmwizard.h b/src/primaryrealmwizard/realmwizard.h new file mode 100644 index 0000000..34de72b --- /dev/null +++ b/src/primaryrealmwizard/realmwizard.h @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef BONDWIZARD_H +#define BONDWIZARD_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "ldapcontroller.h" + +/** prototypes */ +class KLanguageCombo; +class RealmIntroPage; +class RealmConfigPage; +class CertConfigPage; +class RealmFinishPage; + +/** RealmWizard is the base class of the project */ +class RealmWizard : public KWizard { + Q_OBJECT +public: + /** construtor */ + RealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget* parent=0, const char *name=0); + /** destructor */ + ~RealmWizard(); + + virtual void next(); + virtual void back(); + +public slots: // Public slots + /** calls all save functions after resetting all fields to Trinity default */ + void setDefaults(); + /** the cancel button is connected to the reject() slot of TQDialog, + * so we have to reimplement this here to add a dialogbox to + * ask if we really want to quit the wizard. + */ + void reject(); + /** maybe call a dialog that the wizard has finished. + * Calls applySettings() to save the current selection. + */ + void accept(); + /** We need this to use it in a TQTimer */ + void slotNext(); + +private: + void setPosition(); + +private: + RealmIntroPage* intropage; + RealmConfigPage* realmpage; + CertConfigPage* certpage; + RealmFinishPage* finishpage; + bool realm_dirty; + LDAPController* m_controller; + LDAPRealmConfig m_realmconfig; + TQString m_fqdn; + LDAPCertConfig m_certconfig; + +protected: // Protected methods + // the close button on the titlebar sets e->accept() which we don't want. + virtual void closeEvent(TQCloseEvent*); + bool askClose(); +}; + +#endif diff --git a/src/realmconfigpage.cpp b/src/realmconfigpage.cpp deleted file mode 100644 index 03df77d..0000000 --- a/src/realmconfigpage.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "realmconfigpage.h" - -RealmConfigPage::RealmConfigPage(TQWidget *parent, const char *name ) : RealmConfigPageDlg(parent,name) { - - px_introSidebar->setPixmap(UserIcon("step2.png")); - - connect(txtRealmName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(txtKDC, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(txtAdminServer, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - - connect(txtRealmName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(realmNameChanged())); - - m_parentWizard = dynamic_cast(parent); - m_parentDialog = dynamic_cast(parent); -} - -RealmConfigPage::~RealmConfigPage() { - // -} - -void RealmConfigPage::validateEntries() { - if (m_parentWizard) { - if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) { - m_parentWizard->nextButton()->setEnabled(true); - } - else { - m_parentWizard->nextButton()->setEnabled(false); - } - } - if (m_parentDialog) { - if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) { - m_parentDialog->enableButton(KDialogBase::Ok, true); - } - else { - m_parentDialog->enableButton(KDialogBase::Ok, false); - } - } -} - -void RealmConfigPage::realmNameChanged() { - TQString realmName = txtRealmName->text(); - txtRealmName->setText(realmName.upper()); - - TQString defaultDomainAliases; - defaultDomainAliases = realmName.lower(); - defaultDomainAliases += "\n"; - defaultDomainAliases += "."; - defaultDomainAliases += realmName.lower(); - txtDomains->setText(defaultDomainAliases); -} - -#include "realmconfigpage.moc" diff --git a/src/realmconfigpage.h b/src/realmconfigpage.h deleted file mode 100644 index 99ff81f..0000000 --- a/src/realmconfigpage.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef REALMCONFIGPAGE_H -#define REALMCONFIGPAGE_H - -#include - -#include "realmconfigpagedlg.h" - -class TQStringList; - -/**Abstract class for the first wizard page. Sets the according selection on save() - *@author Timothy Pearson - */ - -class RealmConfigPage : public RealmConfigPageDlg { - Q_OBJECT - -public: - RealmConfigPage(TQWidget *parent=0, const char *name=0); - ~RealmConfigPage(); - -public slots: - void validateEntries(); - void realmNameChanged(); - -private: - KWizard* m_parentWizard; - KDialogBase* m_parentDialog; -}; - -#endif diff --git a/src/realmconfigpagedlg.ui b/src/realmconfigpagedlg.ui deleted file mode 100644 index 1661407..0000000 --- a/src/realmconfigpagedlg.ui +++ /dev/null @@ -1,293 +0,0 @@ - - RealmConfigPageDlg - - - RealmConfigPageDlg - - - - 0 - 0 - 678 - 452 - - - - - unnamed - - - - px_introSidebar - - - - 0 - 0 - 0 - 0 - - - - - 170 - 430 - - - - Panel - - - Sunken - - - true - - - 0 - - - - - groupRealmInfo - - - Basic Realm Information (required) - - - - unnamed - - - - unnamed - - - Realm Name - - - - - txtRealmName - - - - - unnamed - - - Key Distribution Server [KDC] - - - - - txtKDC - - - - - unnamed - - - port - - - - - txtKDCPort - - - 1 - - - 99999 - - - - - unnamed - - - Administration Server - - - - - txtAdminServer - - - - - unnamed - - - port - - - - - txtAdminServerPort - - - 1 - - - 99999 - - - - - labelUIDOffset - - - UID offset - - - true - - - - - txtUIDOffset - - - 100 - - - 99999 - - - true - - - - - labelGIDOffset - - - GID offset - - - true - - - - - txtGIDOffset - - - 100 - - - 99999 - - - true - - - - - - - groupDomainAliases - - - Realm Domain Aliases (optional) - - - - unnamed - - - - unnamed - - - Enter each domain alias on a new line below - - - - - txtDomains - - - - - - - groupAdvancedPKInit - - - Advanced PKInit Settings (optional) - - - - unnamed - - - - checkRequireEKU - - - Require EKU - - - - - checkRequireKrbtgtOtherName - - - Require KRB TGT Other Name - - - - - checkWin2k - - - Windows 2000 Compatibility - - - - - checkWin2kPkinitRequireBinding - - - Require Windows 2000 Binding - - - - - - - Spacer6 - - - Vertical - - - Fixed - - - - 20 - 30 - - - - - - Spacer5 - - - Vertical - - - Expanding - - - - - - - diff --git a/src/realmfinishpage.cpp b/src/realmfinishpage.cpp deleted file mode 100644 index ec5b8de..0000000 --- a/src/realmfinishpage.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "realmfinishpage.h" - -RealmFinishPage::RealmFinishPage(TQWidget *parent, const char *name ) : RealmFinishPageDlg(parent,name) { - - px_introSidebar->setPixmap(UserIcon("step3.png")); - - connect(ldapAdminUsername, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(ldapAdminGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(ldapMachineAdminGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - connect(ldapStandardUserGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); - - m_parentWizard = dynamic_cast(parent); - m_parentDialog = dynamic_cast(parent); -} - -RealmFinishPage::~RealmFinishPage(){ - // -} - -void RealmFinishPage::validateEntries() { - if (m_parentWizard) { - if ((ldapAdminUsername->text() != "") && (ldapAdminGroupname->text() != "") && (ldapMachineAdminGroupname->text() != "") && (ldapStandardUserGroupname->text() != "")) { - m_parentWizard->finishButton()->setEnabled(true); - } - else { - m_parentWizard->finishButton()->setEnabled(false); - } - } - if (m_parentDialog) { - if ((ldapAdminUsername->text() != "") && (ldapAdminGroupname->text() != "") && (ldapMachineAdminGroupname->text() != "") && (ldapStandardUserGroupname->text() != "")) { - m_parentDialog->enableButton(KDialogBase::Ok, true); - } - else { - m_parentDialog->enableButton(KDialogBase::Ok, false); - } - } -} - -#include "realmfinishpage.moc" diff --git a/src/realmfinishpage.h b/src/realmfinishpage.h deleted file mode 100644 index 969d13b..0000000 --- a/src/realmfinishpage.h +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef REALMFINISHPAGE_H -#define REALMFINISHPAGE_H - -#include - -#include "realmfinishpagedlg.h" - -class TQStringList; - -/**Abstract class for the first wizard page. Sets the according selection on save() - *@author Timothy Pearson - */ - -class RealmFinishPage : public RealmFinishPageDlg { - Q_OBJECT - - public: - RealmFinishPage(TQWidget *parent=0, const char *name=0); - ~RealmFinishPage(); - - public slots: - void validateEntries(); - - private: - KWizard* m_parentWizard; - KDialogBase* m_parentDialog; -}; - -#endif diff --git a/src/realmfinishpagedlg.ui b/src/realmfinishpagedlg.ui deleted file mode 100644 index 514bbc7..0000000 --- a/src/realmfinishpagedlg.ui +++ /dev/null @@ -1,181 +0,0 @@ - - RealmFinishPageDlg - - - RealmFinishPageDlg - - - - unnamed - - - - px_introSidebar - - - - 0 - 0 - 0 - 0 - - - - - 170 - 430 - - - - Panel - - - Sunken - - - true - - - 0 - - - - - yad_string - - - <h3>You're almost done!</h3> - - - - - passprompt - - - Please provide new LDAP realm administrator credentials below to finish setup - - - - - unnamed - - - Username - - - - - ldapAdminUsername - - - - - unnamed - - - Password - - - - - ldapAdminPassword - - - - - unnamed - - - Confirm Password - - - - - ldapConfirmAdminPassword - - - - - unnamed - - - Realm Administration Group - - - - - ldapAdminGroupname - - - - - unnamed - - - Machine Administration Group - - - - - ldapMachineAdminGroupname - - - - - unnamed - - - Standard User Group - - - - - ldapStandardUserGroupname - - - - - unnamed - - - LDAP Realm - - - - - ldapAdminRealm - - - - - Spacer6 - - - Vertical - - - Fixed - - - - 20 - 30 - - - - - - Spacer5 - - - Vertical - - - Expanding - - - - - - - diff --git a/src/realmintropage.cpp b/src/realmintropage.cpp deleted file mode 100644 index a1f2450..0000000 --- a/src/realmintropage.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "realmintropage.h" - -RealmIntroPage::RealmIntroPage(TQWidget *parent, const char *name ) : RealmIntroPageDlg(parent,name) { - - px_introSidebar->setPixmap(UserIcon("step1.png")); -} - -RealmIntroPage::~RealmIntroPage(){ - // -} - -#include "realmintropage.moc" diff --git a/src/realmintropage.h b/src/realmintropage.h deleted file mode 100644 index 1c5a9e0..0000000 --- a/src/realmintropage.h +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef REALMINTROPAGE_H -#define REALMINTROPAGE_H - -#include "realmintropagedlg.h" - -class TQStringList; - -/**Abstract class for the first wizard page. Sets the according selection on save() - *@author Timothy Pearson - */ - -class RealmIntroPage : public RealmIntroPageDlg { - Q_OBJECT -public: - RealmIntroPage(TQWidget *parent=0, const char *name=0); - ~RealmIntroPage(); -}; - -#endif diff --git a/src/realmintropagedlg.ui b/src/realmintropagedlg.ui deleted file mode 100644 index fabd670..0000000 --- a/src/realmintropagedlg.ui +++ /dev/null @@ -1,119 +0,0 @@ - -RealmIntroPageDlg - - - RealmIntroPageDlg - - - - 0 - 0 - 678 - 452 - - - - - unnamed - - - - px_introSidebar - - - - 0 - 0 - 0 - 0 - - - - - 170 - 430 - - - - Panel - - - Sunken - - - true - - - 0 - - - - - txt_welcome - - - <h3>Welcome to the TDE LDAP Realm Setup Wizard!</h3> - - - - - TextLabel6 - - - - 1 - 1 - 0 - 0 - - - - <p>This Wizard will help you create a new LDAP realm in four quick, easy steps.</p> - <p>Please note that this Wizard will overwrite any existing LDAP realms and data.</p> - <p>If you wish to quit the Wizard, click <b>Cancel</b> at any time.</p> - <p><b>NOTE:</b> Kerberos and LDAP rely heavily on proper DNS resolution in order to function correctly. Therefore, you must have functional forward and reverse DNS entries for this system in order to complete this Wizard.</p> - - - RichText - - - WordBreak|AlignTop|AlignLeft - - - - - - - - - Spacer6 - - - Vertical - - - Fixed - - - - 20 - 30 - - - - - - Spacer5 - - - Vertical - - - Expanding - - - - - - - diff --git a/src/realmwizard.cpp b/src/realmwizard.cpp deleted file mode 100644 index f2a7760..0000000 --- a/src/realmwizard.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "realmintropage.h" -#include "realmconfigpage.h" -#include "certconfigpage.h" -#include "realmfinishpage.h" - -#include "realmwizard.h" -#include "realmwizard.moc" - -RealmWizard::RealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget *parent, const char *name) - : KWizard(parent, name, true), m_controller(controller), m_fqdn(fqdn), m_certconfig(certinfo) { - - setCaption(i18n("LDAP Realm Wizard")); - - intropage = new RealmIntroPage(this); - addPage (intropage, i18n( "Step 1: Introduction" ) ); - setHelpEnabled(TQWizard::page(0), false); - - realmpage = new RealmConfigPage(this); - addPage (realmpage, i18n( "Step 2: Set Up New Realm" ) ); - setHelpEnabled(TQWizard::page(1), false); - - certpage = new CertConfigPage(this); - addPage (certpage, i18n( "Step 3: Set Up Certificates" ) ); - setHelpEnabled(TQWizard::page(2), false); - - finishpage = new RealmFinishPage(this); - addPage (finishpage, i18n( "Step 4: Initialize New Realm" ) ); - setHelpEnabled(TQWizard::page(3), false); - - // Set up some defaults - realmpage->txtKDCPort->setValue(88); - realmpage->txtAdminServerPort->setValue(749); - realmpage->txtUIDOffset->setValue(5000); - realmpage->txtGIDOffset->setValue(5000); - realmpage->txtGIDOffset->setValue(5000); - TQString domainGuess = m_fqdn; - int firstDot = domainGuess.find("."); - if (firstDot >= 0) { - domainGuess.remove(0, firstDot+1); - } - realmpage->txtRealmName->setText(domainGuess); - realmpage->txtKDC->setText(m_fqdn); - realmpage->txtAdminServer->setText(m_fqdn); - realmpage->realmNameChanged(); - certpage->generateKeysEnabled->setChecked(true); - finishpage->ldapAdminGroupname->setText("realmadmins"); - finishpage->ldapMachineAdminGroupname->setText("machineadmins"); - finishpage->ldapStandardUserGroupname->setText("standardusers"); - - // Load certificate info - certpage->organizationName->setText(m_certconfig.organizationName); - certpage->orgUnitName->setText(m_certconfig.orgUnitName); - certpage->commonName->setText(m_certconfig.commonName); - certpage->localityName->setText(m_certconfig.localityName); - certpage->stateOrProvinceName->setText(m_certconfig.stateOrProvinceName); - certpage->countryName->setText(m_certconfig.countryName); - certpage->emailAddress->setText(m_certconfig.emailAddress); - - // Other setup - finishpage->ldapAdminRealm->setEnabled(false); - - // Kerberos won't work unless the DNS suffix matches the realm name - realmpage->txtRealmName->setEnabled(false); - - setFinishEnabled(TQWizard::page(3), true); - - setPosition(); -} - -RealmWizard::~RealmWizard() { -} - - -void RealmWizard::next() { - if (currentPage()==intropage) { - TQWizard::next(); - realmpage->validateEntries(); - } - else if (currentPage()==realmpage) { - // Save realm information - m_realmconfig.name = realmpage->txtRealmName->text(); - m_realmconfig.bonded = false; - m_realmconfig.uid_offset = realmpage->txtUIDOffset->value(); - m_realmconfig.gid_offset = realmpage->txtGIDOffset->value(); - m_realmconfig.domain_mappings = TQStringList::split("\n", realmpage->txtDomains->text(), FALSE); - m_realmconfig.kdc = realmpage->txtKDC->text(); - m_realmconfig.kdc_port = realmpage->txtKDCPort->value(); - m_realmconfig.admin_server = realmpage->txtAdminServer->text(); - m_realmconfig.admin_server_port = realmpage->txtAdminServerPort->value(); - m_realmconfig.pkinit_require_eku = realmpage->checkRequireEKU->isChecked(); - m_realmconfig.pkinit_require_krbtgt_otherName = realmpage->checkRequireKrbtgtOtherName->isChecked(); - m_realmconfig.win2k_pkinit = realmpage->checkWin2k->isChecked(); - m_realmconfig.win2k_pkinit_require_binding = realmpage->checkWin2kPkinitRequireBinding->isChecked(); - - finishpage->ldapAdminRealm->setText(realmpage->txtRealmName->text()); - TQWizard::next(); - certpage->processLockouts(); - certpage->validateEntries(); - } - else if (currentPage()==certpage) { - // Save certificate information - m_certconfig.generate_certs = certpage->generateKeysEnabled->isOn(); - m_certconfig.provided_kerberos_pem = certpage->kerberosPEM->url(); - m_certconfig.provided_kerberos_pemkey = certpage->kerberosPEMKEY->url(); - m_certconfig.provided_kerberos_crt = certpage->kerberosCRT->url(); - m_certconfig.provided_kerberos_key = certpage->kerberosKEY->url(); - m_certconfig.provided_ldap_crt = certpage->ldapCRT->url(); - m_certconfig.provided_ldap_key = certpage->ldapKEY->url(); - m_certconfig.organizationName = certpage->organizationName->text(); - m_certconfig.orgUnitName = certpage->orgUnitName->text(); - m_certconfig.commonName = certpage->commonName->text(); - m_certconfig.localityName = certpage->localityName->text(); - m_certconfig.stateOrProvinceName = certpage->stateOrProvinceName->text(); - m_certconfig.countryName = certpage->countryName->text(); - m_certconfig.emailAddress = certpage->emailAddress->text(); - - TQWizard::next(); - finishpage->validateEntries(); - } - if (currentPage()==finishpage) { - finishButton()->setFocus(); - } -} - -void RealmWizard::slotNext() { - TQWizard::next(); -} - -void RealmWizard::back() { - TQWizard::back(); -} - -bool RealmWizard::askClose(){ - TQString text; - if (currentPage()==intropage) { - return true; - } - else { - if ((currentPage()==certpage) || (currentPage()==finishpage)) { - text = i18n("

Are you sure you want to quit the LDAP Realm Wizard?

" - "

If yes, click Quit and all changes will be lost." - "
If not, click Cancel to return and finish your setup.

"); - } - else { - text = i18n("

Are you sure you want to quit the LDAP Realm Wizard?

" - "

If not, click Cancel to return and finish setup.

"); - } - int status = KMessageBox::warningContinueCancel(this, text, i18n("All Changes Will Be Lost"), KStdGuiItem::quit()); - if(status==KMessageBox::Continue){ - setDefaults(); - return true; - } else { - return false; - } - } -} - -/** the cancel button is connected to the reject() slot of TQDialog, - * so we have to reimplement this here to add a dialogbox to ask if we - * really want to quit the wizard. - */ -void RealmWizard::reject() { - if (askClose()){ - done(-1); - } -} - -void RealmWizard::closeEvent(TQCloseEvent* e){ - if ( askClose() ) - done(0); - else - e->ignore(); -} - -/** maybe call a dialog that the wizard has finished. */ -void RealmWizard::accept() { - // Validate entries - if (TQString(finishpage->ldapAdminPassword->password()) != TQString(finishpage->ldapConfirmAdminPassword->password())) { - KMessageBox::error(this, i18n("Passwords do not match!

Please re-enter the new administration account password"), i18n("Input Error")); - return; - } - if (TQString(finishpage->ldapAdminPassword->password()) == "") { - KMessageBox::error(this, i18n("Password required!

Please enter the new administration account password"), i18n("Input Error")); - return; - } - - // Try to create realm - TQString errorString; - // FIXME - // root account should not be locked to "admin"! - // when fixing, please fix the other instance of locked "admin" in ldapcontroller.cpp ::load() - backButton()->setEnabled(false); - nextButton()->setEnabled(false); - finishButton()->setEnabled(false); - cancelButton()->setEnabled(false); - if (m_controller->createNewLDAPRealm(this, m_realmconfig, finishpage->ldapAdminUsername->text(), finishpage->ldapAdminGroupname->text(), finishpage->ldapMachineAdminGroupname->text(), finishpage->ldapStandardUserGroupname->text(), finishpage->ldapAdminPassword->password(), "admin", finishpage->ldapAdminPassword->password(), finishpage->ldapAdminRealm->text(), m_certconfig, &errorString) == 0) { - done(0); - } - else { - KMessageBox::error(this, i18n("Unable to create new realm!

Details: %1").arg(errorString), i18n("Unable to create new realm")); - } - - backButton()->setEnabled(true); - finishButton()->setEnabled(true); - cancelButton()->setEnabled(true); -} - -/** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */ -void RealmWizard::setDefaults() { -// if(realm_dirty) -// realmpage->save(false); -} - -/** there seems to be a bug in TQWizard, that makes this evil hack necessary */ -void RealmWizard::setPosition() { - TQSize hint = intropage->sizeHint(); - TQSize realm_size = realmpage->sizeHint(); - TQSize finish_size = finishpage->sizeHint(); - - // get the width of the broadest child-widget - if ( hint.width() < realm_size.width() ) - hint.setWidth(realm_size.width()); - if ( hint.width() < finish_size.width() ) - hint.setWidth(finish_size.width()); - - // get the height of the highest child-widget - if ( hint.height() < realm_size.height() ) - hint.setHeight(realm_size.height()); - if ( hint.height() < finish_size.height() ) - hint.setHeight(finish_size.height()); - - // set the position - TQRect rect = KGlobalSettings::desktopGeometry(TQCursor::pos()); - int w = rect.x() + (rect.width() - hint.width())/2 - 9; - int h = rect.y() + (rect.height() - hint.height())/2; - move(w, h); -} diff --git a/src/realmwizard.h b/src/realmwizard.h deleted file mode 100644 index 34de72b..0000000 --- a/src/realmwizard.h +++ /dev/null @@ -1,87 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2012 by Timothy Pearson * - * kb9vqf@pearsoncomputing.net * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 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, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef BONDWIZARD_H -#define BONDWIZARD_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include "ldapcontroller.h" - -/** prototypes */ -class KLanguageCombo; -class RealmIntroPage; -class RealmConfigPage; -class CertConfigPage; -class RealmFinishPage; - -/** RealmWizard is the base class of the project */ -class RealmWizard : public KWizard { - Q_OBJECT -public: - /** construtor */ - RealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget* parent=0, const char *name=0); - /** destructor */ - ~RealmWizard(); - - virtual void next(); - virtual void back(); - -public slots: // Public slots - /** calls all save functions after resetting all fields to Trinity default */ - void setDefaults(); - /** the cancel button is connected to the reject() slot of TQDialog, - * so we have to reimplement this here to add a dialogbox to - * ask if we really want to quit the wizard. - */ - void reject(); - /** maybe call a dialog that the wizard has finished. - * Calls applySettings() to save the current selection. - */ - void accept(); - /** We need this to use it in a TQTimer */ - void slotNext(); - -private: - void setPosition(); - -private: - RealmIntroPage* intropage; - RealmConfigPage* realmpage; - CertConfigPage* certpage; - RealmFinishPage* finishpage; - bool realm_dirty; - LDAPController* m_controller; - LDAPRealmConfig m_realmconfig; - TQString m_fqdn; - LDAPCertConfig m_certconfig; - -protected: // Protected methods - // the close button on the titlebar sets e->accept() which we don't want. - virtual void closeEvent(TQCloseEvent*); - bool askClose(); -}; - -#endif -- cgit v1.2.3