Merge pull request #2103 from dalto8/zfsenhance
[partition] Add support for zfs encryption
This commit is contained in:
commit
70d4512635
@ -373,7 +373,7 @@ Config::fillConfigurationFSTypes( const QVariantMap& configurationMap )
|
||||
luksGeneration = Config::LuksGeneration::Luks1;
|
||||
}
|
||||
m_luksFileSystemType = luksGeneration;
|
||||
gs->insert( "luksFileSystemType", luksGenerationNames().find(luksGeneration) );
|
||||
gs->insert( "luksFileSystemType", luksGenerationNames().find( luksGeneration ) );
|
||||
|
||||
Q_ASSERT( !m_eraseFsTypes.isEmpty() );
|
||||
Q_ASSERT( m_eraseFsTypes.contains( fsRealName ) );
|
||||
@ -409,6 +409,8 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
}
|
||||
setSwapChoice( m_initialSwapChoice );
|
||||
|
||||
m_allowZfsEncryption = CalamaresUtils::getBool( configurationMap, "allowZfsEncryption", true );
|
||||
|
||||
m_allowManualPartitioning = CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true );
|
||||
m_requiredPartitionTableType = CalamaresUtils::getStringList( configurationMap, "requiredPartitionTableType" );
|
||||
|
||||
|
@ -159,6 +159,9 @@ public:
|
||||
*/
|
||||
LuksGeneration luksFileSystemType() const { return m_luksFileSystemType; }
|
||||
|
||||
/// @brief If zfs encryption should be allowed
|
||||
bool allowZfsEncryption() const { return m_allowZfsEncryption; }
|
||||
|
||||
public Q_SLOTS:
|
||||
void setInstallChoice( int ); ///< Translates a button ID or so to InstallChoice
|
||||
void setInstallChoice( InstallChoice );
|
||||
@ -189,7 +192,7 @@ private:
|
||||
InstallChoice m_installChoice = NoChoice;
|
||||
qreal m_requiredStorageGiB = 0.0; // May duplicate setting in the welcome module
|
||||
QStringList m_requiredPartitionTableType;
|
||||
|
||||
bool m_allowZfsEncryption = true;
|
||||
bool m_allowManualPartitioning = true;
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
* SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-FileCopyrightText: 2019 Collabora Ltd
|
||||
* SPDX-FileCopyrightText: 2021 Anubhav Choudhary <ac.10edu@gmail.com>
|
||||
* SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
@ -464,6 +465,18 @@ ChoicePage::continueApplyDeviceChoice()
|
||||
void
|
||||
ChoicePage::onActionChanged()
|
||||
{
|
||||
if ( m_enableEncryptionWidget )
|
||||
{
|
||||
if ( m_config->installChoice() == InstallChoice::Erase && m_eraseFsTypesChoiceComboBox )
|
||||
{
|
||||
m_encryptWidget->setFilesystem( FileSystem::typeForName( m_eraseFsTypesChoiceComboBox->currentText() ) );
|
||||
}
|
||||
else if ( m_config->installChoice() == InstallChoice::Replace && m_replaceFsTypesChoiceComboBox )
|
||||
{
|
||||
m_encryptWidget->setFilesystem( FileSystem::typeForName( m_replaceFsTypesChoiceComboBox->currentText() ) );
|
||||
}
|
||||
}
|
||||
|
||||
Device* currd = selectedDevice();
|
||||
if ( currd )
|
||||
{
|
||||
@ -1747,16 +1760,16 @@ ChoicePage::createBootloaderPanel()
|
||||
bool
|
||||
ChoicePage::shouldShowEncryptWidget( Config::InstallChoice choice ) const
|
||||
{
|
||||
// If there are any choices for FS, check it's not ZFS because that doesn't
|
||||
// support the kind of encryption we enable here.
|
||||
bool suitableFS = true;
|
||||
if ( ( m_eraseFsTypesChoiceComboBox && m_eraseFsTypesChoiceComboBox->isVisible()
|
||||
&& m_eraseFsTypesChoiceComboBox->currentText() == "zfs" )
|
||||
|| ( m_replaceFsTypesChoiceComboBox && m_replaceFsTypesChoiceComboBox->isVisible()
|
||||
&& m_replaceFsTypesChoiceComboBox->currentText() == "zfs" ) )
|
||||
if ( !m_config->allowZfsEncryption()
|
||||
&& ( ( m_eraseFsTypesChoiceComboBox && m_eraseFsTypesChoiceComboBox->isVisible()
|
||||
&& m_eraseFsTypesChoiceComboBox->currentText() == "zfs" )
|
||||
|| ( m_replaceFsTypesChoiceComboBox && m_replaceFsTypesChoiceComboBox->isVisible()
|
||||
&& m_replaceFsTypesChoiceComboBox->currentText() == "zfs" ) ) )
|
||||
{
|
||||
suitableFS = false;
|
||||
}
|
||||
|
||||
const bool suitableChoice
|
||||
= choice == InstallChoice::Erase || choice == InstallChoice::Alongside || choice == InstallChoice::Replace;
|
||||
return suitableChoice && m_enableEncryptionWidget && suitableFS;
|
||||
|
@ -3,6 +3,7 @@
|
||||
* SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac <teo@kde.org>
|
||||
* SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-FileCopyrightText: 2019 Collabora Ltd
|
||||
* SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
|
||||
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
@ -17,6 +18,8 @@
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "utils/Retranslator.h"
|
||||
|
||||
constexpr int ZFS_MIN_LENGTH = 8;
|
||||
|
||||
/** @brief Does this system support whole-disk encryption?
|
||||
*
|
||||
* Returns @c true if the system is likely to support encryption
|
||||
@ -143,7 +146,7 @@ applyPixmap( QLabel* label, CalamaresUtils::ImageType pixmap )
|
||||
}
|
||||
|
||||
void
|
||||
EncryptWidget::updateState()
|
||||
EncryptWidget::updateState( const bool notify )
|
||||
{
|
||||
if ( m_ui->m_passphraseLineEdit->isVisible() )
|
||||
{
|
||||
@ -155,6 +158,11 @@ EncryptWidget::updateState()
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusWarning );
|
||||
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
|
||||
}
|
||||
else if ( m_filesystem == FileSystem::Zfs && p1.length() < ZFS_MIN_LENGTH )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusError );
|
||||
m_ui->m_iconLabel->setToolTip( tr( "Password must be a minimum of %1 characters" ).arg( ZFS_MIN_LENGTH ) );
|
||||
}
|
||||
else if ( p1 == p2 )
|
||||
{
|
||||
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusOk );
|
||||
@ -172,7 +180,10 @@ EncryptWidget::updateState()
|
||||
if ( newState != m_state )
|
||||
{
|
||||
m_state = newState;
|
||||
Q_EMIT stateChanged( m_state );
|
||||
if ( notify )
|
||||
{
|
||||
Q_EMIT stateChanged( m_state );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,3 +212,13 @@ EncryptWidget::onCheckBoxStateChanged( int checked )
|
||||
|
||||
updateState();
|
||||
}
|
||||
|
||||
void
|
||||
EncryptWidget::setFilesystem( const FileSystem::Type fs )
|
||||
{
|
||||
m_filesystem = fs;
|
||||
if ( m_state != Encryption::Disabled )
|
||||
{
|
||||
updateState( false );
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2016 Teo Mrnjavac <teo@kde.org>
|
||||
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
* SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Calamares is Free Software: see the License-Identifier above.
|
||||
@ -14,6 +15,8 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <kpmcore/fs/filesystem.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class EncryptWidget;
|
||||
@ -38,6 +41,12 @@ public:
|
||||
Encryption state() const;
|
||||
void setText( const QString& text );
|
||||
|
||||
/**
|
||||
* @brief setFilesystem sets the filesystem name used for password validation
|
||||
* @param fs A QString containing the name of the filesystem
|
||||
*/
|
||||
void setFilesystem( const FileSystem::Type fs );
|
||||
|
||||
QString passphrase() const;
|
||||
|
||||
void retranslate();
|
||||
@ -46,12 +55,14 @@ signals:
|
||||
void stateChanged( Encryption );
|
||||
|
||||
private:
|
||||
void updateState();
|
||||
void updateState( const bool notify = true );
|
||||
void onPassphraseEdited();
|
||||
void onCheckBoxStateChanged( int checked );
|
||||
|
||||
Ui::EncryptWidget* m_ui;
|
||||
Encryption m_state;
|
||||
|
||||
FileSystem::Type m_filesystem;
|
||||
};
|
||||
|
||||
#endif // ENCRYPTWIDGET_H
|
||||
|
@ -78,6 +78,16 @@ userSwapChoices:
|
||||
#
|
||||
luksGeneration: luks1
|
||||
|
||||
# This setting determines if encryption should be allowed when using zfs. This
|
||||
# setting has no effect unless zfs support is provided.
|
||||
#
|
||||
# This setting is to handle the fact that some bootloaders(such as grub) do not
|
||||
# support zfs encryption.
|
||||
#
|
||||
# The default is true
|
||||
#
|
||||
# allowZfsEncryption: true
|
||||
|
||||
# Correctly draw nested (e.g. logical) partitions as such.
|
||||
drawNestedPartitions: false
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
# SPDX-FileCopyrightText: 2023 Evan James <dalto@fastmail.com>
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
---
|
||||
$schema: https://json-schema.org/schema#
|
||||
@ -14,6 +15,7 @@ properties:
|
||||
# ensureSuspendToDisk: { type: boolean, default: true } # Legacy
|
||||
# neverCreateSwap: { type: boolean, default: false } # Legacy
|
||||
|
||||
allowZfsEncryption: { type: boolean, default: true }
|
||||
drawNestedPartitions: { type: boolean, default: false }
|
||||
alwaysShowPartitionLabels: { type: boolean, default: true }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user