Show Nethserver web interface URLs on login via issue

Continuing the discussion from Set LAN IP after install:

As @danb35 suggested, it may help users to see where to login.
I’d do it via /etc/motd like this:

Create a custom template /etc/e-smith/templates-custom/etc/motd/90nethurl

mkdir -p /etc/e-smith/templates-custom/etc/motd/
nano /etc/e-smith/templates-custom/etc/motd/90nethurl

with following content:

To login to NethServer please use following URL(s):

{
    use esmith::NetworksDB;
    my $ndb = esmith::NetworksDB->open_ro() || return;
    foreach ($ndb->interfaces()) {
        if($_->prop('ipaddr')) {
            $OUT .= sprintf "https:\/\/%s\:980\n", $_->prop('ipaddr');
        }
    }
}

Save it and do:

At login you’ll see:

login as: root
root@192.168.33.133's password:
Last login: Sun Dec 17 01:01:02 2017 from 192.168.33.199

************ Welcome to NethServer ************

This is a NethServer installation.

Before editing configuration files, be aware
of the automatic events and templates system.


          http://docs.nethserver.org

***********************************************

To login to NethServer please use following URL(s):

https://192.168.33.133:980

But I don’t know if it would work on first boot because maybe there are no entries in NetworksDB, need to be checked…

Alternative method to get interface IPs:

ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | sed 's/.*/https:\/\/&:980/'
4 Likes

That would be an improvement over current, but I’d favor it appearing pre-login (as in the two screenshots I showed in the other thread).

OK, just replace /etc/motd with /etc/issue.

mkdir -p /etc/e-smith/templates-custom/etc/issue/
nano /etc/e-smith/templates-custom/etc/issue/90nethurl
...
expand-template /etc/issue

5 Likes

Love this enhancement! thnx for the effort!

2 Likes

Given the fact that many seem to bump into this, great addition. However, how does this help people doing a remote install ? Should you even allow DHCP for a server without making that an express choice having to confirm at least twice ?

It doesn’t.

You are right, a server should have a static IP.
People are warned to switch to a static IP after install, which is a good method for getting network connectivity on install via DHCP and having a static IP afterwards I think.

1 Like

They see it through whatever their remote console capabilities (i.e., out-of-band management) are. They must have some such capabilities, otherwise they wouldn’t be able to do the install in the first place.

2 Likes

@mrmarkuz I would add a little section to the setup to setup the IP for after reboot, and use DHCP to get updates during install and stuff like that.

@danb35 I wasnt sure if that holds true for VPS’s, but yeah, it is a pre-requirement, you are right.

Sorry, I don’t see the advantage…so that one has to set a static IP during setup? After reboot at the end of the initial wizard you are redirected to network page and warned to change to static IP. Isn’t it just a change in the order the static IP is setup before instead after reboot?

pre-requirement yes but not a really elegant solution because when you install with a proxmox host in a remote server I have no dhcp, so the installation fails to a dummy IP ‘192.168.1.1’ which is useless in my case and I need to change the IP manually by the db interface after the installation. of course the most of time it goes to a discourse issue, or worse by the loss of potential users because even if the installer is what you use one time, it is the look of the distro you keep in mind when you test it.

What it could be interesting is to add a new menu to set th network, like the language in the anaconda installer (you see a warning to configure it) and let the system admins choose its network settings. Or at least your howto should be documented and used as official documentation (or goes to the networking wiki page)

1 Like

Shame on me I haven’t done it already: Thanks again, @planet_jeroen for this howto. I put it to the wiki as a first step:

https://wiki.nethserver.org/doku.php?id=basic_installation

I tagged it to the user guides because it covers a complete basic install which is more than just networking:

https://wiki.nethserver.org/doku.php?id=user_guides

2 Likes

It would serve only one purpose: force the person doing the install to think about the IP to be used, and notify him/her that not setting this can, and likely will, lead to frustration in trying to figure out where the Gui answers after reboot.

Given the scenario by @stephdl, where there is no DHCP and the default will never work, it would prevent unnescessary wasted time when you force someone past this configuration, taking into account that it will likely need to be set in 90% of the use-cases anyway.

2 Likes

OK, that may really help in some cases

1 Like

the way is the quickstart file : https://github.com/NethServer/nethserver-createiso/tree/master/src/lib/ks

Love this approach, what about doing something like (for example) VMware ESXi and show all the assigned IPs?

This is already included (see first post), but it just shows all interface ips, no matter if it’s allowed by firewall but it would help at least at first reboot:

foreach ($ndb->interfaces()) {

ESXi also shows the hostname not only the IPs, what about adding https://hostname.domain.local:980 ?:

Sorry, missed it. Good job!

About showing FQDN: it has some meanings only if there is a DHCP involved (or a complete infrastructure aside of the NS). I have no doubt users at first installation will not use FQDN to finish configuration. I would understand it only for aesthetic purposes, maybe. At least these are my 2 cents :wink:

1 Like
  • Force user to think about setting IP as @planet_jeroen suggested: I only see the possibility to change interactive installation in a way not presetting the network, so the sysadmin has to do it at installation. Or is there a way to just show a warning during installation?

  • Show IPs/URLs on login: Is this fix still needed at the end of the ks file as /etc/issue is templated? if [ -f /etc/nethserver-release ]; then echo "Fix /etc/issue..." cp -f /etc/nethserver-release /etc/issue echo -e 'Kernel \\r on an \\m\n' >> /etc/issue fi

Is it enough to show the URLs on first boot or is it better to show them anytime?

Sorry @planet_jeroen, I did not find a way to put a warning to the setup screen. Only way I see is to unset the network, so one has to configure it. Maybe a warning in the docs about setting IP on VPS is enough?

1 Like

Personally I am of the philosophy that if you require documentation to install the basics, you either shouldn’t run a server, where sloppy or are in way over your head and should get to know your distro better, or the distro just sucks.

Any help here is great for new users tho, vps install should be skilled anyway

1 Like