-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
locked out after running debops #148
Comments
@schreon Hello. Have you seen the Getting Started Guide? You might have seen only the guide about the scripts, not the default playbook. DebOps is designed for production environment in mind. Some of the things like use of SSH keys and firewall are enabled by default, however if you haven't changed anything, the various roles should pick up your SSH public key and the IP address you are connecting from and allow you to access the host. In the past it was very common to be locked out by the firewall, but it shouldn't happen now in the default configuration. As for lack of public key... do you have an SSH key set up? Do you use To get back to the host, you should try accessing it over the host console (if it's a VM, look at the VNC connection). Password to the |
@drybjed Hi, thanks for the lightning fast reply. Indeed, I did not change anything except adding my host to the I also tried to force password-authentication ( I currently have no direct access to the host system the VM is running on, so I believe using VNC is no option (however I will contact an admin if I can not figure out how to gain access via |
@schreon In that case you need to check the ... Which, now that i think of it, might not have been. How was that VM prepared for you? Did you have an admin account set up with your SSH key? Do you use preseeding or is that something like a Digital Ocean VM? In that case you might want to check out debops.bootstrap role which can prepare a host to be managed with DebOps for you, including setting a host domain, preparing an admin account and setting up your SSH key. |
We logged in via a host console. We discovered the following issues:
In the end, I ended up locked out because neither the previous remote user nor the new remote user could be used for logging in on the server. Manually adapting the parameters in I will grab another phyiscal machine now, put it under my desktop and try to "get started" there - allowing me to login directly if anything goes wrong :) Thanks again for the quick replies. |
The different roles are configured to what I'm mostly using as defaults, an admin username the same as your local account name, mostly to avoide a static The admin account created by DebOps doesn't have a password because you are supposed to use SSH keys; passwords over SSH are disabled anyway. The password i pointed you to is for the If you want to change the admin account name on remote server, you might need to set:
in the Ansible inventory. Keep in mind that you should tell Ansible to use that as well, by setting |
@schreon BTW, did you make GitLab work? |
@drybjed I am still digesting your input and getting used to ansible / debops :) I will report back soon. Thanks a lot! |
@schreon Come over to |
I had a similar issue when using Vagrant and debops. The solution (thanks to drybjed) was to add the following variables:
I'm adding this here, as this is the first result on Google, and it might help someone in the future! |
FTR: There is debops/ansible-sshd#53 which probably fixed issues related locking out the ansible user. |
I just launched a fresh install of Ubuntu 16.04 from AWS EC2 and experienced the same issue. @drybjed having the user locked out of their machine is an unfortunate first step to get when running this program. It would be of great value if you could ensure sane defaults were set so that users weren't locked out with the default setup. If bootstrap needs to be run to ensure there is no lockout, why not just run it by default? There was nothing in the "getting started" wiki that warned about this. |
@cyrrill Recently the What "sane defaults" would like to see implemented in the project? Currently DebOps should detect the admin account by itself and add it to the The |
@drybjed Thanks for your outstanding work here, I forgot to mention that in the previous post. The note in that page also says:
Which actually applies in my case. AWS EC2 by default creates an instance where the "ubuntu" user can use passwordless sudo. You also already have SSH access by means of *.pem keys. It wasn't clear to me that debops would alter my original account, or that there would be a risk of lockout. Clearing that up in bold somewhere would save a lot frustration to new users as myself. I'm not sure which of these changes did the trick, but in compiling fixes from different threads, this diff now allows me to create a new instance, and not be locked out:
Thanks again! |
Would be just so much simpler if this could happen by itself when needed. Is there some programmatic way to determine if said bootstrapping has already occurred? Perhaps by testing the user groups? Or is it possible to just make the bootstrap idempotent, so it doesn't affect it if run again? |
The above mention about I think that the variables above were needed before the The problem with determining if a user account is in groups that allow SSH access is that, if it isn't, you cannot connect to the host over SSH to test it. It's a chicken and egg problem which But look at it in another way. Since you are using AWS EC2, does the VPS provider give you any way to configure the host during the deployment, like |
I think this should actually be disallowed? Some OS have this turned off in sshd config by default.
Not really, they just give you a choice of stock OS options, hardware +/- on CPU/RAM/Disk, firewall, etc.. but nothing really on the user side. All you get is the default "ubuntu" user with passwordless sudo, and root login disabled. I could use some other tool to prepare the server, but I was hoping debops could take me from AWS launch to deploy...
This is not really possible with the default EC2 setup. Barring hardcoding this into debops, I would really hope there would be a simpler way. Ubuntu is one of the most popular server choices, and EC2 one of the more common cloud choices. Maybe an "ubuntuops" fork can be maintained with some Ubuntu specific settings? I'd be willing to help maintain that if the best way of setting up is determined. |
As I said previously, at the moment DebOps should detect the correct admin account to which you are connecting and add it to the In the AWS EC2 case, the I don't think that a separate fork for Ubuntu would be that useful. The special Ubuntu settings should be reviewed and if useful, implemented in the DebOps itself. It might even benefit Debian hosts, if the specific changes are good enough. Any specific configuration you have in mind? |
@drybjed, I haven't reviewed the source enough to make exact sense as to how debops is handling the specifics of this, maybe once I spend some time I can make a more useful suggestion. |
@cyrrill Publish the repository, and I'll see what can be done. :-) |
For now it contains some proprietary work stuff I haven't prepared for publishing publicly, however those changes are not relevant to this ticket; in terms of avoiding lockout, the vars in: #148 (comment) are pretty much what fixed it (albeit I don't know which one yet ;) ) |
You should be able to just leave |
Once I make some progress in my work, I'll spend some time launching another instance to test. I'll report back. |
Oh, and maybe could be useful to add the bootstrap note to the Installation guide of this repo. It's actually the one I initially used. Didn't read the fuller (and very complete) docs until I ran into problems. |
I'm working on cleaning up |
Had some more time today to run a test. Adding only Found that I don't even have to run the bootstrap. Was able to provision via the I think we can close this issue? |
Caveat lector:
|
I just followed the instructions, ran
debops
, everything finished successfully. ( my goal was to installgitlab
using this utility here ).Now, whenever I want to
ssh
to my host I get the error messagePermission denied (publickey).
Any tasks run via
debops
fail for the same reason.Locally, some folders have been created in my project-folder ( ansible/secret/credentials, ansible/secret/dhparam, ansible/secret/pki )
I did not expect the default playbook of this package to instantly lock me out of my system.
What happened here? What can I do to access my host again?
The text was updated successfully, but these errors were encountered: