Skip to content

Commit

Permalink
Adding some additional posts which might be of interesst for people.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueteamer authored Mar 22, 2024
1 parent 59ef635 commit a12f4fb
Show file tree
Hide file tree
Showing 8 changed files with 245 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
draft: false
toc: true
title: "Configure RDP access for Kali Linux"
description: "Steps required to set up RDP access for kali linux."
date: 2021-03-29
usePageBundles: true
categories: ["brain dump"]
tags: ["linux"]
---


Kali Linux does not come with RDP enabled out of the box. But Kali can be configured to provide RDP access from any device with a proper RDP client.

<!--more-->

## Some context for my specific case
I set up Kali Linux for my lab environment on a hypervisor solution. As I am not working in front of that hypervisor, it would be nice to RDP into Kali from my laptop.

## Configure RDP for Kali Linux
I installed a new instance of Kali Linux 2021.2 and configured the VM to have working network connectivity with my laptop. We are using **xrdp** to sign in to the Linux VM.

### Install xrdp on the Linux device
Open a terminal on your Linux device and install xrdp via **apt-get**.

```
sudo apt-get update
sudo apt-get install xrdp
```

After the successful installation, we need to start xrdp as a service.
```
sudo systemctl start xrdp
sudo systemctl start xrdp-sesman
```

### Test connection from your client
xrdp is installed correctly and running. Let's see if we can connect and sign in.

On your working device (in my case, a Windows device), open a terminal and connect via
```
mstsc /v kali
```

or

```
mstsc /v 10.0.0.100
```

where ***kali*** or ***10.0.0.100*** is either the Linux VMs hostname or IP.
In case the connection was successful, you will see something similar to the image below.


![](images/article.configurerdpaccessforkalilinux.loginscreen.png)

### Make RDP persistent
After a reboot of the Linux device, you need to restart xrdp and xrdp-sesman (Session Manager) manually. Tell Linux to start xrdp automatically as a service to avoid this extra step after each reboot.

```
sudo systemctl enable xrdp
sudo systemctl enable xrdp-sesman
```

### Final thoughts
Make sure you are not logged in anywhere else - e.g., Hyper-V Manager. Otherwise, this will prevent the RDP client from taking over the session. I haven't found a way around this yet.

So long...
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
title: "xRDP - Authentication is required to create a color managed device"
date: "2021-03-31"
description: "Mitigation of a common error in Debian based regarding xRDP - Authentication."
featured: false
draft: false
toc: true
# menu: main
usePageBundles: true
categories:
- "unrelated stuff"
tags:
- linux
- troubleshooting

---

Many Debian based linux distro are using PolKit to enfore specific policies. Especially while working within a RDP session, this can become a major pain in the ass because of re-occurring pop-ups asking for credentials. This makes it almost impossible to do any work.

<!--more-->



![](images/article.configurerdpaccessforkalilinux.authenticatepopup.png)

There is a good article[^fn1] which describes the issue in a more detailed fashion and how to resolve the issue. This post will be a brief summary for later reference.

## How can we solve the problem?

The solution to this issue is, that we have to tell PolKit how to behave if a user is working remotely via RDP. And this can be done with a specific file in the folder
```
/etc/polkit-1/localauthority/50-local.d/
```
Let's have a look, step by step.

### Become root on the terminal as some resources require that special permissions.

```
sudo -i
```

### Check which version of pkaction (PolKit) is running.
In the next step, we have to check the version of pkaction. This will tell us in which direction we need to go.

{{< mermaid >}}
flowchart TD
A[pkaction --version]
A --> |v0.106 and above?| C[*.conf]
A --> |v0.105 and below?| D[*.pkla]
{{< /mermaid >}}

You can check the version in the terminal
```
pkaction --version
```

The output looks something like this:
```
pkaction version 0.105
```

### Case A: (pkaction --version >= 0.106)

```
cd /etc/polkit-1/localauthority.d.conf
touch 02-allow-color.d.conf
nano 02-allow-color.d.conf
```

Add the following content to this file and save it.

```javascript
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.color-manager.create-device" ||
action.id == "org.freedesktop.color-manager.create-profile" ||
action.id == "org.freedesktop.color-manager.delete-device" ||
action.id == "org.freedesktop.color-manager.delete-profile" ||
action.id == "org.freedesktop.color-manager.modify-device" ||
action.id == "org.freedesktop.color-manager.modify-profile") &&
subject.isInGroup("{users}")) {
return polkit.Result.YES;
}
});
```

### Case B: (pkaction --version < 0.106)

```
cd /etc/polkit-1/localauthority/50-local.d/
touch 45-allow-colord.pkla
nano 45-allow-colord.pkla
```

Add the following content to the file and save it.

```bash
[Allow Colord all Users] Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile;
ResultAny=no
ResultInactive=no
ResultActive=yes
```

### Test the configuration

Now try to login via RDP to your machine. No popup should be visible and asking for any kind of credentials.

I highly recommend to read the original article[^fn1] as you will find very useful infos to understand the mechanism behind this behaviour and the proposed solutions.



[^fn1]: "xRDP - The Infamous 'Authentication Required to Create managed Color Device' Explained" | Griffon's IT Library (2021-Mar-22)](https://c-nergy.be/blog?p=12073)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
draft: false
toc: true
title: "How to change display resolution in Kali Linux"
description: "Read how to change the display resolution for kali linux. "
date: 2022-09-27
usePageBundles: true
categories: ["brain dump"]
tags: ["linux"]
---



When you install Kali Linux as a Hyper-V VM the default display resolution is 1024x786. This is too small to work on.
I found some good info on how to do change the display resolution for Kali on YouTube[^fn1] and decided to summarize the steps here for your convenience.

<!--more-->

## Change the resolution
The steps are fairly easy:
- modify the grub configuration file
- update grub
- restart the device


We have to make a modification to a config for grub and restart the machine.
Therefore go to your Kali Linux machine and open a terminal.

### Modify the grub configuration file
Open a terminal on your linux device and open the grub configuration file in nano or any other editor of your choice.

```bash
sudo nano /etc/default/grub
```

Now have a look for this line
```vim
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
```

It is possible that there are more parameters after "quiet". But this is the line we need to modify.
So change this line as follows:

```vim
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video=hyperv_fb:1920x1080"
```

**Info** | In my case I switched the resolution to 1920x1080. I haven't tested any higher resolutions. So, can't tell if it's working with higher numbers.
Let me know if you have any experience with that.

Save the modification with nano's shortcuts **Ctrl+X** and confirm with **y**.

### Send the updated config to grup
After we made the modification of the grub config file, we need to tell grub about these changes. Do that with the statement here:

```bash
sudo update-grub
```

### Restart your device
In the last step, we do a restart of the Kali Linux machine. The new settings should apply and you'll now have way more place on your desktop.

Enjoy.

[^fn1]: [Change Kali Linux screen resolution on Hyper-V Virtual Machine](https://www.youtube.com/watch?v=N8K9qnd5NT8) (Youtube: HERESJAKEN)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a12f4fb

Please sign in to comment.