aker-gateway / Aker

SSH bastion/jump host/jumpserver
Other
566 stars 81 forks source link

Error running aker.py #86

Closed Tomasfire closed 5 years ago

Tomasfire commented 5 years ago

Hi, I set up this environment: aker.wp.local - aker server akerclient.wp.local - client where I want to connect freeipa.wp.local - freeipa server

Servers were set up by Ansible playbook, freeipa authentication is working (I can connect with freeipa user to akerclient), however when I connect to the aker server, I recive this error:

ipa: ERROR: Could not create log_dir u/home/test/.ipa/log
Traceback (most recent call last):
  File "/bin/aker/aker.py", line 174, in <module>
    Aker().build_tui()
  File "/bin/aker/aker.py", line 130, in __init__
    self.user = User(self.posix_user)
  File "/bin/aker/aker.py", line 82, in __init__
    self.allowed_ssh_hosts, self.hostgroups = self.hosts.list_allowed()
  File "/bin/aker/hosts.py", line 261, in list_allowed
    backend_host_attributes['name'],
KeyError: 'name

Can you please help me? Tom

Tomasfire commented 5 years ago

Here is output from aker.log, maybe it will help more:

2019-02-22 10:36:56,325 - INFO - Core: Starting up, user=admin from=192.168.255.16:31072
2019-02-22 10:36:56,325 - DEBUG - Core: using Identity Provider IPA
2019-02-22 10:36:56,325 - INFO - IdPFactory: trying dynamic loading of module : IPA
2019-02-22 10:36:56,374 - INFO - IPA: loaded
2019-02-22 10:36:56,780 - DEBUG - IPA: ALL_HOSTS freeipa.wp.local
2019-02-22 10:36:56,826 - DEBUG - IPA: ALL_HOSTS freeipa.wp.local
2019-02-22 10:36:56,868 - DEBUG - IPA: Checking freeipa.wp.local
2019-02-22 10:36:56,970 - DEBUG - IPA: ALLOWED_HOSTS freeipa.wp.local
anazmy commented 5 years ago

So, You're accessing aker server using freeipa user, right?

Tomasfire commented 5 years ago

Correct, I am able to log in with freeipa user to freeipa client (also installed on aker server), but when I use aker itself, I got error mentioned in first post.

anazmy commented 5 years ago

The below line looks off. Can you please aker.ini and all variables you passed to the ansible playbook?

ipa: ERROR: Could not create log_dir u/home/test/.ipa/log
Tomasfire commented 5 years ago

aker.ini:

[General]
log_level = DEBUG
ssh_port = 22

# Identity Provider to determine the list of available hosts
# options shipped are IPA, Json. Default is IPA
idp = IPA
hosts_file = /etc/aker/hosts.json

# FreeIPA hostgroup name contatining Aker gateways
# to be excluded from hosts presented to user
gateway_group = gateways

Ansible command: ansible-playbook -e " install_elasticsearch=False dns=10.253.10.11 aker_load_sample_env=False aker_admin_user=tsrnec" aker-freeipa.yml --ask-become-pass -u tsrnec --ask-pass

Global variables:

# Install Elasticsearch
install_elasticsearch: True

# Install FreeIPA
install_freeipa: True

# DNS server to be added in /etc/resolv.conf
dns: 10.253.10.11

#FreeIPA admin passsword
ipaserver_dir_admin_password: Secret123
ipaserver_admin_password: Secret123

# FreeIPA domain/realm
ipaserver_domain: freeipa.wp.local

# Manage firewalld
ipaserver_manage_firewalld: True

# Add sample rules and users to FreeIPA or Json
aker_load_sample_env: True

# Identity Provider , default to IPA
aker_idp: IPA

# User that doesn't have aker shell forced to it, should have sudo access.
aker_admin_user: tsrnec

I manually created homedir for user test (error with log_dir was fixed with that), but the rest is the same.

zl commented 5 years ago
Traceback (most recent call last):
  File "/usr/bin/aker/aker.py", line 174, in <module>
    Aker().build_tui()
  File "/usr/bin/aker/aker.py", line 130, in __init__
    self.user = User(self.posix_user)
  File "/usr/bin/aker/aker.py", line 82, in __init__
    self.allowed_ssh_hosts, self.hostgroups = self.hosts.list_allowed()
  File "/usr/bin/aker/hosts.py", line 261, in list_allowed
    backend_host_attributes['name'],
KeyError: 'name'
anazmy commented 5 years ago

Just to confirm, this error is when you're logging to aker server?

Tomasfire commented 5 years ago

Yes, this is output from aker server, when I am trying to log in using FreeIPA user.

anazmy commented 5 years ago

Fixed in latest commit. Please check now.

Tomasfire commented 5 years ago

Working! Thanks a lot for help anazmy.