Compare commits
No commits in common. "fd0440fc2f8e37408ba675352661c3338c700f02" and "ff331a45ee06f8dffa801b81298816e0ed9b408d" have entirely different histories.
fd0440fc2f
...
ff331a45ee
2 changed files with 14 additions and 24 deletions
|
@ -2,6 +2,8 @@ This repository holds the documentation of the provs framework.
|
||||||
|
|
||||||
# Design principles
|
# Design principles
|
||||||
|
|
||||||
|
For usage examples it is recommended to have a look at [provs-scripts](https://gitlab.com/domaindrivenarchitecture/provs-scripts) or [provs-ubuntu-extensions](https://gitlab.com/domaindrivenarchitecture/provs-ubuntu-extensions).
|
||||||
|
|
||||||
## "Implarative"
|
## "Implarative"
|
||||||
|
|
||||||
Configuration management tools are usually classified as either **imperative** or **declarative**.
|
Configuration management tools are usually classified as either **imperative** or **declarative**.
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
package org.domaindrivenarchitecture.provs.desktop.infrastructure
|
||||||
|
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.Secret
|
|
||||||
import org.domaindrivenarchitecture.provs.framework.core.remote
|
import org.domaindrivenarchitecture.provs.framework.core.remote
|
||||||
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
||||||
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
|
import org.domaindrivenarchitecture.provs.test.tags.ContainerTest
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.KeyPair
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.KeyPair
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.base.configureGpgKeys
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.base.configureGpgKeys
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.base.gpgFingerprint
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.base.gpgFingerprint
|
||||||
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.secret.secretSources.GopassSecretSource
|
||||||
import org.junit.jupiter.api.Assertions.assertTrue
|
import org.junit.jupiter.api.Assertions.assertTrue
|
||||||
import org.junit.jupiter.api.Disabled
|
import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.*
|
import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.*
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.keys.privateGPGSnakeoilKey
|
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.secret.secretSources.PromptSecretSource
|
|
||||||
import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.makeCurrentUserSudoerWithoutPasswordRequired
|
|
||||||
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
|
import org.domaindrivenarchitecture.provs.test.tags.ExtensiveContainerTest
|
||||||
import org.domaindrivenarchitecture.provs.test_keys.publicGPGSnakeoilKey
|
|
||||||
import org.junit.jupiter.api.Assertions.assertFalse
|
import org.junit.jupiter.api.Assertions.assertFalse
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,32 +56,24 @@ internal class GopassKtTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled // This is an integration test, which needs preparation:
|
@Disabled // Integrationtest; change user, host and keys, then remove this line to run this test
|
||||||
// Pls change user, host and remote connection (choose connection either by password or by ssh key)
|
|
||||||
// then remove tag @Disabled to be able to run this test.
|
|
||||||
// PREREQUISITE: remote machine needs openssh-server installed
|
|
||||||
fun test_install_and_configure_Gopass_and_GopassBridgeJsonApi() {
|
fun test_install_and_configure_Gopass_and_GopassBridgeJsonApi() {
|
||||||
// host and user
|
// settings to change
|
||||||
val host = "192.168.56.154"
|
val host = "192.168.56.135"
|
||||||
val user = "xxx"
|
val user = "xxx"
|
||||||
|
val pubKey = GopassSecretSource("path-to/pub.key").secret()
|
||||||
|
val privateKey = GopassSecretSource("path-to/priv.key").secret()
|
||||||
|
|
||||||
// connection by password
|
// given
|
||||||
val pw = PromptSecretSource("Pw for $user").secret()
|
val prov = remote(host, user)
|
||||||
val prov = remote(host, user, pw)
|
|
||||||
prov.makeCurrentUserSudoerWithoutPasswordRequired(pw) // may be commented out if user can already sudo without password
|
|
||||||
|
|
||||||
// or alternatively use connection by ssh key if the public key is already available remotely
|
|
||||||
// val prov = remote(host, user)
|
|
||||||
|
|
||||||
|
|
||||||
val pubKey = Secret(publicGPGSnakeoilKey())
|
|
||||||
val privateKey = Secret(privateGPGSnakeoilKey())
|
|
||||||
|
|
||||||
|
|
||||||
// when
|
// when
|
||||||
val res = prov.task {
|
val res = prov.task {
|
||||||
configureGpgKeys(
|
configureGpgKeys(
|
||||||
KeyPair(pubKey, privateKey),
|
KeyPair(
|
||||||
|
pubKey,
|
||||||
|
privateKey
|
||||||
|
),
|
||||||
trust = true,
|
trust = true,
|
||||||
skipIfExistin = true
|
skipIfExistin = true
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue