return user_cnf
-def group_admins(activesync_enable=False, xauth_enable=False, suffix="host"):
+def group_admins(proxy_profile="1", activesync_enable=False, xauth_enable=False, suffix="host"):
"""
Generate and save an Administrators group configuration file.
+ :param str proxy_profile: proxy profile instance reference
:param bool activesync_enable: whether to enable ActiveSync for the group
:param bool xauth_enable: whether to enable XAUTH for the group
:param str suffix: optional suffix to use for config identification
instance=1),
[(Update, ("GROUP_ACCESS_REMOTE_ADMINISTRATION_ALLOWED", 0, "1")),
(Update, ("GROUP_EMAILFILTER_BAN_FILTERLIST_REF", 0, "-1")),
- (Update, ("GROUP_PROXY_PROFILE_REF", 0, "1")),
+ (Update, ("GROUP_PROXY_PROFILE_REF", 0, proxy_profile)),
(Update, ("GROUP_ACCESS_GO_ONLINE_ALLOWED", 0, "1")),
(Update, ("GROUP_EMAIL_RELAY_RIGHTS", 0, "RELAY_FROM_INTRANET")),
(Update, ("GROUP_ACTIVESYNC_ENABLE", 0, "1" if activesync_enable else "0")),
return group_cnf
-def nic(ip="1.2.3.4", netmask="255.255.0.0", mac="00:00:00:00:00:00", suffix="host"):
+def nic(instance=0, nictype="NATLAN",
+ ip="1.2.3.4", netmask="255.255.0.0", mac="00:00:00:00:00:00",
+ suffix="host"):
"""
Generate and save a nic configuration file.
+ :param int instance: instance number (for multiple nics, -1 for next available)
+ :param str nictype: type of the nic
:param str ip: IP address of the nic
:param str netmask: network mask of the nic
:param str mac: MAC address of the nic
"""
log.info("Create arnied nic configuration")
nic = batch_update_cnf(
- build_nic.BuildNIC(data="", instance=2, line_no=1),
- [(Update, ("NIC_TYPE", 0, "NATLAN")),
+ build_nic.BuildNIC(data="", instance=instance, line_no=1),
+ [(Update, ("NIC_TYPE", 0, nictype)),
(Update, ("NIC_LAN_IP", 0, ip)),
(Update, ("NIC_LAN_NETMASK", 0, netmask)),
(Update, ("NIC_MAC", 0, mac))])
return nic_cnf
-def intraclient(ip="1.2.3.4", mac="00:00:00:00:00:00", fwrules=5, suffix="host"):
+def intraclient(name="intraclient", instance=1,
+ ip="1.2.3.4", mac="00:00:00:00:00:00",
+ fwrules=5, suffix="host"):
"""
Generate and save an intraclient configuration file.
+ :param str name: name of the intraclient
+ :param int instance: instance number (for multiple clients, -1 for next available)
:param str ip: IP address of the intraclient
:param str mac: MAC address of the intraclient
:param int fwrules: instance of the firewall rules to use
:rtype: str
"""
log.info("Create arnied intraclient configuration")
- intraclient = batch_update_cnf(build_intraclient.BuildIntraclient(instance=1, data="dmzserver"),
+ intraclient = batch_update_cnf(build_intraclient.BuildIntraclient(data=name,
+ instance=instance),
[(Update, ("INTRACLIENT_IP", 0, ip)),
(Update, ("INTRACLIENT_MAC", 0, mac)),
(Update, ("INTRACLIENT_FIREWALL_RULESET_REF", 0, fwrules))])
return intraclient_cnf
-def provider(mode="ROUTER", ip="1.2.3.4", localip=None,
+def provider(name="provider", instance=1, mode="ROUTER", ip="1.2.3.4", localip=None,
netmask="255.255.0.0", dnsmode="IP", dns="1.2.3.4", fwrules=5,
- dialretry=None, name=None, timeout="", mtumode="AUTO",
+ dialretry=None, timeout="", mtumode="AUTO",
vlanid=None, mtusize=None, login=None, password=None,
modemip=None, providerid=None, localdhcp=None,
suffix="host"):
"""
Generate and save a provider configuration file.
+ :param str name: name of the provider
+ :param int instance: instance number (for multiple clients, -1 for next available)
:param str mode: provider mode
:param str ip: IP address of the provider
:param localip: IP address of the configured machine (valid for some configurations)
:type localip: str or None
+ :param str netmask: netmask of the provider
+ :param str dnsmode: dnsmode of the provider
:param str dns: IP address of the DNS server
:param int fwrules: instance of the firewall rules to use
+ :param any args: lots of detailed configuration
:param str suffix: optional suffix to use for config identification
:returns: generated config filename
:rtype: str
if var is not None:
return (Add, (field, 0, str(var)))
return (Delete, field)
- provider = batch_update_cnf(build_provider.BuildProvider(data=name),
+ provider = batch_update_cnf(build_provider.BuildProvider(data=name, instance=instance),
[(Update, ("PROVIDER_MODE", 0, mode)),
ip and (Update, ("PROVIDER_IP", 0, ip))
or (Delete, "PROVIDER_IP"),
def port_forwarding(src_port="1234", src_port_end="",
dst_port="1234", dst_port_end="",
- protocol_type="TCP", suffix="host"):
+ dst_ip_ref="1", protocol_type="TCP",
+ suffix="host"):
"""
Generate and save a port forwarding configuration file.
:param str src_port_end: forwarded source port end for a port range
:param str dst_port: forwarded destination port
:param str dst_port_end: forwarded destination port end for a port range
+ :param str dst_ip_ref: destination nic instance for a port range
:param str protocol_type: port forwarding protocol type
:param str suffix: optional suffix to use for config identification
:returns: generated config filename
return build_cnf("PORT_FORWARDING",
data=value_id,
filename=portforward_client_cnf,
- vals=[(Child, ("PORT_FORWARDING_DST_IP_REF", 0, "1")),
+ vals=[(Child, ("PORT_FORWARDING_DST_IP_REF", 0, dst_ip_ref)),
(Child, ("PORT_FORWARDING_DST_PORT", 0, dst_port)),
(Child, ("PORT_FORWARDING_DST_PORT_END", 0, dst_port_end)),
(Child, ("PORT_FORWARDING_PROTOCOL_TYPE", 0, protocol_type)),