* [Cluster-devel] conga ./conga.spec.in.in luci/utils/luci_admin
@ 2006-08-03 23:39 kupcevic
0 siblings, 0 replies; only message in thread
From: kupcevic @ 2006-08-03 23:39 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-08-03 23:39:01
Modified files:
. : conga.spec.in.in
luci/utils : luci_admin
Log message:
Add '--random' argument to `luci_admin password`, update specfile to use it
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/conga.spec.in.in.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/utils/luci_admin.diff?cvsroot=cluster&r1=1.41&r2=1.42
--- conga/conga.spec.in.in 2006/08/03 20:54:04 1.22
+++ conga/conga.spec.in.in 2006/08/03 23:39:00 1.23
@@ -153,42 +153,35 @@
%post -n luci
/sbin/chkconfig --add luci
+/sbin/service luci status >/dev/null 2>&1
+LUCI_RUNNING=$?
+if [ "$LUCI_RUNNING" = "0" ]; then
+ /sbin/service luci stop >/dev/null 2>&1
+fi
if [ -e /var/lib/luci/var/luci_backup.xml ]; then
- /sbin/service luci status >/dev/null 2>$1
- LUCI_RUNNING=$?
- if [ "$LUCI_RUNNING" = "0" ]; then
- /sbin/service luci stop >/dev/null 2>$1
- fi
- /usr/sbin/luci_admin restore >/dev/null 2>$1
- if [ "$LUCI_RUNNING" = "0" ]; then
- /sbin/service luci start >/dev/null 2>$1
- fi
+ /usr/sbin/luci_admin restore >/dev/null 2>&1
fi
if [ ! -e /var/lib/luci/var/certs/privkey.pem ]; then
# no privkey.pem -> luci not initialized
- # set initial random admin password
- T_PASS=`dd if=/dev/urandom bs=5M count=1 2> /dev/null | sha1sum`
- for i in $T_PASS; do
- if [ "-" != $i ] ; then
- echo -n "admin:{SHA}$i" > /var/lib/luci/inituser
- fi
- done
- /bin/chmod 600 /var/lib/luci/inituser
- /bin/chown luci /var/lib/luci/inituser
+ /usr/sbin/luci_admin password --random >/dev/null 2>&1
+fi
+if [ "$LUCI_RUNNING" = "0" ]; then
+ /sbin/service luci start >/dev/null 2>&1
fi
+
%preun -n luci
-/sbin/service luci status >/dev/null 2>$1
+/sbin/service luci status >/dev/null 2>&1
LUCI_RUNNING=$?
if [ "$LUCI_RUNNING" = "0" ]; then
- /sbin/service luci stop >/dev/null 2>$1
+ /sbin/service luci stop >/dev/null 2>&1
fi
-/usr/sbin/luci_admin backup >/dev/null 2>$1
+/usr/sbin/luci_admin backup >/dev/null 2>&1
if [ "$LUCI_RUNNING" = "0" ]; then
- /sbin/service luci start >/dev/null 2>$1
+ /sbin/service luci start >/dev/null 2>&1
fi
if [ "$1" = "0" ]; then
- /sbin/service luci stop >/dev/null 2>$1
+ /sbin/service luci stop >/dev/null 2>&1
/sbin/chkconfig --del luci
fi
--- conga/luci/utils/luci_admin 2006/08/03 22:58:26 1.41
+++ conga/luci/utils/luci_admin 2006/08/03 23:39:00 1.42
@@ -996,14 +996,26 @@
def password(argv):
- if not luci_initialized():
- sys.stderr.write('The Luci site has not been initialized.\n')
- sys.stderr.write('To initialize it, execute\n')
- sys.stderr.write('\t' + argv[0] + ' init\n')
- sys.exit(1)
-
- print 'Resetting the admin user\'s password\n'
- password = read_passwd('Enter new password: ', 'Confirm password: ')
+ password = None
+ if '--random' in argv:
+ print 'Resetting the admin user\'s password to some random value\n'
+ try:
+ rand = file('/dev/urandom', 'r')
+ password = rand.read(16)
+ rand.close()
+ except:
+ sys.stderr.write('Unable to read from /dev/urandom\n')
+ sys.exit(1)
+ else:
+ if not luci_initialized():
+ sys.stderr.write('The Luci site has not been initialized.\n')
+ sys.stderr.write('To initialize it, execute\n')
+ sys.stderr.write('\t' + argv[0] + ' init\n')
+ sys.exit(1)
+
+ print 'Resetting the admin user\'s password\n'
+ password = read_passwd('Enter new password: ', 'Confirm password: ')
+
print '\nPlease wait...'
if not set_zope_passwd('admin', password):
print 'The admin password has been successfully reset.'
@@ -1112,7 +1124,7 @@
def main(argv):
- if len(argv) != 2:
+ if len(argv) < 2:
luci_help(argv)
sys.exit(1)
@@ -1123,7 +1135,6 @@
sys.stderr.write('Try again with root privileges.\n')
sys.exit(2)
-
if 'init' in argv:
init(argv)
elif 'backup' in argv:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-08-03 23:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-03 23:39 [Cluster-devel] conga ./conga.spec.in.in luci/utils/luci_admin kupcevic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.