Interworx CLI

Hello gang.

I’ve been writing a bunch of bash files to cut some process times for some of our frequent manual processes.

Anyway, I could use some of the cli that interworx uses such as changing shell type that takes existing account password instead of having to use passwd command too. I noticed interworx includes the account password info when changing shell in nodeworx.

Other cli im interested in is APF, How do you add/remove port entries using CLI?

Thanks!

Sorry for the delay, kipper3d, I just responded to your ticket about this issue. I’m posting the same response here for those who are interested:


The interface to apf.pex isn’t very friendly, so you might better off just writing your own bash script to modify /etc/apf/conf.apf. For example, you can’t simply open or close a port with one parameter to ~iworx/bin/apf.pex. You have to list all the ports you want open, each time:

~iworx/bin/apf.pex --set-inbound-tcp=21,22,25,80,110,143,443,993,995,2080,2443,3306,2200_2400,5000_5500,20 \ --set-outbound-tcp=22,25,80,443,2080,2443,3306,2200_2400,5000_5500,20 \
--set-inbound-udp=20,21,53,123,2200_2400,5000_5500 \
--set-outbound-udp=20,21,53,123,2200_2400,5000_5500

If you wanted to completey close the port range 5000-5500 (which was open on both TCP in and out and UDP in and out), you would have to do:

~iworx/bin/apf.pex --set-inbound-tcp=21,22,25,80,110,143,443,993,995,2080,2443,3306,2200_2400,20 \
--set-outbound-tcp=22,25,80,443,2080,2443,3306,2200_2400,20 \
--set-inbound-udp=20,21,53,123,2200_2400 \
--set-outbound-udp=20,21,53,123,2200_2400

Similarly, I don’t suggest using ~iworx/bin/shell.pex to manipulate shell users. But, if you were still set on using the shell.pex command, you would do:

~iworx/bin/shell.pex --change-shell username=/bin/newshell

There are a few scripts in ~iworx/bin/ that do InterWorx specific operations (like listaccounts.pex and varpermsfix.pex), but for the most part the scripts in ~iworx/bin/ are wrapper scripts to get us access to system commands as the iworx user (for security reasons). In most cases, it’s best to write a bash script and use the system commands directly.

Hello,

Does anyone have a list of commands options for using interworx/bin/something.pex?

Such as domain.deactivate.pex

Thanks!

Im frustrated…

Why is it so difficult to get information about the pex files in /home/interworx/bin/??

Heres a couple I use in my perl/bash scripts for automating tasks that are outside the scope of modernbill:

/home/interworx/bin/shell.pex --change-shell $USER=/bin/bash
/home/interworx/bin/backup.pex --domains=all --file-path=/your/path
~iworx/cron/license.pex --sync

Heres how I handle adding ports to apf using perl via bash file as the above method in previous post using pex wasn’t practical:
perl -i.bak.$(date +%Y%m%d-%M) -wp -e “s/(IG_TCP_CPORTS=”.\d\d\d\d\d)/$1,$FULLPORT/g;
s/(EG_TCP_CPORTS=".
\d\d\d\d\d)/$1,$FULLPORT/g;" /etc/apf/conf.apf &&

$FULLPORT is the variable for the port number. This first part makes a backup of the file prior to change for precaution.

I’m sure there’s more. Please share what you have.

Thanks!

Ok any docs on the .pex scripts and their usage? Especially domain-promoter.pex.

I have been using interworx for years and I would really like to take more advantage of the different pex scripts.