Skip to content

Enable TLS for all Puppet Service Clients of Wechaty Ecosystem #160

Open
@huan

Description

@huan

Refer to #124, we have enforced the Wechaty Puppet Service to use TLS for maximum security, and satisfy the gRPC requirements.

The old versions of wechaty-puppet-service prior to version 0.28 will not be able to work with the new versions by default.

So the actions need to be taken for our community to enable the TLS for our ecosystem should at least be include the following tasks:

  1. Enable TLS for Polyglot Wechaty SDK
    • Wechaty (TypeScript)
    • Python Wechaty @wechaty/python
    • Go Wechaty @wechaty/go
    • Java Wechaty @wechaty/java
    • .NET Wechaty @wechaty/dotnet
    • PHP Wechaty @wechaty/php
    • Rust Wechaty @wechaty/rust
    • Scala Wechaty @wechaty/scala
  2. Enable TLS for Puppet Services @wechaty/contributors
    • WXWork @wechaty/juzi
    • Paimon @zpaimon
    • Donut

To be compatible with the old ecosystem, the new version of wechaty-puppet-services provided the following two environment variables to be used for compatible reasons. Please notice that this solution is a workaround, and we should push all of our ecosystems to move forward to work with the latest TLS/TLS versions.

Disable TLS for Puppet Service Server

To disable server TLS:

  1. Set WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER to true
  2. Set options.tls.disable to true

Disable TLS for Puppet Service Client

To disable client TLS:

  1. Set WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT to true
  2. Set options.tls.disable to true

Compatible with non-tls server/clients

We have workarounds to make a new version of wechaty-puppet-service work with the old non-tls server/clients.

To disable tls for server / client, we can set NO_TLS_INSECURE/options.tls.disable:

  1. Should not be used for production
  2. It's compatible with old wechaty-puppet-service servers and clients which are not supported TLS.
  3. All wechaty-puppet-service servers and clients should be updated to the latest version to support TLS as soon as possible.
  4. All Polyglot Wechaty SDK should support TLS as soon as possible.

Troubleshooting

@Gcaufy: try to enable grpc trace log, you will receive more connection details

GRPC_VERBOSITY=DEBUG GRPC_TRACE=all npm run start

Problem

You will run into Error: 14 UNAVAILABLE: No connection established if the Wechaty Puppet Service server & client does not match the TLS settings.

For examples:

  1. Server requires TLS but the client does not support TLS, for example, a newer server with a legacy client
  2. Server does not support TLS but the client is using TLS, for example, a legacy server with a newer client

Solution

Server Client Status Solution (workaround)
TLS no TLS Error: 14 UNAVAILABLE WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER=true
no TLS TLS Error: 14 UNAVAILABLE WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT=true
no TLS no TLS OK N/A
TLS TLS OK N/A

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions