WhatsApp / proxy

This repository contains the WhatsApp proxy implementation for users to host their own proxy infrastructure to connect to WhatsApp for chat (VoIP is not currently supported)
MIT License
1.39k stars 377 forks source link

Proxy can't be installed properly #158

Open hamedSHF opened 1 year ago

hamedSHF commented 1 year ago

Hi I tried to install whatsapp proxy on my vps but i couldn't. My vps includes apache and nginx webservers and i installed Debian 11 along with hestia panel on it. I did steps below :

I executed last command docker run -it -p 80:80 -p 443:443 -p 5222:5222 -p 8080:8080 -p 8443:8443 -p 8222:8222 -p 8199:8199 whatsapp_proxy:1.0 and i got this error "docker: Error response from daemon: driver failed programming external connectivity on endpoint blissful_bell (09046329ee9a28cdc4a5919a23e851bdcee9b96d794484555a7c485a500b4d39): Error starting userland proxy: listen tcp4 0.0.0.0:8443: bind: address already in use."

also for ports 8080,443 and 80 this message was showed

so i changed my server's ports to 2803,2804,2805 and 2806 and i ran following command docker run -it -p 2806:80 -p 2805:443 -p 5222:5222 -p 2804:8080 -p 2803:8443 -p 8222:8222 -p 8199:8199 whatsapp_proxy:1.0

then another error arised : "[ALERT] (25) : Binding [/usr/local/etc/haproxy/haproxy.cfg:60] for frontend haproxy_v4_http: cannot bind socket (Permission denied) for [0.0.0.0:80] [ALERT] (25) : Binding [/usr/local/etc/haproxy/haproxy.cfg:69] for frontend haproxy_v4_https: cannot bind socket (Permission denied) for [0.0.0.0:443] [ALERT] (25) : [haproxy.main()] Some protocols failed to start their listeners! Exiting."

To solve the problem above i tried several solutions but non of them worked :

  1. I cleaned cloned repository and all docker images and containers then i did all steps in order again
  2. I changed my server's OS to ubuntu 18.0.4 but nothing solved.
  3. For the last solution i tried https://github.com/docker-library/haproxy/issues/160 and i ran command below:

docker run -it -p 2806:80 -p 2805:443 -p 5222:5222 -p 2804:8080 -p 2803:8443 -p 8222:8222 -p 8199:8199 --sysctl net.ipv4.ip_unprivileged_port_start=0 whatsapp_proxy:1.0

then i faced another error : docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: open /proc/sys/net/ipv4/ip_unprivileged_port_start: no such file or directory: unknown.

How can i fix it?

Vahid22h commented 1 year ago

Hi I tried to install whatsapp proxy on my vps but i couldn't. My vps includes apache and nginx webservers and i installed Debian 11 along with hestia panel on it. I did steps below :

I executed last command docker run -it -p 80:80 -p 443:443 -p 5222:5222 -p 8080:8080 -p 8443:8443 -p 8222:8222 -p 8199:8199 whatsapp_proxy:1.0 and i got this error "docker: Error response from daemon: driver failed programming external connectivity on endpoint blissful_bell (09046329ee9a28cdc4a5919a23e851bdcee9b96d794484555a7c485a500b4d39): Error starting userland proxy: listen tcp4 0.0.0.0:8443: bind: address already in use."

also for ports 8080,443 and 80 this message was showed

so i changed my server's ports to 2803,2804,2805 and 2806 and i ran following command docker run -it -p 2806:80 -p 2805:443 -p 5222:5222 -p 2804:8080 -p 2803:8443 -p 8222:8222 -p 8199:8199 whatsapp_proxy:1.0

then another error arised : "[ALERT] (25) : Binding [/usr/local/etc/haproxy/haproxy.cfg:60] for frontend haproxy_v4_http: cannot bind socket (Permission denied) for [0.0.0.0:80] [ALERT] (25) : Binding [/usr/local/etc/haproxy/haproxy.cfg:69] for frontend haproxy_v4_https: cannot bind socket (Permission denied) for [0.0.0.0:443] [ALERT] (25) : [haproxy.main()] Some protocols failed to start their listeners! Exiting."

To solve the problem above i tried several solutions but non of them worked :

  1. I cleaned cloned repository and all docker images and containers then i did all steps in order again
  2. I changed my server's OS to ubuntu 18.0.4 but nothing solved.
  3. For the last solution i tried Running as the haproxy user in 2.4 leaved haproxy unable to start - cannot bind socket (Permission denied) [0.0.0.0:80] docker-library/haproxy#160 and i ran command below:

docker run -it -p 2806:80 -p 2805:443 -p 5222:5222 -p 2804:8080 -p 2803:8443 -p 8222:8222 -p 8199:8199 --sysctl net.ipv4.ip_unprivileged_port_start=0 whatsapp_proxy:1.0

then i faced another error : docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: open /proc/sys/net/ipv4/ip_unprivileged_port_start: no such file or directory: unknown.

How can i fix it?

aria1991 commented 1 year ago

Hi @hamed-sharafdoost . The latest error is related to the missing file or directory /proc/sys/net/ipv4/ip_unprivileged_port_start. To fix this, you could try setting thesysctl value to 1 instead of 0. You can run the command:

docker run -it -p 2806:80 -p 2805:443 -p 5222:5222 -p 2804:8080 -p 2803:8443 -p 8222:8222 -p 8199:8199 --sysctl net.ipv4.ip_unprivileged_port_start=1 whatsapp_proxy:1.0

This should allow the container to start successfully.

hamedSHF commented 1 year ago

Thanks @aria1991 but it doesn't work unfortunately. Same error is showed :

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: open /proc/sys/net/ipv4/ip_unprivileged_port_start: no such file or directory: unknown.

aria1991 commented 1 year ago

@hamed-sharafdoost No worries. hmm, let's try sth else. Could you please verify whether the file system is mounted on your machine? mount | grep proc. In case it is not , do sudo mount -t proc proc /proc ( I assume you have root access)

Then could you please check the output of the command sysctl net.ipv4.ip_unprivileged_port_start ? If it is not do sudo sysctl -w net.ipv4.ip_unprivileged_port_start=1. I hope it would fix your issue , if not try sudo service docker restart after applying those changes. Let me know if you were able to solve the issue.

hamedSHF commented 1 year ago

Output of mount | grep proc is :

proc on /proc type proc (rw,relatime,hidepid=2) systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pipe_ino=3288410318,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=3288410318)

None of these commands didn't work :

  1. sysctl net.ipv4.ip_unprivileged_port_start
  2. sudo sysctl -w net.ipv4.ip_unprivileged_port_start=1

We have the same errors again :

sysctl: cannot stat /proc/sys/net/ipv4/ip_unprivileged_port_start: No such file or directory

I tried sudo service docker restart and did all previous steps but nothing changed.

aria1991 commented 1 year ago

@hamed-sharafdoost. Could you tell me what is the output of ls /proc/sys/net/ipv4/ ?

hamedSHF commented 1 year ago

@aria1991 Ouput of ls /proc/sys/net/ipv4/ :

  1. conf
  2. ip_forward
  3. tcp_fastopen
  4. fwmark_reflect
  5. ip_forward_use_pmtu
  6. tcp_keepalive_intvl
  7. icmp_echo_ignore_all
  8. ip_local_port_range
  9. tcp_keepalive_probes
  10. icmp_echo_ignore_broadcasts
  11. ip_no_pmtu_disc
  12. tcp_keepalive_time
  13. icmp_errors_use_inbound_ifaddr
  14. ip_nonlocal_bind
  15. tcp_mem
  16. icmp_ignore_bogus_error_responses
  17. neigh
  18. tcp_min_snd_mss
  19. icmp_ratelimit
  20. ping_group_range
  21. vs
  22. icmp_ratemask
  23. route
  24. xfrm4_gc_thresh
  25. ip_default_ttl
  26. tcp_ecn
aria1991 commented 1 year ago

@hamed-sharafdoost Seems you don't have ip_unprivileged_port_startfile. So let's make it manually by executing the command below:

sudo sh -c 'echo "1024" > /proc/sys/net/ipv4/ip_unprivileged_port_start'

This will set the starting port number to 1024, which is the default value for most Linux systems. You can change this value to any other port number that you prefer. After setting this parameter, you may need to restart any services that rely on it, such as Docker or other network-related applications, for the changes to take effect.

hamedSHF commented 1 year ago

Sorry for late reply @aria1991 That's unbelievable.I faced another error and i was struggling to fix it but i could not.

Here is :

sh: 1: cannot create /proc/sys/net/ipv4/ip_unprivileged_port_start: Directory nonexistent

Also i used cat and touch commands but i can't even create a simple txt file. May it relates to my vps configuration?

aria1991 commented 1 year ago

@hamed-sharafdoost if you have root access, and you are not able to do that, it's better to contact your VPS provider

iceicerickert commented 5 months ago

on synology NAS there is an older Kernel version installed. I cannot get it working either