[PC-BSD Commits] r8205 - pcbsd/current/src-qt4/pc-sysinstaller
svn at pcbsd.org
svn at pcbsd.org
Tue Dec 14 08:10:45 PST 2010
Author: kris
Date: 2010-12-14 08:10:45 -0800 (Tue, 14 Dec 2010)
New Revision: 8205
Modified:
pcbsd/current/src-qt4/pc-sysinstaller/sys-diskwidget.cpp
pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h
pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.ui
Log:
Added new option to enable geli encryption via a single checkbox for auto-partitioning with UFS+S/UFS+SUJ/ZFS
Modified: pcbsd/current/src-qt4/pc-sysinstaller/sys-diskwidget.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sys-diskwidget.cpp 2010-12-13 20:54:59 UTC (rev 8204)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sys-diskwidget.cpp 2010-12-14 16:10:45 UTC (rev 8205)
@@ -16,11 +16,59 @@
connect(pushDeletePartition,SIGNAL(clicked()), this, SLOT(slotDeleteMBRPartition()));
connect(pushDiskRescan,SIGNAL(clicked()), this, SLOT(slotLoadDiskInfo()));
connect(treeWidgetCustomPartition,SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotEditFileSystem()));
+ connect(checkBoxEncUserData,SIGNAL(clicked()), this, SLOT(slotEnableDiskAutoEnc()));
// Hide the ID part of our custom treeWidget
treeWidgetCustomPartition->setColumnHidden(0, true);
}
+void SysInstaller::warnEncryption()
+{
+ QMessageBox::warning(this, tr("PC-BSD Installer"),
+ tr("Encryption is enabled! In addition to using passphrase, key files are randomly generated and will be stored in /boot/keys/ on the system. After installing and rebooting, you should immediately make a backup copy of these keys, or else data loss could occur should they be lost or corrupted."),
+ QMessageBox::Ok);
+
+}
+void SysInstaller::slotEnableDiskAutoEnc()
+{
+ if ( ! checkBoxEncUserData->isChecked() )
+ return;
+
+ bool ok;
+ QString pass, confirm;
+
+ int ret = QMessageBox::question(this, tr("Disk Encryption"),
+ tr("Do you want to use a passphrase to access the encrypted volume?"),
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::Yes);
+
+ if ( ret == QMessageBox::No ) {
+ autoEncPass="";
+ return;
+ }
+
+ // Get the passphrase
+ pass = QInputDialog::getText(this, tr("Enter Passphrase"),
+ tr("Enter the Passphrase for this encrypted disk"), QLineEdit::Password,
+ QString(), &ok);
+
+ // Confirm the passphrase
+ if ( ok && ! pass.isEmpty() )
+ confirm = QInputDialog::getText(this, tr("Enter Passphrase (Confirm)"),
+ tr("Confirm the Passphrase for this encrypted disk"), QLineEdit::Password,
+ QString(), &ok);
+
+ if ( pass != confirm ) {
+ QMessageBox::critical(this, tr("Passphrase mismatch"), tr("The entered passphrases do not match!"));
+ checkBoxEncUserData->setChecked(false);
+ return;
+ }
+
+ // Save the passphrase
+ warnEncryption();
+ autoEncPass=pass;
+}
+
// Returns the disks MBR/GPT format scheme if known
QString SysInstaller::getDiskScheme(QString disk)
{
@@ -260,11 +308,8 @@
}
- if (haveEncryption) {
- QMessageBox::warning(this, tr("PC-BSD Installer"),
- tr("Encryption is enabled! In addition to using passphrase, key files are randomly generated and will be stored in /boot/keys/ on the system. After installing and rebooting, you should immediately make a backup copy of these keys, or else data loss could occur should they be lost or corrupted."),
- QMessageBox::Ok);
- }
+ if (haveEncryption)
+ warnEncryption();
// Check if we have mounts for usr / var, and if not, add their requirements to /
if (!haveVar)
@@ -351,7 +396,7 @@
{
QString targetType, tmp;
int targetLoc, totalSize = 0, mntsize;
- QString targetDisk, targetSlice;
+ QString targetDisk, targetSlice, tmpPass, fsType;
bool ok;
ok = false;
@@ -394,18 +439,16 @@
else
mntsize = 512;
- if ( radioFileSysSUJ->isChecked() || radioFileSysSU->isChecked() )
- {
- QString fsType;
+ if ( radioFileSysSUJ->isChecked() || radioFileSysSU->isChecked() ) {
- if ( radioFileSysSUJ->isChecked() )
- fsType="UFS+SUJ";
- else
- fsType="UFS+S";
+ if ( radioFileSysSUJ->isChecked() )
+ fsType="UFS+SUJ";
+ else
+ fsType="UFS+S";
fileSystem << targetDisk << targetSlice << "/" << fsType << tmp.setNum(mntsize) << "" << "";
totalSize = totalSize - mntsize;
- qDebug() << "Auto-Gen FS:" << fileSystem;
+ //qDebug() << "Auto-Gen FS:" << fileSystem;
sysFinalDiskLayout << fileSystem;
fileSystem.clear();
@@ -416,7 +459,7 @@
mntsize = 512;
fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(mntsize) << "" << "";
totalSize = totalSize - mntsize;
- qDebug() << "Auto-Gen FS:" << fileSystem;
+ //qDebug() << "Auto-Gen FS:" << fileSystem;
sysFinalDiskLayout << fileSystem;
fileSystem.clear();
@@ -425,14 +468,19 @@
mntsize = 1024;
fileSystem << targetDisk << targetSlice << "/var" << fsType << tmp.setNum(mntsize) << "" << "";
totalSize = totalSize - mntsize;
- qDebug() << "Auto-Gen FS:" << fileSystem;
+ //qDebug() << "Auto-Gen FS:" << fileSystem;
sysFinalDiskLayout << fileSystem;
fileSystem.clear();
+ // See if using encryption for this partition
+ if ( checkBoxEncUserData->isChecked() ) {
+ fsType+= ".eli";
+ tmpPass=autoEncPass;
+ }
// Now use the rest of the disk / slice for /usr
- fileSystem << targetDisk << targetSlice << "/usr" << fsType << tmp.setNum(totalSize) << "" << "";
- qDebug() << "Auto-Gen FS:" << fileSystem;
+ fileSystem << targetDisk << targetSlice << "/usr" << fsType << tmp.setNum(totalSize) << "" << tmpPass;
+ //qDebug() << "Auto-Gen FS:" << fileSystem;
sysFinalDiskLayout << fileSystem;
fileSystem.clear();
@@ -448,16 +496,26 @@
// Setup a UFS boot partition
totalSize = totalSize - 500;
fileSystem << targetDisk << targetSlice << "/boot" << "UFS" << tmp.setNum(500) << "" << "";
+ sysFinalDiskLayout << fileSystem;
+ fileSystem.clear();
+ // See if using encryption for this partition
+ if ( checkBoxEncUserData->isChecked() ) {
+ fsType= "ZFS.eli";
+ tmpPass=autoEncPass;
+ } else {
+ fsType= "ZFS";
+ }
+
// Add the main zfs pool with standard partitions
- fileSystem << targetDisk << targetSlice << "/,/var,/usr" << "ZFS" << tmp.setNum(totalSize) << "" << "";
- qDebug() << "Auto-Gen FS:" << fileSystem;
+ fileSystem << targetDisk << targetSlice << "/,/var,/usr" << fsType << tmp.setNum(totalSize) << "" << tmpPass;
+ //qDebug() << "Auto-Gen FS:" << fileSystem;
sysFinalDiskLayout << fileSystem;
fileSystem.clear();
// Add the previously calculated swap size
fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(swapsize) << "" << "";
- qDebug() << "Auto-Gen FS:" << fileSystem;
+ //qDebug() << "Auto-Gen FS:" << fileSystem;
sysFinalDiskLayout << fileSystem;
fileSystem.clear();
}
Modified: pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h 2010-12-13 20:54:59 UTC (rev 8204)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.h 2010-12-14 16:10:45 UTC (rev 8205)
@@ -101,6 +101,7 @@
void slotAddMBRPartition();
void slotDeleteMBRPartition();
void slotLoadDiskInfo();
+ void slotEnableDiskAutoEnc();
// User Management Slots
void slotPasswordTextChanged();
@@ -177,6 +178,10 @@
dialogFileSystem *dfs;
dialogSelectNetServer *dsn;
+ // Encryption bits
+ QString autoEncPass;
+ void warnEncryption();
+
QList<Step> steps;
QList<Label *> labels; // just to handle the "Labels" list
QList<QStringList> sysDisks; // Our lists which contains disk info
Modified: pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.ui
===================================================================
--- pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.ui 2010-12-13 20:54:59 UTC (rev 8204)
+++ pcbsd/current/src-qt4/pc-sysinstaller/sysinstaller.ui 2010-12-14 16:10:45 UTC (rev 8205)
@@ -993,7 +993,7 @@
</palette>
</property>
<property name="currentIndex">
- <number>4</number>
+ <number>3</number>
</property>
<widget class="QWidget" name="aiStep0">
<property name="palette">
@@ -8587,6 +8587,16 @@
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
+ <widget class="QCheckBox" name="checkBoxEncUserData">
+ <property name="toolTip">
+ <string>Encrypt the /usr partition or ZFS zpool.</string>
+ </property>
+ <property name="text">
+ <string>Encrypt user data</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_40">
<property name="orientation">
<enum>Qt::Horizontal</enum>
More information about the Commits
mailing list