[FEATURE-1260] Perspective Security Zone Host Name


I’d like to use the security zones to restrict unauthenticated Perspective project access to a select few fixed HMIs. Setting up a zone using the host names is ideal, but the browser session does not expose the host, only the IP.



The effect is that any security zone set up by host name does not correctly pick the computer. Works perfectly by IP address.

Host is preferred as I never know what happens to the DHCP reservations.

Can this work somehow?


1 Like

I don’t see a way round this right now. I’ll log a feature ticket to explore a solution. It will most likely have to rely on the gateway’s ability resolve a host name using reverse lookup on the session IP.



For the time being, I’ve requested DCHP reservation and used the IP.

Is there any traction on this? I just hit this restriction as well since i would like to create memory tags based on host names and store information in them.

It’s still on our backlog and has been reviewed, although development work has not yet begun.

1 Like

Facing the same problem. Here is a script I put together to get the HOSTNAME via NSLOOKUP. You can add this to your Project Library.

def GetHostName(Host):
	This will do an nslookup and get back the results like below 
	Server:  dns1.example.com
	Non-authoritative answer:
	Name:    LAPTOP.example.com
	it will then parse the output plucking the "Name:" line and
	returning the FQDN for the client.
	import subprocess
	# perform the nslookup
	proc = subprocess.Popen(["nslookup", Host], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
	output = proc.stdout.read()
	# convert the output to a list (array)
	lines = output.split('\n')
	name = ""
	# look for the "Name:" line	
	for line in lines:
		if "Name:" in line:
			name = line
	# return if we don't find it
	if not name:
		return name
	# split the name line into a list and return the last part (FDQN)
	# make sure to strip it
	return name.split(' ')[-1].strip()

May not need an external process.

from java.net import InetAddress

def getHostName(host):
	ia = InetAddress.getByName(host)
	return ia.getCanonicalHostName()

More reliable techniques with javax.naming.directory on stack overflow. Also with no subprocess or parsing.

tried it but I keep getting an Expression Error. I don’t think it likes the java.net import. I am placing this in the Project Library. Maybe i’m supposed to be placing it somewhere else?

from java.net import InetAddress

def GetHostName(Host)
ia = InetAddress.getByName(Host)
return ia.getCanonicalHostName()

The latest 8.1.9 early access build includes a new capability to opt-into client hostname resolution. For more detail, see: Nightly 8.1 Changelogs - 2021 - #128 by sreis