Add installation of udev rule

This commit is contained in:
Jake Howard 2016-05-19 14:20:32 +01:00
parent 136ce6e4b0
commit df1de585f6
5 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,4 @@
click==6.6
flake8==2.5.4
python-yubico==1.3.2
sh==1.11

View file

@ -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 = {}

View 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"

View file

15
yubi_lock/install/cli.py Normal file
View 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!')