Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37509533
en ru br
ALT Linux repos
S:0.3.1-alt2

Group :: System/Configuration/Other
RPM: alterator-luks

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

alterator-luks-0.2.1/000075500000000000000000000000001210376474600144735ustar00rootroot00000000000000alterator-luks-0.2.1/Makefile000064400000000000000000000001621210376474600161320ustar00rootroot00000000000000NAME=luks

all:
clean:
install: install-module
check: check-module

include /usr/share/alterator/build/module.mak
alterator-luks-0.2.1/applications/000075500000000000000000000000001210376474600171615ustar00rootroot00000000000000alterator-luks-0.2.1/applications/luks.desktop000064400000000000000000000003661210376474600215370ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-System
Icon=vm
Terminal=false
Name=Change LUKS passphrase
X-Alterator-URI=/luks
X-Alterator-Weight=90
X-Alterator-Help=luks
Name[ru]=Установка пароля на LUKS разделы
alterator-luks-0.2.1/backend3/000075500000000000000000000000001210376474600161455ustar00rootroot00000000000000alterator-luks-0.2.1/backend3/luks000075500000000000000000000023321210376474600170510ustar00rootroot00000000000000#!/bin/sh

alterator_api_version=1

. alterator-sh-functions

CRYPTSETUP_KEY=/tmp/empty
[ -e "$CRYPTSETUP_KEY" ] || :> "$CRYPTSETUP_KEY"

luks_chpasswd()
{
for device in $(blkid -o device);
do
[ "$(blkid -o value -s TYPE "$device")" = "crypto_LUKS" ] || continue
cryptsetup isLuks "$device" || continue
echo "$1" | cryptsetup --key-file "$CRYPTSETUP_KEY" luksChangeKey "$device"
done
}

change_password()
{
if test_bool "$in_auto" && [ -z "$in_passwd_auto" ]; then
write_error "`_ "You should define a password for LUKS device"`"
elif test_bool "$in_auto" && [ -n "$in_passwd_auto" ]; then
luks_chpasswd "$in_passwd_auto"
elif [ -z "$in_passwd_1" -a -z "$in_passwd_2" ]; then
write_error "`_ "You should define a password for LUKS device"`"
elif [ "$in_passwd_1" != "$in_passwd_2" ]; then
write_error "`_ "Passwords mismatch"`"
else
luks_chpasswd "$in_passwd_1"
fi
}

generate_password()
{
write_string_param passwd_auto "$(pwqgen)"
}

have_active_luks_device()
{
[ -n "$(find /dev/mapper/ -maxdepth 1 -name '*luks')" ] && write_bool_param luks 1 || write_bool_param luks 0
}

alterator_export_proc change_password
alterator_export_proc generate_password
alterator_export_proc have_active_luks_device

message_loop
alterator-luks-0.2.1/steps/000075500000000000000000000000001210376474600156315ustar00rootroot00000000000000alterator-luks-0.2.1/steps/luks.desktop000064400000000000000000000004261210376474600202040ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Icon=steps/vm
Terminal=false
Name=Change LUKS passphrase
Name[ru]=Установка пароля на LUKS-разделы
Name[uk]=Встановлення паролю на LUKS-підрозділи
X-Alterator-URI=/luks
X-Alterator-Help=luks
alterator-luks-0.2.1/ui/000075500000000000000000000000001210376474600151105ustar00rootroot00000000000000alterator-luks-0.2.1/ui/luks/000075500000000000000000000000001210376474600160665ustar00rootroot00000000000000alterator-luks-0.2.1/ui/luks/ajax.scm000064400000000000000000000027151210376474600175220ustar00rootroot00000000000000(define-module (ui luks ajax)
:use-module (alterator ajax)
:use-module (alterator algo)
:use-module (alterator woo)
:use-module (alterator effect)
:export (init
init-passwordbox
commit-passwordbox
))

;; private passwordbox API

(define (generate-passwordbox)
(form-update-value-list
'("passwd_auto")
(woo-call "/luks/generate_password")))

(define (update-passwordbox)
(form-update-value "passwd_1" "")
(form-update-value "passwd_2" "")
(form-update-value "passwd_auto" "")
(form-update-value "auto" #f)
(generate-passwordbox)
(update-effect))

;; public passwordbox API

(define (init-passwordbox)
;; effects
(effect-show "passwd_1" "auto" #f)
(effect-show "passwd_2" "auto" #f)
(effect-show "passwd_auto" "auto" #t)
(effect-show "generate_button" "auto" #t)
;; generate button
(form-bind "generate_button" "click" generate-passwordbox)
(update-passwordbox))

(define (commit-passwordbox)
(apply woo-call "/luks/change_password"
'language (form-value "language")
(form-value-list '("auto" "passwd_1" "passwd_2" "passwd_auto")))
(update-passwordbox))

;;; current form specific API

(define (ui-write)
(form-update-visibility "passwd_message" #f)
(catch/message
(lambda()
(commit-passwordbox)
(form-update-visibility "passwd_message" #t))))

(define (init)
;; password
(init-passwordbox)
(init-effect)
(form-bind "apply_button" "click" ui-write))
alterator-luks-0.2.1/ui/luks/index.html000064400000000000000000000032311210376474600200620ustar00rootroot00000000000000<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!-- user administration module -->
<html wf="none">
<body>
<form method="POST" enctype="multipart/form-data">
<table>
<tr>
<td colspan="2"><span translate="_">Password for LUKS devices:</span></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>
<input type="checkbox" name="auto" value="#t"/>
<span translate="_">Generate automatically</span>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><input type="password" name="passwd_1" class="text"/></td>
<td style="width:100%"><small><span translate="_" name="passwd_1">(enter passphrase)</span></small></td>
</tr>
<tr>
<td><input type="password" name="passwd_2" class="text"/></td>
<td><small><span translate="_" name="passwd_2">(repeat passphrase)</span></small></td>
</tr>
<tr>
<td><input type="text" name="passwd_auto" class="text" style="display:none"/></td>
<td><input type="button" class="btn" name="generate_button" value="Generate" style="display:none"/></td>
</tr>
<tr>
<td colspan="2"><span name="passwd_auto" style="display:none">&nbsp;</span></td>
</tr>
<tr>
<td colspan="2">
<span name="passwd_message" style="display:none" class="alterator-information-message">
<img src="/design/images/information.gif"/>
<span translate="_">LUKS devices' password successfully updated</span>
</span>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>
<input type="button" class="btn" name="apply_button" value="Change password" />
</td>
<td>&nbsp;</td>
</tr>
</table>
</form>
</body>
</html>
alterator-luks-0.2.1/ui/luks/index.scm000064400000000000000000000040721210376474600177040ustar00rootroot00000000000000(document:surround "/std/frame")

;;; Functions

(define (ui-generate)
(form-update-value-list
'("passwd_auto")
(woo-call "/luks/generate_password")))

(define (ui-read)
(form-update-value "passwd_1" "")
(form-update-value "passwd_2" "")
(form-update-value "passwd_auto" "")
(form-update-value "auto" #f)
(ui-generate)
(update-effect))

(define (ui-write)
(catch/message
(lambda()
(apply woo-call "/luks/change_password"
'language (form-value "language")
(form-value-list '("auto" "passwd_1" "passwd_2" "passwd_auto")))
(ui-read))))

(define (ui-init)
(effect-show "passwd_1" "auto" #f)
(effect-show "passwd_2" "auto" #f)
(effect-show "passwd_auto" "auto" #t)
(effect-show "generate_button" "auto" #t)
(init-effect)
(ui-read)
(form-bind "generate_button" "click" ui-generate)
(or (global 'frame:next)
(form-bind "apply_button" "click" ui-write)))

;;; UI

(gridbox columns "20;60;20"
(spacer)
(label text (_ "Setup password for LUKS devices:"))
(spacer)

(spacer)
(gridbox
columns "100;0"
(checkbox text (_ "Generate automatically") name "auto")
(spacer)
(edit name "passwd_1" echo "stars" visibility #f focus #t)
(label name "passwd_1" text (small (_ "(enter passphrase)")) visibility #f)
(edit name "passwd_2" echo "stars" visibility #f)
(label name "passwd_1" text (small (_ "(repeat passphrase)")) visibility #f)
(edit name "passwd_auto" visibility #f)
(button text (_ "Generate") name "generate_button" visibility #f)
(label colspan 2 name "passwd_auto" visibility #f))
(spacer)

(label colspan 3)
(checkbox text (_ "Have luks (hidden)") name "luks" visibility #f colspan 3)

(spacer)
(if (global 'frame:next)
(label)
(button text (_ "Apply") name "apply_button" align "left"))
(spacer))

;;; Logic

(frame:on-next (thunk (or (ui-write) 'cancel)))

(document:root
(when loaded
(form-update-value-list '("luks") (woo-call "/luks/have_active_luks_device"))
(if (not (form-value "luks"))
(frame:next)
(ui-init))
(and (global 'frame:next) (frame:back-activity #f))))
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin