PF Client remote install

#1
Hi,

I have just installed pfclient on my remote PI that gets data from another PI in the network running dump1090.

All seems fine however I cannot get to config as the page is not reacheable outside the network.

I do have SSH access to the PI running the pfclient - is there any way to request the key generation via command line and set it in the config file?

Thanks.
 

ab cd

Senior Member
#4
Ok, thanks, will do once I gain access
Hi Adrian,

There is a way without web interface, only by ssh. I have done it.

Right now I am away from my computer/local network, so cannot tell you exact steps. Will post when I am at my desktop, hopefully in 2 to 3 hours from now.

P.S.
If you can remote access Pi by SSH, then remote access to its web page should also be possible. Why it is not possible?
 
Last edited:
#5
Thanks for your reply, I can imagine that it can be done from terminal as the web interface is only passing parameters to the service which will make the request.

However, I did get access in the mean time and my station is live and feeding data - would still like to find out how it can be done (maybe include it in the install guide as alternate method?)

P.S.
If you can remote access Pi by SSH, then remote access to its web page should also be possible. Why it is not possible?
There was only port 22 available at that moment via Port Forwarding as the PI is behind a router - I needed physical access to the network so I can add a new forwarding rule.


Thanks for your help.
 

ab cd

Senior Member
#6
Hi Asrian

OK, here is the method:

  1. SSH to Pi

  2. Open file pfclient-config.json for editing
    Code:
    sudo nano /etc/pfclient-config.json


  3. For an un-configured new intall, the file opened by above command will nave no info except a pair of curly braces like shown below
    Code:
    { }


  4. Delete this pair of braces to make this file empty. Now copy-paste following code in this empty file.
    NOTE: Replace xx.xxxx, yy.yyyy, and zzzzzzzzzzzz by actual values of latitude, longitude, and sharecode
    Code:
    {
    "tcp_address":"127.0.0.1",
    "tcp_port":"30005",
    "select_timeout":"10",
    "data_upload_interval":"10",
    "connection_type":"1",
    "aircraft_timeout":"30",
    "data_format":"1",
    "latitude":"xx.xxxx",
    "longitude":"yy.yyyy",
    "sharecode":"zzzzzzzzzzzz"
    }

  5. Save (Ctrl+o) and Close (Ctrl+x) the file


  6. Resrart pfclient
    Code:
    sudo systemctl restart pfclient

  7. Wait for 5 minutes, then check log
    Code:
    cat /var/log/pfclient/pfclient*.log


    If all is OK, the above command will give output similar to following
    Code:
    2018-08-09 05:48:27.585103 [-] pfclient (4.1.1 armhf) started with the following options:
    2018-08-09 05:48:27.585898 [-]  connection_type = 1
    2018-08-09 05:48:27.585980 [-]  tcp_address = 127.0.0.1
    2018-08-09 05:48:27.586029 [-]  tcp_port = 30005
    2018-08-09 05:48:27.586090 [-]  data_format = 1
    2018-08-09 05:48:27.586127 [-]  aircraft_timeout = 30
    2018-08-09 05:48:27.586164 [-]  select_timeout = 10
    2018-08-09 05:48:27.586209 [-]  web_server_port = 30053
    2018-08-09 05:48:27.586282 [-]  user_latitude = xx.xxxx
    2018-08-09 05:48:27.586331 [-]  user_longitude = yy.yyyy
    2018-08-09 05:48:27.587431 [V] Performing NTP sync (2.planefinder.pool.ntp.org)...
    2018-08-09 05:48:27.592495 [-] TCP connection established: 127.0.0.1:30005
    2018-08-09 05:48:27.600838 [-] Echo port is now listening on: 192.168.0.21:30054
    2018-08-09 05:48:27.602312 [-] Web server is now listening on: http://192.168.0.21:30053
    2018-08-09 05:48:27.693623 [V] NTP sync succeeded with settings:
    2018-08-09 05:48:27.693803 [V]  Stratum: 2
    2018-08-09 05:48:27.693909 [V]  System clock time: 1533793707.6936
    2018-08-09 05:48:27.693984 [V]  Corrected clock time: 1533793707.7035
    2018-08-09 05:48:27.694054 [V]  NTP offset: 0.0099s
    2018-08-09 05:49:11.48719  [-] User location has been verified.
    2018-08-09 05:50:11.665130 [-] Successfully sent 98 aircraft updates across 10 packets (9.00KB)
    2018-08-09 05:51:55.473818 [-] Successfully sent 87 aircraft updates across 10 packets (9.00KB)
 

ab cd

Senior Member
#8
Have initially tried this method however I did not have the sharecode, and that was the original question, how to request the share code from terminal
Oops, I missed this point.
Well, if you have another Pi (call it Pi2) with pfclient, AND that Pi's web interface is accessible, do this:

  1. SSH to Pi2 and make a copy of file pfclient-config.json by name pfclient-config.json.original
    Code:
    sudo cp /etc/pfclient-config.json  /etc/pfclient-config.json.original

  2. In Pi2, open file pfclient-config.json to edit
    Code:
    sudo nano /etc/pfclient-config.json

  3. In Pi2, delete all lines (Ctrl+k) in above file to make it empty, then type pair of curly braces { }

  4. Save (Ctrl+o) and Close (Ctrl+x) the file

  5. In Pi2, restart pfclient
    Code:
    sudo systemctl restart pfclient

  6. Open web interface of Pi2 and request sharecode using latitude and longitude of the Pi which does not have access to web interface.

  7. After you receive the share code use it for non-web interface Pi.

  8. To restore your modified Pi2, delete dummy file pfclient-config.json and rename pfclient-config.json.original to pfclient-config.json
    Code:
    sudo rm /etc/pfclient-config.json
    sudo mv  /etc/pfclient-config.json.original   /etc/pfclient-config.json
    sudo systemctl restart pfclient
 
Last edited:
Top