id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c6800 | "NewRPCClient", reflect.TypeOf((*MockRPCClient)(nil).NewRPCClient), contextID, channel, rpcSecret)
} | |
c6801 | := m.ctrl.Call(m, "GetRPCClient", contextID)
ret0, _ := ret[0].(*rpcwrapper.RPCHdl)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c6802 | *rpcwrapper.Response) error {
ret := m.ctrl.Call(m, "RemoteCall", contextID, methodName, req, resp)
ret0, _ := ret[0].(error)
return ret0
} | |
c6803 | "RemoteCall", reflect.TypeOf((*MockRPCClient)(nil).RemoteCall), contextID, methodName, req, resp)
} | |
c6804 | "DestroyRPCClient", contextID)
} | |
c6805 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DestroyRPCClient", reflect.TypeOf((*MockRPCClient)(nil).DestroyRPCClient), contextID)
} | |
c6806 | ret0, _ := ret[0].([]string)
return ret0
} | |
c6807 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckValidity", reflect.TypeOf((*MockRPCClient)(nil).CheckValidity), req, secret)
} | |
c6808 | protocol, path, handler)
ret0, _ := ret[0].(error)
return ret0
} | |
c6809 | "StartServer", reflect.TypeOf((*MockRPCServer)(nil).StartServer), ctx, protocol, path, handler)
} | |
c6810 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessMessage", reflect.TypeOf((*MockRPCServer)(nil).ProcessMessage), req, secret)
} | |
c6811 | bool {
ret := m.ctrl.Call(m, "CheckValidity", req, secret)
ret0, _ := ret[0].(bool)
return ret0
} | |
c6812 | nil
}
return []reconcile.Request{
{
NamespacedName: types.NamespacedName{
Name: pod.Name,
Namespace: pod.Namespace,
},
},
}
} | |
c6813 | {
return &tokenManager{
privateKey: privateKey,
signMethod: jwt.SigningMethodES256,
}
} | |
c6814 |
signMethod: jwt.SigningMethodES256,
keycache: cache.NewCacheWithExpiration("PKIVerifierKey", validity),
validity: validity,
}
} | |
c6815 | continue
}
dp := &DatapathKey{
PublicKey: KeyFromClaims(claims),
Tags: claims.Tags,
}
if time.Now().Add(p.validity).Unix() <= claims.ExpiresAt {
p.keycache.AddOrUpdate(tokenString, dp)
}
return dp, nil
}
return nil, errors.New("unable to verify token against any available public key")
} | |
c6816 |
// Create the token and sign with our key
strtoken, err := jwt.NewWithClaims(p.signMethod, claims).SignedString(p.privateKey)
if err != nil {
return []byte{}, err
}
return []byte(strtoken), nil
} | |
c6817 | Curve: elliptic.P256(),
X: claims.X,
Y: claims.Y,
}
} | |
c6818 | c,
tokenaccessor: tp,
puContext: puContext,
registry: registry,
localIPs: localIPs,
certificate: certificate,
ca: caPool,
}
} | |
c6819 | done transparently for TCP.
go p.serve(ctx, listener)
return nil
} | |
c6820 | defer p.Unlock()
p.certificate = cert
p.ca = caPool
} | |
c6821 |
}
p.reportRejectedFlow(flowproperties, puContext.ManagementID(), "default", puContext, collector.UnableToDial, nil, nil)
return
}
defer downConn.Close() // nolint
// Now let us handle the state machine for the down connection
isEncrypted, err := p.CompleteEndPointAuthorization(ip, port, upConn, downConn)
... | |
c6822 | return markedconn.DialMarkedWithContext(ctx, "tcp4", raddr.String(), proxyMarkInt)
} | |
c6823 | far if it is a non managed container anyways.
if !managedContainer {
zap.L().Debug("unmanaged Kubernetes container", zap.String("puID", puid), zap.String("podNamespace", podNamespace), zap.String("podName", podName))
continue
}
// We keep the cache uptoDate for future queries
m.cache.updatePUIDCache(pod... | |
c6824 | return "", "", fmt.Errorf("Error getting Kubernetes Pod namespace")
}
podName, ok := runtime.Tag(KubernetesPodNameIdentifier)
if !ok {
return "", "", fmt.Errorf("Error getting Kubernetes Pod name")
}
return podNamespace, podName, nil
} | |
c6825 | {
continue
}
if isPodInfraContainer(rtm) && rtm.PUType() == common.LinuxProcessPU {
pausePUID = id
break
}
// if the pause container is not host net container, nothing to do.
if isPodInfraContainer(rtm) {
return nil
}
}
extensions[constants.DockerHostPUID] = pausePUID
options := puRuntime... | |
c6826 |
mock.recorder = &MockStatsClientMockRecorder{mock}
return mock
} | |
c6827 | "SendStats", reflect.TypeOf((*MockStatsClient)(nil).SendStats))
} | |
c6828 |
// Process the synack header and claims of the other side.
action, claims, err = d.processNetworkUDPSynAckPacket(udpPacket, context, conn)
if err != nil {
zap.L().Error("UDP Syn ack failed with", zap.Error(err))
return nil, nil, err
}
// Send back the acknowledgement.
err = d.sendUDPAckPacket(udpPa... | |
c6829 |
switch conn.GetState() {
case connection.UDPStart:
// Queue the packet. We will send it after we authorize the session.
if err = conn.QueuePackets(p); err != nil {
// unable to queue packets, perhaps queue is full. if start
// machine is still in start state, we can start authorisation
// again. A drop ... | |
c6830 | transmit syn packet")
}
// Populate the caches to track the connection
hash := udpPacket.L4FlowHash()
d.udpAppOrigConnectionTracker.AddOrUpdate(hash, conn)
d.udpSourcePortConnectionCache.AddOrUpdate(newPacket.SourcePortHash(packet.PacketTypeApplication), conn)
d.udpNatConnectionTracker.AddOrUpdate(newPacket.Sou... | |
c6831 | beginning.
if conn.GetState() == connection.UDPReceiverSendSynAck {
conn.SynAckStop()
}
// Only start the retransmission timer once. Not on every packet.
if err := d.writeWithRetransmit(udpPacket.GetBuffer(0), conn, conn.SynAckChannel()); err != nil {
zap.L().Debug("Unable to send synack token on raw socket",... | |
c6832 |
report, pkt := context.SearchRcvRules(claims.T)
if pkt.Action.Rejected() {
d.reportUDPRejectedFlow(udpPacket, conn, txLabel, context.ManagementID(), context, collector.PolicyDrop, report, pkt, false)
return nil, nil, fmt.Errorf("connection rejected because of policy: %s", claims.T.String())
}
hash := udpPacke... | |
c6833 | // no need for retransmits here.
err = d.udpSocketWriter.WriteSocket(udpPacket.GetBuffer(0))
if err != nil {
zap.L().Debug("Unable to send fin packet on raw socket", zap.Error(err))
return err
}
return nil
} | |
c6834 | }
if err := d.udpSourcePortConnectionCache.Remove(udpPacket.SourcePortHash(packet.PacketTypeNetwork)); err != nil {
zap.L().Debug("Failed to clean cache udpsourcePortConnectionCache", zap.Error(err))
}
zap.L().Debug("Updating the connmark label", zap.String("flow", udpPacket.L4FlowHash()))
if err = d.conntrack... | |
c6835 | != nil {
return nil, err
}
}
if debugClient == nil {
debugClient, err = debugclient.NewDebugClient(collector)
if err != nil {
return nil, err
}
}
procMountPoint := os.Getenv(constants.EnvMountPoint)
if procMountPoint == "" {
procMountPoint = constants.DefaultProcMountPoint
}
return &RemoteEnfo... | |
c6836 |
}
puInfo := &policy.PUInfo{
ContextID: payload.ContextID,
Policy: plc,
Runtime: policy.NewPURuntimeWithDefaults(),
}
if s.enforcer == nil || s.supervisor == nil {
resp.Status = "enforcer not initialized - cannot enforce"
return fmt.Errorf(resp.Status)
}
// If any error happens, cleanup everythi... | |
c6837 |
return fmt.Errorf(resp.Status)
}
var err error
// If any error happens, cleanup everything on exit so that we can recover
// by launcing a new remote.
defer func() {
if err != nil {
s.cleanup()
}
}()
if err = s.supervisor.Unsupervise(payload.ContextID); err != nil {
resp.Status = err.Error()
ret... | |
c6838 | by launcing a new remote.
defer func() {
if err != nil {
s.cleanup()
}
}()
if err = s.enforcer.SetTargetNetworks(payload.Configuration); err != nil {
return err
}
err = s.supervisor.SetTargetNetworks(payload.Configuration)
return err
} | |
c6839 |
s.cleanup()
s.exit <- true
return nil
} | |
c6840 | func() {
if err != nil {
s.cleanup()
}
}()
payload := req.Payload.(rpcwrapper.UpdateSecretsPayload)
s.secrets, err = secrets.NewSecrets(payload.Secrets)
if err != nil {
return err
}
err = s.enforcer.UpdateSecrets(s.secrets)
return err
} | |
c6841 | := s.supervisor.EnableIPTablesPacketTracing(context.Background(), payload.ContextID, payload.Interval); err != nil {
resp.Status = err.Error()
return err
}
resp.Status = ""
return nil
} | |
c6842 |
constants.RemoteContainer,
s.procMountPoint,
payload.ExternalIPCacheTimeout,
payload.PacketLogs,
payload.Configuration,
); err != nil || s.enforcer == nil {
return fmt.Errorf("Error while initializing remote enforcer, %s", err)
}
return nil
} | |
c6843 | clean enforcer state", zap.Error(err))
}
}
if s.service != nil {
if err := s.service.Stop(); err != nil {
zap.L().Error("unable to clean service state", zap.Error(err))
}
}
s.cancel()
} | |
c6844 | flag := unix.SIGHUP
if err := unix.Prctl(unix.PR_SET_PDEATHSIG, uintptr(flag), 0, 0, 0); err != nil {
return err
}
rpcHandle := rpcwrapper.NewRPCServer()
re, err := newRemoteEnforcer(ctx, cancelMainCtx, service, rpcHandle, secret, nil, nil, nil)
if err != nil {
return err
}
go func() {
if err := rpcHand... | |
c6845 |
if val == nil {
return ""
}
return C.GoString(val)
} | |
c6846 |
a.methodRoots[method] = &node{}
}
for _, uri := range rule.URIs {
insert(a.methodRoots[method], uri, sc)
}
}
}
return a
} | |
c6847 | := rule.(*scopeRule); ok {
return found, policyRule.rule
}
return false, nil
} | |
c6848 | return false, false
}
if policyRule.rule.Public {
return true, true
}
return c.MatchClaims(policyRule.rule.ClaimMatchingRules, attributes), false
} | |
c6849 | matched = len(clause)
for _, claim := range clause {
if _, ok := claimsMap[claim]; ok {
matched--
}
if matched == 0 {
return true
}
}
}
return false
} | |
c6850 |
return false, nil
}
return search(root, uri)
} | |
c6851 | }
for i := 1; i < len(s); i++ {
if s[i] == '/' {
return s[0:i], s[i:]
}
}
return s, ""
} | |
c6852 | there is no child, add the new child.
next, ok := n.children[prefix]
if !ok {
next = &node{}
n.children[prefix] = next
}
insert(next, suffix, data)
} | |
c6853 | ok := extensions.Get(constants.DockerHostPUID); ok {
zap.L().Debug("puid of pause container is", zap.String("puid", puid))
return puid
}
return ""
} | |
c6854 | runtime.Options().PolicyExtensions.(policy.ExtendedMap); ok {
return extensions
}
return nil
} | |
c6855 | runtime.PUType() == common.LinuxProcessPU || (getPausePUID(policyExtensions(runtime)) != "")
} | |
c6856 | ok := labels[constants.K8sPodNamespace]; ok {
return true
}
return false
} | |
c6857 | !ok {
podNamespace = ""
}
podName, ok = labels[constants.K8sPodName]
if !ok {
podName = ""
}
if podName == "" || podNamespace == "" {
zap.L().Warn("K8s pod does not have podname/podnamespace labels")
return ""
}
return podNamespace + "/" + podName
} | |
c6858 | map[string]map[string][]*ForwardingPolicy{},
notStarTable: map[string][]*ForwardingPolicy{},
defaultNotExistsPolicy: nil,
}
return m
} | |
c6859 | return fmt.Errorf("Invalid tag: missing value '%s'", tag)
}
*k = tag[:i]
*v = tag[i+1:]
return nil
}
}
return fmt.Errorf("Invalid tag: missing equal symbol '%s'", tag)
} | |
c6860 | if i <= len(v) {
if index, action := searchInMapTable(m.equalMapTable[k][v[:i]], count, skip); index >= 0 {
return index, action
}
}
}
// Parse all of the policies that have a key that matches the incoming tag key
// and a not equal operator and that has a not match rule
for value, policies ... | |
c6861 | zap.String("key", key),
)
}
}
zap.L().Debug("Print Policy DB - not equal table")
for key, values := range m.notEqualMapTable {
for value, policies := range values {
zap.L().Debug("Print Policy DB",
zap.String("policies", fmt.Sprintf("%#v", policies)),
zap.String("key", key),
zap.String("v... | |
c6862 |
return cfg.UDPPorts != "0"
},
"isTCPPorts": func() bool {
return cfg.TCPPorts != "0"
},
"isHostPU": func() bool {
return cfg.AppSection == HostModeOutput && cfg.NetSection == HostModeInput
},
}).Parse(cgroupCaptureTemplate))
rules, err := extractRulesFromTemplate(tmpl, cfg)
if err != nil {
zap... | |
c6863 |
rules, err := extractRulesFromTemplate(tmpl, cfg)
if err != nil {
zap.L().Warn("unable to extract rules", zap.Error(err))
}
return append(rules, i.proxyRules(cfg)...)
} | |
c6864 | err := extractRulesFromTemplate(tmpl, cfg)
if err != nil {
zap.L().Warn("unable to extract rules", zap.Error(err))
}
return rules
} | |
c6865 | return cfg.UID != ""
},
}).Parse(packetCaptureTemplate))
rules, err := extractRulesFromTemplate(tmpl, cfg)
if err != nil {
zap.L().Warn("unable to extract rules", zap.Error(err))
}
return rules
} | |
c6866 | %s of context %s: %s", appChain, i.appPacketIPTableContext, err)
}
if err := i.ipt.NewChain(i.netPacketIPTableContext, netChain); err != nil {
return fmt.Errorf("unable to add netchain %s of context %s: %s", netChain, i.netPacketIPTableContext, err)
}
return nil
} | |
c6867 | "Delete":
if err = i.ipt.Delete(cr[0], cr[1], cr[2:]...); err == nil {
break L
}
default:
return errors.New("invalid method type")
}
}
if err != nil && methodType != "Delete" {
return fmt.Errorf("unable to %s rule for table %s and chain %s with error %s", methodType, cr[0], cr[1], err)
... | |
c6868 | return i.processRulesFromList(i.trapRules(cfg, isHostPU), "Append")
} | |
c6869 | err)
}
rulesspec = append(rulesspec, args...)
if err := i.ipt.Append(i.appPacketIPTableContext, chain, rulesspec...); err != nil {
return fmt.Errorf("unable to program extension rules: %v", err)
}
}
return nil
} | |
c6870 | rulesBucket.ReverseRules = append(rulesBucket.ReverseRules, r...)
if testReject(rule.policy) && testObserveApply(rule.policy) {
rulesBucket.RejectObserveApply = append(rulesBucket.RejectObserveApply, acls...)
}
if testReject(rule.policy) && testNotObserved(rule.policy) {
rulesBucket.RejectNotObser... | |
c6871 | "joinRule": func(rule []string) string {
return strings.Join(rule, " ")
},
}).Parse(acls))
aclRules, err := extractRulesFromTemplate(tmpl, *rulesBucket)
if err != nil {
return fmt.Errorf("unable to extract rules from template: %s", err)
}
if err := i.processRulesFromList(aclRules, "Append"); err != nil {... | |
c6872 | {
return i.processRulesFromList(i.uidChainRules(cfg), "Delete")
}
return i.processRulesFromList(i.cgroupChainRules(cfg), "Delete")
} | |
c6873 | to clear the container net packets chain",
zap.String("netChain", netChain),
zap.String("context", i.netPacketIPTableContext),
zap.Error(err),
)
}
if err := i.ipt.DeleteChain(i.netPacketIPTableContext, netChain); err != nil {
zap.L().Warn("Failed to delete the container net packets chain",
zap.Strin... | |
c6874 | "addrtype", "--dst-type", "LOCAL",
"-m", "set", "!", "--match-set", excludedNetworkSet, "src",
"-j", natProxyInputChain)
if err != nil {
return fmt.Errorf("unable to add default allow for marked packets at net: %s", err)
}
err = i.ipt.Insert(i.appProxyIPTableContext,
ipTableSectionOutput, 1,
"-m", "set",... | |
c6875 |
zap.Error(err),
)
}
if err := i.ipt.DeleteChain(context, rule); err != nil {
zap.L().Warn("Can not delete the chain",
zap.String("context", context),
zap.String("section", rule),
zap.Error(err),
)
}
}
}
} | |
c6876 |
mock.recorder = &MockRuntimeReaderMockRecorder{mock}
return mock
} | |
c6877 | ret0, _ := ret[0].(int)
return ret0
} | |
c6878 | m.ctrl.Call(m, "Tag", arg0)
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(bool)
return ret0, ret1
} | |
c6879 |
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tag", reflect.TypeOf((*MockRuntimeReader)(nil).Tag), arg0)
} | |
c6880 | ret := m.ctrl.Call(m, "Tags")
ret0, _ := ret[0].(*policy.TagStore)
return ret0
} | |
c6881 |
ret := m.ctrl.Call(m, "Options")
ret0, _ := ret[0].(policy.OptionsType)
return ret0
} | |
c6882 |
ret := m.ctrl.Call(m, "IPAddresses")
ret0, _ := ret[0].(policy.ExtendedMap)
return ret0
} | |
c6883 | ret0, _ := ret[0].(common.PUType)
return ret0
} | |
c6884 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PUType", reflect.TypeOf((*MockRuntimeReader)(nil).PUType))
} | |
c6885 | []common.Service) {
m.ctrl.Call(m, "SetServices", services)
} | |
c6886 | "SetServices", reflect.TypeOf((*MockRuntimeReader)(nil).SetServices), services)
} | |
c6887 | ret[0].(map[nat.Port][]string)
return ret0
} | |
c6888 | mock.recorder = &MockResolverMockRecorder{mock}
return mock
} | |
c6889 | policy.RuntimeReader) error {
ret := m.ctrl.Call(m, "HandlePUEvent", ctx, puID, event, runtime)
ret0, _ := ret[0].(error)
return ret0
} | |
c6890 | reflect.TypeOf((*MockResolver)(nil).HandlePUEvent), ctx, puID, event, runtime)
} | |
c6891 | return collector.DatapathVersionMismatch
default:
return collector.InvalidToken
}
} | |
c6892 |
if !ok {
return collector.InvalidToken
}
return errToken.Code()
} | |
c6893 | a.Unlock()
go func() {
<-ctx.Done()
a.Lock()
a.srcNflogHandle.NFlogClose()
a.dstNflogHandle.NFlogClose()
a.Unlock()
}()
} | |
c6894 | &collector.EndPoint{
Type: collector.EnpointTypePU,
ID: p.ManagementID(),
IP: sourceIP,
Port: uint16(sourcePort),
HTTPMethod: r.Method,
URI: r.Method + " " + r.RequestURI,
},
Action: policy.Reject,
L4Protocol: packet.IPProtocolTCP,
ServiceTyp... | |
c6895 | Type: collector.EnpointTypePU,
IP: dest.IP.String(),
Port: uint16(dest.Port),
},
Source: &collector.EndPoint{
Type: collector.EndPointTypeExternalIP,
IP: source.IP.String(),
ID: collector.DefaultEndPoint,
Port: uint16(source.Port),
},
Action: policy.Rej... | |
c6896 | return nil, fmt.Errorf("invalid tag: %s", tag)
}
runtimeTags.AppendKeyValue("@usr:"+parts[0], parts[1])
}
runtimeIps := policy.ExtendedMap{"bridge": "0.0.0.0/0"}
return policy.NewPURuntime(event.Name, 1, "", runtimeTags, runtimeIps, common.LinuxProcessPU, nil), nil
} | |
c6897 | return fmt.Errorf("unable to initialize cleaning iptables controller: %s", err)
}
return ipt.CleanUp()
} | |
c6898 | !f.Accepted() && f.Rejected() {
return actionReject
}
return actionPassthrough
} | |
c6899 | f.ServiceID + f.EncodedActionString()
return prefix
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.