小编x4k*_*k3p的帖子

Raw Socket Linux发送/接收数据包

在接收数据包时遇到一些问题.我可以接收和读取传入的数据包,但我想我不会与任何主机握手.我只想在收到答案的情况下将数据包发送到具有开放端口的远程计算机,以查看TTL(生存时间)和窗口大小.有谁知道错误在哪里?(我对C编程知之甚少)

码:

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <errno.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>

struct pseudohdr {
    u_int32_t src_addr;
    u_int32_t dst_addr;
    u_int8_t padding;
    u_int8_t proto;
    u_int16_t length;
};

struct data_4_checksum {
    struct pseudohdr pshd;
    struct tcphdr tcphdr;
    char payload[1024];
};
unsigned short comp_chksum(unsigned short *addr, int len) {
    long sum = 0;

    while (len > 1) {
        sum += *(addr++);
        len -= 2;
    }

    if (len > 0)
        sum …
Run Code Online (Sandbox Code Playgroud)

c sockets networking send recv

9
推荐指数
1
解决办法
3万
查看次数

Traefik 错误网关

我有一些奇怪的问题。我有以下设置:一个 docker-host 运行 traefik 作为 LB,为多个站点提供服务。网站大多是 php/apache。HTTPS 由 traefik 管理。每个站点都使用包含以下内容的 docker-compose YAML 启动:

version: '2.3'
services:
  redis:
    image: redis:alpine
    container_name: ${PROJECT}-redis
    networks:
      - internal
  php:
    image: registry.gitlab.com/OUR_NAMESPACE/docker/php:${PHP_IMAGE_TAG}
    environment:
      - APACHE_DOCUMENT_ROOT=${APACHE_DOCUMENT_ROOT}
    container_name: ${PROJECT}-php-fpm
    volumes:
       - ${PROJECT_PATH}:/var/www/html:cached
       - .docker/php/php-ini-overrides.ini:/usr/local/etc/php/conf.d/99-overrides.ini
    ports:
      - 80
    networks:
      - proxy
      - internal
    labels:
      - traefik.enable=true
      - traefik.port=80
      - traefik.frontend.headers.SSLRedirect=false
      - traefik.frontend.rule=Host:${PROJECT}
      - "traefik.docker.network=proxy"

networks:
  proxy:
    external:
      name: proxy
  internal:
Run Code Online (Sandbox Code Playgroud)

(作为 PHP,我们使用 5.6.33-apache-jessie 或 7.1.12-apache fe)

除了上述之外,一些网站还获得以下标签:

traefik.docker.network=proxy
traefik.enable=true
traefik.frontend.headers.SSLRedirect=true
traefik.frontend.rule=Host:example.com, www.example.com
traefik.port=80
traefik.protocol=http
Run Code Online (Sandbox Code Playgroud)

我们得到的是一些请求以 502 Bad Gateway …

load-balancing docker bad-gateway traefik

8
推荐指数
4
解决办法
3万
查看次数

GitLab CI - 项目建立在无休止的待定状态

我和GitLab CI有些麻烦.我按照官方指南:https: //github.com/gitlabhq/gitlab-ci/blob/master/doc/installation.md

一切都很好,没有任何错误.我也跟着Runner-Setup.没事.

但...

当我向项目中添加一个跑步者然后尝试构建没有任何反应时.可能是我还没有完全理解某些东西,或者我的一些配置是错误的.我是GitLab CI的新手,但我喜欢它,我想学习新东西.

如果有人能以某种方式帮助我,我将非常高兴.

谢谢!

在此输入图像描述

在此输入图像描述

在此输入图像描述

大新闻: 刚想通了:

~/gitlab-runners/gitlab-ci-runner$ bin/runner
Run Code Online (Sandbox Code Playgroud)

手动启动转轮过程可以解决问题,但如果我查看/etc/init.d中的gitlab-ci-runner - >它正在运行!?!

~/gitlab-runners/gitlab-ci-runner$ sudo /etc/init.d/gitlab-ci-runner start
Number of registered runners in PID file=1
Number of running runners=0
Error! GitLab CI runner(s) (gitlab-ci-runner) appear to be running already! Try stopping them first. Exiting.
~/gitlab-runners/gitlab-ci-runner$ sudo /etc/init.d/gitlab-ci-runner stop
Number of registered runners in PID file=1
Number of running runners=0
WARNING: Numbers of registered runners don't match number of running runners. Will try to stop them all …
Run Code Online (Sandbox Code Playgroud)

deployment continuous-integration build project gitlab

7
推荐指数
1
解决办法
7189
查看次数

两列不同维度的numpy数组的交集

我给出了两个不同的numpy数组.第一个是二维数组,看起来像(前十点):

[[  0.           0.        ]
 [ 12.54901961  18.03921569]
 [ 13.7254902   17.64705882]
 [ 14.11764706  17.25490196]
 [ 14.90196078  17.25490196]
 [ 14.50980392  17.64705882]
 [ 14.11764706  17.64705882]
 [ 14.50980392  17.25490196]
 [ 17.64705882  18.03921569]
 [ 21.17647059  34.11764706]]
Run Code Online (Sandbox Code Playgroud)

第二个数组只是一维的,看起来像(前十点):

[ 18.03921569  17.64705882  17.25490196  17.25490196  17.64705882
  17.64705882  17.25490196  17.64705882  21.17647059  22.35294118]
Run Code Online (Sandbox Code Playgroud)

第二个(一维)数组中的值可能出现在第一列中的第一个(二维)数组中.Fe 17.64705882

我想从二维数组中获取一个数组,其中第一列的值与第二个(一维)数组中的值匹配.怎么做?

python arrays axis numpy intersection

6
推荐指数
1
解决办法
729
查看次数

使用 cURL 和 Kerberos 在 Keycloak 上进行身份验证

我给出了以下设置:

  • keycloak 服务器位于https://auth.example.com
  • 与 LDAP 提供商配置的 AD 连接
  • LDAP 提供程序配置中设置的 Kerberos 选项
  • 任何 AD 用户的身份验证都有效
  • 在浏览器中使用Kerberos 票证进行身份验证有效

据我所知,将 cURL 与 Kerberos 身份验证结合使用,它看起来与此类似:

$ curl --negotiate -u : https://app.example.com/index.html
Run Code Online (Sandbox Code Playgroud)

人们可以使用资源所有者密码凭证授予类型以非交互方式获取访问令牌。但是如何使用带有 Kerberos 票证和 Keycloak 的 cURL 来获取它?

authentication curl kerberos openid-connect keycloak

6
推荐指数
1
解决办法
2440
查看次数

从 IntelliJ 自动部署到远程 tomcat

我现在必须使用 Tomcat 和 JavaEE。为了部署我的网络应用程序,我通过网络管理 gui 手动完成。

在此处输入图片说明

(标记为红色)

作为我的 IDE,我使用 IntelliJ IDEA。

在此处输入图片说明

我的问题是我没有找到任何关于如何将我的应用程序自动部署到这个 tomcat(远程)服务器的描述。我发现所有使用本地 tomcat 和远程 tomcat 的问题。这如下所示

在此处输入图片说明

(在配置...只能选择本地tomcat(?!))

在此处输入图片说明

这是一个类似的问题,应该使用 maven & cargo 插件。

这是唯一的方法,还是可以在我的机器上不安装任何 tomcat 的情况下部署到远程 tomcat?

deployment tomcat intellij-idea remote-server jakarta-ee

5
推荐指数
0
解决办法
639
查看次数

OpenStack上Kubernetes中节点(小兵)的水平自动缩放

是否可以在OpenStack的CoreOS上运行的Kubernetes中启用节点(小兵)的自动缩放?

我只读过AWS和GCE。

nodes openstack autoscaling coreos kubernetes

5
推荐指数
1
解决办法
1023
查看次数

GitLab设置麻烦捆绑

我慢慢地在这里绝望.我按照GitHub上的官方指南设置了GitLab.

最多"捆绑安装"任何事情都没关系.但如果我在这里尝试:

$ sudo -u git -H bundle install --deployment --without development test postgres aws
Run Code Online (Sandbox Code Playgroud)

它依赖于"从https://rubygems.org/获取源索引"

更改gemfile中的内容会产生更多麻烦......

如果已安装rake,则会触发此错误消息:

$ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
Could not find rake-10.1.0 in any of the sources
Run `bundle install` to install missing gems.
Run Code Online (Sandbox Code Playgroud)

该怎么办?为什么它比需要的更复杂?如果有人可以提供帮助,我会很高兴.

谢谢.

ruby installation gem bundle gitlab

2
推荐指数
1
解决办法
3667
查看次数

在自己的应用程序中使用Keycloak的用户

我们有几个应用程序,我们使用自定义实现的安全性和用户管理 现在我们可能会切换到keycloak,因为它是一个更好的解决方案.

在每个应用程序中,我们在多个地方使用我们的用户模型,例如Product(fe creator_id = 1)aso类似的问题在这里被问到Keycloak和spring boot rest api - 用户特定的数据策略

我的问题是:

如何保留我们的用户模型,但使用keycloak进行身份验证和用户管理,而无需将用户迁移到keycloak?以及如何同步用户注册过程(使用Keycloak)?一个有用的例子非常有帮助.

database authentication oauth-2.0 keycloak

0
推荐指数
1
解决办法
1914
查看次数