You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
provs/src/main/kotlin/org/domaindrivenarchitecture/provs/framework/extensions/server_software/standalone_server/nginx/base/BasicAuth.kt

13 lines
551 B
Kotlin

package org.domaindrivenarchitecture.provs.framework.extensions.server_software.standalone_server.nginx.base
import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.core.Secret
import org.domaindrivenarchitecture.provs.framework.ubuntu.install.base.aptInstall
fun Prov.nginxAddBasicAuth(user: String, password: Secret) = requireAll {
aptInstall("apache2-utils")
val passwordFile = "/etc/nginx/.htpasswd"
cmdNoLog("sudo htpasswd -b -c $passwordFile $user ${password.plain()}")
}