1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mageia-sysadm] [516] use a mdv-youri-submit wrapper through sudo, for repsys
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B516%5D%20use%20a%20mdv-youri-submit%20wrapper%20through%20sudo%2C%0A%09for%20repsys&In-Reply-To=%3C20101206233839.760143FDEA%40valstar.mageia.org%3E">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="001072.html">
<LINK REL="Next" HREF="001035.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mageia-sysadm] [516] use a mdv-youri-submit wrapper through sudo, for repsys</H1>
<B>root at mageia.org</B>
<A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B516%5D%20use%20a%20mdv-youri-submit%20wrapper%20through%20sudo%2C%0A%09for%20repsys&In-Reply-To=%3C20101206233839.760143FDEA%40valstar.mageia.org%3E"
TITLE="[Mageia-sysadm] [516] use a mdv-youri-submit wrapper through sudo, for repsys">root at mageia.org
</A><BR>
<I>Tue Dec 7 00:38:39 CET 2010</I>
<P><UL>
<LI>Previous message: <A HREF="001072.html">[Mageia-sysadm] ldap write log
</A></li>
<LI>Next message: <A HREF="001035.html">[Mageia-sysadm] [517] use youri_submit class on pkgsubmit
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#1034">[ date ]</a>
<a href="thread.html#1034">[ thread ]</a>
<a href="subject.html#1034">[ subject ]</a>
<a href="author.html#1034">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Revision: 516
Author: blino
Date: 2010-12-07 00:38:39 +0100 (Tue, 07 Dec 2010)
Log Message:
-----------
use a mdv-youri-submit wrapper through sudo, for repsys
Modified Paths:
--------------
puppet/modules/buildsystem/manifests/init.pp
puppet/modules/buildsystem/templates/repsys.conf
Added Paths:
-----------
puppet/modules/buildsystem/templates/mdv-youri-submit
puppet/modules/buildsystem/templates/mdv-youri-submit.wrapper
puppet/modules/buildsystem/templates/sudoers.youri
Modified: puppet/modules/buildsystem/manifests/init.pp
===================================================================
--- puppet/modules/buildsystem/manifests/init.pp 2010-12-06 17:25:58 UTC (rev 515)
+++ puppet/modules/buildsystem/manifests/init.pp 2010-12-06 23:38:39 UTC (rev 516)
@@ -104,6 +104,29 @@
}
}
+ class youri_submit {
+ file { "/usr/local/bin/mdv-youri-submit":
+ owner => root,
+ group => root,
+ mode => 755,
+ content => template("buildsystem/mdv-youri-submit")
+ }
+
+ file { "/usr/local/bin/mdv-youri-submit.wrapper":
+ owner => root,
+ group => root,
+ mode => 755,
+ content => template("buildsystem/mdv-youri-submit.wrapper")
+ }
+
+ file { "/etc/sudoers.d/mdv-youri-submit":
+ owner => root,
+ group => root,
+ mode => 440,
+ content => template("buildsystem/sudoers.youri")
+ }
+ }
+
define sshuser($homedir, $comment) {
group {"$title":
ensure => present,
Added: puppet/modules/buildsystem/templates/mdv-youri-submit
===================================================================
--- puppet/modules/buildsystem/templates/mdv-youri-submit (rev 0)
+++ puppet/modules/buildsystem/templates/mdv-youri-submit 2010-12-06 23:38:39 UTC (rev 516)
@@ -0,0 +1,2 @@
+#!/bin/sh
+sudo mdv-youri-submit.wrapper "$@"
Property changes on: puppet/modules/buildsystem/templates/mdv-youri-submit
___________________________________________________________________
Added: svn:executable
+ *
Added: puppet/modules/buildsystem/templates/mdv-youri-submit.wrapper
===================================================================
--- puppet/modules/buildsystem/templates/mdv-youri-submit.wrapper (rev 0)
+++ puppet/modules/buildsystem/templates/mdv-youri-submit.wrapper 2010-12-06 23:38:39 UTC (rev 516)
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+# youri-submit wrapper
+
+use strict;
+use warnings;
+use Fcntl ':mode';
+use File::Basename;
+use MDK::Common;
+
+my $log_dir = "$ENV{HOME}/submit-logs";
+
+my $sudo_user = $ENV{SUDO_USER} or die "should be run through sudo";
+my @prog = ('perl', '-I/usr/share/mdv-youri-core/lib', '-I/usr/share/mdv-youri-submit/lib', '/usr/share/mdv-youri-submit/bin/youri-submit');
+
+my @options;
+foreach my $arg (@ARGV) {
+ if ($arg =~ /^-?-(\S+)/) {
+ # drop prohibited options
+ if ($arg =~ /-c/ || $arg =~ /-s/) {
+ print STDERR "prohibited option $arg, skipping\n";
+ next;
+ }
+ }
+ push(@options, $arg);
+}
+
+# logging for bug #30315 -spuk, 2007-05-29
+mkdir_p($log_dir);
+open(STDERR, "| tee -a $log_dir/$sudo_user.err >&2");
+open(STDOUT, "| tee -a $log_dir/$sudo_user.out");
+
+# call wrapped program
+print "Executing @prog --config /etc/youri/submit-todo.conf --define user=$sudo_user @options (sudo_user $sudo_user)\n";
+my $err = system(@prog, "-v", "--verbose", "--config", "/etc/youri/submit-todo.conf", "--define", "user=$sudo_user", @options) && ($? >> 8 || 1);
+
+exit $err
Property changes on: puppet/modules/buildsystem/templates/mdv-youri-submit.wrapper
___________________________________________________________________
Added: svn:executable
+ *
Modified: puppet/modules/buildsystem/templates/repsys.conf
===================================================================
--- puppet/modules/buildsystem/templates/repsys.conf 2010-12-06 17:25:58 UTC (rev 515)
+++ puppet/modules/buildsystem/templates/repsys.conf 2010-12-06 23:38:39 UTC (rev 516)
@@ -56,7 +56,7 @@
[helper]
create-srpm = /usr/share/repsys/create-srpm
-upload-srpm = perl -I/usr/share/mdv-youri-core/lib -I/usr/share/mdv-youri-submit/lib /usr/share/mdv-youri-submit/bin/youri-submit
+upload-srpm = /usr/local/bin/mdv-youri-submit
# needed by mdvsys 2.0
install-buildrequires = sudo rurpmi --auto --no-suggests
Added: puppet/modules/buildsystem/templates/sudoers.youri
===================================================================
--- puppet/modules/buildsystem/templates/sudoers.youri (rev 0)
+++ puppet/modules/buildsystem/templates/sudoers.youri 2010-12-06 23:38:39 UTC (rev 516)
@@ -0,0 +1,3 @@
+Cmnd_Alias YOURI = /usr/local/bin/mdv-youri-submit.wrapper
+Defaults!YOURI always_set_home
+%mga-packagers ALL = (<%= sched_login %>) NOPASSWD: YOURI
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101207/034fe5ea/attachment-0001.html>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="001072.html">[Mageia-sysadm] ldap write log
</A></li>
<LI>Next message: <A HREF="001035.html">[Mageia-sysadm] [517] use youri_submit class on pkgsubmit
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#1034">[ date ]</a>
<a href="thread.html#1034">[ thread ]</a>
<a href="subject.html#1034">[ subject ]</a>
<a href="author.html#1034">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-sysadm">More information about the Mageia-sysadm
mailing list</a><br>
</body></html>
|