Nethserver on command line interface CLI

(Juan Carlos Fernandez) #1

NethServer Version: 7.4.1708

I’m currently setting up host and host groups to be used on the Firewall and Web Filter.
I already figured it out that I can add a new host like this:

db hosts set host1 local Description 'My 1st host' IpAddress MacAddress '00:01:02:03:04:05'

For a host-group it’s like this:

db hosts set host-group-test host-group  Description 'My 1st host-group'  Members host1,host2,host3

I can change one property like this:

db hosts setprop host1 IpAddress

However, it seems that after setting all host/host-groups, one must fire up corresponding events. So far I haven’t been able to guess which one.

(Marc) #2

The developer manual has some notes on firewall objects.

With this you create a DHCP IP reservation (a local host):

To create a host firewall object:

db hosts set host1 host Description 'description of host' IpAddress

Changes are reflected instantly on the UI (accessing/refreshing the page).

If I’m not mistaken, the following call saves the objects to make them available internally to shorewall:

signal-event nethserver-firewall-base-save firewall-objects-modify

(Juan Carlos Fernandez) #3

Thanks @dnutan, I’m creating host on DHCP IP reservation because I’m using [IP/MAC binding], so defining host like this:

db hosts set host1 local Description ‘My 1st host’ IpAddress MacAddress ‘00:01:02:03:04:05’

will allow me to use MAC binding and also use those host definitions to create host-groups for [Web Filter] and [Firewall] rules making.

Right now I’m creating a python script for migrating DHCP from Windows to NS7, which is why I need to know which events must be fire up once I add/modify host on DHCP reservations.

(Marc) #4

I think you can do with these events to create, modify or delete:

signal-event host-create host1
signal-event host-modify host1
signal-event host-delete host1

also with multiple arguments

signal-event host-create host1 host2