-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Endless loop #66
Comments
It is caused by looping over all container ports and adding rules for each port in the string every time. If I map 50 ports, it do rules for fifty ports, it tries to to add 50x50 rules adding the same rules again and again. |
+ containerPort := port.Port()
// List is non empty if port is published
if len(portMaps) > 0 {
ufwRules := []UfwRule{}
if container.Config.Labels["UFW_ALLOW_FROM"] != "" {
ufwAllowFromLabelParsed := strings.Split(container.Config.Labels["UFW_ALLOW_FROM"], ";")
@@ -64,10 +65,14 @@ func CreateUfwRule(ch <-chan *types.ContainerJSON, c *cache.Cache) {
}
}
// Example: 172.10.5.0-LAN or 172.10.5.0-80
if len(ip) == 2 {
+ labelPort := ip[1]
+ if (labelPort != containerPort) {
+ continue
+ } |
But better way would be to rework it to process the |
True. The software definitely could benefit from some improvement. |
@shinebayar-g Do you accept pull requests? I had to fix it for myself, as my 50 ports cause 2500 ufw rules being applied and totally spams my syslog. |
Yeah for sure |
I have 50 rules and once it processes the last it loops back again:
What is the issue?
The text was updated successfully, but these errors were encountered: