[Spacewalk-devel] [PATCH] Adding a password strength meter to spacewalk

2013-12-20 Thread R P Herrold
On Fri, 20 Dec 2013, Maximilian Meister wrote:

> this patch would add a bootstrapified password strength 
> meter to all pages where user details are being created or 
> edited (create the initial admin user, create/edit normal 
> users and create organization). There is also a tick icon on 
> the side of the password input fields, which checks if the 
> value in the desired password field will be accepted by the 
> server and if the value in the confirm password field 
> matches the value in the desired password field.

This seems to pull in new dependencies, doesn't it?  It is not 
really clear to me that doing passwd strength testing here, 
'one off' per package makes sense, rather than having a 
general interface to query a facility that many packages 
beyond just spacewalk could use

Also, how would this interact with non-local 
authentication interfaces such as LDAP?

-- Russ herrold

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


[Spacewalk-devel] [PATCH] perl List port to new css/markup

2013-12-20 Thread Duncan Mac-Vicar P.

Attached is a first port of the list view to the new CSS markup. I still
have a question though.

https://git.fedorahosted.org/cgit/spacewalk.git/tree/web/modules/sniglets/Sniglets/ListView/Style.pm

The way the styles work is by defining Style:standard with the default
methods and then other styles override this default.

When I look at Sniglets::ListView::Style::standard sub header

I see that package Sniglets::ListView::Style::channel_tree redefines it
exactly in the same way (overrides without changing it). Is it because
of the use of Style::blank below?

package Sniglets::ListView::Style::channel_tree;
use base qw/Sniglets::ListView::Style::blank/;

What is the reason for this?

-- 
Duncan Mac-Vicar P. - http://www.suse.com/

SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix
Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

diff --git a/branding/templates/header.pxt b/branding/templates/header.pxt
index d90e605..c567b3a 100644
--- a/branding/templates/header.pxt
+++ b/branding/templates/header.pxt
@@ -21,6 +21,10 @@
 
 
 
+
+
+
+
   
 
 
diff --git a/web/modules/pxt/PXT/HTML.pm b/web/modules/pxt/PXT/HTML.pm
index 7064042..dbde608 100644
--- a/web/modules/pxt/PXT/HTML.pm
+++ b/web/modules/pxt/PXT/HTML.pm
@@ -119,6 +119,7 @@ sub hidden {
 #text(
 #	-name => foo,
 #	-value => foo,
+# -placeholder => foo,
 #	-maxlength => 30,
 #	-size => 15);
 sub text{
@@ -129,7 +130,7 @@ sub text{
 $class->_spew("->text no name given, defaulting to " . $e{-name});
   }
 
-  return $class->_format(\%e,"input type=\"text\"");
+  return $class->_format(\%e,"input class=\"form-control\" type=\"text\"");
 }
 
 #file(
@@ -451,6 +452,26 @@ sub link {
   return sprintf qq{%s}, $url, $label;
 }
 
+sub button {
+  my $class = shift;
+  my $text = shift;
+  my %params = @_;
+
+  if (not exists $params{-name}) {
+die "nameless button";
+  }
+
+  my @inner;
+  for my $attr (qw/value type name class/) {
+next unless exists $params{"-$attr"};
+push @inner, sprintf(qq{$attr="$params{-$attr}"});
+  }
+
+  my $inner_str = join(" ", @inner);
+
+  return qq{$text};
+}
+
 sub link2 {
   my $class = shift;
   my %params = validate(@_, { url => 1, text => 0, css => 0, target => 0, params => 0 });
diff --git a/web/modules/sniglets/Sniglets/ListView/List.pm b/web/modules/sniglets/Sniglets/ListView/List.pm
index 47030ce..9732c20 100644
--- a/web/modules/sniglets/Sniglets/ListView/List.pm
+++ b/web/modules/sniglets/Sniglets/ListView/List.pm
@@ -492,6 +492,17 @@ sub render_formvars {
 
 sub render_alphabar {
   my $self = shift;
+  my $pxt = shift;
+  my $content = shift;
+
+  # if there is no alphabar we still need the div there
+  my $template = $self->style->alphabar();
+  $template =~ s/\{alphabar_content\}/$content/;
+  return $template;
+}
+
+sub render_alphabar_content {
+  my $self = shift;
   my $alphabar = shift;
   my $pagesize = shift;
   my $url = shift;
@@ -536,10 +547,12 @@ sub render_filterbox {
 
   throw "No 'sort_by' column for mode '" . $self->mode->{__name__} . "'\n" unless defined $filter_by;
 
-  $ret .= q{};
-  $ret .= sprintf('Filter by %s: ', $filter_by->name);
+  $ret .= q{};
+  $ret .= q{};
+
   if ($self->filter_type eq 'text') {
-$ret .= PXT::HTML->text(-name => 'filter_value', -value => PXT::Utils->escapeHTML($self->filter_string || ''), -size => 12);
+$ret .= PXT::HTML->text(-name => 'filter_value', -value => PXT::Utils->escapeHTML($self->filter_string || ''),
+-placeholder => sprintf('Filter by %s: ', $filter_by->name));
 $ret .= PXT::HTML->hidden(-name => 'prev_filter_value', -value => PXT::Utils->escapeHTML($self->filter_string || ''));
   }
   elsif ($self->filter_type eq 'select') {
@@ -554,8 +567,12 @@ sub render_filterbox {
 throw "Unknown filter type: '" . $self->filter_type . "'";
   }
 
-  $ret .= " ";
-  $ret .= PXT::HTML->submit_image(-src => '/img/button-go.gif', -alt => "Filter", -name => "filter_list");
+  $ret .= q{};
+  $ret .= PXT::HTML->button(PXT::HTML->icon(-class => 'fa fa-eye') , -type => 'submit', -name => "filter_list",
+-class => "btn btn-default spacewalk-button-filter");
+  $ret .= q{};
+
+  $ret .= q{};
   $ret .= q{};
 
   return $ret;
@@ -598,26 +615,6 @@ sub render_select_buttons {
   return $block;
 }
 
-sub render_set_info {
-  my $self = shift;
-  my $pxt = shift;
-  my $block = shift;
-  my $pos = shift;
-
-  my $subst = { };
-
-  if ($self->allow_selections($pxt) and $self->{__set__}) {
-my $num_contents = scalar $self->{__set__}->contents;
-$subst->{set_string} = sprintf('(%s selected)', $pos, $num_contents);
-  }
-  else {
-$subst->{set_string} = '';
-  }
-
-  $block = PXT::Utils->perform_substitutions($block, $subst);
-  return $block;
-}
-
 sub render_page_info {
   my $self = shift;
   my $pxt = shift;
@@ -674,10 +671,10 @@ sub render_pagination_buttons {
 
   # show buttons
   if ($lower != '1' || ($upper != $

Re: [Spacewalk-devel] [PATCH] Added exception handling so traceback does not occur when wrong password/username is entered

2013-12-20 Thread Milan Zázrivec
On Friday 20 December 2013 11:42:58 Andy Zaugg wrote:
> ---
>  .../spacewalk-create-channel/spacewalk-create-channel  | 10
> +- 1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git
> a/client/tools/spacewalk-remote-utils/spacewalk-create-channel/spacewalk-cr
> eate-channel
> b/client/tools/spacewalk-remote-utils/spacewalk-create-channel/spacewalk-cr
> eate-channel index 1ffbf27..b5f876b 100755
> ---
> a/client/tools/spacewalk-remote-utils/spacewalk-create-channel/spacewalk-cr
> eate-channel +++
> b/client/tools/spacewalk-remote-utils/spacewalk-create-channel/spacewalk-cr
> eate-channel @@ -12,6 +12,7 @@ import getopt
>  import sys
>  import getpass
>  from xmlrpclib import Server
> +from xmlrpclib import Fault
>  import string
>  import os
>  from os import path
> @@ -170,7 +171,14 @@ def main():
> client = Server(proto + "://" + server + "/rpc/api")
> if clone and client.api.getVersion() < 5.1:
>print "--clone cannot be used with a Satellite version older than
> 5.1" -   auth = client.auth.login(user, password)
> +   try:
> +  auth = client.auth.login(user, password)
> +   except Fault:
> +  excInfo = sys.exc_info()[1]
> +  print "\n %s " % excInfo.faultString
> +  sys.exit(1)
> +
> +
> 
> skiplist = []
> if options.skiplist:

Applied in dc1dec14fdc3e377cbda465008535ed81f1898d5

Thank you for your contribution.

Regards
-Milan Zázrivec

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] RFC: manage bare-metal systems from Spacewalk

2013-12-20 Thread Duncan Mac-Vicar P.
On 20/12/13 10:57, Silvio Moioli wrote:
> I guess so, even though I do not understand why you would want to do that.
> 
> Idea is that the boot image is used by default before any kickstart. We
> want any new bare-metal system to automatically appear in Spacewalk as
> soon as it is connected to the network and powered on, to have it
> "inventoried" and ease a subsequent kickstart.

The only purpose of the boot image is to add the necessary intelligence
to a bare-metal system to get out of its state of bare-metal plus some
inventory capabilities.

However, from the user perspective, the machine is empty. It has no OS yet.

-- 
Duncan Mac-Vicar P. - http://www.suse.com/

SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix
Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Re: [Spacewalk-devel] spacecmd - new function patch

2013-12-20 Thread Milan Zázrivec
On Friday 20 December 2013 09:39:12 Gregor Gruener wrote:
> Hi spacewalkers,
> 
> I've updated the spacecmd "package.py" file, to add a new function
> "package_listdependencies".
> Can you review and add this patch upstream.

Applied in 374d691d0a1b49407ecdf5ba232a4b3d0c6bf927

Thank you for your contribution.

Regards
-Milan Zázrivec

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] RFC: manage bare-metal systems from Spacewalk

2013-12-20 Thread Silvio Moioli
On 12/19/2013 01:44 PM, Michael Mraka wrote:
> So do we need entitle such system at all? Nowadays there can be
> unetitled system in spacewalk. Does bootstrap entitlement brings us
> something more than current unetitled system?

Short answer: yes. Among other things, a bootstrap-entitled system can
be powered back on and provisioned.

Long answer: we use the bootstrap entitlement to distinguish bare-metal
systems from others in the Web UI: they get a different icon, some forms
are disabled where they do not make sense, we added a bare-metal
specific search page, etc.
Basically we want the sysadmin to have an "inventory" of bare-metal
systems where the only possible operations are:
 - display some hardware details;
 - kickstart;
 - do power management;
 - move between organizations.

Also, we could not find out how to create an activation key without any
entitlement. It seems like both an entitlement and a base channel are
needed in the Web UI, and even with hand-written SQL you need an
entitlement to insert a line in rhnRegTokenEntitlement, otherwise you
get an invalid token.

Server-side error:
rhnServer/server_token.fetch_token('ERROR', "Invalid token '1-'")"

Client-side error:
Could not find token '1-nokey'
Error Class Code: 60
Error Class Info:
The activation token specified could not be found on the server.
Please retry with a valid key.

> [automatic shutdown...] That's a feature of the boot image, right?

Yes.

> So I could achieve the same with 'poweroff' in post install kickstart script.

I guess so, even though I do not understand why you would want to do that.

Idea is that the boot image is used by default before any kickstart. We
want any new bare-metal system to automatically appear in Spacewalk as
soon as it is connected to the network and powered on, to have it
"inventoried" and ease a subsequent kickstart.

Because it might take a long time (even months) between inventory and
kickstart, we automatically shut the system down in between.

> Yes, we can't create such boot image in satellite right now. So I'd have
> to create external distribution with memory only image and import it to
> satellite. Then I'd have to create an activation key which asigns no base
> channel and no entitlements to systems. And I'd also have to manage
> kickstart based on this distribution + activation key to be the default
> pxe image. Is it all I need?

I am not sure to understand who "I" refers to in the above sentences -
is it you as a Spacewalk developer or user?

With this contribution we propose to add a pre-built bootstrap image to
the files installed by Spacewalk, users should not edit it in any way.
This image gets automatically configured as default in Cobbler as soon
as the feature is enabled in the Web UI. Enabling will also create a
user-invisible activation key used by the bootstrap image on bare-metal
systems. That special key will only assign a user-invisible bootstrap
entitlement that, in turn, will be used later used to distinguish such
bare-metal systems visually.

> Just trying to figure out whether we can't achieve the same goal
> somehow easier with the current code...

We obviously also thought hard about this, but could not find out a
simpler alternative. Suggestions are welcome, as always.

Regards,
-- 
Silvio Moioli
SUSE LINUX Products GmbH
Maxfeldstraße 5, 90409 Nürnberg Germany

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] spacecmd - new function patch

2013-12-20 Thread Gregor Gruener

Hi spacewalkers,

I've updated the spacecmd "package.py" file, to add a new function 
"package_listdependencies".

Can you review and add this patch upstream.

Cheers,
Gregor Grüner
>From 28c227e56f6d3506a0ff97579576d9feeed7850c Mon Sep 17 00:00:00 2001
From: Gregor Gruener 
Date: Fri, 20 Dec 2013 09:33:31 +0100
Subject: [PATCH] added function package_listdependencies

---
 spacecmd/spacecmd.spec  |  3 +++
 spacecmd/src/lib/package.py | 39 +++
 2 files changed, 42 insertions(+)

diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 3b81360..12c9ed3 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -64,6 +64,9 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
 %doc %{_mandir}/man1/spacecmd.1.gz
 
 %changelog
+* Fri Dec 20 2013 Gregor Gruener  2.1.21-1
+- added function package_listdependencies
+
 * Fri Dec 13 2013 Milan Zazrivec  2.1.20-1
 - 1009841 - don't attempt to write out 'None'
 
diff --git a/spacecmd/src/lib/package.py b/spacecmd/src/lib/package.py
index ea2f355..8bbc8a7 100644
--- a/spacecmd/src/lib/package.py
+++ b/spacecmd/src/lib/package.py
@@ -297,4 +297,43 @@ def do_package_listerrata(self, args):
 if len(errata):
 print '\n'.join(sorted([ e.get('advisory') for e in errata ]))
 
+
+
+def help_package_listdependencies(self):
+print 'package_listdependencies: List the dependencies for a package'
+print 'usage: package_listdependencies PACKAGE'
+
+def do_package_listdependencies(self, args):
+(args, options) = parse_arguments(args)
+
+if not len(args):
+self.help_package_listdependencies()
+return
+
+packages = []
+for package in args:
+packages.extend(self.do_package_search(' '.join(args), True))
+
+if not len(packages):
+logging.warning('No packages found')
+return
+
+add_separator = False
+
+for package in packages:
+if add_separator: print self.SEPARATOR
+add_separator = True
+
+package_id = self.get_package_id(package)
+
+if not package_id:
+logging.warning('%s is not a valid package' % package)
+continue
+
+package_id = int(package_id)
+pkgdeps = self.client.packages.list_dependencies(self.session, package_id)
+for dep in pkgdeps:
+print 'Package Name: %s' % package
+print 'Dependency: %s Type: %s Modifier: %s' % (dep['dependency'], dep['dependency_type'], dep['dependency_modifier'])
+
 # vim:ts=4:expandtab:
-- 
1.8.3.1

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

[Spacewalk-devel] [PATCH] Adding a password strength meter to spacewalk

2013-12-20 Thread Maximilian Meister

Hi everybody,

this patch would add a bootstrapified password strength meter 
to all pages where

user details are being created or edited (create the initial admin user,
create/edit normal users and create organization).
There is also a tick icon on the side of the password input fields, 
which checks if
the value in the desired password field will be accepted by the server 
and if the
value in the confirm password field matches the value in the desired 
password field.


We had this implemented in SUSE Manager before, and now completely 
reworked it.
It would be useful due to spacewalk being a systems administrations tool 
and

due to the security implications that come with it.

It is based on https://github.com/ablanco/jquery.pwstrength.bootstrap
where I also contributed to during the process.

Thanks
Maximilian

--
--
Mit freundlichen Grüßen,
Maximilian Meister
Systems Management Department

SUSE LINUX Products GmbH
Maxfeldstr. 5
D-90409 Nuremberg, Germany

http://www.suse.com

GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer, HRB 21284 (AG Nuremberg)

>From 74756cc3d26ac4bb64f322eaf82d30376d69466c Mon Sep 17 00:00:00 2001
From: Maximilian Meister 
Date: Thu, 19 Dec 2013 10:53:33 +0100
Subject: [PATCH 1/3] Styles for the password strength meter.

---
 branding/css/spacewalk-tools.less | 5 +
 branding/css/spacewalk.less   | 2 ++
 2 files changed, 7 insertions(+)
 create mode 100644 branding/css/spacewalk-tools.less

diff --git a/branding/css/spacewalk-tools.less b/branding/css/spacewalk-tools.less
new file mode 100644
index 000..0383b3d
--- /dev/null
+++ b/branding/css/spacewalk-tools.less
@@ -0,0 +1,5 @@
+/* Progress Bar for the password strength check */
+.progress-pwstrength {
+margin-bottom: 0;
+margin-top: 4px;
+}
diff --git a/branding/css/spacewalk.less b/branding/css/spacewalk.less
index 3afa2f0..cb69e25 100644
--- a/branding/css/spacewalk.less
+++ b/branding/css/spacewalk.less
@@ -11,6 +11,8 @@
 @import url(spacewalk-mixins.less);
 /*Import of Tables style*/
 @import url(spacewalk-tables.less);
+/* Import of spacewalk-tools */
+@import url(spacewalk-tools.less);
 /* Import of the Theme */
 @import url(spacewalk-theme.less);
 
--
1.8.4

>From 1b7dde2ec3b25c448cd5f6d050703e4ff3d03ae8 Mon Sep 17 00:00:00 2001
From: Maximilian Meister 
Date: Thu, 19 Dec 2013 10:57:14 +0100
Subject: [PATCH 2/3] Adding modified pwstrength.js library. Adding
 function to setup the password strength meter. Adding function to handle the
 tick icon on the side of a password input field.

---
 web/html/javascript/spacewalk-pwstrength.js | 477 
 1 file changed, 477 insertions(+)
 create mode 100644 web/html/javascript/spacewalk-pwstrength.js

diff --git a/web/html/javascript/spacewalk-pwstrength.js b/web/html/javascript/spacewalk-pwstrength.js
new file mode 100644
index 000..e7837fb
--- /dev/null
+++ b/web/html/javascript/spacewalk-pwstrength.js
@@ -0,0 +1,477 @@
+/*jslint browser: true, regexp: true, unparam: true */
+/*global jQuery */
+
+/*
+* jQuery Password Strength plugin for Twitter Bootstrap
+*
+* Copyright (c) 2008-2013 Tane Piper
+* Copyright (c) 2013 Alejandro Blanco
+* Dual licensed under the MIT and GPL licenses.
+*
+*/
+
+(function ($) {
+"use strict";
+
+var options = {
+errors: [],
+// Options
+minChar: 8,
+bootstrap3: false,
+errorMessages: {
+password_too_short: 'The Password is too short',
+email_as_password: 'Do not use your email as your password',
+same_as_username: 'Your password cannot contain your username',
+repeated_character: 'The password should not contain repetitions',
+no_character_classes: 'Use different character classes'
+},
+scores: [17, 26, 40, 50],
+verdicts: ["Weak", "Normal", "Medium", "Strong", "Very Strong"],
+showVerdicts: true,
+showVerdictsInitially: false,
+raisePower: 1.4,
+usernameField: "#username",
+onLoad: undefined,
+onKeyUp: undefined,
+container: undefined,
+viewports: {
+progress: undefined,
+verdict: undefined,
+errors: undefined
+},
+// Rules stuff
+ruleScores: {
+wordNotEmail: -100,
+wordLength: -100,
+wordSimilarToUsername: -100,
+wordRepetition: -30,
+wordLowercase: 1,
+wordUppercase: 3,
+wordOneNumber: 3,
+wordThreeNumbers: 5,
+wordOneSpecialChar: 3,
+wordTwoSpecialChar: 5,
+wordUpperLowerCombo: 2,
+wordLetterNumberCombo: 2,
+wordLetterNumberCharCombo: 2,
+wordTwoCharacterClasses: -5
+},
+rules: {
+