GSOC cockpit samba ad dc: Difference between revisions

From SambaWiki
 
(8 intermediate revisions by 2 users not shown)
Line 6: Line 6:


= Installation =
= Installation =

== Fedora 32 Installation ==
== Fedora 32 Installation ==
=== Prerequisite: Cockpit ===


# Download the repository https://download.opensuse.org/repositories/home:/Hezekiah/Fedora_32/home:Hezekiah.repo
''Prerequisite: Cockpit''
# Place it to /etc/yum.repos.d/

# Run the following command
1. Download the repository https://download.opensuse.org/repositories/home:/Hezekiah/Fedora_32/home:Hezekiah.repo
#:<pre># dnf install cockpit-samba-ad-dc</pre>

# If you already have Cockpit on your server, point your web browser to: https://ip-address-of-machine:9090
2. Place it to /etc/yum.repos.d/
# Use your system user account and password to log in.

3. Run the following command
# dnf install cockpit-samba-ad-dc

4. If you already have Cockpit on your server, point your web browser to: https://ip-address-of-machine:9090

5. Use your system user account and password to log in.


== Ubuntu 20.04 Installation ==
== Ubuntu 20.04 Installation ==
===Prerequisite: Cockpit===


# Update the apt package index and install packages to allow apt to use a repository over HTTPS:
''Prerequisite: Cockpit''
#:<pre> $ sudo apt update

$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common</pre>
1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:
# Add Cockpit-Samba-AD-DC GPG key:
$ sudo apt update
#:<pre> $ curl -fsSL https://download.opensuse.org/repositories/home:/Hezekiah/xUbuntu_20.04/Release.key | sudo apt-key add - </pre>
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# Add the repository to the sources.list file

#:<pre>$ sudo add-apt-repository "deb https://download.opensuse.org/repositories/home:/Hezekiah/xUbuntu_20.04 ./"</pre>
2. Add Cockpit-Samba-AD-DC GPG key:
# Update the apt package index, and download the latest version of Cockpit-Samba-AD-DC plugin.
$ curl -fsSL https://download.opensuse.org/repositories/home:/Hezekiah/xUbuntu_20.04/Release.key | sudo apt-key add -
#:<pre>$ sudo apt-get update && $ sudo apt-get install cockpit-samba-ad-dc

</pre>
3. Add the repository to the sources.list file
#If you already have Cockpit on your server, point your web browser to: https://ip-address-of-machine:9090

#Use your system user account and password to log in.
$ sudo add-apt-repository "deb https://download.opensuse.org/repositories/home:/Hezekiah/xUbuntu_20.04 ./"

4. Update the apt package index, and download the latest version of Cockpit-Samba-AD-DC plugin.
$ sudo apt-get update
$ sudo apt-get install cockpit-samba-ad-dc
5. If you already have Cockpit on your server, point your web browser to: https://ip-address-of-machine:9090

6. Use your system user account and password to log in.


== Debian 10 Installation ==
== Debian 10 Installation ==
=== Prerequisite: Cockpit===


# Update the apt package index and install packages to allow apt to use a repository over HTTPS:
''Prerequisite: Cockpit''
#:<pre>$ sudo apt update

$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common</pre>
1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:
# Add Cockpit-Samba-AD-DC GPG key:
$ sudo apt update
#:<pre>$ curl -fsSL https://download.opensuse.org/repositories/home:/Hezekiah/Debian_10/Release.key | sudo apt-key add -</pre>
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# Add the repository to the sources.list file

#:<pre>$ sudo add-apt-repository "deb https://download.opensuse.org/repositories/home:/Hezekiah/Debian_10 ./"</pre>
2. Add Cockpit-Samba-AD-DC GPG key:
# Update the apt package index, and download the latest version of Cockpit-Samba-AD-DC plugin.
$ curl -fsSL https://download.opensuse.org/repositories/home:/Hezekiah/Debian_10/Release.key | sudo apt-key add -
#:<pre>$ sudo apt-get update

$sudo apt-get install cockpit-samba-ad-dc</pre>
3. Add the repository to the sources.list file
# If you already have Cockpit on your server, point your web browser to: https://ip-address-of-machine:9090
$ sudo add-apt-repository "deb https://download.opensuse.org/repositories/home:/Hezekiah/Debian_10 ./"
# Use your system user account and password to log in

4. Update the apt package index, and download the latest version of Cockpit-Samba-AD-DC plugin.
$ sudo apt-get update
$ sudo apt-get install cockpit-samba-ad-dc

5. If you already have Cockpit on your server, point your web browser to: https://ip-address-of-machine:9090

6. Use your system user account and password to log in


= Using the Plugin =
= Using the Plugin =
Line 81: Line 63:
Using the plugin you can:
Using the plugin you can:


Create a computer
* Create a computer
* Delete a computer

* Display a Computer Active Directory object
• Delete a computer
* List all computers

* Move a computer to an organizational unit/container.
• Display a Computer Active Directory object

• List all computers

• Move a computer to an organizational unit/container.
[[File:Cockpit-plugin_computer_magement.png|900px]]
[[File:Cockpit-plugin_computer_magement.png|900px]]


== Contact Management ==
== Contact Management ==


Creating a Contact
* Creating a Contact
* Deleting a Contact

* Listing all Contacts
• Deleting a Contact
* Showing a Contact

• Listing all Contacts

• Showing a Contact


[[File:Cockpit-plugin_contact_management.png|920px]]
[[File:Cockpit-plugin_contact_management.png|920px]]
Line 107: Line 82:
Use the plugin to:
Use the plugin to:


Add a service principal as msDS-AllowedToDelegateTo
* Add a service principal as msDS-AllowedToDelegateTo
* Delete a service principal as msDS-AllowedToDelegateTo

* Show the delegation setting of an account
• Delete a service principal as msDS-AllowedToDelegateTo
* Set/unset UF_TRUSTED_FOR_DELEGATION for an account

* Set/unset UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION (S4U2Proxy) for an account
• Show the delegation setting of an account

• Set/unset UF_TRUSTED_FOR_DELEGATION for an account

• Set/unset UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION (S4U2Proxy) for an account


[[File:Cockpit-plugin_delegation_management.png|950px]]
[[File:Cockpit-plugin_delegation_management.png|950px]]
Line 121: Line 92:
== DNS Management ==
== DNS Management ==


Creating a DNS record
*Creating a DNS record
* Deleting a DNS record

* Cleanup DNS records
• Deleting a DNS record
* Query for server information

* Creating zones
• Cleanup DNS records
* Deleting zones

• Query for server information
* Showing zone information

• Creating zones

• Deleting zones

• Showing zone information


[[File:Cockpit-plugin_DNS_management.png|960px]]
[[File:Cockpit-plugin_DNS_management.png|960px]]
Line 141: Line 106:
Using the plugin, you can:
Using the plugin, you can:


Promote an existing domain member or NT4 PDC to an AD DC
* Promote an existing domain member or NT4 PDC to an AD DC
* Get basic info about a domain

* Demote a Domain Controller
• Get basic info about a domain
* Join domain as either member or backup domain controller

* Upgrade from Samba classic (NT4-like) database to Samba AD DC database
• Demote a Domain Controller
* Create a domain or forest trust

* Delete a domain trust
• Join domain as either member or backup domain controller
* List domain trusts

* Show trusted domain details
• Upgrade from Samba classic (NT4-like) database to Samba AD DC database
* Validate a domain trust

• Create a domain or forest trust
* Manage forest trust namespaces
* Copy a running DC's current DB into a backup tar file

* Backup the local domain directories safely into a tar file
• Delete a domain trust
* Copy a running DC's DB to backup file, renaming the domain in the process

* Restore the domain's DB from a backup-file
• List domain trusts

• Show trusted domain details

• Validate a domain trust

• Manage forest trust namespaces

• Copy a running DC's current DB into a backup tar file

• Backup the local domain directories safely into a tar file

• Copy a running DC's DB to backup file, renaming the domain in the process

• Restore the domain's DB from a backup-file


[[File:Cockpit-plugin_domain_management.png|960px]]
[[File:Cockpit-plugin_domain_management.png|960px]]
Line 175: Line 126:
== Forest Management ==
== Forest Management ==


Show
* Show
* DSHeuristics

• DSHeuristics
== FSMO Management ==
== FSMO Management ==


Seize Roles
* Seize Roles
* Show Roles

• Show Roles
* Transfer Roles

• Transfer Roles
== Group Policy Object (GPO) Management ==
== Group Policy Object (GPO) Management ==


Create an empty GPO
* Create an empty GPO
* Deleting a GPO

• Deleting a GPO
* Backing up a GPO
* Delete GPO link from a container

• Backing up a GPO
* Downloading a GPO
* Get inheritance flag for a container

• Delete GPO link from a container
* List GPO Links for a container
* List GPOs for an account

* List all GPOs
• Downloading a GPO
* List all linked containers for a GPO

• Get inheritance flag for a container
* Restore a GPO to a new container
* Set inheritance flag on a container

• List GPO Links for a container
* Add or update a GPO link to a container
* Show information for a GPO

• List GPOs for an account

• List all GPOs

• List all linked containers for a GPO

• Restore a GPO to a new container

• Set inheritance flag on a container

• Add or update a GPO link to a container

• Show information for a GPO


== Group Management ==
== Group Management ==


Create a new AD group
* Create a new AD group
* Delete an AD group

* List all groups
• Delete an AD group
* List all members of an AD group

* Move a group to an organizational unit/container
• List all groups
* Remove members from an AD group

* Display a group AD object
• List all members of an AD group

• Move a group to an organizational unit/container

• Remove members from an AD group

• Display a group AD object


[[File:Cockpit-plugin_Group_management.png|960px]]
[[File:Cockpit-plugin_Group_management.png|960px]]
Line 237: Line 166:
== Organization Unit (OU) Management ==
== Organization Unit (OU) Management ==


Create an organizational unit
* Create an organizational unit
* Delete an organizational unit

• Delete an organizational unit
* List all organizational units
* List all objects in an organizational unit

• List all organizational units
* Move an organizational unit
* Rename an organizational unit

• List all objects in an organizational unit

• Move an organizational unit

• Rename an organizational unit


[[File:Cockpit-plugin_OU_management.png|960px]]
[[File:Cockpit-plugin_OU_management.png|960px]]
Line 254: Line 178:
Use the plugin to:
Use the plugin to:


Create a new site
* Create a new site
* Delete an existing site

* Create a new subnet
• Delete an existing site
* Delete an existing subnet

• Create a new subnet
* Assign a subnet to a site

• Delete an existing subnet

• Assign a subnet to a site


[[File:Cockpit-plugin_sites_management.png|960px]]
[[File:Cockpit-plugin_sites_management.png|960px]]
Line 269: Line 189:
With the plugin, you can:
With the plugin, you can:


Create a new spn
* Create a new spn
* Delete a spn

* List spns of a given user
• Delete a spn

• List spns of a given user


[[File:Cockpit-plugin_SPN_Management.png|960px]]
[[File:Cockpit-plugin_SPN_Management.png|960px]]
Line 280: Line 198:
Using the plugin you can:
Using the plugin you can:


Create a new user
* Create a new user
* Delete a user
* Disable a user
* Enable a user
* List all users
* Move a user to an organizational unit/container
* Change password for a user account
* Set or reset the password of a user account
* Set the expiration of a user account
* Display a user AD object


[[File:Cockpit-plugin_user_management.png|960px]]
• Delete a user


== Server Time ==
• Disable a user
Retrieve the time on a server
[[File:Cockpit-plugin_time.png|960px]]


== DS ACLs manipulation ==
• Enable a user
Using the plugin, you can:


* Get access list on a directory object
• List all users
* Modify access list on a directory object


[[File:Cockpit-plugin_DS_ACLs_manipulation.png|960px]]
• Move a user to an organizational unit/container


== NT ACLs manipulation ==
• Change password for a user account


Use the plugin to:
• Set or reset the password of a user account


* Change the domain SID for ACLs
• Set the expiration of a user account
* Get ACLs of a file
* Get DOS info of a file from xattr
* Set ACLs on a file
* Check sysvol ACLs match defaults
* Reset sysvol ACLs to defaults


[[File:Cockpit-plugin_NT_ACLs_manipulation.png|960px]]
• Display a user AD object


= Project Design =
[[File:Cockpit-plugin_user_management.png|960px]]


The plugin uses:
== Server Time ==
Retrieve the time on a server
[[File:Cockpit-plugin_time.png|960px]]


* React - A Javascript library for building user interfaces (https://reactjs.org/)
== DS ACLs manipulation ==
* Cockpit - https://cockpit-project.org/
Using the plugin, you can:
* PatternFly - https://www.patternfly.org/v4/
* Open Build Service - https://openbuildservice.org/
* Webpack - https://webpack.js.org/


The plugin is built on top of the Cockpit's Starter Kit (https://github.com/cockpit-project/starter-kit).
• Get access list on a directory object
Starter Kit makes it easy to get started building plugins for Cockpit. This blog post (https://cockpit-project.org/blog/cockpit-starter-kit.html) gives more explanation on why developers might need the Starter Kit when building plugins for Cockpit.


= Building the Source Code =
• Modify access list on a directory object
Make sure you have npm available (usually from your distribution package). These commands check out the source and build it into the dist/ directory:


git clone https://gitlab.com/HezekiahM/samba-ad-dc.git
[[File:Cockpit-plugin_DS_ACLs_manipulation.png|960px]]
cd samba-ad-dc
make


''make install'' compiles and installs the package in ''/usr/share/cockpit/''.
== NT ACLs manipulation ==


For development, you usually want to run your module straight out of the git tree. To do that, link that to the location were cockpit-bridge looks for packages:
Use the plugin to:


mkdir -p ~/.local/share/cockpit
• Change the domain SID for ACLs
ln -s `pwd`/dist ~/.local/share/cockpit/starter-kit
After changing the code and running make again, reload the Cockpit page in your browser.


You can also use watch mode to automatically update the webpack on every code change with
• Get ACLs of a file


npm run watch
• Get DOS info of a file from xattr
or


make watch
• Set ACLs on a file


To contibute to the project, clone the repository, make your changes in a feature branch and make a merge request to the master branch.
• Check sysvol ACLs match defaults


= Automated Releases =
• Reset sysvol ACLs to defaults


The plugin utilises Open Build Service for automated releases currently for these distributions:
[[File:Cockpit-plugin_NT_ACLs_manipulation.png|960px]]
* Fedora 32
* Ubuntu 20.04
* Debian 10

The OBS package can be found here: https://build.opensuse.org/package/show/home:Hezekiah/samba-ad-dc. A webhook in gitlab pushes any code changes in the master branch to OBS repo where it gets built and released for the various distributions.

----
[[Category:Active Directory]]
[[Category:GSOC]]

Latest revision as of 14:54, 20 August 2023

Cockpit Samba AD DC Plugin Documentation

What is Cockpit?

According to Cockpit’s documentation, it’s an "easy-to-use, integrated, glanceable, and open web-based interface for your servers" (https://cockpit-project.org/).

Cockpit helps you manage your Linux servers using a user interface that runs in a browser. It also lets developers develop their own plugins using an API cockpit provides for interacting with the server. This project sought to incorporate tasks done using the samba-tool command line utility for Samba AD DC in an intuitive UI for easier usage and administration.

Installation

Fedora 32 Installation

Prerequisite: Cockpit

  1. Download the repository https://download.opensuse.org/repositories/home:/Hezekiah/Fedora_32/home:Hezekiah.repo
  2. Place it to /etc/yum.repos.d/
  3. Run the following command
    # dnf install cockpit-samba-ad-dc
  4. If you already have Cockpit on your server, point your web browser to: https://ip-address-of-machine:9090
  5. Use your system user account and password to log in.

Ubuntu 20.04 Installation

Prerequisite: Cockpit

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:
     $ sudo apt update

$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

  1. Add Cockpit-Samba-AD-DC GPG key:
     $ curl -fsSL https://download.opensuse.org/repositories/home:/Hezekiah/xUbuntu_20.04/Release.key | sudo apt-key add - 
  2. Add the repository to the sources.list file
    $ sudo add-apt-repository "deb https://download.opensuse.org/repositories/home:/Hezekiah/xUbuntu_20.04 ./"
  3. Update the apt package index, and download the latest version of Cockpit-Samba-AD-DC plugin.
    $ sudo apt-get update && $ sudo apt-get install cockpit-samba-ad-dc
  1. If you already have Cockpit on your server, point your web browser to: https://ip-address-of-machine:9090
  2. Use your system user account and password to log in.

Debian 10 Installation

Prerequisite: Cockpit

  1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:
    $ sudo apt update

$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

  1. Add Cockpit-Samba-AD-DC GPG key:
    $ curl -fsSL https://download.opensuse.org/repositories/home:/Hezekiah/Debian_10/Release.key | sudo apt-key add -
  2. Add the repository to the sources.list file
    $ sudo add-apt-repository "deb https://download.opensuse.org/repositories/home:/Hezekiah/Debian_10 ./"
  3. Update the apt package index, and download the latest version of Cockpit-Samba-AD-DC plugin.
    $ sudo apt-get update

$sudo apt-get install cockpit-samba-ad-dc

  1. If you already have Cockpit on your server, point your web browser to: https://ip-address-of-machine:9090
  2. Use your system user account and password to log in

Using the Plugin

Provisioning an AD DC Domain

The plugin first checks the Samba configuration file (smb.conf) to make sure that the server is set as an Active Directory Domain Controller (AD DC). If the server is not, the user is prompted to setup one.

Cockpit-plugin provision AD DC.png

Once provisioned, a page with a list of actions you can perform with the plugin appears.

Cockpit-samba-ad-dc main page.png

Computer Management

Using the plugin you can:

  • Create a computer
  • Delete a computer
  • Display a Computer Active Directory object
  • List all computers
  • Move a computer to an organizational unit/container.
Cockpit-plugin computer magement.png

Contact Management

  • Creating a Contact
  • Deleting a Contact
  • Listing all Contacts
  • Showing a Contact

Cockpit-plugin contact management.png

Delegation Management

Use the plugin to:

  • Add a service principal as msDS-AllowedToDelegateTo
  • Delete a service principal as msDS-AllowedToDelegateTo
  • Show the delegation setting of an account
  • Set/unset UF_TRUSTED_FOR_DELEGATION for an account
  • Set/unset UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION (S4U2Proxy) for an account

Cockpit-plugin delegation management.png

DNS Management

  • Creating a DNS record
  • Deleting a DNS record
  • Cleanup DNS records
  • Query for server information
  • Creating zones
  • Deleting zones
  • Showing zone information

Cockpit-plugin DNS management.png

Domain Management

Using the plugin, you can:

  • Promote an existing domain member or NT4 PDC to an AD DC
  • Get basic info about a domain
  • Demote a Domain Controller
  • Join domain as either member or backup domain controller
  • Upgrade from Samba classic (NT4-like) database to Samba AD DC database
  • Create a domain or forest trust
  • Delete a domain trust
  • List domain trusts
  • Show trusted domain details
  • Validate a domain trust
  • Manage forest trust namespaces
  • Copy a running DC's current DB into a backup tar file
  • Backup the local domain directories safely into a tar file
  • Copy a running DC's DB to backup file, renaming the domain in the process
  • Restore the domain's DB from a backup-file

Cockpit-plugin domain management.png

Forest Management

  • Show
  • DSHeuristics

FSMO Management

  • Seize Roles
  • Show Roles
  • Transfer Roles

Group Policy Object (GPO) Management

  • Create an empty GPO
  • Deleting a GPO
  • Backing up a GPO
  • Delete GPO link from a container
  • Downloading a GPO
  • Get inheritance flag for a container
  • List GPO Links for a container
  • List GPOs for an account
  • List all GPOs
  • List all linked containers for a GPO
  • Restore a GPO to a new container
  • Set inheritance flag on a container
  • Add or update a GPO link to a container
  • Show information for a GPO

Group Management

  • Create a new AD group
  • Delete an AD group
  • List all groups
  • List all members of an AD group
  • Move a group to an organizational unit/container
  • Remove members from an AD group
  • Display a group AD object

Cockpit-plugin Group management.png

Organization Unit (OU) Management

  • Create an organizational unit
  • Delete an organizational unit
  • List all organizational units
  • List all objects in an organizational unit
  • Move an organizational unit
  • Rename an organizational unit

Cockpit-plugin OU management.png

Sites Management

Use the plugin to:

  • Create a new site
  • Delete an existing site
  • Create a new subnet
  • Delete an existing subnet
  • Assign a subnet to a site

Cockpit-plugin sites management.png

SPN Management

With the plugin, you can:

  • Create a new spn
  • Delete a spn
  • List spns of a given user

Cockpit-plugin SPN Management.png

User Management

Using the plugin you can:

  • Create a new user
  • Delete a user
  • Disable a user
  • Enable a user
  • List all users
  • Move a user to an organizational unit/container
  • Change password for a user account
  • Set or reset the password of a user account
  • Set the expiration of a user account
  • Display a user AD object

Cockpit-plugin user management.png

Server Time

Retrieve the time on a server Cockpit-plugin time.png

DS ACLs manipulation

Using the plugin, you can:

  • Get access list on a directory object
  • Modify access list on a directory object

Cockpit-plugin DS ACLs manipulation.png

NT ACLs manipulation

Use the plugin to:

  • Change the domain SID for ACLs
  • Get ACLs of a file
  • Get DOS info of a file from xattr
  • Set ACLs on a file
  • Check sysvol ACLs match defaults
  • Reset sysvol ACLs to defaults

Cockpit-plugin NT ACLs manipulation.png

Project Design

The plugin uses:

The plugin is built on top of the Cockpit's Starter Kit (https://github.com/cockpit-project/starter-kit). Starter Kit makes it easy to get started building plugins for Cockpit. This blog post (https://cockpit-project.org/blog/cockpit-starter-kit.html) gives more explanation on why developers might need the Starter Kit when building plugins for Cockpit.

Building the Source Code

Make sure you have npm available (usually from your distribution package). These commands check out the source and build it into the dist/ directory:

git clone https://gitlab.com/HezekiahM/samba-ad-dc.git
cd samba-ad-dc
make

make install compiles and installs the package in /usr/share/cockpit/.

For development, you usually want to run your module straight out of the git tree. To do that, link that to the location were cockpit-bridge looks for packages:

mkdir -p ~/.local/share/cockpit
ln -s `pwd`/dist ~/.local/share/cockpit/starter-kit

After changing the code and running make again, reload the Cockpit page in your browser.

You can also use watch mode to automatically update the webpack on every code change with

npm run watch

or

make watch

To contibute to the project, clone the repository, make your changes in a feature branch and make a merge request to the master branch.

Automated Releases

The plugin utilises Open Build Service for automated releases currently for these distributions:

  • Fedora 32
  • Ubuntu 20.04
  • Debian 10

The OBS package can be found here: https://build.opensuse.org/package/show/home:Hezekiah/samba-ad-dc. A webhook in gitlab pushes any code changes in the master branch to OBS repo where it gets built and released for the various distributions.