A hardened Linux desktop, rebuilt from scratch, with your Windows apps built in. Free and open source.
Wild OS Alpha 2
Dan1d0cef5e3744
diff --git a/build/Dockerfile b/build/Dockerfileindex a8e7fe8..8c7a956 100644--- a/build/Dockerfile+++ b/build/Dockerfile@@ -126,6 +126,12 @@ RUN apt-get update \&& apt-get install -y --no-install-recommends libdbus-1-dev libsystemd-dev pkgconf \&& rm -rf /var/lib/apt/lists/*+# The password strength hint in Settings and first boot setup scores the+# password with libpwquality.+RUN apt-get update \+ && apt-get install -y --no-install-recommends libpwquality-dev \+ && rm -rf /var/lib/apt/lists/*+# Compiles go through ccache (a volume shared by every build, see# build-iso.sh), so a package whose code barely changed rebuilds in seconds.RUN apt-get update \diff --git a/build/build.sh b/build/build.shindex 494b0bc..3a74f3c 100644--- a/build/build.sh+++ b/build/build.sh@@ -640,7 +640,9 @@ repack_open() {grep -qxF "$dep" <<<"$deps" || repack_fail "$name"donekept=$(grep -vxF -f <(printf '%s\n' "$@") <<<"$deps" | paste -sd, | sed 's/,/, /g')- sed -i -e "s/^Depends: .*/Depends: $kept/" -e 's/^Version: \(.*\)$/Version: \1+wildos1/' "$control"+ # REPACK_REVISION goes up when a repack changes while Kicksecure's version+ # stays the same, so machines take the new one.+ sed -i -e "s/^Depends: .*/Depends: $kept/" -e "s/^Version: \(.*\)\$/Version: \1+wildos${REPACK_REVISION:-1}/" "$control"}# Adds programs compiled into $REPACK/pkg to the package: it becomes amd64# and depends on the libraries they link.@@ -674,9 +676,17 @@ repack_close() {# boot drive is pulled out) and fm-shim-backend (its org.freedesktop.FileManager1# service) in its postinst. emerg-shutdown would also compile at run time,# but only when its program is missing.-repack_open security-misc-shared build-essential libdbus-1-dev libsystemd-dev pkgconf+#+# Its preinst also stops an install or upgrade when no account is in the sudo+# or console groups, to keep someone from locking themselves out. Wild OS makes+# and manages the accounts (Settings keeps an administrator in sudo, and every+# account that signs in is in console), so the check can only block updates,+# as it did on a computer still at first-run setup.+REPACK_REVISION=2 repack_open security-misc-shared build-essential libdbus-1-dev libsystemd-dev pkgconf(cd "$REPACK/pkg"+ [ "$(grep -cxE ' (sudo|console)_users_check' DEBIAN/preinst)" = 2 ] || repack_fail security-misc-shared+ sed -i -E 's/^ (sudo|console)_users_check$/ true/' DEBIAN/preinst[ "$(grep -cxE ' build_(fm_shim_backend|emerg_shutdown)' DEBIAN/postinst)" = 2 ] || repack_fail security-misc-sharedsed -i -E '/^ build_(fm_shim_backend|emerg_shutdown)$/d' DEBIAN/postinstfor program in emerg-shutdown fm-shim-backend; dodiff --git a/packages/wildos-desktop/debian/changelog b/packages/wildos-desktop/debian/changelogindex f63e290..6d6c925 100644--- a/packages/wildos-desktop/debian/changelog+++ b/packages/wildos-desktop/debian/changelog@@ -1,3 +1,15 @@+wildos-desktop (0.1.1) trixie; urgency=medium++ * Depend on libcanberra-pulse, so the start-up sound plays through+ PipeWire's PulseAudio service instead of libcanberra's ALSA backend.+ The ALSA backend's player thread could still be inside+ libcanberra-alsa.so when startplasma freed the context after the sound+ ended, and the module was unloaded under it: startplasma-wayland+ segfaulted about 6 seconds into the session and SDDM logged+ "sddm-helper exited with 11", leaving the sign-in screen.++ -- Wild OS Developers <[email protected]> Tue, 10 Nov 2026 17:00:00 +0000+wildos-desktop (0.1.0) trixie; urgency=medium* Initial release.diff --git a/packages/wildos-desktop/debian/control b/packages/wildos-desktop/debian/controlindex 0676e7f..84d5b2b 100644--- a/packages/wildos-desktop/debian/control+++ b/packages/wildos-desktop/debian/control@@ -50,6 +50,14 @@ Depends:breeze-gtk-theme,pipewire-audio,pipewire-pulse,+# The start-up sound (wildos-branding) is played by startplasma through+# libcanberra. Without this backend libcanberra falls back to ALSA, whose+# player thread can still be running in libcanberra-alsa.so after it+# reports the sound finished; startplasma then frees the context, the+# module is unloaded under the thread, and the whole session crashes back+# to the sign-in screen about 6 seconds in. The PulseAudio backend, served+# by pipewire-pulse, stops its thread before the context goes.+ libcanberra-pulse,wireplumber,fonts-noto-core,fonts-noto-color-emoji,diff --git a/packages/wildos-mail/CMakeLists.txt b/packages/wildos-mail/CMakeLists.txtindex 4613150..2cb4e54 100644--- a/packages/wildos-mail/CMakeLists.txt+++ b/packages/wildos-mail/CMakeLists.txt@@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 20)set(CMAKE_CXX_STANDARD_REQUIRED ON)include(GNUInstallDirs)-find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui DBus Network Qml Quick QuickControls2)+find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui Widgets DBus Network Qml Quick QuickControls2)find_package(Qt6Keychain REQUIRED)find_package(litehtml REQUIRED)find_package(PkgConfig REQUIRED)@@ -49,7 +49,7 @@ qt_add_qml_module(wildos-mailtarget_include_directories(wildos-mail PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)-target_link_libraries(wildos-mail PRIVATE+target_link_libraries(wildos-mail PRIVATE Qt6::WidgetsQt6::Gui Qt6::DBus Qt6::Network Qt6::Qml Qt6::Quick Qt6::QuickControls2qt6keychainlitehtmldiff --git a/packages/wildos-mail/debian/control b/packages/wildos-mail/debian/controlindex 769b921..8a6871d 100644--- a/packages/wildos-mail/debian/control+++ b/packages/wildos-mail/debian/control@@ -23,7 +23,7 @@ Depends:${misc:Depends},evolution-data-server-camel-providers,evolution-data-server-core,- wildos-ui,+ wildos-ui (>= 0.1.2),evolution-data-server-common,qml6-module-qtcore,qml6-module-qtquick,diff --git a/packages/wildos-mail/src/main.cpp b/packages/wildos-mail/src/main.cppindex 7ece401..2eeb0bc 100644--- a/packages/wildos-mail/src/main.cpp+++ b/packages/wildos-mail/src/main.cpp@@ -5,7 +5,7 @@#include <QDBusConnection>#include <QDBusConnectionInterface>#include <QDBusMessage>-#include <QGuiApplication>+#include <QApplication>#include <QIcon>#include <QQmlApplicationEngine>#include <QQuickWindow>@@ -195,7 +195,9 @@ int runReminders(int argc, char *argv[])int runCalendar(int argc, char *argv[]){- QGuiApplication app(argc, argv);+ // A QApplication, not a QGuiApplication: only then does the KDE+ // platform theme hand open and save dialogs to the Wild OS file dialog.+ QApplication app(argc, argv);app.setApplicationName(QStringLiteral("wildos-mail"));app.setOrganizationDomain(QStringLiteral("wildos.io"));app.setApplicationDisplayName(QStringLiteral("Calendar"));@@ -308,7 +310,9 @@ int main(int argc, char *argv[])calendar = calendar || qstrcmp(argv[i], "--calendar") == 0;}- QGuiApplication app(argc, argv);+ // A QApplication, not a QGuiApplication: only then does the KDE+ // platform theme hand open and save dialogs to the Wild OS file dialog.+ QApplication app(argc, argv);app.setApplicationName(QStringLiteral("wildos-mail"));app.setOrganizationDomain(QStringLiteral("wildos.io"));app.setApplicationDisplayName(QStringLiteral("Mail"));diff --git a/packages/wildos-office/CMakeLists.txt b/packages/wildos-office/CMakeLists.txtindex 03b3ed7..46776f6 100644--- a/packages/wildos-office/CMakeLists.txt+++ b/packages/wildos-office/CMakeLists.txt@@ -5,7 +5,7 @@ set(CMAKE_CXX_STANDARD 20)set(CMAKE_CXX_STANDARD_REQUIRED ON)include(GNUInstallDirs)-find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui DBus Qml Quick QuickControls2)+find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui Widgets DBus Qml Quick QuickControls2)qt_standard_project_setup(REQUIRES 6.8)# The start screen: wildos-office, run as wildos-write or wildos-tables@@ -30,7 +30,7 @@ qt_add_qml_module(wildos-officeSOURCES src/office.cpp src/office.h)target_include_directories(wildos-office PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)-target_link_libraries(wildos-office PRIVATE Qt6::Gui Qt6::DBus Qt6::Qml Qt6::Quick Qt6::QuickControls2)+target_link_libraries(wildos-office PRIVATE Qt6::Widgets Qt6::Gui Qt6::DBus Qt6::Qml Qt6::Quick Qt6::QuickControls2)install(TARGETS wildos-office RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})foreach(link wildos-write wildos-tables)diff --git a/packages/wildos-office/debian/control b/packages/wildos-office/debian/controlindex 7ae8c37..01fb754 100644--- a/packages/wildos-office/debian/control+++ b/packages/wildos-office/debian/control@@ -24,7 +24,7 @@ Depends:fonts-crosextra-caladea,hunspell-en-gb,hunspell-en-us,- wildos-ui,+ wildos-ui (>= 0.1.2),qml6-module-qtcore,qml6-module-qtquick,qml6-module-qtquick-controls,diff --git a/packages/wildos-office/src/main.cpp b/packages/wildos-office/src/main.cppindex 1aa67a9..ad0da6e 100644--- a/packages/wildos-office/src/main.cpp+++ b/packages/wildos-office/src/main.cpp@@ -3,7 +3,7 @@#include <QDBusMessage>#include <QDir>#include <QFileInfo>-#include <QGuiApplication>+#include <QApplication>#include <QIcon>#include <QProcess>#include <QQmlApplicationEngine>@@ -137,7 +137,9 @@ int main(int argc, char *argv[])return 127;}- QGuiApplication app(argc, argv);+ // A QApplication, not a QGuiApplication: only then does the KDE+ // platform theme hand open and save dialogs to the Wild OS file dialog.+ QApplication app(argc, argv);app.setApplicationName(QStringLiteral("wildos-office"));app.setOrganizationDomain(QStringLiteral("wildos.io"));app.setApplicationVersion(QStringLiteral(WILDOS_OFFICE_VERSION));diff --git a/packages/wildos-remote/debian/changelog b/packages/wildos-remote/debian/changelogindex 03ee9f6..fbd701d 100644--- a/packages/wildos-remote/debian/changelog+++ b/packages/wildos-remote/debian/changelog@@ -1,3 +1,17 @@+wildos-remote (0.1.3) trixie; urgency=medium++ * SSH passwords can be saved in the keyring. The terminal's password+ prompt opens in the terminal window with "Save in my keyring", and the+ password is saved once the server accepts it. The next connection+ signs in with it, and asks again (replacing it) if it stops working.+ Files sign in with it too. A host's settings can forget it, and+ deleting a host deletes it.+ * A host's settings have a Port field next to the address, for desktops+ and terminals. Empty means the usual port, and an address typed as+ host:port fills it in.++ -- Wild OS Developers <[email protected]> Tue, 10 Nov 2026 17:00:00 +0000+wildos-remote (0.1.2) trixie; urgency=medium* The loading splash shows on every start, for about a second, as Writediff --git a/packages/wildos-remote/debian/control b/packages/wildos-remote/debian/controlindex 0900d7c..5e1d89e 100644--- a/packages/wildos-remote/debian/control+++ b/packages/wildos-remote/debian/control@@ -25,7 +25,7 @@ Architecture: anyDepends:${shlibs:Depends},${misc:Depends},- wildos-ui (>= 0.1.1+r302),+ wildos-ui (>= 0.1.2),openssh-client,libfreerdp3-3 (>= 3.32),libfreerdp-client3-3 (>= 3.32),diff --git a/packages/wildos-remote/qml/HostDialog.qml b/packages/wildos-remote/qml/HostDialog.qmlindex bb666d6..07b6503 100644--- a/packages/wildos-remote/qml/HostDialog.qml+++ b/packages/wildos-remote/qml/HostDialog.qml@@ -45,8 +45,10 @@ Panel {const h = host;const d = h.desktop || {};const s = h.ssh || {};- address.text = h.address || "";- name.text = h.name && h.name !== h.address ? h.name : "";+ const where = Hosts.addressParts(h.address || "");+ address.text = where.host;+ port.text = where.port > 0 ? String(where.port) : "";+ name.text = h.name && h.name !== h.address && h.name !== where.host ? h.name : "";group.currentIndex = Math.max(0, groupModel.findIndex(o => o.value === (h.group || "")));user.text = h.user || "";note.text = h.note || "";@@ -66,12 +68,23 @@ Panel {forwards = (s.forwards || []).slice();colour = s.colour || Hosts.colours()[0];identity.currentIndex = Math.max(0, identityModel.findIndex(o => o.value === (s.identity || "")));+ passwordSaved = false;+ if (editing && h.kind === "terminal") {+ const key = Hosts.passwordKey(h);+ Secrets.exists(key, found => {+ if (dialog.host.id === h.id) {+ dialog.passwordSaved = found;+ }+ });+ }}function collect() {const out = Object.assign({}, host);out.kind = kind;- out.address = address.text.trim();- out.name = name.text.trim() || out.address.split(":")[0];+ // A port typed into the address still counts; the Port field wins.+ const where = Hosts.addressParts(address.text.trim());+ out.address = Hosts.joinAddress(where.host, port.text.length > 0 ? parseInt(port.text) : where.port, kind);+ out.name = name.text.trim() || where.host;out.group = group.currentValue || "";out.user = user.text.trim();out.note = note.text.trim();@@ -114,6 +127,8 @@ Panel {property string folderPathproperty bool advanced: falseproperty string colour: "#5fd39a"+ // An SSH password saved for this host's account, as it was opened.+ property bool passwordSaved: falsereadonly property var groupModel: [{ value: "", text: qsTr("No group") }].concat(Hosts.groups.map(g => ({ value: g, text: g })))readonly property var resolutionModel: [@@ -187,26 +202,57 @@ Panel {spacing: 8Heading { text: dialog.kind === "desktop" ? qsTr("Computer") : qsTr("Server") }- FieldLabel { text: qsTr("Address") }- UI.TextField {- id: address+ RowLayout {Layout.fillWidth: true- size: "large"- leftPadding: 40- placeholderText: dialog.kind === "desktop" ? "studio-02.office.lan" : "web-01.hosting.lan"- UI.Icon {- x: 14- anchors.verticalCenter: parent.verticalCenter- name: dialog.kind === "desktop" ? "monitor" : "terminal"- size: 15- color: UI.Style.iconMuted+ spacing: 12+ ColumnLayout {+ Layout.fillWidth: true+ spacing: 8+ FieldLabel { text: qsTr("Address") }+ UI.TextField {+ id: address+ Layout.fillWidth: true+ size: "large"+ leftPadding: 40+ placeholderText: dialog.kind === "desktop" ? "studio-02.office.lan" : "web-01.hosting.lan"+ // "host:2222" typed or pasted: the port goes to its own field.+ onEditingFinished: {+ const where = Hosts.addressParts(text.trim());+ if (where.port > 0) {+ text = where.host;+ port.text = String(where.port);+ }+ }+ UI.Icon {+ x: 14+ anchors.verticalCenter: parent.verticalCenter+ name: dialog.kind === "desktop" ? "monitor" : "terminal"+ size: 15+ color: UI.Style.iconMuted+ }+ }+ }+ ColumnLayout {+ Layout.preferredWidth: 110+ spacing: 8+ FieldLabel { text: qsTr("Port") }+ UI.TextField {+ id: port+ Layout.fillWidth: true+ size: "large"+ placeholderText: dialog.kind === "desktop" ? "3389" : "22"+ inputMethodHints: Qt.ImhDigitsOnly+ validator: IntValidator { bottom: 1; top: 65535 }+ }}}UI.Label {- text: dialog.kind === "desktop" ? qsTr("A name or IP address. Add :port if it isn't 3389")- : qsTr("A name or IP address. Add :port if it isn't 22")+ Layout.fillWidth: true+ text: dialog.kind === "desktop" ? qsTr("A name or IP address. Leave the port empty for 3389, the usual one.")+ : qsTr("A name or IP address. Leave the port empty for 22, the usual one.")size: 12color: UI.Style.inkSubtle+ wrapMode: Text.Wrap}RowLayout {Layout.fillWidth: true@@ -281,12 +327,33 @@ Panel {UI.Label {Layout.fillWidth: truetext: identity.currentIndex === 0- ? qsTr("ssh tries your keys and the key agent, then asks for a password in the terminal.")+ ? qsTr("ssh tries your keys and the key agent, then asks for a password."): qsTr("Only this key is offered to the server.")size: 12color: UI.Style.inkSubtlewrapMode: Text.Wrap}+ RowLayout {+ visible: dialog.passwordSaved+ Layout.fillWidth: true+ Layout.topMargin: 4+ spacing: 12+ UI.Label {+ Layout.fillWidth: true+ text: qsTr("A password for %1 is saved in your keyring.").arg(dialog.host.user ? dialog.host.user + "@" + Hosts.hostName(dialog.host) : Hosts.hostName(dialog.host))+ size: 12+ color: UI.Style.inkSubtle+ wrapMode: Text.Wrap+ }+ UI.Button {+ size: "small"+ text: qsTr("Forget saved password")+ onClicked: {+ Secrets.remove(Hosts.passwordKey(dialog.host));+ dialog.passwordSaved = false;+ }+ }+ }}Heading { text: dialog.kind === "desktop" ? qsTr("Display") : qsTr("Card"); Layout.topMargin: 10 }@@ -561,14 +628,14 @@ Panel {UI.Button {size: "large"text: qsTr("Save")- enabled: address.text.trim().length > 0+ enabled: address.text.trim().length > 0 && (port.text.length === 0 || port.acceptableInput)onClicked: dialog.save(false)}UI.Button {size: "large"kind: "primary"text: qsTr("Save and connect")- enabled: address.text.trim().length > 0+ enabled: address.text.trim().length > 0 && (port.text.length === 0 || port.acceptableInput)onClicked: dialog.save(true)}}diff --git a/packages/wildos-remote/qml/Main.qml b/packages/wildos-remote/qml/Main.qmlindex f9a247b..33dc37f 100644--- a/packages/wildos-remote/qml/Main.qml+++ b/packages/wildos-remote/qml/Main.qml@@ -64,15 +64,15 @@ UI.AppWindow {// or a new one saved as typed.function quickConnect(address) {for (const h of Hosts.hosts) {- if (h.kind === address.kind && h.address === address.address && (h.user === address.user || !address.user)) {+ if (h.kind === address.kind && Hosts.hostName(h) === Hosts.hostName(address) && Hosts.port(h) === Hosts.port(address) && (h.user === address.user || !address.user)) {connectHost(h.id);return;}}const id = Hosts.save({kind: address.kind,- name: address.address.split(":")[0],- address: address.address,+ name: Hosts.hostName(address),+ address: Hosts.joinAddress(Hosts.hostName(address), Hosts.port(address), address.kind),user: address.user,group: ""});@@ -119,7 +119,11 @@ UI.AppWindow {}Connections {target: AskPass- function onPassphraseNeeded(id, title, prompt, kind) {+ function onPassphraseNeeded(id, title, prompt, kind, context) {+ // The terminal window asks its own.+ if (context === "terminal") {+ return;+ }window.raise();passphraseDialog.ask(id, title, prompt, kind);}@@ -137,9 +141,11 @@ UI.AppWindow {onActivated: hostDialog.create(window.page === "keychain" ? "terminal" : "")}+ // No inset: the title bar, and the window buttons in it, reach the+ // window's top and right edges as in Files and Settings, so a pointer+ // flung into the corner of a maximised window lands on Close.ColumnLayout {anchors.fill: parent- anchors.margins: window.maximised ? 0 : 1spacing: 0// The title bar: 56px, as the boards draw it.@@ -225,7 +231,8 @@ UI.AppWindow {UI.WindowButtons {id: windowButtonsanchors.right: parent.right- anchors.verticalCenter: parent.verticalCenter+ anchors.top: parent.top+ buttonHeight: parent.heightframe: window.frame}@@ -418,7 +425,7 @@ UI.AppWindow {title = qsTr("Delete %1?").arg(h.name);text = h.kind === "desktop"? qsTr("It goes from your hosts, with its saved password and its last screen. The PC itself isn't changed.")- : qsTr("It goes from your hosts. Its entry in known hosts stays, so Remote still knows it if you add it again.");+ : qsTr("It goes from your hosts, with any password saved for it. Its entry in known hosts stays, so Remote still knows it if you add it again.");open();}buttons: [diff --git a/packages/wildos-remote/qml/SessionChrome.qml b/packages/wildos-remote/qml/SessionChrome.qmlindex d28d045..ef9e46a 100644--- a/packages/wildos-remote/qml/SessionChrome.qml+++ b/packages/wildos-remote/qml/SessionChrome.qml@@ -25,7 +25,35 @@ Item {Binding {target: hostproperty: "chromeFull"- value: tabMenu.opened || plusMenu.opened || runAllDialog.opened || forwardMenu.opened+ value: tabMenu.opened || plusMenu.opened || runAllDialog.opened || forwardMenu.opened || signInDialog.opened || questionDialog.opened+ }++ // The terminal's ssh asking for a password, a code or a passphrase:+ // asked here, over the tab it's for, not in the home window.+ Connections {+ target: AskPass+ function onPassphraseNeeded(id, title, prompt, kind, context, details) {+ if (context !== "terminal") {+ return;+ }+ const tabs = host.tabs;+ for (let i = 0; i < tabs.length; ++i) {+ if (details.hostId && tabs[i].hostId === details.hostId) {+ host.currentIndex = i;+ break;+ }+ }+ host.focusChrome();+ if (kind === "password" && details.save) {+ signInDialog.ask(id, details);+ } else {+ questionDialog.ask(id, title, prompt, kind);+ }+ }+ function onQuestionClosed(id) {+ signInDialog.closeFor(id);+ questionDialog.closeFor(id);+ }}// The suggestions under the cursor, and the part of the window they@@ -566,6 +594,15 @@ Item {]}+ SshSignInDialog {+ id: signInDialog+ onClosed: if (root.tab) root.tab.focusTerminal()+ }+ PassphraseDialog {+ id: questionDialog+ onClosed: if (root.tab) root.tab.focusTerminal()+ }+UI.Toast {id: toastanchors.horizontalCenter: parent.horizontalCenterdiff --git a/packages/wildos-remote/qml/SshSignInDialog.qml b/packages/wildos-remote/qml/SshSignInDialog.qmlnew file mode 100644index 0000000..9fbedb8--- /dev/null+++ b/packages/wildos-remote/qml/SshSignInDialog.qml@@ -0,0 +1,178 @@+import QtQuick+import QtQuick.Layouts+import WildOS.Remote+import WildOS.UI as UI++// A server's password prompt, from the terminal's ssh (through AskPass),+// laid out as the desktop sign-in is. The password can be saved in the+// keyring, and is only once the server has accepted it.+Panel {+ id: dialog++ property string askId+ property var details: ({})+ property bool answered: false+ readonly property bool retry: details.retry === true++ width: 460+ padding: 28++ function ask(id, d) {+ askId = id;+ details = d;+ password.text = "";+ // A saved password that didn't work is replaced by the one typed now.+ save.checked = d.saved === true;+ answered = false;+ open();+ password.forceActiveFocus();+ }+ function closeFor(id) {+ if (id === askId) {+ answered = true;+ close();+ }+ }++ onClosed: {+ if (!answered) {+ AskPass.cancel(askId);+ }+ password.text = "";+ }++ contentItem: ColumnLayout {+ spacing: 14++ RowLayout {+ spacing: 14+ Image {+ Layout.preferredWidth: 40+ Layout.preferredHeight: 40+ source: "qrc:/qt/qml/WildOS/Remote/data/org.wildos.remote.svg"+ sourceSize: Qt.size(80, 80)+ }+ ColumnLayout {+ spacing: 2+ UI.Label {+ text: qsTr("Sign in to %1").arg(dialog.details.name || "")+ size: 20+ font.weight: Font.Bold+ }+ UI.Label {+ text: dialog.details.address || ""+ size: 13+ color: UI.Style.inkMuted+ }+ }+ }++ Rectangle {+ Layout.fillWidth: true+ Layout.preferredHeight: 56+ radius: 10+ color: dialog.retry ? Qt.rgba(255 / 255, 154 / 255, 138 / 255, 0.10) : UI.Style.tone(0.05)+ RowLayout {+ anchors.fill: parent+ anchors.leftMargin: 14+ anchors.rightMargin: 14+ spacing: 12+ UI.Spinner {+ visible: !dialog.retry+ size: 22+ running: dialog.visible+ }+ UI.Icon {+ visible: dialog.retry+ name: "warning"+ size: 18+ color: "#ff9a8a"+ }+ ColumnLayout {+ Layout.fillWidth: true+ spacing: 1+ UI.Label {+ Layout.fillWidth: true+ text: dialog.retry ? qsTr("%1 didn't accept that").arg(dialog.details.name || "") : qsTr("Connected to %1").arg(dialog.details.name || "")+ size: 13+ font.weight: Font.DemiBold+ }+ UI.Label {+ Layout.fillWidth: true+ text: dialog.details.savedFailed ? qsTr("The password saved in your keyring didn't work. Type the current one.")+ : dialog.retry ? qsTr("That didn't work. Check the password, then try again.")+ : qsTr("Its identity checks out. Waiting for you to sign in")+ size: 12+ color: UI.Style.inkMuted+ wrapMode: Text.Wrap+ }+ }+ }+ }++ UI.Label {+ text: qsTr("Password")+ size: 13+ font.weight: Font.DemiBold+ }+ UI.TextField {+ id: password+ Layout.fillWidth: true+ size: "large"+ leftPadding: 40+ revealable: true+ placeholderText: qsTr("Password")+ onAccepted: go.clicked()+ UI.Icon {+ x: 14+ anchors.verticalCenter: parent.verticalCenter+ name: "lock"+ size: 15+ color: UI.Style.iconMuted+ }+ }+ RowLayout {+ spacing: 12+ UI.Toggle {+ id: save+ Accessible.name: saveLabel.text+ }+ UI.Label {+ id: saveLabel+ text: qsTr("Save in my keyring")+ size: 14+ }+ }+ UI.Label {+ Layout.fillWidth: true+ text: qsTr("Your keyring is locked with your Wild OS password, so saved passwords are only readable while you're signed in. Nothing is saved until the server accepts it.")+ size: 12+ color: UI.Style.inkMuted+ wrapMode: Text.Wrap+ lineHeight: 1.35+ }+ RowLayout {+ Layout.fillWidth: true+ Layout.topMargin: 4+ spacing: 10+ Item { Layout.fillWidth: true }+ UI.Button {+ size: "large"+ text: qsTr("Cancel")+ onClicked: dialog.close()+ }+ UI.Button {+ id: go+ size: "large"+ kind: "primary"+ text: qsTr("Sign in")+ enabled: password.text.length > 0+ onClicked: {+ dialog.answered = true;+ AskPass.answer(dialog.askId, password.text, save.checked);+ dialog.close();+ }+ }+ }+ }+}diff --git a/packages/wildos-remote/src/askpass.cpp b/packages/wildos-remote/src/askpass.cppindex ec8caee..62f2309 100644--- a/packages/wildos-remote/src/askpass.cpp+++ b/packages/wildos-remote/src/askpass.cpp@@ -7,6 +7,7 @@#include <QJsonObject>#include <QLocalServer>#include <QLocalSocket>+#include <QRegularExpression>#include <QTextStream>#include <QUuid>@@ -54,13 +55,31 @@ void AskPass::listen()}QString AskPass::newToken(const Provider &provider, const QString &title)+{+ Options options;+ options.title = title;+ if (provider) {+ options.provider = [provider](const QString &prompt, int count, const std::function<void(const Lookup &)> &done) {+ done({provider(prompt, count), {}});+ };+ }+ return newToken(options);+}++QString AskPass::newToken(const Options &options){listen();const QString token = QUuid::createUuid().toString(QUuid::WithoutBraces);- m_runs.insert(token, {provider, title, 0});+ m_runs.insert(token, {options, 0});return token;}+bool AskPass::isPassword(const QString &prompt)+{+ static const QRegularExpression password(QStringLiteral("^(\\S+@\\S+'s )?password:$"), QRegularExpression::CaseInsensitiveOption);+ return password.match(prompt.trimmed()).hasMatch();+}+void AskPass::release(const QString &token){m_runs.remove(token);@@ -99,32 +118,50 @@ void AskPass::incoming()reply(socket, false, {});return;}- ++run->count;- if (run->provider && kind != QLatin1String("touch")) {- if (const auto answer = run->provider(prompt, run->count)) {- reply(socket, true, *answer);+ const int count = ++run->count;+ if (!run->options.provider || kind == QLatin1String("touch")) {+ askPerson(socket, token, prompt, kind, {});+ return;+ }+ run->options.provider(prompt, count, [this, socket = QPointer(socket), token, prompt, kind](const Lookup &lookup) {+ if (!socket) {return;}- }- const QString id = QString::number(m_next++);- m_waiting.insert(id, socket);- // The tool gave up waiting, or (for a touch notice) is done.- connect(socket, &QLocalSocket::disconnected, this, [this, id] {- if (m_waiting.remove(id)) {- Q_EMIT questionClosed(id);+ if (lookup.answer) {+ reply(socket, true, *lookup.answer);+ return;}+ askPerson(socket, token, prompt, kind, lookup.details);});- QString shown = kind;- if (shown.isEmpty()) {- shown = prompt.contains(QLatin1String("passphrase"), Qt::CaseInsensitive) ? QStringLiteral("passphrase")- : prompt.contains(QLatin1String("PIN")) ? QStringLiteral("pin")- : QStringLiteral("password");- }- Q_EMIT passphraseNeeded(id, run->title, prompt, shown);});}}+void AskPass::askPerson(QLocalSocket *socket, const QString &token, const QString &prompt, const QString &kind, const QVariantMap &details)+{+ const auto run = m_runs.constFind(token);+ // Released while the keyring was being read, or never to be asked.+ if (run == m_runs.cend() || !run->options.askPerson) {+ reply(socket, false, {});+ return;+ }+ const QString id = QString::number(m_next++);+ m_waiting.insert(id, {socket, token, prompt});+ // The tool gave up waiting, or (for a touch notice) is done.+ connect(socket, &QLocalSocket::disconnected, this, [this, id] {+ if (m_waiting.remove(id)) {+ Q_EMIT questionClosed(id);+ }+ });+ QString shown = kind;+ if (shown.isEmpty()) {+ shown = prompt.contains(QLatin1String("passphrase"), Qt::CaseInsensitive) ? QStringLiteral("passphrase")+ : prompt.contains(QLatin1String("PIN")) ? QStringLiteral("pin")+ : QStringLiteral("password");+ }+ Q_EMIT passphraseNeeded(id, run->options.title, prompt, shown, run->options.context, details);+}+void AskPass::reply(QLocalSocket *socket, bool ok, const QString &text){QJsonObject a;@@ -134,17 +171,24 @@ void AskPass::reply(QLocalSocket *socket, bool ok, const QString &text)socket->flush();}-void AskPass::answer(const QString &id, const QString &text)+void AskPass::answer(const QString &id, const QString &text, bool save){- if (QLocalSocket *socket = m_waiting.take(id)) {- reply(socket, true, text);+ const Waiting w = m_waiting.take(id);+ if (!w.socket) {+ return;}+ // Told before the tool has the answer, so whatever follows from it+ // (the server accepting it, or asking again) comes after.+ if (const auto run = m_runs.constFind(w.token); run != m_runs.cend() && run->options.answered) {+ run->options.answered(w.prompt, text, save);+ }+ reply(w.socket, true, text);}void AskPass::cancel(const QString &id){- if (QLocalSocket *socket = m_waiting.take(id)) {- reply(socket, false, {});+ if (const Waiting w = m_waiting.take(id); w.socket) {+ reply(w.socket, false, {});}}diff --git a/packages/wildos-remote/src/askpass.h b/packages/wildos-remote/src/askpass.hindex bacc8bb..9f24245 100644--- a/packages/wildos-remote/src/askpass.h+++ b/packages/wildos-remote/src/askpass.h@@ -5,6 +5,7 @@#include <QPointer>#include <QProcessEnvironment>#include <QQmlEngine>+#include <QVariantMap>#include <functional>#include <optional>@@ -20,7 +21,7 @@ class QLocalSocket;//// Each run gets a token. An answer comes from the provider registered for// the token (a passphrase just typed, or one from the keyring), or the-// question goes to the window as passphraseNeeded.+// question goes to a window as passphraseNeeded.class AskPass : public QObject{Q_OBJECT@@ -31,24 +32,57 @@ public:// Returns the answer, or an empty optional to ask the person.using Provider = std::function<std::optional<QString>(const QString &prompt, int count)>;+ // What a run knows about a question before the person is asked.+ struct Lookup {+ std::optional<QString> answer;+ // Goes with the question to the window that asks.+ QVariantMap details;+ };+ // For a run whose answers come from the keyring, which answers later:+ // done() is called once, perhaps after this returns.+ using AsyncProvider = std::function<void(const QString &prompt, int count, const std::function<void(const Lookup &)> &done)>;+ // The person's answer to one of the run's questions, and whether they+ // ticked "Save in my keyring".+ using Answered = std::function<void(const QString &prompt, const QString &text, bool save)>;++ struct Options {+ AsyncProvider provider;+ Answered answered;+ QString title;+ // The window that asks: empty for the home window, "terminal" for+ // the terminal window.+ QString context;+ // False for a run that must never ask the person: a question the+ // provider can't answer is cancelled.+ bool askPerson = true;+ };+static AskPass *instance();static AskPass *create(QQmlEngine *, QJSEngine *);// The environment for a tool run with this token.QProcessEnvironment environment(const QString &token, QProcessEnvironment base = QProcessEnvironment::systemEnvironment());QString newToken(const Provider &provider = {}, const QString &title = {});+ QString newToken(const Options &options);void release(const QString &token);// The helper side, in the copy of Remote ssh starts. Prints the answer// and returns 0, or returns 1 when the question was cancelled.static int ask(const QString &prompt);- Q_INVOKABLE void answer(const QString &id, const QString &text);+ // A password prompt as ssh words it: "alex@web-01's password:", or+ // "Password:" from the server's keyboard-interactive sign-in. A one-time+ // code, a key's passphrase or a new password never is one.+ static bool isPassword(const QString &prompt);++ Q_INVOKABLE void answer(const QString &id, const QString &text, bool save = false);Q_INVOKABLE void cancel(const QString &id);Q_SIGNALS:// `kind` is "passphrase", "password", "confirm" (yes or no) or "pin".- void passphraseNeeded(const QString &id, const QString &title, const QString &prompt, const QString &kind);+ // `context` is the window that asks (see Options), and `details` what+ // the run added to the question.+ void passphraseNeeded(const QString &id, const QString &title, const QString &prompt, const QString &kind, const QString &context, const QVariantMap &details);void questionClosed(const QString &id);private:@@ -56,15 +90,20 @@ private:void listen();void incoming();void reply(QLocalSocket *socket, bool ok, const QString &text);+ void askPerson(QLocalSocket *socket, const QString &token, const QString &prompt, const QString &kind, const QVariantMap &details);struct Run {- Provider provider;- QString title;+ Options options;int count = 0;};+ struct Waiting {+ QPointer<QLocalSocket> socket;+ QString token;+ QString prompt;+ };QLocalServer *m_server = nullptr;QString m_path;QHash<QString, Run> m_runs;- QHash<QString, QPointer<QLocalSocket>> m_waiting;+ QHash<QString, Waiting> m_waiting;int m_next = 1;};diff --git a/packages/wildos-remote/src/filebrowser.cpp b/packages/wildos-remote/src/filebrowser.cppindex aa56443..5c87922 100644--- a/packages/wildos-remote/src/filebrowser.cpp+++ b/packages/wildos-remote/src/filebrowser.cpp@@ -1,5 +1,6 @@#include "filebrowser.h"#include "paths.h"+#include "secrets.h"#include <QDateTime>#include <QDesktopServices>@@ -8,6 +9,7 @@#include <QFileInfo>#include <QFileSystemWatcher>#include <QLocale>+#include <QPointer>#include <QUrl>#include <algorithm>@@ -102,13 +104,23 @@ FileBrowser::FileBrowser(const QString &hostName, QObject *parent)FileBrowser::~FileBrowser() = default;-void FileBrowser::connectTo(const QStringList &sshArgs)+void FileBrowser::connectTo(const QStringList &sshArgs, const QString &passwordKey){m_sshArgs = sshArgs;+ m_passwordKey = passwordKey;m_loading = true;m_remoteError.clear();Q_EMIT remoteChanged();- m_sftp->start(sshArgs);+ if (passwordKey.isEmpty()) {+ m_sftp->start(sshArgs);+ return;+ }+ Secrets::instance()->read(passwordKey, [this, guard = QPointer(this), sshArgs](const QString &secret, bool found) {+ if (!guard || sshArgs != m_sshArgs) {+ return;+ }+ m_sftp->start(sshArgs, found ? std::optional<QString>(secret) : std::nullopt);+ });}void FileBrowser::disconnectNow()@@ -119,7 +131,7 @@ void FileBrowser::disconnectNow()void FileBrowser::retry(){if (!m_sshArgs.isEmpty()) {- connectTo(m_sshArgs);+ connectTo(m_sshArgs, m_passwordKey);}}diff --git a/packages/wildos-remote/src/filebrowser.h b/packages/wildos-remote/src/filebrowser.hindex c467047..73311f3 100644--- a/packages/wildos-remote/src/filebrowser.h+++ b/packages/wildos-remote/src/filebrowser.h@@ -37,8 +37,9 @@ public:FileBrowser(const QString &hostName, QObject *parent = nullptr);~FileBrowser() override;- // Connects through the terminal's shared connection.- void connectTo(const QStringList &sshArgs);+ // Connects through the terminal's shared connection, or with the+ // password saved under passwordKey (Secrets) when there is one.+ void connectTo(const QStringList &sshArgs, const QString &passwordKey = {});void disconnectNow();QString localPath() const { return m_localPath; }@@ -106,6 +107,7 @@ private:QString m_hostName;Sftp *m_sftp;QStringList m_sshArgs;+ QString m_passwordKey;QString m_localPath;QStringList m_localHistory;QVariantList m_localEntries;diff --git a/packages/wildos-remote/src/hosts.cpp b/packages/wildos-remote/src/hosts.cppindex 39e986d..af8f535 100644--- a/packages/wildos-remote/src/hosts.cpp+++ b/packages/wildos-remote/src/hosts.cpp@@ -1,5 +1,6 @@#include "hosts.h"#include "paths.h"+#include "secrets.h"#include <QDateTime>#include <QDir>@@ -168,7 +169,9 @@ QString Hosts::save(const QVariantMap &input)h.insert(QStringLiteral("id"), id);m_hosts.append(h);} else {+ const QString before = passwordKey(m_hosts[i].toMap());m_hosts[i] = h;+ forgetUnused(before);}const QString group = h.value(QStringLiteral("group")).toString();if (!group.isEmpty() && !m_groups.contains(group)) {@@ -184,8 +187,10 @@ void Hosts::remove(const QString &id)if (i < 0) {return;}+ const QString key = passwordKey(m_hosts[i].toMap());m_hosts.removeAt(i);QFile::remove(screenPath(id));+ forgetUnused(key);write();}@@ -327,6 +332,49 @@ QVariantMap Hosts::parseAddress(const QString &text) constreturn {};}+QString Hosts::passwordKey(const QVariantMap &h) const+{+ if (h.value(QStringLiteral("kind")).toString() != QLatin1String("terminal")) {+ return {};+ }+ QString user = h.value(QStringLiteral("user")).toString();+ if (user.isEmpty()) {+ // ssh signs in as the person using this PC when no user is given.+ user = qEnvironmentVariable("USER");+ }+ return Secrets::sshKey(user, hostName(h), port(h));+}++void Hosts::forgetUnused(const QString &key)+{+ if (key.isEmpty()) {+ return;+ }+ for (const QVariant &v : std::as_const(m_hosts)) {+ if (passwordKey(v.toMap()) == key) {+ return;+ }+ }+ Secrets::instance()->remove(key);+}++QVariantMap Hosts::addressParts(const QString &address) const+{+ const auto [h, p] = splitAddress(address);+ return {{QStringLiteral("host"), h}, {QStringLiteral("port"), p}};+}++QString Hosts::joinAddress(const QString &host, int port, const QString &kind) const+{+ const QString h = host.trimmed();+ const int standard = kind == QLatin1String("desktop") ? 3389 : 22;+ if (port <= 0 || port > 65535 || port == standard) {+ return h;+ }+ // An IPv6 address takes brackets before a port.+ return QString::fromLatin1(h.contains(QLatin1Char(':')) ? "[%1]:%2" : "%1:%2").arg(h).arg(port);+}+QString Hosts::hostName(const QVariantMap &h) const{return splitAddress(h.value(QStringLiteral("address")).toString()).first;diff --git a/packages/wildos-remote/src/hosts.h b/packages/wildos-remote/src/hosts.hindex 79dbd5a..44e8f70 100644--- a/packages/wildos-remote/src/hosts.h+++ b/packages/wildos-remote/src/hosts.h@@ -58,6 +58,16 @@ public:// port when none is given.Q_INVOKABLE QString hostName(const QVariantMap &host) const;Q_INVOKABLE int port(const QVariantMap &host) const;+ // An address as the host settings show it: {host, port}, the port 0+ // when none is given. joinAddress puts them back together, leaving out+ // the kind's default port, which is how hosts store it.+ Q_INVOKABLE QVariantMap addressParts(const QString &address) const;+ Q_INVOKABLE QString joinAddress(const QString &host, int port, const QString &kind) const;+ // Where a terminal host's SSH password is kept in the keyring (Secrets),+ // or empty for a desktop. A host that is deleted, or moved to another+ // address or account, takes its saved password with it unless another+ // host still uses that account.+ Q_INVOKABLE QString passwordKey(const QVariantMap &host) const;// Whether each host answers on its port, for Online and Offline on the// recent desktops. Only opens and closes a TCP connection.@@ -79,6 +89,7 @@ private:void load();void write();int indexOf(const QString &id) const;+ void forgetUnused(const QString &key);QVariantList m_hosts;QStringList m_groups;diff --git a/packages/wildos-remote/src/secrets.cpp b/packages/wildos-remote/src/secrets.cppindex 2cf4c0e..ba53271 100644--- a/packages/wildos-remote/src/secrets.cpp+++ b/packages/wildos-remote/src/secrets.cpp@@ -76,3 +76,12 @@ void Secrets::write(const QString &key, const QString &secret, const QJSValue &c}});}++void Secrets::exists(const QString &key, const QJSValue &callback)+{+ read(key, [callback](const QString &, bool found) mutable {+ if (callback.isCallable()) {+ callback.call({QJSValue(found)});+ }+ });+}diff --git a/packages/wildos-remote/src/secrets.h b/packages/wildos-remote/src/secrets.hindex 2025178..bff977d 100644--- a/packages/wildos-remote/src/secrets.h+++ b/packages/wildos-remote/src/secrets.h@@ -28,9 +28,18 @@ public:Q_INVOKABLE void read(const QString &key, const QJSValue &callback);Q_INVOKABLE void write(const QString &key, const QString &secret, const QJSValue &callback);- // The keyring names for a desktop host's password and a key's- // passphrase.+ // Whether a secret is saved, without handing it to QML: callback(found).+ Q_INVOKABLE void exists(const QString &key, const QJSValue &callback);++ // The keyring names for a desktop host's password, an SSH account's+ // password (user@host:port, so the terminal and the files of any host+ // with that account share it, and a host moved to another address+ // never sends it there) and a key's passphrase.static QString hostKey(const QString &hostId) { return QStringLiteral("desktop:") + hostId; }+ static QString sshKey(const QString &user, const QString &host, int port)+ {+ return QStringLiteral("ssh:%1@%2:%3").arg(user, host).arg(port);+ }static QString passphraseKey(const QString &fingerprint) { return QStringLiteral("key:") + fingerprint; }private:diff --git a/packages/wildos-remote/src/sessionwindow.cpp b/packages/wildos-remote/src/sessionwindow.cppindex 104fc6d..67ed906 100644--- a/packages/wildos-remote/src/sessionwindow.cpp+++ b/packages/wildos-remote/src/sessionwindow.cpp@@ -1,8 +1,10 @@#include "sessionwindow.h"+#include "askpass.h"#include "filebrowser.h"#include "hosts.h"#include "keychain.h"#include "paths.h"+#include "secrets.h"#include "terminalview.h"#include "windowframe.h"@@ -10,6 +12,7 @@#include <QGuiApplication>#include <QPainter>#include <QPainterPath>+#include <QProcess>#include <QQmlContext>#include <QQmlEngine>#include <QQuickItem>@@ -64,6 +67,7 @@ SessionTab::SessionTab(const QVariantMap &host, QObject *parent)m_forwards.append(QStringLiteral("localhost:%1 to %2").arg(f.value(QStringLiteral("localPort")).toInt()).arg(target.isEmpty() || target == QLatin1String("localhost") ? m_title : target));}+ m_passwordKey = hosts->passwordKey(host);m_files = new FileBrowser(m_title, this);measureLatency();}@@ -128,7 +132,11 @@ TerminalView *SessionTab::makeView(bool first)} else if (const QStringList exec = m_host.value(QStringLiteral("exec")).toStringList(); !exec.isEmpty()) {view = new TerminalView(exec.first(), exec.mid(1), QString());} else {- view = new TerminalView(QStringLiteral("ssh"), sshArgs(first), m_hostId);+ const QString token = signInToken();+ view = new TerminalView(QStringLiteral("ssh"), sshArgs(first), m_hostId, AskPass::instance()->environment(token));+ connect(view, &QObject::destroyed, AskPass::instance(), [token] {+ AskPass::instance()->release(token);+ });}m_splitter->addWidget(view);m_views.append(view);@@ -213,7 +221,7 @@ void SessionTab::setFilesOpen(bool open)}m_filesOpen = open;if (open && !m_files->remoteReady()) {- m_files->connectTo(sshArgs(false));+ m_files->connectTo(sshArgs(false), m_passwordKey);}m_splitter->setVisible(!open);Q_EMIT changed();@@ -286,6 +294,116 @@ void SessionTab::measureLatency()socket->connectToHost(Hosts::instance()->hostName(m_host), quint16(Hosts::instance()->port(m_host)));}+// One ssh's sign-in. The first password prompt is answered from the+// keyring when one is saved; the window asks for anything else, and for the+// password again when the server turns it down.+struct SessionTab::SignIn {+ int passwords = 0;+ // A password is saved for this account.+ bool saved = false;+ // The last password ssh was given came from the keyring.+ bool fromKeyring = false;+ // Moves on whenever an answer being checked is overtaken.+ int watch = 0;+};++QString SessionTab::signInToken()+{+ auto signIn = std::make_shared<SignIn>();+ const QVariantMap details{+ {QStringLiteral("save"), true},+ {QStringLiteral("hostId"), m_hostId},+ {QStringLiteral("name"), m_title},+ {QStringLiteral("address"), m_userHost},+ };+ AskPass::Options options;+ options.title = m_title;+ options.context = QStringLiteral("terminal");+ options.provider = [key = m_passwordKey, signIn, details](const QString &prompt, int, const std::function<void(const AskPass::Lookup &)> &done) {+ if (!AskPass::isPassword(prompt)) {+ done({});+ return;+ }+ ++signIn->passwords;+ // Asked again: the answer being checked was wrong.+ ++signIn->watch;+ const bool keyringFailed = std::exchange(signIn->fromKeyring, false);+ auto ask = [signIn, details, done, keyringFailed] {+ QVariantMap d = details;+ d.insert(QStringLiteral("saved"), signIn->saved);+ d.insert(QStringLiteral("retry"), signIn->passwords > 1);+ d.insert(QStringLiteral("savedFailed"), keyringFailed);+ done({std::nullopt, d});+ };+ if (signIn->passwords > 1) {+ ask();+ return;+ }+ Secrets::instance()->read(key, [signIn, done, ask](const QString &secret, bool found) {+ signIn->saved = found;+ if (found) {+ signIn->fromKeyring = true;+ done({secret, {}});+ } else {+ ask();+ }+ });+ };+ options.answered = [this, guard = QPointer(this), signIn](const QString &prompt, const QString &text, bool save) {+ // Only a password is ever kept, never a code or a passphrase, and+ // only once the server has taken it.+ if (!guard || !AskPass::isPassword(prompt) || (!save && !signIn->saved)) {+ return;+ }+ confirmSignIn(signIn, ++signIn->watch, text, save, 0);+ };+ return AskPass::instance()->newToken(options);+}++void SessionTab::confirmSignIn(const std::shared_ptr<SignIn> &signIn, int watch, const QString &password, bool save, int tries)+{+ // ssh opens its shared connection only once the server has signed it+ // in, so the connection being there means the password worked.+ if (signIn->watch != watch || tries > 240) {+ return;+ }+ QStringList args = sshArgs(false);+ const qsizetype end = args.lastIndexOf(QStringLiteral("--"));+ args.insert(end >= 0 ? end : args.size() - 1, QStringLiteral("check"));+ args.insert(end >= 0 ? end : args.size() - 1, QStringLiteral("-O"));+ args.prepend(QStringLiteral("BatchMode=yes"));+ args.prepend(QStringLiteral("-o"));+ auto *check = new QProcess(this);+ check->setProcessChannelMode(QProcess::MergedChannels);+ connect(check, &QProcess::finished, this, [=, this](int code, QProcess::ExitStatus status) {+ check->deleteLater();+ if (signIn->watch != watch) {+ return;+ }+ if (status == QProcess::NormalExit && code == 0) {+ ++signIn->watch;+ if (save) {+ Secrets::instance()->write(m_passwordKey, password);+ signIn->saved = true;+ } else {+ // Typed again without saving: the saved one was wrong.+ Secrets::instance()->remove(m_passwordKey);+ signIn->saved = false;+ }+ return;+ }+ QTimer::singleShot(500, this, [=, this] {+ confirmSignIn(signIn, watch, password, save, tries + 1);+ });+ });+ connect(check, &QProcess::errorOccurred, check, [check](QProcess::ProcessError e) {+ if (e == QProcess::FailedToStart) {+ check->deleteLater();+ }+ });+ check->start(QStringLiteral("ssh"), args);+}+SessionWindow *SessionWindow::instance(bool create){static QPointer<SessionWindow> window;@@ -453,6 +571,15 @@ void SessionWindow::runEverywhere(const QString &command)}}+void SessionWindow::focusChrome()+{+ raise();+ activateWindow();+ if (m_chrome) {+ m_chrome->setFocus();+ }+}+void SessionWindow::showHome(){Q_EMIT homeRequested(QString());diff --git a/packages/wildos-remote/src/sessionwindow.h b/packages/wildos-remote/src/sessionwindow.hindex b0ce968..8d1a47e 100644--- a/packages/wildos-remote/src/sessionwindow.h+++ b/packages/wildos-remote/src/sessionwindow.h@@ -7,6 +7,8 @@#include <QVariantMap>#include <QWidget>+#include <memory>+class FileBrowser;class QQuickWidget;class QSplitter;@@ -80,6 +82,10 @@ Q_SIGNALS:private:TerminalView *makeView(bool first);+ struct SignIn;+ // A token for one ssh (AskPass), and the check that its password worked.+ QString signInToken();+ void confirmSignIn(const std::shared_ptr<SignIn> &signIn, int watch, const QString &password, bool save, int tries);void measureLatency();QString m_title;@@ -87,6 +93,7 @@ private:bool m_local = false;QString m_hostId;QVariantMap m_host;+ QString m_passwordKey;QString m_userHost;QString m_auth;QStringList m_forwards;@@ -159,6 +166,8 @@ public:// Runs a snippet in every terminal tab.Q_INVOKABLE void runEverywhere(const QString &command);Q_INVOKABLE int terminalTabCount() const;+ // Keyboard to the layer over the terminals, for a dialog in it.+ Q_INVOKABLE void focusChrome();Q_SIGNALS:void tabsChanged();diff --git a/packages/wildos-remote/src/sftp.cpp b/packages/wildos-remote/src/sftp.cppindex 605aed3..39e85c0 100644--- a/packages/wildos-remote/src/sftp.cpp+++ b/packages/wildos-remote/src/sftp.cpp@@ -1,4 +1,5 @@#include "sftp.h"+#include "askpass.h"#include <QFile>#include <QSharedPointer>@@ -152,15 +153,33 @@ Sftp::~Sftp()stop();}-void Sftp::start(const QStringList &sshArgs)+void Sftp::start(const QStringList &sshArgs, const std::optional<QString> &password){stop();m_process = new QProcess(this);m_process->setProgram(QStringLiteral("ssh"));QStringList args = sshArgs;- // Never a prompt: the terminal's connection is used, or nothing.- args.prepend(QStringLiteral("BatchMode=yes"));- args.prepend(QStringLiteral("-o"));+ if (password) {+ // The saved password answers ssh's first password prompt, once.+ // Anything else it asks (a one-time code, a key's passphrase, the+ // password again) is turned down, never shown.+ AskPass::Options options;+ options.askPerson = false;+ options.provider = [secret = *password, given = false](const QString &prompt, int, const std::function<void(const AskPass::Lookup &)> &done) mutable {+ if (!given && AskPass::isPassword(prompt)) {+ given = true;+ done({secret, {}});+ } else {+ done({});+ }+ };+ m_askToken = AskPass::instance()->newToken(options);+ m_process->setProcessEnvironment(AskPass::instance()->environment(m_askToken));+ } else {+ // Never a prompt: the terminal's connection is used, or nothing.+ args.prepend(QStringLiteral("BatchMode=yes"));+ args.prepend(QStringLiteral("-o"));+ }// -s is an option, so it goes before the destination (the last of// sshArgs, after its "--"); the subsystem's name comes after it, where// a command would.@@ -211,6 +230,9 @@ void Sftp::stop()}m_process->deleteLater();m_process = nullptr;+ if (!m_askToken.isEmpty()) {+ AskPass::instance()->release(std::exchange(m_askToken, {}));+ }m_pending.clear();m_buffer.clear();if (m_ready) {diff --git a/packages/wildos-remote/src/sftp.h b/packages/wildos-remote/src/sftp.hindex 5ac08ed..0591982 100644--- a/packages/wildos-remote/src/sftp.h+++ b/packages/wildos-remote/src/sftp.h@@ -6,10 +6,13 @@#include <QProcess>#include <functional>+#include <optional>// An SFTP (version 3) client over `ssh -s sftp`. It rides on the// terminal's connection through OpenSSH's connection sharing, so it needs-// no second sign-in and checks nothing ssh hasn't already checked.+// no second sign-in and checks nothing ssh hasn't already checked. With no+// terminal signed in, it signs in itself only with a password saved in the+// keyring, and never asks.class Sftp : public QObject{Q_OBJECT@@ -32,7 +35,7 @@ public:~Sftp() override;// The ssh arguments that reach the host (control path, port, user@host).- void start(const QStringList &sshArgs);+ void start(const QStringList &sshArgs, const std::optional<QString> &password = {});void stop();bool ready() const { return m_ready; }@@ -61,6 +64,7 @@ private:void closeHandle(const QByteArray &handle);QProcess *m_process = nullptr;+ QString m_askToken;QByteArray m_buffer;quint32 m_nextId = 1;QHash<quint32, Reply> m_pending;diff --git a/packages/wildos-remote/src/terminalview.cpp b/packages/wildos-remote/src/terminalview.cppindex 798c0b3..d106880 100644--- a/packages/wildos-remote/src/terminalview.cpp+++ b/packages/wildos-remote/src/terminalview.cpp@@ -41,14 +41,13 @@ QFont terminalFont()}}-TerminalView::TerminalView(const QString &program, const QStringList &args, const QString &historyKey, QWidget *parent)+TerminalView::TerminalView(const QString &program, const QStringList &args, const QString &historyKey, QProcessEnvironment env, QWidget *parent): QTermWidget(0, parent), m_historyKey(historyKey){setShellProgram(program);setArgs(args);setWorkingDirectory(QDir::homePath());- QProcessEnvironment env = QProcessEnvironment::systemEnvironment();env.insert(QStringLiteral("TERM"), QStringLiteral("xterm-256color"));env.insert(QStringLiteral("COLORTERM"), QStringLiteral("truecolor"));env.remove(QStringLiteral("DESKTOP_STARTUP_ID"));diff --git a/packages/wildos-remote/src/terminalview.h b/packages/wildos-remote/src/terminalview.hindex 34ff80e..b745186 100644--- a/packages/wildos-remote/src/terminalview.h+++ b/packages/wildos-remote/src/terminalview.h@@ -1,6 +1,7 @@#pragma once#include <QPointer>+#include <QProcessEnvironment>#include <QVariantList>#include <qtermwidget.h>@@ -18,7 +19,10 @@ class TerminalView : public QTermWidgetQ_OBJECTpublic:- TerminalView(const QString &program, const QStringList &args, const QString &historyKey, QWidget *parent = nullptr);+ // `environment` is what the program runs with, before the terminal's own+ // settings (TERM and the like) go on top.+ TerminalView(const QString &program, const QStringList &args, const QString &historyKey,+ QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(), QWidget *parent = nullptr);QVariantList suggestions() const { return m_suggestions; }int selected() const { return m_selected; }diff --git a/packages/wildos-settings/CMakeLists.txt b/packages/wildos-settings/CMakeLists.txtindex 466066d..4d71af7 100644--- a/packages/wildos-settings/CMakeLists.txt+++ b/packages/wildos-settings/CMakeLists.txt@@ -21,6 +21,7 @@ find_package(Cups REQUIRED)find_package(SDL2 2.0.16 REQUIRED)find_package(PkgConfig REQUIRED)pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)+pkg_check_modules(PWQUALITY REQUIRED IMPORTED_TARGET pwquality)qt_standard_project_setup(REQUIRES 6.8)@@ -54,6 +55,7 @@ qt_add_qml_module(wildos-settingssrc/keyboard.cpp src/keyboard.hsrc/printers.cpp src/printers.hsrc/users.cpp src/users.h+ src/passwordcheck.cpp src/passwordcheck.hsrc/language.cpp src/language.hsrc/appaccess.cpp src/appaccess.hsrc/poweroptions.cpp src/poweroptions.h@@ -85,6 +87,7 @@ target_link_libraries(wildos-settings PRIVATECups::CupsSDL2::SDL2PkgConfig::GLIB+ PkgConfig::PWQUALITYutil)diff --git a/packages/wildos-settings/debian/changelog b/packages/wildos-settings/debian/changelogindex 7b66a7d..79e6469 100644--- a/packages/wildos-settings/debian/changelog+++ b/packages/wildos-settings/debian/changelog@@ -1,3 +1,11 @@+wildos-settings (0.1.5) trixie; urgency=medium++ * Changing your password and creating an account show how strong the new+ password looks (weak, fair or strong, and why when it is weak), scored+ with libpwquality. It is advice only and never stops a password.++ -- Wild OS Developers <[email protected]> Tue, 10 Nov 2026 17:40:00 +0000+wildos-settings (0.1.4) trixie; urgency=medium* Sign-in options has a saved passwords dialog, opened from thatdiff --git a/packages/wildos-settings/debian/control b/packages/wildos-settings/debian/controlindex dac0cf3..748c622 100644--- a/packages/wildos-settings/debian/control+++ b/packages/wildos-settings/debian/control@@ -21,6 +21,7 @@ Build-Depends:libcups2-dev,libsdl2-dev,libglib2.0-dev,+ libpwquality-dev,pkgconf,Standards-Version: 4.7.0Rules-Requires-Root: no@@ -70,6 +71,8 @@ Depends:pipewire-bin,libpipewire-0.3-modules,libglib2.0-bin,+ libpwquality1,+ cracklib-runtime,Recommends:systemsettings,bolt,diff --git a/packages/wildos-settings/qml/components/StrengthLine.qml b/packages/wildos-settings/qml/components/StrengthLine.qmlnew file mode 100644index 0000000..fee41d1--- /dev/null+++ b/packages/wildos-settings/qml/components/StrengthLine.qml@@ -0,0 +1,53 @@+import QtQuick+import QtQuick.Layouts+import WildOS.Settings+import WildOS.UI as UI++// How strong the password being chosen looks: three bars and a line of+// text that says the same thing, so the colour is never the only signal.+// Advice only. No button waits on it and a weak password can still be used.+// It shows once the password is long enough to be accepted.+RowLayout {+ id: line++ property string password+ property string oldPassword+ property var names: []++ readonly property var result: password.length >= 8 ? PasswordCheck.check(password, oldPassword, names) : ({})+ readonly property string level: result.level || ""+ readonly property int bars: level === "strong" ? 3 : level === "fair" ? 2 : 1+ readonly property color tone: level === "strong" ? UI.Style.success : level === "fair" ? UI.Style.warning : UI.Style.danger++ visible: level.length > 0+ spacing: 10++ Row {+ Layout.alignment: Qt.AlignVCenter+ spacing: 3+ Accessible.ignored: true++ Repeater {+ model: 3++ Rectangle {+ required property int index+ width: 16+ height: 4+ radius: 2+ color: index < line.bars ? line.tone : UI.Style.borderControl+ }+ }+ }++ UI.Label {+ Layout.fillWidth: true+ text: line.level === "strong" ? "Strong password"+ : line.level === "fair" ? "Fair password"+ : "Weak password, " + line.result.reason + "."+ size: 12+ color: UI.Style.inkMuted+ wrapMode: Text.Wrap+ elide: Text.ElideNone+ }+}diff --git a/packages/wildos-settings/qml/pages/OtherUsersPage.qml b/packages/wildos-settings/qml/pages/OtherUsersPage.qmlindex 196cb2d..4425ee9 100644--- a/packages/wildos-settings/qml/pages/OtherUsersPage.qml+++ b/packages/wildos-settings/qml/pages/OtherUsersPage.qml@@ -225,6 +225,12 @@ PageScroll {onAccepted: confirmField.forceActiveFocus()}+ StrengthLine {+ Layout.fillWidth: true+ password: passwordField.text+ names: [userField.text, fullField.text]+ }+UI.TextField {id: confirmFieldLayout.fillWidth: truediff --git a/packages/wildos-settings/qml/pages/SignInPage.qml b/packages/wildos-settings/qml/pages/SignInPage.qmlindex e785c7e..7b8ae88 100644--- a/packages/wildos-settings/qml/pages/SignInPage.qml+++ b/packages/wildos-settings/qml/pages/SignInPage.qml@@ -361,6 +361,13 @@ PageScroll {onAccepted: confirmField.forceActiveFocus()}+ StrengthLine {+ Layout.fillWidth: true+ password: newField.text+ oldPassword: currentField.text+ names: [Users.me.userName || "", Users.me.realName || ""]+ }+UI.TextField {id: confirmFieldLayout.fillWidth: truediff --git a/packages/wildos-settings/src/passwordcheck.cpp b/packages/wildos-settings/src/passwordcheck.cppnew file mode 100644index 0000000..c70eb06--- /dev/null+++ b/packages/wildos-settings/src/passwordcheck.cpp@@ -0,0 +1,101 @@+#include "passwordcheck.h"++#include <QRegularExpression>++#include <pwquality.h>++namespace+{++// libpwquality's own messages are long and technical ("fails the+// dictionary check"), so each failure gets a short plain reason instead.+// Cracklib's reasons only come as text, matched here in English; in another+// language they fall back to the general one.+QString reasonFor(int error, const QString &cracklib)+{+ switch (error) {+ case PWQ_ERROR_CRACKLIB_CHECK:+ if (cracklib.contains(QLatin1String("dictionary word"))) {+ return QStringLiteral("it's based on a dictionary word");+ }+ if (cracklib.contains(QLatin1String("simplistic"))) {+ return QStringLiteral("it follows a simple pattern");+ }+ if (cracklib.contains(QLatin1String("DIFFERENT"))) {+ return QStringLiteral("it uses too few different characters");+ }+ if (cracklib.contains(QLatin1String("whitespace"))) {+ return QStringLiteral("it's all spaces");+ }+ if (cracklib.contains(QLatin1String("short"))) {+ return QStringLiteral("it's short");+ }+ return QStringLiteral("it's easy to guess");+ case PWQ_ERROR_PALINDROME:+ return QStringLiteral("it reads the same backwards");+ case PWQ_ERROR_USER_CHECK:+ case PWQ_ERROR_GECOS_CHECK:+ return QStringLiteral("it contains your name");+ case PWQ_ERROR_SAME_PASSWORD:+ case PWQ_ERROR_CASE_CHANGES_ONLY:+ case PWQ_ERROR_TOO_SIMILAR:+ case PWQ_ERROR_ROTATED:+ return QStringLiteral("it's too close to your current password");+ case PWQ_ERROR_MIN_LENGTH:+ return QStringLiteral("it's short");+ default:+ return QStringLiteral("it's easy to guess");+ }+}++}++QVariantMap PasswordCheck::check(const QString &password, const QString &oldPassword, const QStringList &names) const+{+ if (password.isEmpty()) {+ return {};+ }+ const auto weak = [](const QString &reason) {+ return QVariantMap{{QStringLiteral("level"), QStringLiteral("weak")}, {QStringLiteral("reason"), reason}};+ };++ // libpwquality only knows the user name, and only once the account+ // exists, so a new account's names are checked here too.+ static const QRegularExpression separators(QStringLiteral("[\\s._-]+"));+ for (const QString &name : names) {+ for (const QString &part : name.split(separators, Qt::SkipEmptyParts)) {+ if (part.size() >= 3 && password.contains(part, Qt::CaseInsensitive)) {+ return weak(QStringLiteral("it contains your name"));+ }+ }+ }++ pwquality_settings_t *settings = pwquality_default_settings();+ if (!settings) {+ return {};+ }+ QByteArray secret = password.toUtf8();+ QByteArray old = oldPassword.toUtf8();+ const QString first = names.value(0).trimmed();+ const QByteArray user = !first.isEmpty() && !first.contains(QLatin1Char(' ')) ? first.toUtf8() : QByteArray();+ void *aux = nullptr;+ const int score = pwquality_check(settings, secret.constData(), old.isEmpty() ? nullptr : old.constData(),+ user.isEmpty() ? nullptr : user.constData(), &aux);+ secret.fill('\0');+ old.fill('\0');+ // For a cracklib failure the extra information is cracklib's reason.+ const QString cracklib = score == PWQ_ERROR_CRACKLIB_CHECK && aux ? QString::fromUtf8(static_cast<const char *>(aux)) : QString();+ // Frees whatever libpwquality attached to the result.+ char buffer[PWQ_MAX_ERROR_MESSAGE_LEN];+ pwquality_strerror(buffer, sizeof buffer, score, aux);+ pwquality_free_settings(settings);++ // Without cracklib's word list there is nothing fair to say.+ if (cracklib.contains(QLatin1String("error loading dictionary"))) {+ return {};+ }+ if (score < 0) {+ return weak(reasonFor(score, cracklib));+ }+ return {{QStringLiteral("level"), score >= 80 ? QStringLiteral("strong") : QStringLiteral("fair")}, {QStringLiteral("reason"), QString()}};+}diff --git a/packages/wildos-settings/src/passwordcheck.h b/packages/wildos-settings/src/passwordcheck.hnew file mode 100644index 0000000..6ec1ed7--- /dev/null+++ b/packages/wildos-settings/src/passwordcheck.h@@ -0,0 +1,26 @@+#pragma once++#include <QObject>+#include <QQmlEngine>+#include <QStringList>+#include <QVariantMap>++// Advice on a password someone is choosing, from libpwquality's checks and+// score. It never decides whether a password can be used: a password is a+// choice, and the dialogs keep only their own rules. The password goes to+// libpwquality inside this process and nowhere else; it is not kept, logged+// or written down.+class PasswordCheck : public QObject+{+ Q_OBJECT+ QML_ELEMENT+ QML_SINGLETON++public:+ using QObject::QObject;++ // { level: "weak", "fair" or "strong", reason: why it is weak, or "" }.+ // `names` are the account's user name and full name; the first is+ // passed to libpwquality as the user name when it is one word.+ Q_INVOKABLE QVariantMap check(const QString &password, const QString &oldPassword, const QStringList &names) const;+};diff --git a/packages/wildos-ui/debian/changelog b/packages/wildos-ui/debian/changelogindex dd941ca..9534887 100644--- a/packages/wildos-ui/debian/changelog+++ b/packages/wildos-ui/debian/changelog@@ -1,3 +1,9 @@+wildos-ui (0.1.2) trixie; urgency=medium++ * LoadingSplash, the splash apps show while they open.++ -- Wild OS Developers <[email protected]> Tue, 10 Nov 2026 17:02:15 +0000+wildos-ui (0.1.1) trixie; urgency=medium* Stronger text on glass makes glass behind text nearly solid and muted textdiff --git a/packages/wildos-welcome/CMakeLists.txt b/packages/wildos-welcome/CMakeLists.txtindex 4653653..8e52169 100644--- a/packages/wildos-welcome/CMakeLists.txt+++ b/packages/wildos-welcome/CMakeLists.txt@@ -12,6 +12,7 @@ find_package(KF6JobWidgets REQUIRED)find_package(packagekitqt6 REQUIRED)find_package(PkgConfig REQUIRED)pkg_check_modules(HIVEX REQUIRED IMPORTED_TARGET hivex)+pkg_check_modules(PWQUALITY REQUIRED IMPORTED_TARGET pwquality)qt_standard_project_setup(REQUIRES 6.8)@@ -35,6 +36,7 @@ qt_add_qml_module(wildos-welcomesrc/wifi.cpp src/wifi.hsrc/windowsprograms.cpp src/windowsprograms.hsrc/firstrun.cpp src/firstrun.h+ src/passwordcheck.cpp src/passwordcheck.h)target_include_directories(wildos-welcome PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)@@ -44,6 +46,7 @@ target_link_libraries(wildos-welcome PRIVATEKF6::ConfigCore KF6::CoreAddons KF6::JobWidgetsPK::packagekitqt6PkgConfig::HIVEX+ PkgConfig::PWQUALITY)install(TARGETS wildos-welcome RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})diff --git a/packages/wildos-welcome/debian/changelog b/packages/wildos-welcome/debian/changelogindex 26c5d3d..929c29d 100644--- a/packages/wildos-welcome/debian/changelog+++ b/packages/wildos-welcome/debian/changelog@@ -1,3 +1,11 @@+wildos-welcome (0.1.1) trixie; urgency=medium++ * Creating your account at first boot shows how strong the password+ looks (weak, fair or strong, and why when it is weak), scored with+ libpwquality. It is advice only and never stops a password.++ -- Wild OS Developers <[email protected]> Tue, 10 Nov 2026 17:40:00 +0000+wildos-welcome (0.1.0) trixie; urgency=medium* Initial release.diff --git a/packages/wildos-welcome/debian/control b/packages/wildos-welcome/debian/controlindex 6b55920..03d001e 100644--- a/packages/wildos-welcome/debian/control+++ b/packages/wildos-welcome/debian/control@@ -13,6 +13,7 @@ Build-Depends:libkf6jobwidgets-dev,libpackagekitqt6-dev,libhivex-dev,+ libpwquality-dev,pkgconf,Standards-Version: 4.7.0Rules-Requires-Root: no@@ -35,6 +36,8 @@ Depends:pkexec,fonts-inter,libqt6sql6-sqlite,+ libpwquality1,+ cracklib-runtime,Recommends:wildos-appbridge,ntfs-3g,diff --git a/packages/wildos-welcome/qml/components/StrengthLine.qml b/packages/wildos-welcome/qml/components/StrengthLine.qmlnew file mode 100644index 0000000..3e75c9a--- /dev/null+++ b/packages/wildos-welcome/qml/components/StrengthLine.qml@@ -0,0 +1,53 @@+import QtQuick+import QtQuick.Layouts+import WildOS.Welcome+import WildOS.UI as UI++// How strong the password being chosen looks: three bars and a line of+// text that says the same thing, so the colour is never the only signal.+// Advice only. No button waits on it and a weak password can still be used.+// It shows once the password is long enough to be accepted.+RowLayout {+ id: line++ property string password+ property string oldPassword+ property var names: []++ readonly property var result: password.length >= 8 ? PasswordCheck.check(password, oldPassword, names) : ({})+ readonly property string level: result.level || ""+ readonly property int bars: level === "strong" ? 3 : level === "fair" ? 2 : 1+ readonly property color tone: level === "strong" ? UI.Style.success : level === "fair" ? UI.Style.warning : UI.Style.danger++ visible: level.length > 0+ spacing: 10++ Row {+ Layout.alignment: Qt.AlignVCenter+ spacing: 3+ Accessible.ignored: true++ Repeater {+ model: 3++ Rectangle {+ required property int index+ width: 16+ height: 4+ radius: 2+ color: index < line.bars ? line.tone : UI.Style.borderControl+ }+ }+ }++ UI.Label {+ Layout.fillWidth: true+ text: line.level === "strong" ? "Strong password"+ : line.level === "fair" ? "Fair password"+ : "Weak password, " + line.result.reason + "."+ size: 12+ color: UI.Style.inkMuted+ wrapMode: Text.Wrap+ elide: Text.ElideNone+ }+}diff --git a/packages/wildos-welcome/qml/setup/AccountStep.qml b/packages/wildos-welcome/qml/setup/AccountStep.qmlindex eba4f71..b9811ee 100644--- a/packages/wildos-welcome/qml/setup/AccountStep.qml+++ b/packages/wildos-welcome/qml/setup/AccountStep.qml@@ -173,6 +173,12 @@ StepPage {Accessible.name: "Password"onAccepted: page.submit()}+ StrengthLine {+ Layout.fillWidth: true+ Layout.topMargin: 6+ password: passwordField.text+ names: [nameField.text]+ }hint: page.passwordShort ? "Use at least 8 characters." : ""hintError: !passwordField.activeFocus}diff --git a/packages/wildos-welcome/src/passwordcheck.cpp b/packages/wildos-welcome/src/passwordcheck.cppnew file mode 100644index 0000000..c70eb06--- /dev/null+++ b/packages/wildos-welcome/src/passwordcheck.cpp@@ -0,0 +1,101 @@+#include "passwordcheck.h"++#include <QRegularExpression>++#include <pwquality.h>++namespace+{++// libpwquality's own messages are long and technical ("fails the+// dictionary check"), so each failure gets a short plain reason instead.+// Cracklib's reasons only come as text, matched here in English; in another+// language they fall back to the general one.+QString reasonFor(int error, const QString &cracklib)+{+ switch (error) {+ case PWQ_ERROR_CRACKLIB_CHECK:+ if (cracklib.contains(QLatin1String("dictionary word"))) {+ return QStringLiteral("it's based on a dictionary word");+ }+ if (cracklib.contains(QLatin1String("simplistic"))) {+ return QStringLiteral("it follows a simple pattern");+ }+ if (cracklib.contains(QLatin1String("DIFFERENT"))) {+ return QStringLiteral("it uses too few different characters");+ }+ if (cracklib.contains(QLatin1String("whitespace"))) {+ return QStringLiteral("it's all spaces");+ }+ if (cracklib.contains(QLatin1String("short"))) {+ return QStringLiteral("it's short");+ }+ return QStringLiteral("it's easy to guess");+ case PWQ_ERROR_PALINDROME:+ return QStringLiteral("it reads the same backwards");+ case PWQ_ERROR_USER_CHECK:+ case PWQ_ERROR_GECOS_CHECK:+ return QStringLiteral("it contains your name");+ case PWQ_ERROR_SAME_PASSWORD:+ case PWQ_ERROR_CASE_CHANGES_ONLY:+ case PWQ_ERROR_TOO_SIMILAR:+ case PWQ_ERROR_ROTATED:+ return QStringLiteral("it's too close to your current password");+ case PWQ_ERROR_MIN_LENGTH:+ return QStringLiteral("it's short");+ default:+ return QStringLiteral("it's easy to guess");+ }+}++}++QVariantMap PasswordCheck::check(const QString &password, const QString &oldPassword, const QStringList &names) const+{+ if (password.isEmpty()) {+ return {};+ }+ const auto weak = [](const QString &reason) {+ return QVariantMap{{QStringLiteral("level"), QStringLiteral("weak")}, {QStringLiteral("reason"), reason}};+ };++ // libpwquality only knows the user name, and only once the account+ // exists, so a new account's names are checked here too.+ static const QRegularExpression separators(QStringLiteral("[\\s._-]+"));+ for (const QString &name : names) {+ for (const QString &part : name.split(separators, Qt::SkipEmptyParts)) {+ if (part.size() >= 3 && password.contains(part, Qt::CaseInsensitive)) {+ return weak(QStringLiteral("it contains your name"));+ }+ }+ }++ pwquality_settings_t *settings = pwquality_default_settings();+ if (!settings) {+ return {};+ }+ QByteArray secret = password.toUtf8();+ QByteArray old = oldPassword.toUtf8();+ const QString first = names.value(0).trimmed();+ const QByteArray user = !first.isEmpty() && !first.contains(QLatin1Char(' ')) ? first.toUtf8() : QByteArray();+ void *aux = nullptr;+ const int score = pwquality_check(settings, secret.constData(), old.isEmpty() ? nullptr : old.constData(),+ user.isEmpty() ? nullptr : user.constData(), &aux);+ secret.fill('\0');+ old.fill('\0');+ // For a cracklib failure the extra information is cracklib's reason.+ const QString cracklib = score == PWQ_ERROR_CRACKLIB_CHECK && aux ? QString::fromUtf8(static_cast<const char *>(aux)) : QString();+ // Frees whatever libpwquality attached to the result.+ char buffer[PWQ_MAX_ERROR_MESSAGE_LEN];+ pwquality_strerror(buffer, sizeof buffer, score, aux);+ pwquality_free_settings(settings);++ // Without cracklib's word list there is nothing fair to say.+ if (cracklib.contains(QLatin1String("error loading dictionary"))) {+ return {};+ }+ if (score < 0) {+ return weak(reasonFor(score, cracklib));+ }+ return {{QStringLiteral("level"), score >= 80 ? QStringLiteral("strong") : QStringLiteral("fair")}, {QStringLiteral("reason"), QString()}};+}diff --git a/packages/wildos-welcome/src/passwordcheck.h b/packages/wildos-welcome/src/passwordcheck.hnew file mode 100644index 0000000..6ec1ed7--- /dev/null+++ b/packages/wildos-welcome/src/passwordcheck.h@@ -0,0 +1,26 @@+#pragma once++#include <QObject>+#include <QQmlEngine>+#include <QStringList>+#include <QVariantMap>++// Advice on a password someone is choosing, from libpwquality's checks and+// score. It never decides whether a password can be used: a password is a+// choice, and the dialogs keep only their own rules. The password goes to+// libpwquality inside this process and nowhere else; it is not kept, logged+// or written down.+class PasswordCheck : public QObject+{+ Q_OBJECT+ QML_ELEMENT+ QML_SINGLETON++public:+ using QObject::QObject;++ // { level: "weak", "fair" or "strong", reason: why it is weak, or "" }.+ // `names` are the account's user name and full name; the first is+ // passed to libpwquality as the user name when it is one word.+ Q_INVOKABLE QVariantMap check(const QString &password, const QString &oldPassword, const QStringList &names) const;+};