| 200 | } |
| 201 | |
| 202 | func (this *Firewalld) RemoveSourceIP(ip string) error { |
| 203 | if !this.isReady { |
| 204 | return nil |
| 205 | } |
| 206 | |
| 207 | var family = "ipv4" |
| 208 | if strings.Contains(ip, ":") { |
| 209 | family = "ipv6" |
| 210 | } |
| 211 | for _, action := range []string{"reject", "drop"} { |
| 212 | var args = []string{"--remove-rich-rule=rule family='" + family + "' source address='" + ip + "' " + action} |
| 213 | var cmd = executils.NewTimeoutCmd(10*time.Second, this.exe, args...) |
| 214 | this.pushCmd(cmd, "") |
| 215 | } |
| 216 | return nil |
| 217 | } |
| 218 | |
| 219 | func (this *Firewalld) pushCmd(cmd *executils.Cmd, denyIP string) { |
| 220 | select { |