Giter Site home page Giter Site logo

hashbangctl's Introduction

hashbangctl

https://github.com/hashbang/hashbangctl

About

This dameon allows users to create/manage shell accounts over ssh.

Features

  • Current
    • New users get a form to create an account
      • Prefills form with hosts, username and ssh key
        • Randomly populate hosts dropdown from userdb
        • Direct users to run ssh-keygen if no key detected
        • Suggest available username based on incoming username
    • Connection IP rate limiting
    • Basic end to end test suite
  • Future
    • If incoming ssh key detected and account exists, direct to management menu
      • Allow users to change their details in UserDB, manage keys, etc
    • Support non-interactive use
    • text captcha
    • k8s deployment boilerplate
      • strict pod security policy
      • strict apparmor/seccomp rules

Requirements

  • Docker 19+
  • Go 1.13+

Usage

Build

Build or rebuild the binaries.

make

Serve

Start the server

make serve

Connect

Connect to the server

make connect

Test

Run the test suite

make test

Test Shell

Launch a shell in the test suite to run any tests by hand

make test-shell
> ssh_command "ed25519" "jdoe" "some-command"

Clean

Stop all containers and cleanup

make clean

hashbangctl's People

Contributors

aagat avatar bmintz avatar chickennuggers avatar daurnimator avatar drgrove avatar kellerfuchs avatar lrvick avatar lyneca avatar m42e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

hashbangctl's Issues

hashbangctl.conf can't be stored in shell-etc because it contains a secret

hashbangctl.conf can't be stored in shell-etc because it contains a secret.

Maybe this isn't that big of a deal because who cares about that file anyway, right?

But nonetheless, I'd like to see all admin-tools type stuff store all the secrets in a way that allows uses to have maximum visibility into /etc.

For many years, users on many *nix boxen have been able to read all the files in /etc that weren't explicitly verboten by permissions. With a little work, we might be able to get back to that.

Pip problems causing hashbangctl to crash

When sudo hashbangctl is run, Pip/setuptools gets mad and spits out

Traceback (most recent call last):
  File "/usr/local/bin/hashbangctl", line 4, in <module>
    __import__('pkg_resources').require('hashbangctl==0.2')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2876, in <module>
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 449, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 745, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 639, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: hashbangctl==0.2

@KellerFuchs started to diagnose:

2016-03-04 21:00:39     KellerFuchs     Oh fsck, I think I know
2016-03-04 21:00:50     KellerFuchs     pip is a pip of shit that installs in /tmp
2016-03-04 21:00:55     KellerFuchs     and /tmp got compartmented

TypeError when importing ssh keys from github

Importing my pubkey from github and then saving changes results in a TypeError:

Traceback (most recent call last):
  File "/usr/local/bin/hashbangctl", line 186, in <module>
  File "/usr/local/bin/hashbangctl", line 86, in ldap_sync
  File "/usr/local/lib/python2.7/dist-packages/provisor/provisor.py", line 271, in modify_user
  File "/usr/local/lib/python2.7/dist-packages/ldap/ldapobject.py", line 401, in modify_s
  File "/usr/local/lib/python2.7/dist-packages/ldap/ldapobject.py", line 398, in modify
  File "/usr/local/lib/python2.7/dist-packages/ldap/ldapobject.py", line 370, in modify_ext
  File "/usr/local/lib/python2.7/dist-packages/ldap/ldapobject.py", line 106, in _ldap_call
TypeError: ('expected a string in the list', u'[MY PUBLIC KEY]')

Shells that don't exist can be set

07:44:07 <bibek> oh really? oh why would it silently let me [change] it to that.

We should -probably- check if a shell exists before we set users up to fail in authentication.

Greater than 9 Public keys results in inability to delete any keys

Using the Github public key import feature, I had 17 public keys for my user account. I tried to SSH back in and was given failure notices. After SSH-ing back in as root, then su singlerider, I tried to delete the numerous (and I thought perhaps duplicated) Public keys. To my horror, I was unable to, due to:

https://github.com/hashbang/hashbangctl/blob/master/bin/hashbangctl#L176

expecting a single string character to extract with ord(). I had to go to [email protected] -p 8893
and execute commands resembling:

docker exec -i slapd ldapmodify -D "cn=admin,dc=hashbang,dc=sh" -w $ldap_password << EOF
dn: uid=singlerider,ou=People,dc=hashbang,dc=sh
changetype: modify
delete: sshPublicKey
sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCyzIDwTLWC1PuciL09yUS/kSsM2+VGOBmiNyk3OOONDrcM04EFIjW8RzH5wsa2ERzlL2c4z+esQwlosvCg8yzJEdo3KE2d4J52CciufuKplc+nRSXsb2d6cul5iZUhzgou14bRTN0xmLlZUZeKM1jyGqpkthOhBRid+0GpLAlXReUnu+MVHSreeqtgVswmaP1RdvTPLW11enyCWW0IxfKp7RUWrDKANEQ5+aUXzY95dxwQJxbw1Rh2IbPIugaG3pPklt4cKRLYHyf30C/HlBvyy9Fm7AHnYtjNOA8OVL1MI7Pf5sW0VXXY0HnlBSd+5RItETUXl5xupmEwKHdyLadD79prHg/Z++65xAJEYF1C+BVlIqiMXrUEdPwx4VnH61KpBAicY+W5V/YJeMeeqlI9clgynPwkiPman9TGNNdXPz7Z3Q11KHHbFBFOPlkR9TGWLLy2ex+rRejhTQJlI29hbN+4wuiVs7oLursP66VEDPTNuX1aRFJwrU1JJHL3I8ipl5B5cn6NNgN8vqUBUzjMbSyRico0h9jaC4ytwpZOMtFjEeq4t0JIYXkyXjihy7sV7/sF8EaB81dTGtlcps6cZ+homdY8l/94g5Qa2/5BBFh1ZxCwkqlsgZPI5rHA1Te7sr6WuF4niUhuSGBYufmNBT1W6fk3RDeR0W2IgL7HFQ== cardno:000605649986
EOF

one-by-one, ensuring hashbangctl was NOT open on my account, as that locks its state when I run the above command.

Another interesting side-effect was that, with greater than 9 public keys, a user is unable to log in to hashbang via ssh.

Split off between a privileged daemon and an unprivileged frontend

I'm proposing an idea for a new version of the hashbangctl program.
Multiple clients, one server.
Clients write to server, server interfaces with the system as root. Clients won't need sudo permissions.

Thoughts?
( lrvick also suggested to make hashbangctl upgrade it's runtime user level to root, thoughts on this too? )

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.