unjust / microradio_server

work for the streaming service and site
4 stars 0 forks source link

stunnel doesnt work for Facebook stream #1

Closed unjust closed 5 years ago

unjust commented 5 years ago

We went by this post to set up stunnel on our instance https://dev.to/lax/rtmps-relay-with-stunnel-12d3

but hit a wall when starting the service systemctl restart stunnel4 && systemctl status stunnel4

output:

After this operation, 468 kB of additional disk space will be used. Get:1 http://southamerica-east1-b.gce.clouds.archive.ubuntu.com/ubuntu/ trusty/universe stunnel4 amd64 3:4.53-1.1ubuntu1 [ 152 kB] Fetched 152 kB in 1s (93.4 kB/s)   

Selecting previously unselected package stunnel4. (Reading database ... 52429 files and directories currently installed.) Preparing to unpack .../stunnel4_3%3a4.53-1.1ubuntu1_amd64.deb ... 

Unpacking stunnel4 (3:4.53-1.1ubuntu1) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ...  

Processing triggers for ureadahead (0.100.0-16) ... Setting up stunnel4 (3:4.53-1.1ubuntu1) ...  

Warning: The home dir /var/run/stunnel4 you specified can't be accessed: 

No such file or directory Adding system user stunnel4' (UID 107) ...  
Adding new group stunnel4' (GID 112) ... Adding new user stunnel4' (UID 107) with group stunnel4' ... Not creating home directory `/var/run/stunnel4'. SSL tunnels disabled, see /etc/default/stunnel4 Processing triggers for ureadahead (0.100.0-16) ...
m33toh commented 5 years ago

Dummy gummy stepbystep instructions https://dev.to/lax/rtmps-relay-with-stunnel-12d3

unjust commented 5 years ago

I think we tried this before, but we probably fucked up somehow... its the same post as we tried above ^^^ wanna try it out and see if you can get it working?

unjust commented 5 years ago

tracking progress here step by step apt install stunnel4 might be ok but get this warning? Warning: The home dir /var/run/stunnel4 you specified can't be accessed: No such file or directory

also can't seem to create the config files - even with sudo?
I changed root password with sudo passwd to something simple . https://stackoverflow.com/questions/35016795/get-root-password-for-google-cloud-engine-vm .

the I su root to create the config files (I just used vi)

looking at this https://www.stunnel.org/config_unix.html after running into this error:

cat <<EOF > /etc/stunnel/conf.d/fb.conf 
> [fb-live]
> client = yes
> accept = 127.0.0.1:19350
> connect = live-api-s.facebook.com:443
> verifyChain = no
> EOF
-bash: /etc/stunnel/conf.d/fb.conf: No such file or directory

I ended up creatinbg the dir as root and then dropping the config in

root@instance-template-ubuntu-1404-4-stunnel:/home/unjust# vi /etc/stunnel/stunnel.conf
root@instance-template-ubuntu-1404-4-stunnel:/home/unjust# cd /etc/stunnel/
root@instance-template-ubuntu-1404-4-stunnel:/etc/stunnel# mkdir conf.d
root@instance-template-ubuntu-1404-4-stunnel:/etc/stunnel# cat <<EOF > /etc/stunnel/conf.d/fb.conf 
> [fb-live]
> client = yes
> accept = 127.0.0.1:19350
> connect = live-api-s.facebook.com:443
> verifyChain = no
> EOF
root@instance-template-ubuntu-1404-4-stunnel:/etc/stunnel# 

I had to apt-get install systemd install systemd to use systemctl but still doesnt seem to work so starting manually

stunnel /etc/stunnel/stunnel.conf
By default, stunnel uses /var/log/secure to log its output.
To terminate stunnel, kill the process by running the following command as root:
~]# kill `cat /var/run/stunnel/stunnel.pid`

also inlined the fb conf config (removed the include directive)

I had to also remove some args include, verify.. from the conf, oh and EOF ;-)

stunnel4 /etc/stunnel/stunnel.conf
Clients allowed=500
stunnel 4.53 on x86_64-pc-linux-gnu platform
Compiled with OpenSSL 1.0.1e 11 Feb 2013
Running  with OpenSSL 1.0.1f 6 Jan 2014
Update OpenSSL shared libraries or rebuild stunnel
Threading:PTHREAD SSL:+ENGINE+OCSP Auth:LIBWRAP Sockets:POLL+IPv6
Reading configuration from file /etc/stunnel/stunnel.conf
Compression not enabled
PRNG seeded successfully
Initializing service section [fb-live]
SSL options set: 0x00000004
Configuration successful
Service [fb-live] (FD=12) bound to 127.0.0.1:19350
setgid: Operation not permitted (1)
Service [fb-live] closed (FD=12)
str_stats: 11 block(s), 1197 data byte(s), 638 control byte(s)
unjust@instance-template-ubuntu-1404-4-stunnel:/etc/stunnel$ sudo stunnel4 /etc/stunnel/stunnel.conf

but now at least we get the pid

other stuff https://hamy.io/post/0012/how-to-install-and-configure-stunnel-on-ubuntu/

unjust commented 5 years ago

use 2 containers and networking to communicate https://fabianlee.org/2017/03/07/docker-installing-docker-ce-on-ubuntu-14-04-and-16-04/ https://medium.com/@jaaq/making-docker-containers-talk-to-each-other-by-hostname-using-container-networking-94835a6f6a5b

unjust commented 5 years ago

Got this working with a user created network, a stunnel image, cretaing confs for stunnel.

https://github.com/unjust/radio_molecula/pull/9/