博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Setting Up a Kerberos server (with Debian/Ubuntu)
阅读量:5738 次
发布时间:2019-06-18

本文共 3656 字,大约阅读时间需要 12 分钟。

First I created three Virtualbox VMs (Debian Linux) for Kerberos server, client and ssh server.

Kerberos server - kerberos.com
Client - client.com
SSH server - ssh.com

Then I added the following lines to the /etc/hosts files of the VMs.

10.0.0.1 kerberos.com
10.0.0.2 client.com
10.0.0.3 ssh.com
Make sure you can ping kerberos.com, ssh.com, client.com from all VMs(To check host-names are resolving).
Kerberos Server

Installing the Kerberos server (kerberos.com)

apt-get install krb5-admin-server krb5-kdc
During the installation it "may" ask following questions (My answers are shown in brackets)
Default Kerberos version 5 realm? [KERBEROS.COM]
Kerberos servers for your realm? [kerberos.com]
Administrative server for your realm? [kerberos.com]
Configuring Kerberos server
Before beginning a new realm must be created
krb5_newrealm

Edit the /etc/krb5.conf file (enter the following lines to the file if they're not there)

[libdefaults]

default_realm = KERBEROS.COM

...

...
...
[realms]

kdc = kerberos.com    admin_server = kerberos.com

...

...
...
[domain_realm]
...
...

kerberos.com = KERBEROS.COM    .kerberos.com = KERBEROS.COM

Notice on cdh:

we should open tcp port by updating file /etc/krb5kdc/kdc.conf:
kdc_tcp_ports = 88
then restart kdc service:
service krb5-admin-server restart
service krb5-kdc restart

Adding users (Principles)

Use the kadmin.local tool to add/delete/modify users (principles)

Type kadmin.local to use the tool

listprics will list the existing principles
To add the root user, type
addprinc root

If you want to assign an admin role to a user use the following command

addprinc root/admin
Then you have to uncomment the /admin line in /etc/krb5kdc/kadm.acl file.

In order to check the principle has applied correctly type the following command

kinit

kinit is used to get tickets from the Kerberos server.

It will prompt for password. (Enter the password given to the addprinc command)
Now type the following command to see the ticket.
klist
Client

Installing and configuring client for Kerberos (client.com)

apt-get install krb5-user

It will ask the same questions, asked during the server installation.

[Make sure you can ping kerberos.com from your client.com machine]

Testing

To get a ticket for your client machine type the following command.
kinit root
or (depending on your principles in kerberos.com)
kinit root/admin
If you get a ticket from kerberos.com, its working!.

Services

Using SSH service with Kerberos (ssh.com)

Install open ssh server and krb5-config
apt-get install openssh-server krb5-config
Configure the /etc/krb5.conf accordingly (Just like the previous ones)

Configuring SSH to use with Kerberos

Edit /etc/ssh/sshd_config and enable the following lines
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
Then restart the ssh server [/etc/init.d/ssh restart]

Configuring Kerberos server (kerberos.com) to work with ssh.com

Type the following commands on the kerberos.com to add the ssh.com principle
kadmin.local
addprinc -randkey host/ssh.com
ktadd -k /tmp/ssh.com.keytab host/ssh.com
Now copy the /tmp/ssh.com.keytab file to the ssh server (ssh.com) using the command below
scp /tmp/ssh.com.keytab root@ssh.com:/etc/krb5.keytab
Configuring a client machine for Kerberos authentication
Edit /etc/ssh/ssh_config and enable the following lines
GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes
Testing SSH service with Kerberos
Log in to the client machine and get a ticket
kinit root
(or kinit root/admin)
Then type the command below. It should log in to the ssh.com without password.
ssh root@ssh.com
Now type the following commands and check the difference
kdestroy
ssh root@ssh.com

Source:-

转载地址:http://cpbzx.baihongyu.com/

你可能感兴趣的文章
apache安装报错undefined reference ssl
查看>>
关于爱情只有一句忠告
查看>>
CentOS 7下安装部署Oracle11g图文教程
查看>>
F#初学笔记06
查看>>
实战:将企业域名解析委派给企业DNS服务器
查看>>
在Lync 2013环境部署Office Web Apps
查看>>
微软大会Ignite,你准备好了么?
查看>>
读书笔记-高标管事 低调管人
查看>>
Master带给世界的思考:是“失控”还是进化
查看>>
用户和开发者不满苹果iCloud问题多多
查看>>
attrs.xml中declare-styleable 详解(用于自定义控件的属性)
查看>>
java.lang.UnsatisfiedLinkError:no dll in java.library.path终极解决之道
查看>>
错误“Unexpected namespace prefix "xmlns" found for tag LinearLayout”的解决方法(转)
查看>>
我的工具:文本转音频文件
查看>>
【许晓笛】从零开始运行EOS系统
查看>>
【跃迁之路】【460天】程序员高效学习方法论探索系列(实验阶段217-2018.05.11)...
查看>>
C++入门读物推荐
查看>>
TiDB 源码阅读系列文章(七)基于规则的优化
查看>>
面试中会遇到的正则题
查看>>
Spring之旅第八站:Spring MVC Spittr舞台的搭建、基本的控制器、请求的输入、表单验证、测试(重点)...
查看>>