isSecureIndex returns false if the provided indexName is part of the list of insecure registries Insecure registries accept HTTP and/or accept HTTPS with certificates from unknown CAs. The list of insecure registries can contain an element with CIDR notation to specify a whole subnet. If the subnet
(indexName string)
| 170 | // in a subnet. If the resolving is not successful, isSecureIndex will only try to match hostname to any element |
| 171 | // of insecureRegistries. |
| 172 | func (config *serviceConfig) isSecureIndex(indexName string) bool { |
| 173 | // Check for configured index, first. This is needed in case isSecureIndex |
| 174 | // is called from anything besides newIndexInfo, in order to honor per-index configurations. |
| 175 | if index, ok := config.indexConfigs[indexName]; ok { |
| 176 | return index.Secure |
| 177 | } |
| 178 | |
| 179 | return !isCIDRMatch(config.insecureRegistryCIDRs, indexName) |
| 180 | } |
| 181 | |
| 182 | // for mocking in unit tests. |
| 183 | var lookupIP = net.LookupIP |
no test coverage detected