Skip to content

Why port 587 not using self generated CA Certificate? #303

Open

Description

@bilogic

Before reporting a bug, please see our FAQ in FAQ.md!

Description

https://github.com/WhatsApp/proxy/blob/main/FAQ.md#5-does-the-proxy-support-https-or-socks

  1. It is indicated here that this proxy is just passing TCP traffic around.
  2. If that is the case, why need to generate a random CA Certificate?

export RANDOM_SSL=$(head -c 60 /dev/urandom | tr -dc 'a-zA-Z0-9')
export SSL_SUBJECT="${RANDOM_SSL}.net"
export SSL_DNS=${SSL_DNS}
export SSL_IP=${SSL_IP}
export DEBUG=${DEBUG:=1}
echo "--> Certificate Authority"
echo "Generating certs for ${SSL_SUBJECT}"
if [[ -e ./${CA_KEY} ]]; then
echo "====> Using existing CA Key ${CA_KEY}"
else
echo "====> Generating new CA key ${CA_KEY}"
openssl genrsa -out ${CA_KEY} 4096
fi
if [[ -e ./${CA_CERT} ]]; then
echo "====> Using existing CA Certificate ${CA_CERT}"
else
echo "====> Generating new CA Certificate ${CA_CERT}"
openssl req -x509 -new -nodes -key ${CA_KEY} -days ${CA_EXPIRE} -out ${CA_CERT} -subj "/CN=${CA_SUBJECT}" || exit 1
fi

  1. Since a random CA Certificate is generated for port 443, why doesn't port 587 use this same CA Certificate but chooses to use the official WhatsApp one?

These 3 points are total contradictions and makes media fails in places that block WhatsApp. There is so much room to do better if the aim is to really help people get access to WhatsApp.

Failed Step

The use of offical WhatsApp cert makes media fails in places that block WhatsApp.

Activity

  1. Nicepaul commented on Sep 13, 2024

    @Nicepaul

    Yes, that’s the problem

  2. bilogic commented on Sep 14, 2024

    @bilogic
    Author

    @Nicepaul do you know of a workaround?

  3. Nicepaul commented on Sep 14, 2024

    @Nicepaul

    @Nicepaul do you know of a workaround?

    I'm not deploying a WhatsApp proxy on a VPS; I'm setting it up on my home OpenWRT router to bypass issues with media not working. However, the prerequisite is that the OpenWRT router must be able to successfully bypass the firewall restrictions.

  4. bilogic commented on Sep 14, 2024

    @bilogic
    Author

    Does the proxy behave differently on different hardware?
    The proxy has to be located outside the restricted network.

  5. Nicepaul commented on Sep 14, 2024

    @Nicepaul

    Does the proxy behave differently on different hardware? The proxy has to be located outside the restricted network.

    This is not hardware-related. I’ve installed Passwall or SSRPlus on OpenWRT to bypass the Great Firewall of China, essentially setting up a VPN. All internal network applications and data, including WhatsApp, are routed through this tunnel, so the data packets are transmitted within the VPN and won’t be intercepted by the firewall. I’ve then mapped WhatsApp proxy's port to the public IP of the OpenWRT router. This is essentially a workaround to bypass WhatsApp’s certificate issues

  6. bilogic commented on Sep 14, 2024

    @bilogic
    Author

    I'm a little confused, if your mobile's WhatsApp is connected to the router which has VPN, why does it still need a proxy?

  7. Nicepaul commented on Sep 14, 2024

    @Nicepaul

    I'm a little confused, if your mobile's WhatsApp is connected to the router which has VPN, why does it still need a proxy?

    I want to use WhatsApp but prefer not to install a VPN app on my phone. Therefore, setting up a WhatsApp proxy on my home OpenWRT router seems like a good solution. Additionally, VPNs tend to drain battery and can significantly affect phone network performance, making it impractical to keep them always on. However, turning it off would disrupt WhatsApp communication.

  8. cloudwindy commented on Sep 19, 2024

    @cloudwindy
  9. peixian commented on Mar 29, 2025

    @peixian
    Contributor

    587 and 443 front different backends, with different cert requirements: https://github.com/WhatsApp/proxy/blob/main/proxy/src/proxy_config.cfg#L87

  10. bilogic commented on Mar 30, 2025

    @bilogic
    Author

    https://faq.whatsapp.com/1299035810920553/?helpref=uf_share

    Since a random CA Certificate is generated for port 443, why doesn't port 587 use this same CA Certificate but chooses to use the official WhatsApp one?

    • I believe many are unable to connect directly to WhatsApp servers because they are being blocked actively
    • And blocking in this age is almost always more than just simple IP blocking
    • So much explanations, but no answers
  11. M4mB14 commented on Aug 18, 2025

    @M4mB14

    still no solution?

  12. peixian commented on Aug 18, 2025

    @peixian
    Contributor
  13. bilogic commented on Aug 18, 2025

    @bilogic
    Author

    443 is intended to unblock chat, while 587 fronts media on WA. These are configurable from inside the client, as traffic is distinguishable between them and we need to have different routes.If you'd like to game out another threat model, I'd encourage you to make a PR.

    How does that answer my question? Since a random CA Certificate is generated for port 443, why doesn't port 587 use this same CA Certificate but chooses to use the official WhatsApp one?

  14. peixian commented on Aug 18, 2025

    @peixian
    Contributor
  15. bilogic commented on Aug 18, 2025

    @bilogic
    Author

    Well, quite clearly, we have trouble understanding each other.

    1. First, https://github.com/WhatsApp/proxy/blob/main/proxy/src/proxy_config.cfg#L87 - yes I know it's port 587, but I don't see any cert requirements... My SMTP port uses the same SSL cert as my HTTPS, so I can't make any sense of this.
    2. Then comes the threat model, this assumes I know the existing threat model (which I don't). How does a proxy mitigate threats apart from obscuring its original source host, which is mooted by the use of unconfigurable cert with whatsapp in its CN?
    3. Then it is mentioned both paths are different... are you saying they can't use the same cert because of that? How does this makes any sense.

    At this point, it's probably easier to just say nobody knows why 587 chooses to the original cert from the source host.

  16. peixian commented on Aug 18, 2025

    @peixian
    Contributor
  17. peixian commented on Aug 18, 2025

    @peixian
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions