1 |
On 7/15/22 1:07 AM, J. Roeleveld wrote: |
2 |
> What I am looking for is: |
3 |
> 1) Lookup credentials from password vault (I can do this in |
4 |
> script-form, already doing this in limited form for ansible-scripts, |
5 |
> but this doesn't give me an interactive shell) |
6 |
|
7 |
ACK You indicated you already had a solution for this. So I'm leaving |
8 |
it in your capable hands. |
9 |
|
10 |
> 2) Use admin-account credentials to login via SSH into host |
11 |
|
12 |
When you say "admin-account", do you mean the given System |
13 |
Administrator's personal account or a common / shared administrative |
14 |
account? E.g. would I log in as myself; "gtaylor", or something shared |
15 |
"helpdeskadmin"? |
16 |
|
17 |
I'm assuming the former unless corrected. |
18 |
|
19 |
Do you want the user to be prompted for the Unix account password (on |
20 |
the remote system) or can they use SSH keys to login without a password |
21 |
prompt? |
22 |
|
23 |
> 3) On remote host, initiate "su -" to switch to root and provide |
24 |
> root-password over SSH link at the right time |
25 |
|
26 |
I would suggest having the SSH command invoke the "su -" command |
27 |
automatically. |
28 |
|
29 |
Note: You will probably want to run a command something like this to |
30 |
make sure that a TTY is allocated for proper interaction with su. |
31 |
|
32 |
ssh -t <remote_user>@<remote_host> "/path/to/su -" |
33 |
|
34 |
> 4) Give me an interactive root-shell on remote-host |
35 |
|
36 |
Okay. Not what I would have expected, but it's your system and you do |
37 |
you. :-) |
38 |
|
39 |
> When I close the shell, I expect to be fully logged out (eg, I go |
40 |
> straight back to the local host, not to the admin-account) |
41 |
|
42 |
The nice thing about having SSH invoke the "su -" command directly is |
43 |
that once you exit su, you also end up exiting the SSH session. |
44 |
|
45 |
> I see plenty of google-results and also as answers for ssh directly to |
46 |
> "root" using ssh-keys. I do not consider this a safe method, I use |
47 |
> it for un- priviliges accounts (not member of "wheel"). I don't use |
48 |
> it for admin- accounts. |
49 |
|
50 |
Thank you for the elaboration. I tend to agree with your stance. I |
51 |
have exceedingly few things that can SSH into systems as the root user, |
52 |
and they all have forced commands. They all have to do with the backup |
53 |
system which can't use sudo /or/ I want the ability to get in and |
54 |
restore a sudoers file if it gets messed up, thus avoiding the chicken / |
55 |
egg problem. |
56 |
|
57 |
Following the same security mentality, I prefer to specify the full path |
58 |
to executables, when possible, in order to make sure that someone |
59 |
doesn't put a Trojanized version earlier in the path. }:-) |
60 |
|
61 |
|
62 |
|
63 |
-- |
64 |
Grant. . . . |
65 |
unix || die |