OpenVZ Forum


Home » General » Support » Access to /sys/class/dmi/id/* from VE
Access to /sys/class/dmi/id/* from VE [message #37427] Tue, 08 September 2009 22:31 Go to next message
ramjet is currently offline  ramjet
Messages: 16
Registered: September 2009
Junior Member
I would like to access the dmi values /sys/class/dmi/id/* of the hardware host inside the VE's.
E.g.
/sys/class/dmi/id/product_serial
/sys/class/dmi/id/product_uuid

I can achieve it using dmidecode(1) after applying
DEVNODES="mem:r "
CAPABILITY="SYS_RAWIO:on "

but I prefer the simple /sys/class interface because of security issues and because dmidecode can be spoofed.

I have looked at the kernel sources and thought it would an easy task but found the code too generic for me.
Re: Access to /sys/class/dmi/id/* from VE [message #37445 is a reply to message #37427] Fri, 11 September 2009 13:19 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

I'm afraid nobody will prepare a patch for this particular thing mostly because nobody will support a custom kernel.

I think that you show a good way of solving your problem.

Do these parameters are only readable?
Don't you want to use bindmounts from the HN into the VE.
Re: Access to /sys/class/dmi/id/* from VE [message #37455 is a reply to message #37445] Fri, 11 September 2009 19:43 Go to previous messageGo to next message
ramjet is currently offline  ramjet
Messages: 16
Registered: September 2009
Junior Member
Thanks for your answer.

I just tested bindmount which worked except I was not allowed to create mountpount $VZDIR/root/148/sys/class/dmi so I created $VZDIR/root/148/tmp/dmi and could bindmount there.

Let me explain why I need this. I have created a simple software license key system which is bound to the serialnumber and UUID of a physical server. I read those values from the files found in /sys/class/dmi/id/. So using bindmount I could try to read dmi values from /sys/class/dmi and if that doesn't succeed I could try to look at some other mountpount as a fallback.

It would be really awesome if OpenVZ could support fake dmi values per container like VMware and Paralllels do:

VMware
system-product-name=VMware Virtual Platform

Parallels
system-product-name=Parallels Virtual Platform

Do you have any idea of how difficult that would be?

The following information should be available:
bios_date
bios_vendor
bios_version
board_asset_tag
board_name
board_serial
board_vendor
board_version
chassis_asset_tag
chassis_serial
chassis_type
chassis_vendor
chassis_version
product_name
product_serial
product_uuid
product_version
Re: Access to /sys/class/dmi/id/* from VE [message #37611 is a reply to message #37445] Wed, 30 September 2009 19:55 Go to previous message
ramjet is currently offline  ramjet
Messages: 16
Registered: September 2009
Junior Member
Bindmount works fine but I need to mount my directory with fake dmi files at /sys/class/dmi/id.

How can I add the directories dmi/id to the /sys/class hierarchy and make id directory writeable so I can bindmount there?

I really appreciate any help or pointers for this.
Previous Topic: chkpnt: Error: d_path is invisible /var/lock
Next Topic: I figured it out.
Goto Forum:
  


Current Time: Thu Aug 22 11:14:46 GMT 2024

Total time taken to generate the page: 0.04734 seconds