ports

morpheus ports
git clone git://git.2f30.org/ports
Log | Files | Refs | LICENSE

commit 8522f093afe7100e83af73670c2adaa598adf395
parent 3a67aac7ae684cf7bcd2a057cc3e63d482a4f152
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed,  9 Jul 2014 17:35:12 +0000

add experimental mktcb script

to make tcb file structure from /etc/shadow file. Some features not
implemented yet though, see TODO.

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>

Diffstat:
Afs/bin/mktcb | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/fs/bin/mktcb b/fs/bin/mktcb @@ -0,0 +1,22 @@ +#!/bin/sh +# make tcb file structure from a /etc/shadow file. +# Usage: cat /etc/shadow | mktcb +# TODO: need to set group "auth" and permissions. +# http://docs.altlinux.org/manpages/tcb.5.html + +umask 0077 +mkdir -p /etc/tcb +chmod 755 /etc/tcb +while read -r line; do + name=$(printf '%s' "$line" | cut -f 1 -s -d ':') + if test -z x"$name"; then + continue + fi + hash=$(printf '%s' "$line" | cut -f 2 -d ':') + mkdir -p "/etc/tcb/$name" + chown "$name:root" "/etc/tcb/$name" + chmod 700 "/etc/tcb/$name" + printf '%s\n' "$line" > "/etc/tcb/$name/shadow" + chown "$name:root" "/etc/tcb/$name/shadow" + chmod 600 "/etc/tcb/$name/shadow" +done