> On July 28, 2016, 3:38 p.m., Jonathan Hurley wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/utils/HostUtils.java, 
> > lines 44-46
> > <https://reviews.apache.org/r/50577/diff/1/?file=1456787#file1456787line44>
> >
> >     Could you instead use Guava's `InternetDomainName.isValid(String)` for 
> > this?

`InternetDomainName.isValid(String)` does not allow for hostnames that start 
with a digit - like "1localhost". This is supposed to be allowed according to 
RCF 1123:

>From https://www.ietf.org/rfc/rfc1123.txt

```
   2.1  Host Names and Numbers

      The syntax of a legal Internet host name was specified in RFC-952
      [DNS:4].  One aspect of host name syntax is hereby changed: the
      restriction on the first character is relaxed to allow either a
      letter or a digit.  Host software MUST support this more liberal
      syntax.
```

Do we want to allow such hostnames?  I think we can go with this, and if somene 
hits a validation issue, the feature can be turned off via the 
ambari.properties file.  What do you think?


- Robert


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/50577/#review143980
-----------------------------------------------------------


On July 28, 2016, 2:09 p.m., Robert Levas wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/50577/
> -----------------------------------------------------------
> 
> (Updated July 28, 2016, 2:09 p.m.)
> 
> 
> Review request for Ambari, Dmytro Sen, Jonathan Hurley, Myroslav 
> Papirkovskyy, Nate Cole, and Robert Nettleton.
> 
> 
> Bugs: AMBARI-17908
>     https://issues.apache.org/jira/browse/AMBARI-17908
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Ensure the supplied hostname is a valid hostname when signing agent-side host 
> certs via the following REST API call:
> 
> ```
> POST /certs/:HOSTNAME
> ```
> 
> This is a validity check to make sure only valid hostname are handled. 
> 
> The following industry accepted regular expression maybe use to validate 
> hostnames: 
> ```
> ^(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-_]*[a-zA-Z0-9]).)*(?:[A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-_]*[A-Za-z0-9])$
> ```
> 
> 
> Diffs
> -----
> 
>   
> ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
>  9655bf9 
>   
> ambari-server/src/main/java/org/apache/ambari/server/security/CertificateManager.java
>  b698ef3 
>   ambari-server/src/main/java/org/apache/ambari/server/utils/HostUtils.java 
> PRE-CREATION 
>   
> ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
>  b5d0e02 
>   
> ambari-server/src/test/java/org/apache/ambari/server/security/CertificateManagerTest.java
>  PRE-CREATION 
>   
> ambari-server/src/test/java/org/apache/ambari/server/utils/HostUtilsTest.java 
> PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/50577/diff/
> 
> 
> Testing
> -------
> 
> Manually tested
> 
> 
> # Local test results:
> 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 1:26:42.515s
> [INFO] Finished at: Thu Jul 28 13:22:10 EDT 2016
> [INFO] Final Memory: 60M/1859M
> [INFO] 
> ------------------------------------------------------------------------
> 
> # Jenkins test results:  PENDING
> 
> 
> Thanks,
> 
> Robert Levas
> 
>

Reply via email to