Hetzner - DokuWiki

IPMI/en
K (Model Overview)
K (GRUB (grub-legacy))
Zeile 279: Zeile 279:
 
  terminal --timeout=5 serial console
 
  terminal --timeout=5 serial console
  
At the same time, the same serial port needs to be added to the boot options of the kernel. That is ttyS0 with the PX60/70, ttyS1 with the PX91/121 und ttyS2 with the PX90/120.
+
At the same time, the same serial port needs to be added to the boot options of the kernel. That is ttyS0 with the PX60/70, ttyS1 with the PX91/121 and ttyS2 with the PX90/120.
  
 
  console=tty0 console=ttyS0,115200n8
 
  console=tty0 console=ttyS0,115200n8

Version vom 1. Juli 2015, 14:29 Uhr

Inhaltsverzeichnis

IPMI Information

IPMI (Intelligent Platform Management Interface) is an interface for the management and administration of servers. The is implemented by a BMC (Baseboard Management Controller) of a motherboard. This interface can be accessed via a command-line program (such as ipmitool) or a web interface, through which administration tasks can be performed. Such tasks include performing a reset, starting a KVM and reading the output of the motherboard sensors.

Model Overview

  • PX60(-SSD)/PX70(-SSD) - BMC incl. IPMI (KVM-over-IP as an optional paid module)
  • PX90(-SSD)/PX120(-SSD) - BMC incl. IPMI and KVM
  • PX91(-SSD)/PX121(-SSD) - paid optional BMC module with IPMI/KVM

Activation of the Network Interface

Some PX servers have an integrated BMC, while with others this can be added as a module. With the integrated BMC, the network configuration is disabled by default. To use the IPMI and Serial over LAN and/or KVM functionality an additional fee-based IP address needs to be ordered via the Robot.

Important: The MAC address of the BMC must be specified when ordering the additional IP address.

The MAC address can be read using ipmitool (see Network). After allocation of the IP address it can be statically configured or assigned via DHCP to the BMC.

Adding a BMC module / Unlocking the KVM functionality

To add the BMC module (incl. IPMI and KVM) with the PX91 and PX121 models, or to activate the KVM Option (incl. Virtual Media) with the PX60 and PX70 models, the KVM add-on module must be ordered via the Hetzner Robot. To install the add-on module, the server must be shut down. The downtime for this is only a few minutes.

Safety Instructions

If the BMC is made accessible by assigning a public IP to it, it can be attacked and under certain circumstances abused, leading to the server potentially becoming compromised. Therefore, measures should be taken to counteract the well-known attack scenarios. With the Metasploit penetration tool collection some attacks can be carried out (https://community.rapid7.com/community/metasploit/blog/2013/07/02/a-penetration-testers-guide-to-ipmi).

The motherboard used in the models PX60 and PX70 is not vulnerable to the options described in the link, as some protection mechanisms are already installed by default. Generally the default passwords should be changed and already existing users disabled or renamed. Anonymous access is deactivated by default on all models. The other attack vectors and their prevention are described in the following points.

Current Threats

Vulnerabilities

Since the BMC that provides the IPMI functionality is simply software, there can be vulnerabilities in this.

Note: For the motherboard of the models PX90/120 (Supermicro X9SRi-F) a vulnerability was discovered in the 2.14 firmware version, allowing usernames and passwords to be read in plain text. If your server has this firmware, a firmware update is required before activating the network interface.

The firmware version can be read using ipmitool:

# ipmitool mc info
...
Firmware Revision         : 3.39

If you have already activated the network of the IPMI, you can perform the update via the web interface. You can find the latest version on download.hetzner.de.

Alternatively, an update is also possible under Linux if the network of the IPMI has not been activated:

wget http://mirror.hetzner.de/tools/Supermicro/tools/SMT_X9_339.tgz
tar -xzf SMT_X9_339.tgz
cd SMT_X9_339
./lUpdate -f SMT_X9_339.bin

Please note that this update only applies to the PX90 or PX120.

Cipher 0 Attacks

Cipher 0 means that no encryption is used and thus any authentication is bypassed. By default Cipher 0 is only activated on the motherboard for callback, meaning logging in is not possible, only the response of whether BMC is there or not can be gotten. To ensure that even with that no abuse can take place the Cipher 0 is disabled by default on delivery of the server and can therefore no longer be used.

Transmission of the password's hash

In the IPMI specification, the authentication of the user is only possible on the user side. Therefore, a hash of the password is transmitted to any requesting users. As it specifies exactly what this hash contains, there is the possibility of finding the password via brute-force attack. Due to this being part of the IPMI specification, this problem is found on all BMCs and can only be remedied by changing the specification. Therefore, the only note about this issue is to use a really long and strong password for the BMC to make it as difficult as possible for any attackers. If a short or easy to guess password is used for the BMC it can be compromised within hours or even minutes.

Here are some tips for a secure password:
Should the password be easy to remember, it makes sense to string together several words that have no connection to each other (http://correcthorsebatterystaple.net/). This is secure due to the length and yet still easy to remember.
If the password is stored in a database and does not need to be remembered, then you can use sufficiently random numbers and letters in a reasonable length (> 30 characters) to create a secure password.

Explanation of individual functions

Web Interface

The web interface can be used to read data from the BMC easily and securely. It displays all sensors, users can be added and changed, the network configuration can be set, and if you have a KVM, it can be started

System Information: On this page, you can find some information about your server (BIOS version, current status, CPU and RAM information) and you can see the users who are currently signed in.

Server Health: Here, you can see the output of individual sensors on the motherboard and in the CPU. If there are any thermal problems, you can detect them here. Furthermore, there is an event log. In the log, you can find system events, such as critical temperatures, reboots, and CPU throttling. This may help you diagnose a potential problem. The page "Power Statistics" does not work with this model because the power supply does not have the necessary PMBUS interface.

Configuration: Here you can configure many options of the BMC. The network settings do not usually need to be changed because the configuration for IPv4 is set automatically via DHCP. You can manually configure IPv6, but using the Hetzner default gateway fe80::1 will be possible with future firmware versions only. You can also add new users here, as well as change and delete existing ones. Additionally, the option "Alerts" allows you to have notifications sent via SNMP or email when certain events occur on the server. This can be useful for monitoring the server.

Remote Control: On this page, you can use the KVM functionality of the BMC. However, the option "Console Redirection" is only available if you activate an additional module. You can always use "Server Power Control". This allows sending a hardware and software reset to the server as well as shutting it down or starting it.

Configuration

In this section some basic configuration options are shown. In most cases the web interface of the BMC can be used. It is also recommended to install "ipmitool", which can be installed via the package manager of all major distributions. This gives access to additional functions which can not be configured via the web interface.

Example for Debian:

Installation via the package manager:

apt-get install ipmitool

In order for ipmitool to function the following modules must be loaded via "modprobe":

modprobe ipmi_devintf
modprobe ipmi_si

To check if everything important was correctly loaded and installed the following example command can be used, which will show the data from all available sensors:

ipmitool sensor list

Users

On the BMC several users can be created with different rights. After creating a new user with administrative rights via ipmitool, more users can be managed via the web interface. There are 4 different rights/permission levels:

  • Callback (1): Can only initiate a callback
  • User (2): Can send read-only requests but cannot change any configuration files
  • Operator (3): Can change all configurations apart from deactivating the channel and changing rights
  • Administrator (4): Can change all configurations

Usually one or more users already exist. An overview of the existing user IDs and logins can be obtained via:

ipmitool user list 1

In the PX90/PX120 models an active user with administrative rights already exists:

ID  Name             Callin  Link Auth  IPMI Msg   Channel Priv Limit
2   ADMIN            false   false      true       ADMINISTRATOR

In the BMC/KVM modules of the PX91/PX121 models there are two actve users with administrator rights:

ID  Name             Callin  Link Auth  IPMI Msg   Channel Priv Limit
1                    false   false      true       ADMINISTRATOR
2   admin            false   false      true       ADMINISTRATOR

In the PX60/PX70 models there are 5 standard inactive users, which can be changed with the exception of the first one.

ID  Name             Callin  Link Auth  IPMI Msg   Channel Priv Limit
1                    true    false      true       ADMINISTRATOR
2   root             false   true       true       ADMINISTRATOR
3   test1            true    false      true       ADMINISTRATOR
4   test2            true    false      true       ADMINISTRATOR
5   test3            true    false      true       ADMINISTRATOR

The root (or ADMIN) user ID should be deactivated and, if possible, renamed after creating a customer user and before activating the network configuration.

Changing the login name can be done via ipmitool:

ipmitool user set name 2 john-doe

To create a new user simply assign a previously unused ID a name. The procedure here is identical to changing the login of an ID. A deletion of IDs is possible only by resetting the BMC settings.

Create a new user:

ipmitool user set name 6 max+meier

After that a password should be set:

ipmitool user set password 6 Correct-Battery-Horse-Staple

Now the access for this user should be activated:

ipmitool channel setaccess 1 6 link=on ipmi=on callin=on privilege=4

The user itself should also be activated:

ipmitool user enable 6

To change the password of the user the following command suffices:

ipmitool user set password 6 Battery+Staple-Horse$Correct

Finally the default admin user is deactivated:

ipmitool user disable 2

Network

In order to make the BMC accessible via the internet, you need to order an additional (fee-based) IP for it via Robot. The IPv4 configuration of the BMC can be done either manually or via DHCP using ipmitool. You can make changes to this configuration using the web interface at "Configuration / IPv4 Network". Using IPv6 is currently not possible. The configuration will be possible later using the web interface.

The initial configuration can be set using ipmitool. The corresponding IPMI channel is dependent on the motherboard and which inferface to configure.

Shared LAN port of the main IP

  • PX60/70/90/120: Channel 1
  • PX91/121: Channel 8

To display the current configuration and the MAC address of the BMC, the following command is sufficient:

  • PX60/70/90/120:
ipmitool lan print 1
  • PX91/121:
ipmitool lan print 8

As shown above, "set 8" is to be used, rather than "set 1", for all other commands for the PX91/121.

To receive an IP via DHCP, use the following command:

ipmitool lan set 1 ipsrc dhcp

If you want to use the default static configuration, enter:

ipmitool lan set 1 ipsrc static

Setting an IP address:

ipmitool lan set 1 ipaddr <IP address>

Setting a netmask:

ipmitool lan set 1 netmask <netmask>

Setting a gateway IP:

ipmitool lan set 1 defgw ipaddr <gateway IP address>

Serial over LAN

In order to activate SOL (Serial over LAN), enter the following command:

ipmitool -C 3 -I lanplus -H <ipaddr> -U <user> -P <pass> sol activate

Using cipher suite 3 is essential (if that is not the default) because communication via lanplus is not possible otherwise.

If the following error message appears, you need to activate SOL for the user:

$ ipmitool -C 3 -I lanplus -H <ipaddr> -U <user> -P <pass> sol activate
Info: SOL payload disabled
$ ipmitool -C 3 -I lanplus -H <ipaddr> -U <user> -P <pass> sol payload enable <channel> <user-id>

After that, you can see the BIOS output. Accessing the boot loader and/or the booted system requires additional settings.

GRUB2

For GRUB2, simply change some lines to match the following in /etc/default/grub and re-generate the settings.

With the PX90/120 (Supermicro X9SRi-F) the serial console is on ttyS2/unit=2, with the PX91/121 (Asus Z10PA-U8) it is on ttyS1/unit=1 and with the PX60/70 (Intel S1200V3RPL) it is on ttyS0/unit=0. It should also be noted that the baud rate needs to be set at 57600 with the PX91/121, and 115200 with all others.

PX60/70

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset console=tty0 console=ttyS0,115200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"

PX90/120

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset console=tty0 console=ttyS2,115200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=2 --word=8 --parity=no --stop=1"

PX91/121

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset console=tty0 console=ttyS1,57600n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=57600 --unit=1 --word=8 --parity=no --stop=1"

GRUB (grub-legacy)

For GRUB1 (grub-legacy), add the following lines to /boot/grub/menu.lst or /boot/grub/grub.conf (CentOS):

PX60/70

serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console

PX90/120

serial --unit=2 --speed=57600 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console

PX91/121

serial --unit=1 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console

At the same time, the same serial port needs to be added to the boot options of the kernel. That is ttyS0 with the PX60/70, ttyS1 with the PX91/121 and ttyS2 with the PX90/120.

console=tty0 console=ttyS0,115200n8

This tells the kernel to output information on the first serial port. The change of GRUB_TERMINAL to serial means any input/output is redirected to the serial port. A local screen will not display a boot menu anymore and thus, selecting a boot entry via LARA or KVM is not possible anymore. After a reboot, the output will be sent both locally and to the serial port.

After that, you need to set up a terminal for the serial port in your system.

Debian 7.x (wheezy) / Debian 8 with Sys-V Init

The following line needs to be added to /etc/inittab. Here again: ttyS0 and 115200 Baud with the PX60/70, ttyS2 and 115200 Baud with the PX90/120 and ttyS1 and 57600 Baud with the PX91/121:

T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100

After that, you can activate the terminal by entering 'init q'.

Ubuntu (up until 14.10 with Upstart)

Create the file /etc/init/ttyS0.conf with the following content (or appropriately ttyS2.conf with ttyS2 and 115200 Baud with the PX90/120 or ttyS1.conf with ttyS1 and 57600 Baud with the PX91/121):

# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -L ttyS0 115200 vt100

After that, you can activate the terminal by entering 'start ttyS0'.

CentOS

In CentOS 6.x, the configuration is similar to Ubuntu. However, /etc/init/serial.conf automatically starts a getty on the serial port, which adds the port /etc/securetty. It is therefore sufficient to configure the serial console in grub.conf and attach the appropriate kernel option.

Debian 8 / OpenSuSE / Fedora

For Debian 8 (jessie), OpenSuSE and other distributions such as Fedora which use systemd and GRUB2, just change /etc/default/grub accordingly and renew the configuration using grub2-mkconfig. At the next boot, systemd will automatically start using the serial port of GRUB2.

Serial Console

Now, you will see a login prompt if you connect via ipmitool:

 $ ipmitool -C 3 -I lanplus -H <ipaddr> -U <user> -P <pass> sol activate
 [SOL Session operational.  Use ~? for help]

 Debian GNU/Linux 7 Debian-70-wheezy-64-minimal ttyS0

 Debian-70-wheezy-64-minimal login:


© 2019. Hetzner Online GmbH. Alle Rechte vorbehalten.