标签: https

Spring Boot 2.0.4 中从 http 重定向到 https

我用Spring boot 2.0.4。我想为所有 url 模式配置从 http 到 https 的自动重定向。我在 application.yml 中添加以下几行:

server:
  ssl:
    enabled: true
    key-alias: tomcat
    key-store: "classpath:tomcat.keystore"
    key-store-type: jks
    key-store-password: 123456
    key-password: 123456
Run Code Online (Sandbox Code Playgroud)

我创建了 bean:

    @Bean
    public TomcatServletWebServerFactory httpsRedirectConfig() {
        return new TomcatServletWebServerFactory () {
            @Override
            protected void postProcessContext(Context context) {
                SecurityConstraint securityConstraint = new SecurityConstraint();
                securityConstraint.setUserConstraint("CONFIDENTIAL");
                SecurityCollection collection = new SecurityCollection();
                collection.addPattern("/*");
                securityConstraint.addCollection(collection);
                context.addConstraint(securityConstraint);
            }
        };
    }
Run Code Online (Sandbox Code Playgroud)

但是,当我运行我的应用程序时,出现错误:

Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to multiple ServletWebServerFactory beans : tomcatServletWebServerFactory,httpsRedirectConfig
Run Code Online (Sandbox Code Playgroud)

怎么了?我该如何修复它?谢谢。

java https spring spring-boot

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

使用 HTTPS 的 Elastic Beanstalk 应用程序上的 502 错误网关

我正在尝试使用 HTTPS 部署 Elastic Beanstalk 应用程序,但我不断从 HTTPS 端点收到 502 错误。我可以很好地访问 HTTP 端点,并且该网站似乎按预期工作。我只在 HTTPS 上看到此错误。我不太确定在哪里查找错误,但我没有在 EC2 实例的任何日志中看到任何看似相关的内容。这可能是我的 SSL 证书有问题吗?我目前正在使用自签名证书进行测试。以下是我用来创建资源的 CloudFormation 模板的相关部分:

Resources:

  # VPC and Subnets
  Vpc:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: 10.0.0.0/16
      EnableDnsSupport: true
      EnableDnsHostnames: true
      InstanceTenancy: default
      Tags:
      - Key: Name
        Value: !Sub "ClimbAssistVpc${ResourceNameSuffix}"
  InternetGateway:
    Type: AWS::EC2::InternetGateway
  VpcGatewayAttachment:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      InternetGatewayId: !Ref InternetGateway
      VpcId: !Ref Vpc
  SubnetA:
    Type: AWS::EC2::Subnet
    Properties:
      AvailabilityZone: us-west-2a
      CidrBlock: 10.0.0.0/17
      MapPublicIpOnLaunch: true
      VpcId: !Ref Vpc
  SubnetB:
    Type: AWS::EC2::Subnet
    Properties:
      AvailabilityZone: us-west-2b
      CidrBlock: 10.0.128.0/18
      MapPublicIpOnLaunch: true …
Run Code Online (Sandbox Code Playgroud)

ssl https amazon-ec2 amazon-web-services amazon-elastic-beanstalk

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

向显式给定的 IP 发出请求,但使用显式给定的主机名进行 SSL 验证?

有没有办法同时告诉GuzzleHttp\\Client:

\n\n
    \n
  • 将请求发送到明确指定的 IP,并且
  • \n
  • 为了进行 SSL 验证而“假装”请求是针对特定主机名发出的?
  • \n
\n\n

由于超出此问题范围的原因,我不能简单地将“ https://some.host.name/uri ”作为请求 URL 传递。我必须通过https://<some-numeric-IP>/uri ”并设置Host标头。但是,当我这样做时,Guzzle 会出于HostSSL 主机和对等验证的目的而忽略标头,并尝试使用数字 IP 地址,这失败了。

\n\n

如何获取WhatIWant\xe2\x84\xa2?

\n

php https guzzle

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

grpc - 如果启用 https,是否需要 TLS?

我是 grpc 的新手,玩过 java、go 和 python 的简单 grpc 客户端。我了解基本的 http 和 https,但不熟悉协议细节。所以这个问题对你来说可能很荒谬,但我在网上没有找到任何解释。

我知道 grpc 有不安全(go:grpc.WithInsecure(),python:grpc.insecure_channel,java:)usePlaintext()和安全模式(TLS)。而grpc是基于httpv2的,http有安全模式(https)。

那么如果使用不安全的 grpc 和 https 会怎么样呢?整体数据传输安全吗?

如果将 TLS grpc 与 https 结合使用会怎样?是否有性能开销(因为我认为消息被加密了两次)?

感谢您的任何回答,任何解释此类主题的现有网页将是最好的!

ssl https http grpc tls1.2

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

Android - 找不到处理 HTTPS CustomTabsIntent 的活动

我有一个正在生产的应用程序,一些用户收到关于 VIEW https 意图的奇怪 ActivityNotFoundException。我无法在我的物理设备或模拟器上本地重现它。我还假设每个 Android 都有一个默认打开 URL 的浏览器,我错了吗?(遇到该错误的设备都没有被root)。问题可能是因为手机没有 chrome 吗?

我使用 CustomTabsIntent 打开 URL:

public static void openUrl(final Uri url, final Activity activity) {
        CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
        builder.setToolbarColor(ContextCompat.getColor(activity, R.color.denis_red));
        builder.setCloseButtonIcon(
                BitmapFactory.decodeResource(activity.getResources(),
                        R.drawable.ic_arrow_back_white_24dp));
        builder.setStartAnimations(activity, R.anim.activity_slide_in_right,
                R.anim.activity_slide_out_left);
        builder.setExitAnimations(activity, R.anim.activity_slide_in_left,
                R.anim.activity_slide_out_right);
        builder.build().launchUrl(activity, url);
    }
Run Code Online (Sandbox Code Playgroud)

如果有帮助的话,我会添加一些堆栈跟踪。谢谢!

1:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://redirect.denis.de/... (has extras) }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2031)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1686)
    at android.app.Activity.startActivityForResult(Activity.java:4506)
    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:767)
    at android.app.Activity.startActivity(Activity.java:4825)
    at android.support.v4.content.ContextCompat.startActivity(ContextCompat.java:248)
    at android.support.customtabs.CustomTabsIntent.launchUrl(CustomTabsIntent.java:263)
    at de.boxine.denisapp.util.web.ChromeTabUtil.openUrl(ChromeTabUtil.java:26)
    at de.boxine.denisapp.denis.list.DenisListActivity.onOptionsItemSelected(DenisListActivity.java:82)
    at android.app.Activity.onMenuItemSelected(Activity.java:3469)
    at …
Run Code Online (Sandbox Code Playgroud)

https android android-intent activitynotfoundexception chrome-custom-tabs

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

更改 Jupyter 笔记本使用的 TLS 版本密码

从几天前开始,我的 MacOs/Safari 客户端已无法通过 HTTPS 访问我的 Jupyter Notebook(放置在另一台服务器中)。

我正在调查的可能性之一是 Apple 可能已停止接受 TLS1.0 密码算法https://www.macrumors.com/2018/10/15/apple-ending-tls-1-1-1-0-support -2020年3月/

当我从 MacOs/Firefox 连接到同一个 Jupyter 服务器时,一切正常,但 Firefox 抱怨我使用不安全的加密算法:TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA TLS1.0

我已经确认“openssl ciphers -v”我的服务器盒子接受许多高达 TLS v1.2 的算法

如何指示 Jupyter Notebook 服务器使用更高版本的协议?

我可以在 Jupiter_notebook_config.py 中看到一个可能有帮助的部分:

## Supply SSL options for the tornado HTTPServer. See the tornado docs for
#  details.
#c.NotebookApp.ssl_options = {}
Run Code Online (Sandbox Code Playgroud)

我应该把什么作为 ssl_options 放在这里???

ssl https jupyter jupyter-notebook

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

使用 http4s 从 http 更改为 https

有没有办法使用 http4s 库将 http 服务器更改为 https?(https://http4s.org/)

https http http4s

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

基于 TLS 的 WebSocket:Golang / Gorilla

我一直在尝试通过 TLS 设置 WebSocket 连接(因此使用加密)。我将 Golang 与 Gorilla 一起使用。WebSocket 连接被实现为初始 HTTP 连接,并升级为 WebSocket 协议连接。代码是这样的:

func wsEndpoint(w http.ResponseWriter, r *http.Request) {
    // upgrade
    ws, err := upgrader.Upgrade(w, r, nil)
    if err != nil {
        //...
    }

    log.Println("Client Connected")
    err = ws.WriteMessage(1, []byte("Hi Client!"))
    if err != nil {
        //...
    }
    // listen indefinitely for new messages coming 
}
Run Code Online (Sandbox Code Playgroud)

然后我们设置路由:

func main() {
    //...
    setupRoutes()
    log.Fatal(http.ListenAndServe(":8080", nil))
}
Run Code Online (Sandbox Code Playgroud)

将最后一行更改为:

...http.ListenAndServeTLS(...)
Run Code Online (Sandbox Code Playgroud)

换句话说,使用 TLS 建立第一个连接?这种方法是否足以确保 WebSocket 上的整个通信从开始到结束的安全?我是否应该确定连接持续时间内的所有数据包传输也受到 TLS 保护?如果没有,如何在 Golang / Gorilla 框架中设置它?

ssl https go websocket gorilla

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

https 连接被拒绝,使用 ingress-nginx

我在 Ubuntu 19.10 上安装了 kubernetes。我已经设置了 ingress-nginx 并且可以使用 http 访问我的测试服务。但是,当我尝试通过 https 访问时,收到“连接被拒绝”的消息。

[编辑] 我试图让 https 在入口处终止,并将未加密的流量传递到我的服务,就像 http 一样。我根据我见过的许多示例实现了以下内容,但运气不佳。

亚米尔

kind: Service
apiVersion: v1
metadata:
  name: messagemanager-service
  namespace: default
  labels:
    name: messagemanager-service
spec:
  type: NodePort
  selector:
    app: messagemanager
  ports:
  - port: 80
    protocol: TCP
    targetPort: 8080
    nodePort: 31212
    name: http

  externalIPs:
    - 192.168.0.210


---
kind: Deployment
#apiVersion: extensions/v1beta1
apiVersion: apps/v1
metadata:
  name: messagemanager
  labels:
        app: messagemanager
        version: v1
spec:
  replicas: 3
  selector:
      matchLabels:
        app: messagemanager
  template:
    metadata:
      labels:
        app: messagemanager
        version: v1 …
Run Code Online (Sandbox Code Playgroud)

ssl https kubernetes kubernetes-ingress

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

Alamofire ssl 错误证书 Swift

我正在尝试连接到使用无效证书的https://wrong.host.badssl.com/ 。

我在 Viewcontroller.swift 中的代码:

let manager = ServerTrustManager(evaluators: ["wrong.host.badssl.com:443": DisabledEvaluator()])
let session = Session(serverTrustManager: manager)
session.request("https://wrong.host.badssl.com").response { response in
    debugPrint(response)
}
Run Code Online (Sandbox Code Playgroud)

响应是:

[Request]: GET https://wrong.host.badssl.com
[Request Body]: 
None
[Response]: 
nil
[Response Body]: 
None
[Data]: None
[Network Duration]: None
[Serialization Duration]: 0.0s
[Result]: failure(Alamofire.AFError.sessionDeinitialized)
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

欢呼马蒂亚斯

ssl https swift alamofire

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