Add installation of udev rule
This commit is contained in:
parent
136ce6e4b0
commit
df1de585f6
5 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
|||
click==6.6
|
||||
flake8==2.5.4
|
||||
python-yubico==1.3.2
|
||||
sh==1.11
|
||||
|
|
|
@ -11,7 +11,7 @@ logging.getLogger("requests").setLevel(logging.WARNING)
|
|||
class YubiLockCLI(click.MultiCommand):
|
||||
|
||||
def list_commands(self, ctx):
|
||||
return ['status']
|
||||
return ['status', 'install']
|
||||
|
||||
def get_command(self, ctx, name):
|
||||
ns = {}
|
||||
|
|
2
yubi_lock/data/85-yubikey-screen-lock.rules
Normal file
2
yubi_lock/data/85-yubikey-screen-lock.rules
Normal file
|
@ -0,0 +1,2 @@
|
|||
SUBSYSTEM=="usb", ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", RUN+="yubi-lock handle enable"
|
||||
SUBSYSTEM=="usb", ACTION=="add", ENV{ID_VENDOR_ID}=="1050", RUN+="yubi-lock handle disable"
|
0
yubi_lock/install/__init__.py
Normal file
0
yubi_lock/install/__init__.py
Normal file
15
yubi_lock/install/cli.py
Normal file
15
yubi_lock/install/cli.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import click
|
||||
from sh import sudo
|
||||
import os
|
||||
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
@click.command('install', short_help='Install required files for insertion detection')
|
||||
@click.option('-v', '--verbose')
|
||||
def cli(verbose):
|
||||
if verbose:
|
||||
print("Exporting UDEV rule...")
|
||||
sudo.cp(BASE_DIR + "../data/85-yubikey-screen-lock.rules", "/etc/udev/rules.d/85-yubikey-screen-lock.rules")
|
||||
print('Export complete!')
|
Reference in a new issue