Thanks for your reply bliako

I think I found possible solution using just sudo

have a program Perl and make executable chmod + x

in sudo whitelist that program and nothing else, I test it and work

because inside the program exist the location to binary perl hashbang or sh-bang

In the case of https://security.stackexchange.com/questions/219989/sudo-white-list-just-program-perl you have to white list perl binary and the program

So inside of perl program you can set Taint mode, ops, Safe

That mean have a helper or wrapper perl program (this have all privileges of sudo because this working white list a single program) inside of program you have to parameterised all the commands, is like dispatch table.

Related to hashbang or sh-bang security, I read a case of perl would redirect to another interpreter:

The change to hashbang redirection introduced in Perl 5.24.0, whereby perl would redirect to another interpreter (Perl 6) if it found a hashbang path which contains "perl" followed by "6"

source: https://perldoc.pl/perl5241delta

is this solution good?


In reply to Re: Modern and Robust Module for privilege separation Linux by Thenothing
in thread Modern and Robust Module for privilege separation Linux by Thenothing

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.