Giter Club home page Giter Club logo

Comments (6)

skhuang avatar skhuang commented on July 16, 2024

你們在執行外部命名時,原本是以 www-data 執行 cmd arg ....
現在改為
/usr/bin/sudo /bin/su penobody -c cmd arg ...

這樣就以 penobody 的權限執行,就無法動到 www-data 的檔案。

from peaas.

skhuang avatar skhuang commented on July 16, 2024

另外有關 security ,另外解法是 linux control group, 用 cgexec. 我們後續可慢慢學。

from peaas.

lancechentw avatar lancechentw commented on July 16, 2024

you may also consider using

/usr/bin/sudo -u penobody cmd args

from peaas.

skhuang avatar skhuang commented on July 16, 2024

it is restricted in /etc/sudoers with NOPASSWD for /bin/su penobody -c. Is it possible to limit sudo -u penobody without password ? the command launched by www-data is from web applications.

from peaas.

lancechentw avatar lancechentw commented on July 16, 2024

Sure, a simple example

www-data    ALL = (penobody) NOPASSWD: /usr/bin/cmdA, /usr/bin/cmdB, /usr/bin/cmdC

User www-data can run cmdA, cmdB and cmdC as user penobody without authentication on any hosts.

from peaas.

skhuang avatar skhuang commented on July 16, 2024

It is a better solution. We need the whitelist of cmdA,B,C. Another concern is that the command executed may create a backdoor to other sites. (I just restrict outgoing connection)

from peaas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.