[skip-ci] Allow execution of gopass_wrapper.sh

Firefox wasn't allowed to execute the gopass_wrapper.sh in Ubuntu 22.04.
Explicitly adding it to the Apparmor firefox profile solves this.
Lower jsonApiVersion.
This commit is contained in:
erik 2022-08-31 15:03:31 +02:00
parent ed8e86e758
commit ee48355b9f

View file

@ -2,12 +2,14 @@ package org.domaindrivenarchitecture.provs.desktop.infrastructure
import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.core.ProvResult
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.addTextToFile
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDir
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createDirs
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.userHome
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.isPackageInstalled
import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL
import java.io.File
fun Prov.downloadGopassBridge() = task {
@ -69,12 +71,27 @@ fun Prov.installGopassBridgeJsonApi() = task {
}
}
fun Prov.enableGopassWrapperShForFirefox() = task {
val appArmorFile = File("/etc/apparmor.d/usr.bin.firefox")
if (appArmorFile.exists()) {
addTextToFile(
"owner @{HOME}/.config/gopass/gopass_wrapper.sh ux",
appArmorFile,
sudo = true
)
}
cmd("systemctl reload apparmor", sudo = true)
}
fun Prov.configureGopassBridgeJsonApi() = task {
if (isPackageInstalled("gopass-jsonapi")) {
// configure for firefox and choose default for each:
// "Install for all users? [y/N/q]",
// "In which path should gopass_wrapper.sh be installed? [/home/testuser/.config/gopass]"
// "Wrapper Script for gopass_wrapper.sh ..."
enableGopassWrapperShForFirefox()
cmd("printf \"\\n\\n\\n\" | gopass-jsonapi configure --browser firefox")
} else {
ProvResult(