Posts

Showing posts with the label SSH

Misc: Adding/Enabling a Linux user via ssh public key w/ sudo and to not require a password.

Summary: This is a very specific use case, but is helpful when working w/ cloud instance VM's that don't make use of central auth.  The following script essentially adds a user to Linux so that they can ssh into the system w/ using their ssh public key and utilize sudo if granted.  Running sudo as these users typically requires a password be set.  In this case, we are not setting a password on the account as  This script circumvents the need for users to provide a password. Details: Effectively, the script works like so: An existing sudoer/root/admin must run this script. You provide a username and the user's ssh public key. Set sudoer to true or false (or anything other than true really) customsudofile path defaults to /etc/sudoers.d/nopasswd Essentially, anything in sudoers.d path is ingested by sudoer file as an override. customsudodata is what you want to insert into the custom sudo file. Default set to allow sudo members to invoke sudo w/o a...

Mac: VPN over SSH using sshuttle

Image
Summary: Sometimes it's simply easier to run or do things from your local system rather than rely on a bastion/jumphost.  sshuttle allows you to utilize a Linux bastion/jumphost as a psuedo VPN endpoint. Full documentation and source can be found here: http://sshuttle.readthedocs.io/en/stable/manpage.html https://github.com/apenwarr/sshuttle Walkthrough: Brew is probably the easiest installation method and less prone to complications by using pip.  So that's what I'll go through here: Launch Terminal brew install sshuttle sshuttle -r usernameonLinuxSSHhost@LinuxSSHhostnameorIP 192.168.50.0/24 Done.  Easy right?  Now upon successful connection, all traffic bound for an ip on 192.168.50.0/24 will tunnel through your Linux SSH host.   Additional Notes: Remember to kill your session when done.  I've heard of reports that sshuttle having memory leaks or whatnot causing RAM to fill up.  Killing terminal session should kill it, bu...