Giter VIP home page Giter VIP logo

proxmox_wol's Introduction

proxmox_wol

A containerized utility enabling a magic packet sent to the broadcast address of a network to start a proxmox resource (qemu or lxc)

Configuration:

  • Create a proxmox pam user 'proxmox_wol'

  • Create a 'Role' in proxmox called 'proxmox_wol' and give it the following privileges: VM.Audit, VM.PowerMgmt

  • Create a 'User Permission' (Permissions) at both '/nodes' and '/vms' for 'proxmox_wol@pam' and assign the role created above, set Propagate to 'true'.

  • Create an API Token for the promox_wol user, set Token ID to 'proxmox_wol', disable 'Privilege Separation'. Note down the API token somewhere.

  • Create a config.py with values appropriate for your setup (you will be passing this into your docker container as a volume so locate it accordingly):

    pm_user = "proxmox_wol@pam"
    pm_token_name = "proxmox_wol"
    pm_token = "<proxmox-api-token-goes-here>"
    pm_nodes = {
         "proxmoxnode-01": {"ip": "192.168.20.2"},
         "proxmoxnode-02": {"ip": "192.168.20.3"}
    }
    wol_port = 9   ## this could be 7 or 9 depending on the wakeonlan client you are using to send magic packets
    

    Example docker compose file:

    services:
      proxmox_wol:
          container_name: proxmox_wol
          volumes:
              - '/path/to/config.py:/config.py'
          network_mode: host
          restart: unless-stopped
          image: lupinelab/proxmox_wol
    

    Start the container:

    docker-compose up -d
    

Notes:

  • The container must have the network_mode set to 'host' as magic packets are not forwarded when using the default bridged network driver
  • The container (and therefore docker host) must be in the same VLAN that you are sending magic packets from, although I'm sure it is possible to forward magic packets across VLANs through a variety of methods it's probably more convenient to setup an LCX container in the appropriate VLAN and have it run the container.

proxmox_wol's People

Contributors

lupinelab avatar

Stargazers

 avatar vanlab.co avatar Dave Johnson avatar ʞ-uɐʇsıɹʇ avatar

Watchers

 avatar

Forkers

hermesthecat

proxmox_wol's Issues

MAC addresses that begin with F shifts all characters left one position

Edit: Original Issue was named "VM does not start", I have changed the title to reflect what I discovered as I tested out different things trying to fix my problem.

I've setup this docker container on my Proxmox node (running 7.2-11) inside an LXC container.
I have also setup a portainer container and can confirm that docker in general is at least working

I have copied the docker-compose.yaml script you've provide and changed pm_nodes to the name and ip of my proxmox server (I only have the one so I deleted the second line)

I entered the pm user and token name and token that was generated and made sure everyone had the correct permissions

I can watch the logs of the container from portainer and see that it does see the magic packet come in and the mac address is of the VM I want to turn on, but the VM isn't turning on.

I'm not using VLANs, both my VM I want to turn on and my LXC container are using the vmbr0 bridge, the vm is using a VirtIO network card. When I send the magic packet I see this in my logs:

Listening for magic packets on port 9: Heard E9:DE:39:34:F5:1F Listening for magic packets on port 9: Heard E9:DE:39:34:F5:1F Listening for magic packets on port 9: Heard E9:DE:39:34:F5:1F Listening for magic packets on port 9: Heard E9:DE:39:34:F5:1F

Any ideas what is going on with it?

Improvement Suggestion: Magic Packet Port determines Power function

Hey, I wanted to say thanks for making this, it's working like a champ to wake my VMs. (I'm running docker in an LXC container on Proxmox in unprivileged mode in case anyone is wondering how to set it up later)

I was looking at this thread where they come at the issue from a different direction than you took to wake the VM and interestingly they included the following power options:
Wake up
Shutdown
Power Off
Suspend
Resume
Reboot
Reset

I was curious what your thoughts were about letting the port the magic packet came through on determine which power function was applied to the VM. Most the WoL packages I've looked at let me specify the port I want to use so it would be interesting if I could specify one port in the config file, say 9, to power it on and a second port, port 7 for example, to suspend it.

What are your thoughts?

No user permissions available

I'm likely being dense, but maybe there's a step worth adding to the readme.

After adding the pam user and creating the respective role, I found that there are no available permissions for the proxmox_wol user. Alternatively, the root user has many.

Does the proxmox_wol user need to be added to another group after creation?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.