Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Control » Configure autologin IP through API
  •  
ar92

Messages: 5
Karma: 0
Send a private message to this user
I am looking for a way to change the Autologin IP address via the Kerio Control API.

Currently I have the following;
user = callMethod('Users.set', {'userIds':['5096ace1-9f6c-0f4a-9682-27beb02530fc'],'details ':{'fullName':'UserName','autoLogin': {
'addresses': {'enabled': True, 'value': ['10.20.1.124']}}},
'domainId':'local'}, token)

This appears to work ok, as I'm not getting an error back. Once I look in the web interface of the Kerio the user still doesn't have an IP assigned. When I change the autologin IP via the web interface it works fine.....

When I look into the debugs it looks like the username is missing (not needed) in the API call;

Changes made via web interface (Username=Test)
[23/Oct/2015 02:17:27] admin - DELETE FROM AutoLogins WHERE IpType=address IpAddr=10.20.1.20
[23/Oct/2015 02:17:27] admin - INSERT INTO AutoLogins VALUES Username=Test, UUID=59da2f50-e094-0f49-bc95-29b1e194d79a, IpType=address, IpAddr=10.20.1.20

Changes made via API call (Username missing)
[23/Oct/2015 02:20:29] admin - DELETE FROM AutoLogins WHERE Username= [Original values: Username=, UUID=5096ace1-9f6c-0f4a-9682-27beb02530fc, IpAddr=10.20.1.200, IpGroup=, MacAddr=, IpType=address]
[23/Oct/2015 02:20:29] admin - DELETE FROM AutoLogins WHERE IpType=address IpAddr=10.20.1.200
[23/Oct/2015 02:20:29] admin - INSERT INTO AutoLogins VALUES Username=, UUID=5096ace1-9f6c-0f4a-9682-27beb02530fc, IpType=address, IpAddr=10.20.1.200

Could this be related (possibly a bug) to the issue I'm seeing?
  •  
Petr Dobry (Kerio)

Messages: 774
Karma: 61
Send a private message to this user
Some API calls needs to be confirmed in order to prevent cut-off. Users.set is one of them.

Quote:
In some cases you are required to call methods Session.getConfigTimestamp and Session.confirmConfig in order to confirm you are still able to connect to firewall with new configuration. This mechanism protects you from cutting yourself from the firewall. Otherwise your changes will be lost after 30 seconds automatically.


Could it be the case ?

Petr Dobry
Product Development Manager | Kerio

Stay Connected Anytime, Anywhere. Discover Kerio Cloud!
Looking for help ? - http://kb.kerio.com
  •  
ar92

Messages: 5
Karma: 0
Send a private message to this user
Hm that might explain why I get the "successfully reconnected" message every time I log into the web interface after the API call.

I will give it a try tomorrow morning.

Thank you
  •  
ar92

Messages: 5
Karma: 0
Send a private message to this user
The confirm config method doesn't seem to help. Im getting the following response from the config, timestamp and confirmconfig methods;

User change:
{'jsonrpc': '2.0', 'result': {'errors': []}, 'id': 1}

Getting timestamp
{'jsonrpc': '2.0', 'result': {'clientTimestampList': [{'timestamp': 1772, 'name': 'config'}, {'timestamp': 118, 'name': 'UserDB'}]}, 'id': 1}

Confirm config with timestamp included
{'jsonrpc': '2.0', 'result': {'confirmed': True}, 'id': 1}

It looks like there were no errors generated. In the meantime I can change the users full name without any issues.

[Updated on: Thu, 12 November 2015 14:18]

  •  
ar92

Messages: 5
Karma: 0
Send a private message to this user
Anyone who can help me with this or has done this before?
  •  
Petr Dobry (Kerio)

Messages: 774
Karma: 61
Send a private message to this user
You're missing one mandatory parameter - username.

Correct API call should look like:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "Users.set",
  "params": {
    "userIds": [
      "940f8c80-4255-754b-bf37-d3b9678060c9"
    ],
    "details": {
      "credentials": {
        "userName": "some_user"
      },
      "autoLogin": {
        "addresses": {
          "enabled": true,
          "value": [
            "192.168.1.100"
          ]
        }
      }
    },
    "domainId": "local"
  }
}

Petr Dobry
Product Development Manager | Kerio

Stay Connected Anytime, Anywhere. Discover Kerio Cloud!
Looking for help ? - http://kb.kerio.com
  •  
ar92

Messages: 5
Karma: 0
Send a private message to this user
Hi Petr,

This works, thank you very much!
Previous Topic: Link Aggregation Kerio 3130
Next Topic: RAM utilization
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Sat Jan 21 18:26:48 CET 2017

Total time taken to generate the page: 0.01054 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.