Omega remote access with dataplicity with wormhole



  • Hello everyone, I want to share my project modifying the source code to port dataplicity to omega onion and any openwrt device, so, lets to start

    check you have the last version of firmware

    oupgrade

    lets go to edit the repo list

    vi /etc/opkg/distfeeds.conf

    0_1552545493034_Captura de pantalla de 2019-03-13 17-38-36.png

    after that, you have to make a opkg update

    opkg update

    install the following packages

    opkg install python-pip sudo shadow-useradd ca-certificates curl nano

    0_1552545784594_Captura de pantalla de 2019-03-13 10-55-06.png

    so we have to upgrade pip and install the next packages

    pip install --upgrade pip setuptools
    pip install --upgrade egg supervisor

    make these two lines one by one because all in the same line causes errors

    0_1552545996988_Captura de pantalla de 2019-03-13 11-09-14.png

    create the next folders

    mkdir /etc/supervisor/
    mkdir /etc/supervisor/conf.d

    create the supervisor config file in the first folder

    nano /etc/supervisor/supervisord.conf

    and paste the next code inside

    ; supervisor config file
    
    [unix_http_server]
    file=/var/run/supervisor.sock   ; (the path to the socket file)
    chmod=0700                       ; sockef file mode (default 0700)
    
    [supervisord]
    pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
    
    ; the below section must remain in the config file for RPC
    ; (supervisorctl/web interface) to work, additional interfaces may be
    ; added by defining them in separate rpcinterface: sections
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket
    
    ; The [include] section can just contain the "files" setting.  This
    ; setting can list multiple files (separated by whitespace or
    ; newlines).  It can also contain wildcards.  The filenames are
    ; interpreted as relative to this file.  Included files *cannot*
    ; include files themselves.
    
    [include]
    files = /etc/supervisor/conf.d/*.conf
    
    

    the next step is download dataplicity code, create an account and add a device so you will see something like this

    0_1552547021018_Captura de pantalla de 2019-03-13 11-10-19.png

    the token is different for each account, so you have to download the code to change some lines
    download it with wget

    wget https://www.dataplicity.com/"your_token.py"

    after that, we have to delete some lines

    nano "your_token.py"

    find these selected lines and delete them

    0_1552547423398_Captura de pantalla de 2019-03-13 11-11-34.png

    0_1552547441813_Captura de pantalla de 2019-03-13 11-12-36.png

    so, at this point you can install dataplicity, lets do it

    0_1552606161408_1552547829025-captura-de-pantalla-de-2019-03-14-01-13-13-resized.png

    finally we have to create a daemon of supervisor package

    according this web we can do it with this codes

    http://a0726h77.blogspot.com/2017/01/supervisord-on-openwrt.html

    I prefer nano, so execute the next code and paste this

    nano /etc/init.d/supervisor

    #!/bin/sh /etc/rc.common
    
    #
    
    # AUTHOR: Takumi Sueda 
    #
    # Start/stop/restart supervisor in OpenWrt.
    START=91
    USE_PROCD=0
    PROG=/usr/bin/supervisord
    DAEMON=${PROG}
    # Location of the pid file
    PIDFILE=/tmp/supervisord.pid
    # Config of supervisor
    CONFIG=/etc/supervisor/supervisord.conf
    start_service()
    {
        # $DAEMON -c $CONFIG -j $PIDFILE
        procd_open_instance
        procd_set_param command $PROG -c $CONFIG -j $PIDFILE
        procd_set_param respawn
        procd_close_instance
        touch $CONFIG
    }
    stop_service()
    {
        kill $(cat $PIDFILE)
    }
    

    check that we change the config line by the new route "/etc/supervisor/supervisord.conf"

    execute

    chmod u+x /etc/init.d/supervisor
    /etc/init.d/supervisor enable
    /etc/init.d/supervisor start
    cd /etc/rc.d
    ln -s ../init.d/supervisor S99supervisor

    If you do it right you will see something like this

    0_1552548535862_Captura de pantalla de 2019-03-13 17-43-25.png

    click on the device and turn on the wormhole

    0_1552548723113_Captura de pantalla de 2019-03-13 17-43-38.png

    install the legacy console on the omega

    0_1552548812681_Captura de pantalla de 2019-03-13 10-46-14.png

    when you click the wormhole link it will be redirect to

    https://something.dataplicity.io/OnionOS/
    

    change it for

    https://something.dataplicity.io/console/
    

    and voila, you have terminal and a lot of things remotely without dmz and free!

    don't forget, you can use it with webcam app
    0_1552552410855_Captura de pantalla de 2019-03-13 10-48-21.png

    I will appreciate if someone helps me to improve the code and do it fully working without wormhole or adding something else, the reboot button works fine



  • Hi David,
    Great post, it was very easy to follow and all works great however the terminal does not.
    All I see is 0_1555460655464_datap.JPG
    Any ideas ?
    PS a warning at the start about oupgrade resetting previous configurations would be handy.



Looks like your connection to Community was lost, please wait while we try to reconnect.