https://codingpackets.com/blog/pfsense-qemu-guest-agent/
Contents
Intro
I use Proxmox for my hypervsior and recently installed pfSense as a firewall. I use the QEMU Guest Agent to get more detailed info about the VM’s that are running in the Proxmox console.
This post shows the process to get the QEMU Guest Agent running on a pfSense firewall.
Software Versions
The following software versions were used in this post.
- pfSense Community Edition – 2.6.0
- QEMU Guest Agent – 5.0.1
Install
Install the qemu-guest-agent package.
cmd
pkg install -y qemu-guest-agent
If you get an error “insufficient privileges to install packages”, you need to make sure the default admin account is enabled and you need to log in as admin. You may need to install the sudo package too.
# pkg install sudo
The default sudoers
file is located here: /usr/local/etc/sudoers
. To edit it and add rules you need to use the visudo
command.
$ su -
$ visudo
Then to give a user access to everything as root:
userX ALL=(ALL) ALL
To become root (as userX):
$ sudo -s
-or-
$ sudo -i
Once installed, there is a note on how to setup the agent.
=======================================================
Modify your `/etc/rc.conf` by adding these settings
qemu_guest_agent_enable="YES"
qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
and run
# service qemu-guest-agent start
For detailed help use `qemu-ga -h`
=======================================================
Configure
I am following the steps in the script here (with slight modifications).
Append to the /etc/rc.conf.local file.
cmd
cat >> /etc/rc.conf.local << EOF
qemu_guest_agent_enable="YES"
qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
#virtio_console_load="YES"
EOF
Create the /usr/local/etc/rc.d/qemu-agent.sh file.
cmd
cat > /usr/local/etc/rc.d/qemu-agent.sh << EOF
#!/bin/sh
sleep 3
service qemu-guest-agent start
EOF
Make the /usr/local/etc/rc.d/qemu-agent.sh file executable.
cmd
chmod +x /usr/local/etc/rc.d/qemu-agent.sh
Start the QEMU Guest Agent service.
cmd
service qemu-guest-agent start
Confirm the QEMU Guest Agent service is running.
cmd
service qemu-guest-agent status
# Output
qemu_guest_agent is running as pid 85066.