/[smeserver]/rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz9155-rsshgroup.patch
ViewVC logotype

Contents of /rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz9155-rsshgroup.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sun Feb 14 22:17:06 2021 UTC (3 years, 8 months ago) by jpp
Branch: MAIN
CVS Tags: e-smith-base-5_8_0-99_el7_sme, e-smith-base-5_8_0-94_el7_sme, e-smith-base-5_8_0-98_el7_sme, e-smith-base-5_8_0-97_el7_sme, e-smith-base-5_8_0-92_el7_sme, e-smith-base-5_8_0-91_el7_sme, e-smith-base-5_8_0-83_el7_sme, e-smith-base-5_8_0-96_el7_sme, e-smith-base-5_8_0-95_el7_sme, e-smith-base-5_8_0-90_el7_sme, e-smith-base-5_8_0-85_el7_sme, e-smith-base-5_8_0-86_el7_sme, e-smith-base-5_8_0-93_el7_sme, e-smith-base-5_8_0-81_el7_sme, e-smith-base-5_8_0-82_el7_sme, e-smith-base-5_8_0-87_el7_sme, e-smith-base-5_8_0-88_el7_sme, e-smith-base-5_8_0-84_el7_sme, e-smith-base-5_8_0-89_el7_sme
* Sun Feb 14 2021 Jean-Philipe Pialasse <tests@pialasse.com> 5.8.0-81.sme
- fix user with rssh shell need to be member of rsshusers group [SME: 9155]

1 diff -Nur e-smith-base-5.8.0.old/createlinks e-smith-base-5.8.0/createlinks
2 --- e-smith-base-5.8.0.old/createlinks 2021-02-14 17:04:03.823000000 -0500
3 +++ e-smith-base-5.8.0/createlinks 2021-02-14 17:12:36.219000000 -0500
4 @@ -313,6 +313,7 @@
5 event_link("conf-startup", $event, "10");
6 event_link("user-lock-passwd", $event, "15");
7 event_link("group-modify-unix", $event, "15");
8 +event_link("user-rsshd", $event, "16");
9 event_link("update-passwd", $event, "20");
10 event_link("count-active-user-accounts", $event, "25");
11 event_link("conf-modules", $event, "30");
12 @@ -337,6 +338,7 @@
13 templates2events("/home/e-smith/ssl.pem/pem", $event);
14 event_link("systemd-default", $event, "05");
15 event_link("set-hostname", $event, "10");
16 +event_link("user-rsshd", $event, "16");
17 event_link("conf-modules", $event, "30");
18 event_link("conf-startup", $event, "60");
19 event_link("systemd-reload", $event, "89");
20 @@ -356,6 +358,7 @@
21 event_link("systemd-default", $event, "05");
22 event_link("rmmod-bonding", $event, "10");
23 event_link("set-hostname", $event, "10");
24 +event_link("user-rsshd", $event, "16");
25 event_link("conf-modules", $event, "30");
26 event_link("conf-startup", $event, "60");
27 event_link("conf-routes", $event, "89");
28 @@ -445,6 +448,7 @@
29 event_link("init-accounts", $event, "05");
30 event_link("init-passwords", $event, "10");
31 event_link("conf-startup", $event, "10");
32 +event_link("user-rsshd", $event, "16");
33 event_link("conf-modules", $event, "30");
34 event_link("create-mnt-floppy", $event, "50");
35 event_link("systemd-reload", $event, "89");
36 @@ -463,6 +467,7 @@
37 event_link("conf-startup", $event, "10");
38 event_link("user-lock-passwd", $event, "15");
39 event_link("group-modify-unix", $event, "15");
40 +event_link("user-rsshd", $event, "16");
41 event_link("update-passwd", $event, "20");
42 event_link("count-active-user-accounts", $event, "25");
43 event_link("conf-modules", $event, "30");
44 @@ -495,6 +500,7 @@
45 $event = "user-create";
46
47 event_link("user-create-unix", $event, "04");
48 +event_link("user-rsshd", $event, "16");
49 event_link("count-active-user-accounts", $event, "25");
50 event_link("user-group-modify", $event, "85");
51
52 @@ -516,6 +522,7 @@
53 $event = "user-modify";
54
55 event_link("user-modify-unix", $event, "15");
56 +event_link("user-rsshd", $event, "16");
57 event_link("user-group-modify", $event, "85");
58
59 $event = "user-modify-admin";
60 diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/user-create-unix e-smith-base-5.8.0/root/etc/e-smith/events/actions/user-create-unix
61 --- e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/user-create-unix 2013-01-31 10:52:04.000000000 -0500
62 +++ e-smith-base-5.8.0/root/etc/e-smith/events/actions/user-create-unix 2021-02-14 17:05:46.650000000 -0500
63 @@ -73,6 +73,7 @@
64 my $city = $acct->prop('City') || '';
65 my $street = $acct->prop('Street') || '';
66 my $shell = $acct->prop('Shell') || '/usr/bin/rssh';
67 +my $groups = ($shell eq '/usr/bin/rssh')? "shared,rsshusers" : "shared";
68
69 if ($ldapauth ne 'enabled')
70 {
71 @@ -91,7 +92,7 @@
72 "-g", $gid,
73 "-c", "$first $last",
74 "-d", "/home/e-smith/files/users/$userName",
75 - "-G", "shared",
76 + "-G", "$groups",
77 "-m",
78 "-k", "/etc/e-smith/skel/user",
79 "-s", "$shell",
80 @@ -124,7 +125,7 @@
81 "-e", "$userName\@$domain",
82 "-a", "$tmpattr",
83 "-d", "/home/e-smith/files/users/$userName",
84 - "-G", "shared",
85 + "-G", "$groups",
86 "-m",
87 "-k/etc/e-smith/skel/user",
88 "-s", "$shell",
89 diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/user-group-modify e-smith-base-5.8.0/root/etc/e-smith/events/actions/user-group-modify
90 --- e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/user-group-modify 2005-11-20 23:28:05.000000000 -0500
91 +++ e-smith-base-5.8.0/root/etc/e-smith/events/actions/user-group-modify 2021-02-14 17:07:22.349000000 -0500
92 @@ -39,7 +39,7 @@
93 # actions for all these groups
94 my %modified_groups = map { $_, 1 } @old_groups, $acctdb->user_group_list($userName);
95 # but omit "shared" and user private group
96 -foreach ('shared', $userName)
97 +foreach ('shared', $userName, 'rsshusers')
98 {
99 delete $modified_groups{$_} if exists $modified_groups{$_};
100 }
101 diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/user-modify-unix e-smith-base-5.8.0/root/etc/e-smith/events/actions/user-modify-unix
102 --- e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/user-modify-unix 2014-03-23 22:47:23.000000000 -0400
103 +++ e-smith-base-5.8.0/root/etc/e-smith/events/actions/user-modify-unix 2021-02-14 17:07:34.030000000 -0500
104 @@ -81,7 +81,7 @@
105 my $new_shell = $u->prop('Shell')
106 || (($shell eq "/bin/sshell") ? "/usr/bin/rssh" : $shell);
107
108 - $u->set_prop('Shell', $new_shell);
109 + $u->set_prop('Shell', $new_shell) unless (not defined $u->prop('Shell') && $new_shell eq "/usr/bin/rssh" ) ;
110
111 my $result;
112 #------------------------------------------------------------
113 diff -Nur e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/user-rsshd e-smith-base-5.8.0/root/etc/e-smith/events/actions/user-rsshd
114 --- e-smith-base-5.8.0.old/root/etc/e-smith/events/actions/user-rsshd 1969-12-31 19:00:00.000000000 -0500
115 +++ e-smith-base-5.8.0/root/etc/e-smith/events/actions/user-rsshd 2021-02-14 17:14:00.552000000 -0500
116 @@ -0,0 +1,42 @@
117 +#!/usr/bin/perl -w
118 +
119 +package esmith;
120 +
121 +use strict;
122 +use Errno;
123 +use esmith::ConfigDB;
124 +use esmith::AccountsDB;
125 +use File::Temp;
126 +
127 +sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
128 +
129 +my $conf = esmith::ConfigDB->open_ro;
130 +my $accounts = esmith::AccountsDB->open;
131 +
132 +my $event = $ARGV[0];
133 +my $userName = $ARGV[1];
134 +# finallement get all user
135 +my @users = (not defined $ARGV[1])? $accounts->get_all_by_prop(type => "user" ) : map { $accounts->get($_); } $userName;
136 +my @currents=split /\n/, `/usr/sbin/lid -ng rsshusers`;
137 +@currents=map { trim($_) } @currents;
138 +
139 +# here we could be emptying group, but we might want to let system user on this list.
140 +#if ( $event ~~ ['user-modify','user-create'] ) {
141 +# system("/usr/bin/gpasswd","-M ''", "rsshusers");
142 +# print "deleting rsshusers group content ...";
143 +#}
144 +
145 +foreach my $user (@users) {
146 + my $cuser=$user->key;
147 + # we remove users that should not be there
148 + if ( defined $user->prop('Shell') && $user->prop('Shell') ne '/usr/bin/rssh') {
149 + next unless ( "$cuser" ~~ @currents ) ;
150 + system("/usr/bin/gpasswd", "-d", $cuser, "rsshusers");
151 + next;
152 + }
153 + # next if the user is already there
154 + next if ( "$cuser" ~~ @currents ) ;
155 + print "Adding user $cuser to group rsshusers";
156 + system("/usr/sbin/usermod", "-a", "-G", "rsshusers", $cuser);
157 +
158 +}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed