Setting Up a Kerberos server (with Debian/Ubuntu)

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://www.debian-administration.org/articles/570

时间: 2024-09-18 09:54:37

Setting Up a Kerberos server (with Debian/Ubuntu)的相关文章

How to Setup a Minecraft Server on Debian or Ubuntu OS

By Arslan Ud Din Shafiq Alibaba Cloud Tech Share Author Minecraft is one of the most played games worldwide, with more than 100 million users from all over the world. In a 3D generated place, players explore & build anything that they want. You can p

Debian Ubuntu Root权限受到威胁 Tomcat本地提权漏洞CVE-2016-1240 请安全运维尽快升级

2016年9月30日,legalhackers.com网站发布了一个关于Tomcat漏洞的公告,所涉及漏洞的编号为CVE-2016-1240.Debian系统的Linux上管理员通常利用apt-get进行包管理,debian包的一个初始化脚本中存在漏洞,会让deb包安装程序自动执行启动脚本,脚本位置/etc/init.d/tomcatN 攻击者可以在拥有Tomcat低权限的情况下,利用该漏洞获得系统的root权限.受影响的系统包括Debian和ubuntu,其他使用debian包的系统也可能会受

服务器操作系统应该选择 Debian/Ubuntu 还是 CentOS?

服务器操作系统应该选择 Debian/Ubuntu 还是 CentOS? 编辑推荐!本文来自知乎的袁昊洋,是我见过的关于如何选择服务器操作系统的最有理有据的文章,而且富有实践基础.小编基本上同意全文观点--当然,这并不是说大家就不应该选择其他的操作系统做服务器--甚至你选择Windows XP做服务器都有你的道理.大家有什么选择,希望也发表你的观点. 首先的首先,我想请各位玩家,你们不要自己最近新玩上什么就觉得什么好,然后大肆的推荐什么好不好!负点责任好不好!人家是服务器,有些时候选错一个发行版

linux系统中安装部署shadowsocks(CentOS/Debian/Ubuntu/Windows)

前装的是libuv 的版的,只是给手机用用,但是后来小米更新系统后,shadowsocks在我手机上总是闪退,goagent也闪退,唯一能用的就是fqrouter.最近shadowsocks更新,小米也更新了,网友让我试一下,结果没有闪退,所以打算重新在vps上安装shadowsocks . shadowsocks安装分为两部分,一部分是服务器端的部署,另外一个自然是客户端部署.这里先说下服务器端的部署,即CentOS/Debian/Ubuntu/Windows安装shadowsocks服务端

Debian/Ubuntu打包工具入门指南

在http://www.aliyun.com/zixun/aggregation/13835.html">Ubuntusci的一部分努力之下,许多没有被Ubuntu软件仓库收录的软件包被添加到了仓库中.把其他类UNIX系统上的软件(或者其他Linux发行版上的软件)移植到Ubuntu Linux中是一件复杂的事情,需要的时间和努力会比预期更多. 不考虑Ubuntu软件仓库,任何已经出现在Debian软件仓库中至少4至5年的软件都将可能成为我们移植打包工作可能面临的困难.这还是个保守的假设.

在Debian/Ubuntu系统中安装*.sh与*.bin文件

在Debian/Ubuntu系统中安装*.sh与*.bin文件的基本方法. 一,安装*.sh文件 运行命令行至文件目录下,执行:sudo sh *.sh直接运行 在命令行中执行:sudo chmod +x *.sh 再输入sudo ./*.sh可安装到任意目录,./*.sh可安装到当前用户有权限的目录. 二,安装*.bin文件 运行命令行至文件目录下 在命令行中执行:sudo chmod +x *.bin 再输入sudo ./*.bin可安装到任意目录,./*.bin可安装到当前用户有权限的目录

Debian/Ubuntu中设置WEP密钥

在http://www.aliyun.com/zixun/aggregation/33836.html">Debian/Ubuntu系统中,需要在/etc/network/interfaces文件中加入一个合法的wireless-key参数,和wireless-essid在一起 ## File: /etc/network/interfaces## The primary network interfaceauto eth1iface eth1 inet static address 192

Debian/Ubuntu的网络配置

这章涉及的大部分Fedora / Redhat命令和配置文件也可一个用于基于http://www.aliyun.com/zixun/aggregation/33836.html">Debian的操作系统,但也有一些关键的差别. /etc/network/interfaces文件 主网络配置文件是/etc/network/interfaces ,所有网络接口相关的参数都是在这里定义的.文件划分成多个小节: auto小节 auto小节定义了接口是不是要在系统启动时自动初始化. mapping小

Debian/Ubuntu Linux下内核编程者必备

如果你想要升级你的Debian/Ubuntu Linux内核,或者你希望为内核开发新的模块,或者您要为某个硬件写新的驱动程序--这一切都涉及到Debian/Ubuntu Linux内核编程. 作为一个内核编程者,有那么几个软件是你必须要有的,看作是你进行内核编程的几件法宝吧,下面我一一列举出来: 1.gcc 大名鼎鼎的gcc我想没有人不知道的吧?它是任何编程者必然要先安装的一个武器了.不过一般如果你是安装的Debian系统,应该已经默认安装了的.要是Ubuntu你就安装一下吧,安装方法嘛,就是输