stephdl
(Stéphane de Labrusse)
October 11, 2016, 9:06pm
1
I don’t know if it is a feature, or a bug, but hostname (ServerNames property) can be set even if they are not real (FQDN) hostname in the virtualhosts panel.
Of course there are some validators in /usr/share/nethesis/NethServer/Template/VirtualHosts/Modify.php but they don’t work.
My php is a bit rusted
giacomo
(Giacomo Sanchietti)
October 12, 2016, 7:12am
2
Sorry but I don’t understand
Can you provide an example?
stephdl
(Stéphane de Labrusse)
October 12, 2016, 10:13am
3
In the virtualhosts panel you ask to set a fqdn domain name and i can write a bad domain name like ‘toto’
giacomo
(Giacomo Sanchietti)
October 12, 2016, 12:22pm
4
Got it, thank you!
It seems that the interface is accepting hostname, not FQDN.
From apache 2.4, even a hostname (not FQDN) should be valid:
https://httpd.apache.org/docs/2.4/mod/core.html#servername
This is the relevant part in Web UI:
$this->setViewTemplate('Nethgui\Template\Table\Delete');
}
parent::initialize();
}
public function validate(\Nethgui\Controller\ValidationReportInterface $report)
{
parent::validate($report);
if ( ! $this->getRequest()->isMutation()) {
return;
}
$serverList = explode(',', $this->sanitizeServerNames($this->parameters['ServerNames']));
$validHostname = $this->createValidator()->hostname();
foreach ($serverList as $serverName) {
if ( ! $validHostname->evaluate($serverName)) {
$report->addValidationError($this, 'ServerNames', $validHostname);
}
if($this->findServerName($serverName, array($this->parameters['name']))) {
$report->addValidationErrorMessage($this, 'ServerNames', 'valid_servername_already_used', array($serverName));
}
}
2 Likes
davidep
(Davide Principi)
Closed
October 13, 2016, 12:22pm
5
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.