[skip ci] move provisionFirewall

This commit is contained in:
az 2022-09-09 15:59:28 +02:00
parent 7355f9f51d
commit 552c6e9445
3 changed files with 5 additions and 3 deletions

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.framework.extensions.server_software.standalone_server.firewall.base package org.domaindrivenarchitecture.provs.framework.ubuntu.firewall
import org.domaindrivenarchitecture.provs.framework.core.Prov import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.core.ProvResult import org.domaindrivenarchitecture.provs.framework.core.ProvResult
@ -6,6 +6,7 @@ import java.time.LocalDateTime
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
@Suppress("unused")
fun Prov.saveIpTablesToFile() = task { fun Prov.saveIpTablesToFile() = task {
val dateTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("-yyyy-MM-dd--HH:mm:ss")) val dateTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("-yyyy-MM-dd--HH:mm:ss"))
val file = "savedrules$dateTime.txt" val file = "savedrules$dateTime.txt"
@ -14,6 +15,7 @@ fun Prov.saveIpTablesToFile() = task {
cat $file""") cat $file""")
} }
@Suppress("unused")
fun Prov.restoreIpTablesFromFile(file: String? = null) = task { fun Prov.restoreIpTablesFromFile(file: String? = null) = task {
val fileName = file ?: cmd("ls -r a* | head -1\n").out val fileName = file ?: cmd("ls -r a* | head -1\n").out
fileName?.let { cmd("sudo iptables-restore < $file") } fileName?.let { cmd("sudo iptables-restore < $file") }

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.framework.extensions.server_software.standalone_server.firewall package org.domaindrivenarchitecture.provs.framework.ubuntu.firewall
import org.domaindrivenarchitecture.provs.framework.core.Prov import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.core.ProvResult import org.domaindrivenarchitecture.provs.framework.core.ProvResult

View file

@ -1,4 +1,4 @@
package org.domaindrivenarchitecture.provs.framework.extensions.server_software.standalone_server.firewall package org.domaindrivenarchitecture.provs.framework.ubuntu.firewall
import org.domaindrivenarchitecture.provs.framework.core.Prov import org.domaindrivenarchitecture.provs.framework.core.Prov
import org.domaindrivenarchitecture.provs.framework.core.docker.dockerProvideImage import org.domaindrivenarchitecture.provs.framework.core.docker.dockerProvideImage