Skip to content

Commit

Permalink
Randomize MAC address in sys-net
Browse files Browse the repository at this point in the history
  • Loading branch information
viq committed May 13, 2018
1 parent d2bfbf3 commit 02738ed
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions qvm/randomize-mac.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# vim: set syntax=yaml ts=2 sw=2 sts=2 et :

##
# qvm.ramdomize-mac
# =================
#
# Sets sys-net to randomize MAC address as per
# https://www.qubes-os.org/doc/anonymizing-your-mac-address/
#
# Execute:
# qubesctl state.sls qvm.randomize-mac sys-net
##

NetworkManager bind-dir config:
file:
- managed
- name: /rw/config/qubes-bind-dirs.d/68_networkmanager.conf
- makedirs: True
- user: root
- group: root
- mode: 0644
- contents:
- binds+=( '/etc/NetworkManager/conf.d/' )

NetworkManager persistent directory:
file:
- directory
- name: /rw/bind-dirs/etc/NetworkManager/conf.d/
- makedirs: True

NetworkManager MAC config:
file:
- managed
- name: /rw/bind-dirs/etc/NetworkManager/conf.d/mac.conf
- contents: |
[device]
wifi.scan-rand-mac-address=yes
[connection]
wifi.cloned-mac-address=stable

This comment has been minimized.

Copy link
@tlaurion

tlaurion Oct 21, 2018

BTW, this line should be
wifi.cloned-mac-address=random

And stabilized hereafter by user choice, on a per connection base through NetworkManager.

ethernet.cloned-mac-address=stable

This comment has been minimized.

Copy link
@tlaurion

tlaurion Oct 21, 2018

Same reasoning here. That line should be:
ethernet.cloned-mac-address=random

connection.stable-id=${CONNECTION}/${BOOT}
- require:
- file: NetworkManager persistent directory

3 comments on commit 02738ed

@tlaurion
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@viq : How would you deploy this for testing?
Trying to wrap my head around QubesOS' salt documentation and whereabouts and official documentation in the goal of merging this and creating new salt recipies

In this case, following your documentation:

under dom0:

sudo cp qvm_randomize-mac.sls /srv/formulas/base/virtual-machines-formula/qvm
sudo qubesctl state.sls qvm.randomize-mac sys-net

Results in:

[ERROR    ] Template was specified incorrectly: False
local: 
        Data failed to compile:
----------
        No matching sls found for 'qvm.randomize-mac' in env 'base' 
DOM0 configuration failed, not continuing

Thanks

@tlaurion
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marmarek? someone?

@tlaurion
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.