id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c7400 | if err != nil {
return nil, err
}
return v, nil
case common.OIDC:
p := v.(*oidc.TokenVerifier)
verifier, err := oidc.NewClient(context.Background(), p)
if err != nil {
return nil, err
}
return verifier, nil
}
return nil, fmt.Errorf("uknown verifier type")
} | |
c7401 | mock.recorder = &MockEnforcerMockRecorder{mock}
return mock
} | |
c7402 | "Unenforce", contextID)
ret0, _ := ret[0].(error)
return ret0
} | |
c7403 | ret := m.ctrl.Call(m, "GetFilterQueue")
ret0, _ := ret[0].(*fqconfig.FilterQueue)
return ret0
} | |
c7404 | "GetFilterQueue", reflect.TypeOf((*MockEnforcer)(nil).GetFilterQueue))
} | |
c7405 | _ := ret[0].(error)
return ret0
} | |
c7406 | time.Duration) error {
ret := m.ctrl.Call(m, "EnableIPTablesPacketTracing", ctx, contextID, interval)
ret0, _ := ret[0].(error)
return ret0
} | |
c7407 | p.ipHdr.Buffer[p.ipHdr.ipHeaderLen+UDPDataPos:]
} | |
c7408 |
p.tcpHdr.tcpOptions = []byte{}
p.tcpHdr.tcpData = []byte{}
} | |
c7409 | p.ipHdr.destinationAddress.To4().String(), p.tcpHdr.destinationPort,
tcpFlagsToStr(p.GetTCPFlags()),
p.tcpHdr.tcpSeq, p.tcpHdr.tcpAck, uint16(len(p.ipHdr.Buffer[p.ipHdr.ipHeaderLen:]))-p.TCPDataStartBytes(),
expAck, expAck, p.tcpHdr.tcpDataOffset,
p.tcpHdr.tcpChecksum, ccsum, csumValidationStr)
print = t... | |
c7410 | p.tcpHdr.tcpOptions...)
pktBytes = append(pktBytes, p.tcpHdr.tcpData...)
return pktBytes
} | |
c7411 | p.ipHdr.Buffer[uint16(p.ipHdr.ipHeaderLen)+p.TCPDataStartBytes():]
} | |
c7412 | place. We don't do anything
// for this packet.
if buffer[tcpDataStart-optionLength] != TCPAuthenticationOption {
return errTCPAuthOption
}
return
} | |
c7413 | old
binary.BigEndian.PutUint16(p.ipHdr.Buffer[ipv4LengthPos:ipv4LengthPos+2], p.ipHdr.ipTotalLength)
binary.BigEndian.PutUint16(p.ipHdr.Buffer[ipv4ChecksumPos:ipv4ChecksumPos+2], p.ipHdr.ipChecksum)
} | |
c7414 |
p.tcpHdr.tcpSeq = p.tcpHdr.tcpSeq + incr
binary.BigEndian.PutUint32(buffer[tcpSeqPos:tcpSeqPos+4], p.tcpHdr.tcpSeq)
} | |
c7415 |
p.tcpHdr.tcpSeq = p.tcpHdr.tcpSeq - decr
binary.BigEndian.PutUint32(buffer[tcpSeqPos:tcpSeqPos+4], p.tcpHdr.tcpSeq)
} | |
c7416 |
p.tcpHdr.tcpAck = p.tcpHdr.tcpAck + incr
binary.BigEndian.PutUint32(buffer[tcpAckPos:tcpAckPos+4], p.tcpHdr.tcpAck)
} | |
c7417 |
p.tcpHdr.tcpAck = p.tcpHdr.tcpAck - decr
binary.BigEndian.PutUint32(buffer[tcpAckPos:tcpAckPos+4], p.tcpHdr.tcpAck)
} | |
c7418 | = p.tcpHdr.tcpDataOffset - uint8(optionLength/4)
buffer[tcpDataOffsetPos] = p.tcpHdr.tcpDataOffset << 4
} | |
c7419 | = p.tcpHdr.tcpDataOffset + uint8(numberOfOptions)
binary.BigEndian.PutUint16(buffer[tcpChecksumPos:tcpChecksumPos+2], p.tcpHdr.tcpChecksum)
buffer[tcpDataOffsetPos] = p.tcpHdr.tcpDataOffset << 4
} | |
c7420 | + len(tcpOptions))
// IP Header Processing
p.FixupIPHdrOnDataModify(p.ipHdr.ipTotalLength, p.ipHdr.ipTotalLength+packetLenIncrease)
// TCP Header Processing
p.FixuptcpHdrOnTCPDataAttach(tcpOptions, tcpData)
return
} | |
c7421 | + strconv.Itoa(int(p.SourcePort())) + ":" + strconv.Itoa(int(p.DestPort()))
} | |
c7422 | {
return strconv.Itoa(int(p.ipHdr.ipID))
} | |
c7423 | return p.ipHdr.Buffer[offset:]
} | |
c7424 | nil, fmt.Errorf("unable to initialize iptables provider: %s", err)
}
ips := provider.NewGoIPsetProvider()
return newInstanceWithProviders(fqc, mode, cfg, ipt, ips)
} | |
c7425 |
netPacketIPTableSection: ipTableSectionInput,
appSynAckIPTableSection: ipTableSectionOutput,
contextIDToPortSetMap: cache.NewCache("contextIDToPortSetMap"),
createPUPortSet: ipsetCreatePortset,
isLegacyKernel: buildflags.IsLegacyKernel(),
serviceIDToIPsets: map[string]*ipsetInfo{},... | |
c7426 | // Tri-App/Tri-Net are the main chains for the egress/ingress directions
// UID related chains for any UID PUs.
// Host, Service, Pid chains for the different modes of operation (host mode, pu mode, host service).
// The priority is explicit (Pid activations take precedence of Service activations and Host Services)... | |
c7427 | this point we can install all the ACL rules that will direct
// traffic to user space, allow for external access or direct
// traffic towards the proxies
if err = i.installRules(cfg, pu); err != nil {
return err
}
// We commit the ACLs at the end. Note, that some of the ACLs in the
// NAT table are not commit... | |
c7428 | the ipsets.
// References must be deleted for ipset deletion to succeed.
if err := i.ipt.Commit(); err != nil {
zap.L().Warn("Failed to commit ACL changes", zap.Error(err))
}
// We delete the set that captures all destination ports of the
// PU. This only holds for Linux PUs.
if err := i.deletePortSet(context... | |
c7429 | priority.
if err := i.deleteChainRules(oldCfg); err != nil {
return err
}
// Delete the old chains, since there are not references any more.
if err := i.deletePUChains(oldCfg.AppChain, oldCfg.NetChain); err != nil {
return err
}
// Commit all actions in on iptables-restore function.
if err := i.ipt.Commit... | |
c7430 | err := i.ipset.DestroyAll(chainPrefix); err != nil {
zap.L().Error("Failed to clean up ipsets", zap.Error(err))
}
return nil
} | |
c7431 | nil {
return fmt.Errorf("unable to create trireme chains:%s", err)
}
for _, rule := range rules {
if len(rule) != 4 {
continue
}
if err := i.ipt.NewChain(rule[1], rule[3]); err != nil {
return err
}
}
return nil
} | |
c7432 |
if cfg.TCPPortSet == "" {
return fmt.Errorf("port set was not found for the contextID. This should not happen")
}
return i.addChainRules(cfg)
} | |
c7433 | if err := i.configureLinuxRules(cfg); err != nil {
return err
}
}
isHostPU := extractors.IsHostPU(containerInfo.Runtime, i.mode)
if err := i.addExternalACLs(cfg.ContextID, cfg.AppChain, cfg.NetChain, appACLIPset, true); err != nil {
return err
}
if err := i.addExternalACLs(cfg.ContextID, cfg.NetChain, ... | |
c7434 | else {
contextID = contextID + output[:4]
}
if len(prefix) > 16 {
prefix = prefix[:16]
}
return (prefix + contextID)
} | |
c7435 | make(chan net.Conn),
mark: mark,
}
} | |
c7436 | fmt.Errorf("mux: listener closed")
}
return c, nil
} | |
c7437 | sync.WaitGroup{},
protomap: map[common.ListenerType]*ProtoListener{},
registry: registry,
localIPs: markedconn.GetInterfaces(),
mark: mark,
puID: puID,
}
} | |
c7438 | := &ProtoListener{
Listener: m.root,
connection: make(chan net.Conn),
mark: m.mark,
}
m.protomap[ltype] = p
return p, nil
} | |
c7439 |
defer m.Unlock()
delete(m.protomap, ltype)
return nil
} | |
c7440 | return fmt.Errorf("Default listener already registered")
}
m.defaultListener = p
return nil
} | |
c7441 | return fmt.Errorf("No default listener registered")
}
m.defaultListener = nil
return nil
} | |
c7442 | select {
case <-ctx.Done():
return nil
case <-m.shutdown:
return nil
default:
c, err := m.root.Accept()
if err != nil {
return err
}
m.wg.Add(1)
go m.serve(c)
}
}
} | |
c7443 | compressedTagsVersion = claimsheader.CompressionTypeNone
if console := os.Getenv(constants.EnvCompressedTags); console != string(claimsheader.CompressionTypeNone) {
if console == string(claimsheader.CompressionTypeV1) {
compressedTagsVersion = claimsheader.CompressionTypeV1
} else if console == string(claimshe... | |
c7444 | variable.
tagContent, ok := runtime.Tag(KubernetesContainerNameIdentifier)
if !ok || tagContent != KubernetesInfraContainerName {
return false
}
return true
} | |
c7445 | statsInterval: defaultStatsIntervalMiliseconds * time.Millisecond,
userRetention: defaultUserRetention * time.Minute,
stop: make(chan bool),
}
if sc.statsChannel == "" {
return nil, errors.New("no path to stats socket provided")
}
if sc.secret == "" {
return nil, errors.New("no secret provided f... | |
c7446 |
flows := s.collector.GetAllRecords()
users := s.collector.GetUserRecords()
if flows == nil && users == nil {
continue
}
s.sendRequest(flows, users)
case <-userTicker.C:
s.collector.FlushUserCache()
case <-ctx.Done():
return
}
}
} | |
c7447 | if flows == nil && users == nil {
zap.L().Debug("Flows and UserRecords are nil while sending stats to collector")
return
}
s.sendRequest(flows, users)
} | |
c7448 | client cannot connect", zap.Error(err))
return err
}
go s.sendStats(ctx)
return nil
} | |
c7449 | time.Hour * 8760,
procMountPoint: constants.DefaultProcMountPoint,
externalIPcacheTimeout: -1,
remoteParameters: &env.RemoteParameters{
LogToConsole: true,
LogFormat: "console",
LogLevel: "info",
LogWithID: false,
CompressedTags: claimsheader.CompressionTypeV1,
... | |
c7450 | // Start all the enforcers.
for _, e := range t.enforcers {
if err := e.Run(ctx); err != nil {
return fmt.Errorf("unable to start the enforcer: %s", err)
}
}
go t.runIPTraceCollector(ctx)
return nil
} | |
c7451 |
s.CleanUp() // nolint
}
for _, e := range t.enforcers {
e.CleanUp() // nolint
}
return nil
} | |
c7452 | {
lock, _ := t.locks.LoadOrStore(puID, &sync.Mutex{})
lock.(*sync.Mutex).Lock()
defer lock.(*sync.Mutex).Unlock()
return t.doHandleCreate(puID, policy, runtime)
} | |
c7453 | nil {
zap.L().Error("unable to update secrets", zap.Error(err))
}
}
return nil
} | |
c7454 | zap.L().Error("Failed to update target networks in cotnroller", zap.Error(err))
failure = true
}
}
if failure {
return fmt.Errorf("configuration update failed")
}
return nil
} | |
c7455 | %s", err)
}
if err := t.supervisors[t.puTypeToEnforcerType[containerInfo.Runtime.PUType()]].Supervise(contextID, containerInfo); err != nil {
if werr := t.enforcers[t.puTypeToEnforcerType[containerInfo.Runtime.PUType()]].Unenforce(contextID); werr != nil {
zap.L().Warn("Failed to clean up state after failures"... | |
c7456 | nil,
Event: collector.ContainerDelete,
})
if errS != nil || errE != nil {
return fmt.Errorf("unable to delete context id %s, supervisor %s, enforcer %s", contextID, errS, errE)
}
return nil
} | |
c7457 |
zap.L().Warn("Failed to clean up after enforcerments failures",
zap.String("contextID", contextID),
zap.Error(werr),
)
}
return fmt.Errorf("unable to update policy for pu %s: %s", contextID, err)
}
if err := t.supervisors[t.puTypeToEnforcerType[containerInfo.Runtime.PUType()]].Supervise(contextID,... | |
c7458 | s + "."
} else {
s = s + "R"
}
if flags&0x02 == 0 {
s = s + "."
} else {
s = s + "S"
}
if flags&0x01 == 0 {
s = s + "."
} else {
s = s + "F"
}
return s
} | |
c7459 | != nil {
zap.L().Debug("Failed to set fast open socket option", zap.Error(err))
}
})
},
}
conn, err := d.DialContext(ctx, network, addr)
if err != nil {
zap.L().Error("Failed to dial to downstream node",
zap.Error(err),
zap.String("Address", addr),
zap.String("Network type", network),
)
... | |
c7460 | zap.L().Error("Cannot set tcp fast open options", zap.Error(err))
}
})
},
}
listener, err := listenerCfg.Listen(ctx, "tcp4", port)
if err != nil {
return nil, fmt.Errorf("Failed to create listener: %s", err)
}
return ProxiedListener{netListener: listener, mark: mark}, nil
} | |
c7461 | p.originalIP.String()+":"+strconv.Itoa(p.originalPort))
if err != nil {
return nil
}
return addr
} | |
c7462 | p.originalTCPConnection.SetDeadline(t)
} | |
c7463 | p.originalTCPConnection.SetReadDeadline(t)
} | |
c7464 | p.originalTCPConnection.SetWriteDeadline(t)
} | |
c7465 | ip, _, _ := net.ParseCIDR(addr.String())
if ip.To4() != nil {
ipmap[ip.String()] = struct{}{}
}
}
}
return ipmap
} | |
c7466 | filelist {
if file.IsDir() {
cgroupList = append(cgroupList, file.Name())
}
}
return cgroupList
} | |
c7467 | func(cfg *config) {
cfg.collector = c
}
} | |
c7468 | func(cfg *config) {
cfg.service = s
}
} | |
c7469 | *config) {
cfg.secret = s
}
} | |
c7470 | func(cfg *config) {
cfg.fq = f
}
} | |
c7471 | func(cfg *config) {
cfg.runtimeCfg = c
}
} | |
c7472 | Option {
return func(cfg *config) {
cfg.runtimeErrorChannel = errorChannel
}
} | |
c7473 | func(cfg *config) {
cfg.remoteParameters = p
}
} | |
c7474 | t.puTypeToEnforcerType[common.UIDLoginPU] = constants.LocalServer
t.puTypeToEnforcerType[common.HostPU] = constants.LocalServer
t.puTypeToEnforcerType[common.HostNetworkPU] = constants.LocalServer
t.puTypeToEnforcerType[common.SSHSessionPU] = constants.LocalServer
}
if t.config.mode == constants.RemoteContain... | |
c7475 | {
return "", fmt.Errorf("invalid pu id: %s", eventInfo.Cgroup)
}
puID = baseName(eventInfo.Cgroup, "/")
if eventInfo.PUType == common.SSHSessionPU {
return "ssh-" + puID, nil
}
return puID, nil
} | |
c7476 | shell account
} else {
//Do something
slog, _ := syslog.New(syslog.LOG_ALERT|syslog.LOG_AUTH, "mypam")
defer func() {
_ = slog.Close()
}()
client, err := client.NewClient(common.TriremeSocket)
if err != nil {
return C.PAM_SUCCESS
}
slog.Alert("Calling Trireme") // nolit
if err := client.Send... | |
c7477 | slog.Alert("pam_sm_close_session") // nolint
slog.Close() // nolint
return C.PAM_SUCCESS
} | |
c7478 | ctrl}
mock.recorder = &MockProcessManagerMockRecorder{mock}
return mock
} | |
c7479 | error {
ret := m.ctrl.Call(m, "KillRemoteEnforcer", contextID, force)
ret0, _ := ret[0].(error)
return ret0
} | |
c7480 | return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "KillRemoteEnforcer", reflect.TypeOf((*MockProcessManager)(nil).KillRemoteEnforcer), contextID, force)
} | |
c7481 | refNsPath, arg, statssecret, procMountPoint)
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c7482 | "LaunchRemoteEnforcer", reflect.TypeOf((*MockProcessManager)(nil).LaunchRemoteEnforcer), contextID, refPid, refNsPath, arg, statssecret, procMountPoint)
} | |
c7483 | opt := range opts {
opt(c)
}
return c
} | |
c7484 | of secrets.NewCompactPKIWithTokenCA")
return NewCompactPKIWithTokenCA(keyPEM, certPEM, caPEM, [][]byte{caPEM}, txKey, compress)
} | |
c7485 | p.AuthorityPEM,
Token: p.txKey,
TokenCAs: p.TokenKeyPEMs,
Compressed: p.Compressed,
}
} | |
c7486 | nil, nil, nil, nil, nil, 0, nil, nil, []string{})
} | |
c7487 | defer p.Unlock()
return p.managementID
} | |
c7488 | defer p.Unlock()
return p.triremeAction
} | |
c7489 | defer p.Unlock()
p.triremeAction = action
} | |
c7490 | {
p.Lock()
defer p.Unlock()
return p.applicationACLs.Copy()
} | |
c7491 | defer p.Unlock()
return p.networkACLs.Copy()
} | |
c7492 | defer p.Unlock()
return p.DNSACLs.Copy()
} | |
c7493 | defer p.Unlock()
return p.receiverRules.Copy()
} | |
c7494 |
p.Lock()
defer p.Unlock()
p.receiverRules = append(p.receiverRules, t)
} | |
c7495 | {
p.Lock()
defer p.Unlock()
return p.transmitterRules.Copy()
} | |
c7496 |
p.Lock()
defer p.Unlock()
p.transmitterRules = append(p.transmitterRules, t)
} | |
c7497 | defer p.Unlock()
return p.identity.Copy()
} | |
c7498 | defer p.Unlock()
return p.annotations.Copy()
} | |
c7499 | {
p.Lock()
defer p.Unlock()
p.identity.AppendKeyValue(k, v)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.