Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] An update to shadow

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: "Andraž 'ruskie' Levstik" <ruskie AT mages.ath.cx>
  • To: " sm-discuss " <sm-discuss AT lists.ibiblio.org>
  • Subject: [SM-Discuss] An update to shadow
  • Date: Sat, 24 Feb 2007 22:53:57 +0100

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I had the following lying around on my hdd for a few weeks and today
decided to finalize it.

Here's the idea(as used in the nano system-wide config install):

provide a way to be able to pick what add/deluser scripts to install
provide a way to not install any such scripts
make it easily extensible by having them in a dir


By default it still uses our old scripts and I've added a set of scripts I
use. As there is no upstream default for these scripts(last I checked)
I think this would be usefull.

I'll wait a week for ppl to review and comment on the changes then I'll
commit or trash the thing.

- --
Andraž "ruskie" Levstik
Source Mage GNU/Linux Games grimoire guru
Geek/Hacker/Tinker

Hacker FAQ: http://www.plethora.net/%7eseebs/faqs/hacker.html
Be sure brain is in gear before engaging mouth.

Key id = F4C1F89C
Key fingerprint = 6FF2 8F20 4C9D DB36 B5B6 F134 884D 72CC F4C1 F89C

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF4LP2iE1yzPTB+JwRAlB6AJ4kZOYCD+NHp7KRFb8vn0aQp+HwmACgr9qS
0pjsYSIh3B31KmvOg7/M7JQ=
=vyxJ
-----END PGP SIGNATURE-----diff --git a/security/shadow/CONFIGURE b/security/shadow/CONFIGURE
index 7ad9599..dcf6eed 100755
--- a/security/shadow/CONFIGURE
+++ b/security/shadow/CONFIGURE
@@ -1,3 +1,9 @@
+message "Note in the following list default is the same as smgl and none
install no script" &&
+AVAILABLE_ADDDEL="$(ls --color=no -1
$SCRIPT_DIRECTORY/adddelscripts/adduser* | sed -e "s:.*-\(.*\):\1:g" | tr
"\n" " ")" &&
+AVAILABLE_ADDDEL="default none $AVAILABLE_ADDDEL" &&
+config_query_list SHADOW_ADDDEL "Which add/deluser script do you want to
use?" \
+ $AVAILABLE_ADDDEL &&
+
# There's a bug introduced by the solution of bug 8834:
# if you said "n" to $SHADOW_CONV, you ended up with the state pw/grpunconv
# left on dispelling old shadow.
@@ -6,8 +12,8 @@
if [[ "$SHADOW_CONV" == n ]] && [[ -z "$SHADOW_RECONV" ]]; then
message "Checking passwd for shadowness (there could have been an unwanted
run of pwunconv/grpunconv, see bug #8834)." &&
if ! grep -q '^root:x:' "$INSTALL_ROOT/etc/passwd"; then
- message "${PROBLEM_COLOR}Your passwd file contains password hashes,
resuggesting conversion to shadow." &&
- message "${MESSAGE_COLOR}You can still say n to the upcoming query but
make sure to run pwconv / grpconv yourself if you want existing passwords
shadowed." &&
+ message "${PROBLEM_COLOR}Your passwd file contains password hashes,
resuggesting conversion to shadow.${DEFAULT_COLOR}" &&
+ message "${MESSAGE_COLOR}You can still say n to the upcoming query but
make sure to run pwconv / grpconv yourself if you want existing passwords
shadowed.${DEFAULT_COLOR}" &&
config_query SHADOW_RECONV "One-time query: convert/fix accounts (with
installed shadow utils) this time" n
fi
else
diff --git a/security/shadow/INSTALL b/security/shadow/INSTALL
index ec5de2e..d086495 100755
--- a/security/shadow/INSTALL
+++ b/security/shadow/INSTALL
@@ -6,5 +6,12 @@ install_config_file etc/login.defs
$INSTALL_ROOT/etc/login.defs &&

mkdir -p $INSTALL_ROOT/etc/default &&

-cp -fv $SCRIPT_DIRECTORY/adduser $INSTALL_ROOT/usr/sbin &&
-cp -fv $SCRIPT_DIRECTORY/deluser $INSTALL_ROOT/usr/sbin
+if [[ $SHADOW_ADDDEL == default ]]; then
+ cp -fv $SCRIPT_DIRECTORY/adddeluser/adduser-smgl
$INSTALL_ROOT/usr/sbin/adduser &&
+ cp -fv $SCRIPT_DIRECTORY/adddeluser/deluser-smgl
$INSTALL_ROOT/usr/sbin/deluser
+elif [[ $SHADOW_ADDDEL == none ]]; then
+ true
+else
+ cp -fv $SCRIPT_DIRECTORY/adddeluser/deluser-$SHADOW_ADDDEL
$INSTALL_ROOT/usr/sbin/deluser
+ cp -fv $SCRIPT_DIRECTORY/adddeluser/adduser-$SHADOW_ADDDEL
$INSTALL_ROOT/usr/sbin/adduser
+fi
diff --git a/security/shadow/adddelscripts/adduser-ruskie
b/security/shadow/adddelscripts/adduser-ruskie
new file mode 100755
index 0000000..76cceb4
--- /dev/null
+++ b/security/shadow/adddelscripts/adduser-ruskie
@@ -0,0 +1,30 @@
+#!/bin/bash
+. /var/lib/sorcery/modules/libmedia
+. /var/lib/sorcery/modules/libmisc
+COLOR_SCHEME="bright"
+media_init ""
+PROMPT_DELAY="31557807"
+
+if [[ "$UID" == 0 ]]; then
+
+ real_query_string NEWUSER "Username: "
+ echo -e "${QUERY_COLOR}List of all available shells on the
system$DEFAULT_COLOR"
+ echo -e "$(cat /etc/shells)\n/bin/true" | column
+ real_query_string NEWSH "Shell: " "/bin/true"
+ echo -e "${QUERY_COLOR}List of all available groups on the
system$DEFAULT_COLOR"
+ echo "$(cat /etc/group | awk -F":" '{printf("%s(%s)\n", $1,$3)}')" | column
+ real_query_string EXTRA_GROUPS "Enter any extra groups(comma(,)
separated): "
+ real_query_string GECOS "Enter the GECOS/Comment field for this user: " "A
user"
+ [[ -d /home ]] || mkdir /home
+ echo groupadd $NEWUSER
+ if [[ -n $EXTRA_GROUPS ]]; then
+ echo useradd -c "$GECOS" -b /home -d /home/$NEWUSER -m -G $EXTRA_GROUPS
-g $NEWUSER -s $NEWSH
+ else
+ echo useradd -c "$GECOS" -b /home -d /home/$NEWUSER -m -g $NEWUSER -s
$NEWSH
+ fi
+else
+
+ su - -c "PATH=$PATH $0 $1"
+
+fi
+
diff --git a/security/shadow/adduser
b/security/shadow/adddelscripts/adduser-smgl
similarity index 100%
rename from security/shadow/adduser
rename to security/shadow/adddelscripts/adduser-smgl
diff --git a/security/shadow/adddelscripts/deluser-ruskie
b/security/shadow/adddelscripts/deluser-ruskie
new file mode 100755
index 0000000..78cf616
--- /dev/null
+++ b/security/shadow/adddelscripts/deluser-ruskie
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [[ "$UID" == 0 ]]; then
+
+
+ echo userdel $DEADDUCK
+
+else
+
+ su - -c "PATH=$PATH $0 $1"
+
+fi
+
diff --git a/security/shadow/deluser
b/security/shadow/adddelscripts/deluser-smgl
similarity index 100%
rename from security/shadow/deluser
rename to security/shadow/adddelscripts/deluser-smgl


  • [SM-Discuss] An update to shadow, Andraž 'ruskie' Levstik, 02/24/2007

Archive powered by MHonArc 2.6.24.

Top of Page