Crypttab

Parses /etc/crypttab from the cryptsetup package.

Author: Frédéric Lespez frederi.nosp@m.c.lespez@fre.nosp@m.e.fr

Summary
CrypttabParses /etc/crypttab from the cryptsetup package.
ReferenceThis lens tries to keep as close as possible to `man crypttab` where possible.
LicenseThis file is licensed under the LGPL v2+, like the rest of Augeas.
Lens UsageSample usage of this lens in augtool
Configuration filesThis lens applies to /etc/crypttab.
USEFUL PRIMITIVES
Separators
sep_tab
comma
Generic primitives
eol
comment
empty
word
optval
target
fspath
ENTRIES
comma_sep_listA comma separated list of options (opt=value or opt)
recordA crypttab record
lnsThe crypttab lens
filter

Reference

This lens tries to keep as close as possible to `man crypttab` where possible.

License

This file is licensed under the LGPL v2+, like the rest of Augeas.

Lens Usage

Sample usage of this lens in augtool

  • Create a new entry for an encrypted block devices
ins 01 after /files/etc/crypttab/*[last()]
set /files/etc/crypttab/01/target crypt_sda2
set /files/etc/crypttab/01/device /dev/sda2
set /files/etc/crypttab/01/password /dev/random
set /files/etc/crypttab/01/opt swap
  • Print the entry applying to the “/dev/sda2” device
print /files/etc/crypttab/01
  • Remove the entry applying to the “/dev/sda2” device
rm /files/etc/crypttab/*[device="/dev/sda2"]

Configuration files

This lens applies to /etc/crypttab.  See filter.

USEFUL PRIMITIVES

Separators

sep_tab

let sep_tab = Sep.tab

comma

let comma = Sep.comma

Generic primitives

eol

let eol = Util.eol

comment

let comment = Util.comment

empty

let empty = Util.empty

word

let word = Rx.word

optval

let optval = /[A-Za-z0-9_.:-]+/

target

let target = Rx.device_name

fspath

let fspath = Rx.fspath

ENTRIES

comma_sep_list

let comma_sep_list (l:string) = let value = [ label "value" . Util.del_str "=" . store optval ] in let lns = [ label l . store word . value? ] in Build.opt_list lns comma

A comma separated list of options (opt=value or opt)

record

let record = [ seq "entry" . [ label "target" . store target ] . sep_tab . [ label "device" . store fspath ] . (sep_tab . [ label "password" . store fspath ] . ( sep_tab . comma_sep_list "opt")? )? . eol ]

A crypttab record

lns

let lns = ( empty | comment | record ) *

The crypttab lens

filter

let sep_tab = Sep.tab
let comma = Sep.comma
let eol = Util.eol
let comment = Util.comment
let empty = Util.empty
let word = Rx.word
let optval = /[A-Za-z0-9_.:-]+/
let target = Rx.device_name
let fspath = Rx.fspath
let comma_sep_list (l:string) = let value = [ label "value" . Util.del_str "=" . store optval ] in let lns = [ label l . store word . value? ] in Build.opt_list lns comma
A comma separated list of options (opt=value or opt)
let record = [ seq "entry" . [ label "target" . store target ] . sep_tab . [ label "device" . store fspath ] . (sep_tab . [ label "password" . store fspath ] . ( sep_tab . comma_sep_list "opt")? )? . eol ]
A crypttab record
let lns = ( empty | comment | record ) *
The crypttab lens
Close