How is "uniqid" for a VIP entry generated
-
I am writing a jinja based template engine for initial pfsense configuration. I've done most of the other configuration section and now I want to create the <virtualip> via a template. Could somebody explain how is the "uniqid" entry populated?
I've taken a look in https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/firewall_virtual_ip_edit.php
However I don't see it being set or generated in that file.
What is see is that it's always a alphanumerical field with lowercase letters and a length of 13 characters.
Could anybody confirm my assumptions?
Here is code example:
<vip> <mode>carp</mode> <interface>wan</interface> <vhid>2</vhid> <advskew>0</advskew> <advbase>10</advbase> <password>{{ carp_password }}</password> <uniqid>5aa10f2a5b569</uniqid> <descr><![CDATA[WAN IPv6 CARP IP]]></descr> <type>single</type> <subnet_bits>{{ wan_ipv6_network }}</subnet_bits> <subnet>{{ wan_carp_ip_ipv6 }}</subnet> </vip>
-
http://php.net/manual/en/function.uniqid.php
-
Hi jimp, thaks for the quick reply. So my suspicion is confirmed. 13 characters, alphanumeric.
-
Hello, I came across the same topic, it was very useful for me.
This is how I decided to implement it in ansible.
- name: "Generate a virtual ip address uniq id" ansible.builtin.debug: var: query('community.general.random_string', upper=false, special=false, min_numeric=10, min_lower=3, length=13) # Example result: ['202121w730p1q']