EzDevInfo.com

fqdn interview questions

Top fqdn frequently asked interview questions

Validate FQDN in C# using regex

I wrote the following pattern in C# to validate a FQDN received from a user:

(`?=^.{1,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[0-9a-zA-Z]{1,})$)

I want to allow the user to enter the following FQDN:

<name>.<letter><digit>

such as "aa.a1". For "aa.a1" my regex detects the FQDN as invalid, and for "aa.1a" it detects it as valid. Does anyone know why?


Source: (StackOverflow)

Translating NETBIOS domain into a FQDN (Fully Qualified Domain Name)

In short - How do I translate a NETBIOS domain to a FQDN ?

Details: Assuming I'm in domain A and I have user credentials for domain B which has a trust relationship with domain A (I can authenticate the credentials). How do I get domain B's FQDN when all I have are the credentials of some authenticated user from that domain, including the netbios domain name?

I'm coding in C# but a COM/WMI/Win32 solution would be welcomed as well.


Source: (StackOverflow)

Advertisements

Validate a FQDN

I found this regex at http://gskinner.com/RegExr/ to validate a FQDN domain:

(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]{1,63}(?<!-)\.?)+(?:[a-zA-Z]{2,})$)

it basically works but I want to modify it to not allow hostnames of three or more chars and no domain. For example, currently this is valid:

www

This isn't:

ww

This is too:

www.test.com

I want to modify it to not allow the first example. In other words, check that there's always a domain present.

Thanks.


Source: (StackOverflow)

How to find FQDN of local machine in C#/.NET ?

How can you get the FQDN of a local machine in C#?


Source: (StackOverflow)

Fully qualified domain name validation

Is there a quick and dirty way to validate if the correct FQDN has been entered? Keep in mind there is no DNS server or Internet connection, so validation has to be done via regex/awk/sed.

Any ideas?


Source: (StackOverflow)

Validate a hostname string

Following up to Regular expression to match hostname or IP Address? and using Restrictions on valid host names as a reference, what is the most readable, concise way to match/validate a hostname/fqdn (fully qualified domain name) in Python? I've answered with my attempt below, improvements welcome.


Source: (StackOverflow)

How can I get the FQDN of the current host in Ruby?

I need to get the fully expanded hostname of the host that my Ruby script is running on. In Perl I've used Sys::Hostname::Long with good results. Google seems to suggest I should use Socket.hostname in ruby, but that's returning just the nodename, not the full hostname.


Source: (StackOverflow)

Android Search Domains / FQDN

There is a bug in Android in using a simple domain name ej: myservice.local etc

In PCs you can use nslookup and you get the full domain name such as company.domain.com Then this domain can be used to create a socket in the android app.

If I look in /etc/resolv.conf in my PC there is a list of domain names So if I manually add them in code and try them one by one and see which one works:

protected static final String [] DNSSS = new String[] {
    "bla.bla.net",
    "aaa.bbb.net",
    "comp.com",
    "ddd.cccc.net",
    "comp.net"
};

So my question is now: how can I do something that could work in a more general way? Of course I can add user settings where they could add their dns servers one by one but what are the other options? How could I solve this problem and somehow get this list of servers from local network but in android?


Source: (StackOverflow)

Puppet Behaviour not consistent in Amazon VPC

I'm testing out puppet in Amazon VPC and found out its behavior is not consistent. In Amazon EC2, puppet works out perfectly fine. But while running puppet manifests in Amazon VPC, sometimes it runs properly..sometimes not.

root@ip-10-0-0-123:~# puppet apply /etc/puppet/manifests/site.pp

dnsdomainname: Name or service not known
dnsdomainname: Name or service not known
dnsdomainname: Name or service not known
warning: Could not retrieve fact fqdn
dnsdomainname: Name or service not known
warning: Host is missing hostname and/or domain: ip-10-0-0-123

I feel that it is because of fqdn not defined properly in Amazon VPC.

Issuing 'hostname -f' throws error : hostname: name or service not known. Same happens for dnsdomainname.

Do anyone have any idea how to fix this ?


Source: (StackOverflow)

Install Chef-Server 11 on EC2 Instance

I am using hosted Chef for quite some time. Wanted to explore the opensource chef server. hence I am trying to setup my Chef-Server 11 on EC2 instance.

I have Chef-server running and I can access the web GUI for the same. I have the chef-workstation configured on another ec2 instance that is also working fine.

Problem: I am not able to upload any cookbook. I get below error when I try uploading the cookbook:

# knife cookbook upload getting-started
Uploading getting-started [0.4.0]
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:763:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)

However, other list commands of knife are working fine.

I did my home work and bumped on below links:

http://www.opscode.com/blog/2013/03/11/chef-11-server-up-and-running/

http://www.curvve.com/blog/servers/2013/script-to-configure-and-set-your-hostname-and-fqdn-on-ec2-instances/

So,

It is mentioned that the chef-server needs a working FQDN to work. I set the my public ec2 host name as the hostname of the server as well as set it up in /etc/hosts. Rebooted the instance. Ran chef-server-ctl reconfigure again. And still facing the same error.

QUESTION: How to figure out the FQDN part of the EC2 instance for chef-server to work? if anyone has set up chef-server successfully on EC2 and was able to upload the cookbooks, then please share your steps for FQDN workout.


Source: (StackOverflow)

get domain name from FQDN?

I am trying to get the NetBios name from a fully qualified Domain Name...

the user inputs the FQDN and i convert to NetBios name for

eg xyz.test.com (this is just an example, the FQDN an be anything)

to its NetBios (i am not sure if it is called NetBios please feel free to correct me) name 'xyz'.

is there a way to do this..??

thanks

understanding part??

I am a bit confused with the terms...

we have clients with different FQDNs like xyz.test.com or int.hdsh.local and so on..

i need to get the domain name out of these so i can form domain\username

so the above examples look like xyz\username and hdsh\username..

as we can see the 2nd FQDN has 2nd part as domain.

so i need help is figuring out which is the domain within a FQDN.


Source: (StackOverflow)

How to get current system FQDN in php-cli?

Is there a way to retrieve current system fully qualified domain name using php-cli?

What I'm looking for is php function to retrieve the same thing that hostname -f is doing:

$ hostname -f  #returns needed: system01.dev.lan

I tried following:

php_uname('n') // returns: system01
gethostname() // returns: system01
gethostbyname(gethostname()) // returns ip address
gethostbyname(gethostname() . '.') // returns system01

$_SERVER dose not exist (because only cli env)

Again, I know I can do this

php -r "var_dump(shell_exec('hostname -f'));"

But for this trivial task, I think php should have built in functionality to retreive fqdn.


Source: (StackOverflow)

Tomcat with 1-way and 2-way SSL

I have a service A that uses 1-way SSL and also 2-way SSL to make secure requests to service B. 1-way SSL is specified by Tomcat config, I provide keystoreFile, keystorePass, enable SSL, etc. 2-way SSL is implemented using JSSE on the client (service A). I know this could be done similarly in Tomcat server.xml too (example is here: http://blog1.vorburger.ch/2006/08/setting-up-two-way-mutual-ssl-with.html).

Part of my 1-way SSL Tomcat configuration:

<Connector port="securePort"
           scheme="https"
           secure="true"
           clientAuth="false"
           sslProtocol="TLS"
           SSLEnabled="true"
           keystoreFile="keystoreFile"
           keystorePass="keystorePass"
           keystoreType="keystoreType"
           ...
/>

Is there a way to specify both 1-way and 2-way (client side) SSL for the same service in Tomcat though. The challenge here is that I'm using 2 certificates (server and client one) on the same IP. Any hints?


Source: (StackOverflow)

Outlook.com (hotmail) blocking images from alt-port or non fqdn src

Morning all,

So I have a strange issue with Outlook.com, former hotmail.com...

I am working on a project to supply businesses with micro servers (raspberry pi) which I have setup as apache servers, and installed an HTML/PHP/BASH program that allows the user to create html email campaigns and send them to groups of contacts. The program/hardware works perfectly.

Except:

Emails received by outlook clients do not receive the images (just place-holders).

I have figured out though testing that the images are blocked because the src="non-fqdn" - in other words, I am using the IP of the client without registering a domain - because that is over complicated and they are NOT hosting a website. So there should be no reason for an fqdn.

If this problem can be solved, don't read further!!!

BTW Every other MUA renders the images perfectly :-(

So I am re thinking a way around this, and figured I would host the images on my own domain, however; the clients raspberry pis will need to be able to upload the images on a server within my domain, so for security reasons, I have setup a stand-alone headless server for just that purpose, and aligned it to port 8080. Problem solved right? NO!

Outlook still bloody blocks them. WHY!!!!

Here is an example to explain my problem.

Consider the following IMG codes which would be in the email html:

Eg. 1
<img src="http://fqdn.com/images/example.jpg" width="30%" align="center">

Eg. 2
<img src="http://fqdn.com:8080/images/example.jpg" width="30%" align="center">

Eg. 3
<img src="http://IP/images/example.jpg" width="30%" align="center">

In Eg.1 The image is rendered perfectly. In Eg.2 & 3 The images are blocked.

Note: fqdn in both 1 and 2 are the same.

Please help me :-) Months of work about to be shit canned...

Tim


Source: (StackOverflow)

how to find FQDN for any machine name in multi domain scenario

I found this question for getting FQDN of localhost. My question is, is there any way to get the FQDN of machine which is not in same domain as host machine where we query in c#.

For eg: on machineA (in Domain A) runs a program to find out FQDN of machineB (in Domain B).


Source: (StackOverflow)