Key Management Service on Ubuntu 20.04


Getting started

Prerequisites

  • Ubuntu 20.04 Server

Update

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential  git -y
cd /opt

Change to root

kms@svrkms:~$ sudo -s

Set your time zone

root@svrkvm:# date
Sat 11 Jan 21:22:53 GMT 2020
root@svrkvm:# sudo dpkg-reconfigure tzdata

Current default time zone: 'Europe/Paris'
Local time is now:      Sat Jan 11 22:24:07 CET 2020.
Universal Time is now:  Sat Jan 11 21:24:07 UTC 2020.

root@svrkvm:# date
Sat 11 Jan 22:24:16 CET 2020

Installing the KMS server

The KMS server is available as binaries or source code that needs to be compiled. Let us use the source code.

root@svrkvm:# sudo apt-get install build-essential  git -y

git clone the KMS server source code:

administrator@kms:~$ git clone https://github.com/kebe7jun/linux-kms-server

Create user:

administrator@kms:~$ useradd -s /usr/sbin/nologin -r -M vlmcsd

Compile the source code:

root@svrkvm:# cd /opt/linux-kms-server/vlmcsd/
root@svrkvm:~/vlmcsd# make

Create a service:

root@svrkvm:# vim /lib/systemd/system/vlmcsd.service

[Unit]
Description=vlmcsd KMS emulator service
After=network-online.target
Wants=network-online.target 

[Service]
Type=forking
User=vlmcsd
ExecStart=/opt/linux-kms-server/vlmcsd/vlmcsd -l /var/log/vlmcsd/vlmcsd.log 

[Install]
WantedBy=multi-user.target

Create and chown log folder:

root@svrkvm:# mkdir /var/log/vlmcsd
root@svrkvm:#chown vlmcsd:vlmcsd /var/log/vlmcsd

Start the KMS

root@svrkvm:# systemctl start vlmcsd
root@svrkvm:# systemctl enable vlmcsd

Open port 1688:

root@svrkvm:# ufw allow 1688/tcp

Using netstat you’ll see that vlmcd is listening on 1688:

administrator@kms:~/vlmcsd/bin$ netstat -a
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:1688            0.0.0.0:*               LISTEN  


Test with KMS client

Test the KMS server by running the KMS client:

administrator@kms:~/vlmcsd/bin$ ./vlmcs
Connecting to 127.0.0.1:1688 ... successful
Sending activation request (KMS V6) 1 of 1  -> 1111-12201-369-033755-01-5079-11213.0010-0032021 (4A1DD49C13BB0079)

Use status to see a brief status report as seen below:

administrator@kms:/etc/systemd/system$ sudo systemctl status kms@administrator.service 
● kms@administrator.service - KMS
   Loaded: loaded (/etc/systemd/system/kms@administrator.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Mon 2020-02-03 14:31:21 UTC; 1s ago
  Process: 6491 ExecStart=/home/administrator/vlmcsd/bin/vlmcsd (code=exited, status=0/SUCCESS)
 Main PID: 6491 (code=exited, status=0/SUCCESS)

Feb 03 14:31:21 kms systemd[1]: Started KMS.
administrator@kms:/etc/systemd/system$ ps -ef | grep vlmcsd
adminis+  6363  5391  0 14:29 pts/0    00:00:00 grep --color=auto vlmcsd

Get licence key:

https://docs.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys
https://docs.microsoft.com/en-us/DeployOffice/vlactivation/gvlks?redirectedfrom=MSDN

Windows configuration

Open up cmd.exe as Administrator:

C:\Windows\system32\>slmgr /upk
C:\Windows\system32\> slmgr /ipk [KMS Client Product Key]
C:\Windows\system32\> slmgr /skms [IP_KMS_Server]:1688
C:\Windows\system32\> slmgr /ato

Office

CD \Program Files\Microsoft Office\Office16 OR CD \Program Files (x86)\Microsoft Office\Office16
cscript ospp.vbs /sethst:YOUR_IP_OR_HOSTNAME
cscript ospp.vbs /inpkey:xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
cscript ospp.vbs /act
cscript ospp.vbs /dstatusall

Check the Status of Windows ActivationOptionally, you can display information about the Windows activation status:

C:\Program Files\Microsoft Office\Office15>cscript ospp.vbs /dstatusallslmgr.vbs /dli

windows kms

As you can see, the utility returned the following useful info:

  • Name — the OS version;
  • Description — distribution channel VOLUME_KMSCLIENT channel;
  • License status — licensed;
  • Volume activation expirations — 180 days;
  • KMS server IP address and DNS name (Registered KMS machine name).

  • Office:
    C:\Program Files\Microsoft Office\Office15>cscript ospp.vbs /dstatusall

Post a Comment

أحدث أقدم