Is there a way to update FAHControl from CLI?

Moderators: Site Moderators, FAHC Science Team

Post Reply
psjrg
Posts: 17
Joined: Mon Mar 23, 2020 7:26 am

Is there a way to update FAHControl from CLI?

Post by psjrg »

Hi

I'm trying to update FAHControl clients without the GUI. I did some googling and also looked at FAHControl on github but haven't been able to find any obvious answer. I'd like to be able to deploy FAHClients with a script and have it CRUD the client info in FAHControl.

Could anyone provide some insight on this? Perhaps a link that might get me started? Thanks in advance.
ipkh
Posts: 175
Joined: Thu Jul 16, 2015 2:03 pm

Re: Is there a way to update FAHControl from CLI?

Post by ipkh »

What are you trying to update? The config.xml file is pretty standard layout and options. Your script could just replace it or edit it.
psjrg
Posts: 17
Joined: Mon Mar 23, 2020 7:26 am

Re: Is there a way to update FAHControl from CLI?

Post by psjrg »

I have config.xml pretty well figured out for deploying and configuring FAHClient on the remote machines. What I would like to do is be able to update the client info (IP/port) in FAHControl on my local machine for monitoring. Config.xml doesn't appear to contain the client information for FAHControl.
ipkh
Posts: 175
Joined: Thu Jul 16, 2015 2:03 pm

Re: Is there a way to update FAHControl from CLI?

Post by ipkh »

I see, I'm sure there must be a file somewhere that houses that information. If you add multiple clients manually does it survive a reboot? Maybe there's a config file in the users home directory.
psjrg
Posts: 17
Joined: Mon Mar 23, 2020 7:26 am

Re: Is there a way to update FAHControl from CLI?

Post by psjrg »

It does survive a reboot, so it must be recorded or serialized somewhere. I just can't seem to find it.
ipkh
Posts: 175
Joined: Thu Jul 16, 2015 2:03 pm

Re: Is there a way to update FAHControl from CLI?

Post by ipkh »

I'll do a double check on my system at home tonight.
psjrg
Posts: 17
Joined: Mon Mar 23, 2020 7:26 am

Re: Is there a way to update FAHControl from CLI?

Post by psjrg »

I think I found it using lsof. It appears to be a serialized data.data file. Not human readable though.

This is on MacOS. Its in the saved application state directory.
Joe_H
Site Admin
Posts: 7870
Joined: Tue Apr 21, 2009 4:41 pm
Hardware configuration: Mac Pro 2.8 quad 12 GB smp4
MacBook Pro 2.9 i7 8 GB smp2
Location: W. MA

Re: Is there a way to update FAHControl from CLI?

Post by Joe_H »

You can use telnet to connect to the running FAHClient, telnet to local address 127.0.0.1 over port 36330. I have done this in the past, but it appears Apple has removed telnet from the available utilities for the CLI. There may be a replacement you can install. As best as I can tell the removal was with High Sierra.

Once connected to FAHClient there is a help command available, you should be able to make and save changes.

The user storable changes are kept in config.xml.

(Dang it, I just had to upgrade my laptop to HS for VPN and Remote Desktop for work from home :cry: )
Image

iMac 2.8 i7 12 GB smp8, Mac Pro 2.8 quad 12 GB smp6
MacBook Pro 2.9 i7 8 GB smp3
psjrg
Posts: 17
Joined: Mon Mar 23, 2020 7:26 am

Re: Is there a way to update FAHControl from CLI?

Post by psjrg »

Thanks Joe. I do have telnet through homebrew.

The commands seem related to FAHClient on the local machine. I was hoping to be able to update the client list in FAHControl for newly deployed instances or updating for IP changes. Is there a specific command you could point.

Bascially the script I'd like to make would run from the local machine and do the following to a list of remote machines:
>log into remote machine
>download FAHClient Package
>deploy custom config.xml
>restart FAHClient
>open firewall ports
>add client to FAHControl on the local machine

Its really just the last step that I'm asking about. I don't want to manually add the remote machines to the client list in FAHControl for each remote machine. Its probably the most trivial step but would help with organization.

I hope I am explaining this in a way that makes sense.

Screenshot below of the panel I'm trying to update:
https://imgur.com/a/1K9qcWI
ipkh
Posts: 175
Joined: Thu Jul 16, 2015 2:03 pm

Re: Is there a way to update FAHControl from CLI?

Post by ipkh »

The Fahcontrol uses a SQL database stored in the .FAHClient directory of the users home directory. There is a simple clients entry with 3 data points name,ip address and password.
Last edited by ipkh on Tue Mar 31, 2020 1:10 am, edited 1 time in total.
psjrg
Posts: 17
Joined: Mon Mar 23, 2020 7:26 am

Re: Is there a way to update FAHControl from CLI?

Post by psjrg »

ipkh wrote:The Fahcontrol uses a SQL database stored in the .FAHClient directory of the users home directory. There is a simple clients entry with 3 data points nane,up address and password.
Wow thanks! I found it. For anyone on macOS: /Users/<username>/Library/Application\ Support/FAHClient/FAHControl.db
Post Reply