Show Nethserver web interface URLs on login via issue

v7

(Markus Neuberger) #1

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/'

P3scan Suggestion
(Dan) #2

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).


(Markus Neuberger) #3

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


Set LAN IP after install
(Rob Bosch) #4

Love this enhancement! thnx for the effort!


(Jeroen Visser) #5

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 ?


(Markus Neuberger) #6

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.


(Dan) #7

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.


(Jeroen Visser) #8

@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.


(Markus Neuberger) #9

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?


(Stéphane de Labrusse) #10

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)


(Markus Neuberger) #11

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


(Jeroen Visser) #12

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.


(Markus Neuberger) #13

OK, that may really help in some cases


(Stéphane de Labrusse) #14

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


(Emiliano Vavassori) #15

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


(Markus Neuberger) #16

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 ?:


(Emiliano Vavassori) #17

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:


(Markus Neuberger) #18
  • 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


(Markus Neuberger) #19

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?


(Jeroen Visser) #20

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