Skip to content

Commit

Permalink
Changed Credcon and the broken pipe error. Also added debugging info.
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanSelen committed Nov 28, 2024
1 parent 440f8b1 commit ba171b6
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 8 deletions.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,60 @@ Paste your installation commands into the root part, for example: `./configs/min
5. Enjoy! Linux is so much fun to use. 😉

# How to debug?

If you are encountering issues with - most likely connecting the actual RDP session. Follow these steps!<br>
Make sure you have exported the correct DISPLAY environment variable.<br>
The way I do this - is in MeshCentral I enter the `Terminal` tab and enter `export DISPLAY=:0`.<br>

> This makes sure all graphical apps pop-up on the actual monitor!
Then if you want to debug `Credcon` do the following:

```shell
bash ~/Templates/credcon.sh
```

This will print the output to the current terminal, while keeping the GUI/Dialogue boxes on the monitor!

Example output:
```text
user@NTOS:~/Templates$ bash credcon.sh
Starting loading bar
# 1%
# 2%
# 3%
# 4%
[16:39:02:892] [8315:8327] [ERROR][com.freerdp.core] - freerdp_tcp_connect:freerdp_set_last_error_ex ERRCONNECT_DNS_NAME_NOT_FOUND [0x00020005]
# 5%
[16:39:02:946] [8315:8327] [ERROR][com.freerdp.core] - rdg_establish_data_connection:freerdp_set_last_error_ex ERRCONNECT_ACCESS_DENIED [0x00020016]
[16:39:02:891] [8315:8327] [INFO][com.freerdp.core.nego] - Detecting if host can be reached locally. - This might take some time.
[16:39:02:891] [8315:8327] [INFO][com.freerdp.core.nego] - To disable auto detection use /gateway-usage-method:direct
[16:39:02:891] [8315:8327] [INFO][com.freerdp.core.nego] - Detecting if host can be reached locally. - This might take some time.
[16:39:02:891] [8315:8327] [INFO][com.freerdp.core.nego] - To disable auto detection use /gateway-usage-method:direct
# 6%
# 7%
# 8%
# 9%
# 10%
xfreerdp terminated early (less than '30' seconds).
# 11%
# 12%
# 13%
# 14%
# 15%
# 16%
# 17%
# 18%
# 19%
# 20%
# 21%
# 22%
# 23%
```

The above example shows a `ACCESS_DENIED` error.

## Image examples:

![Preseed-screen](./assets/images/debian12-preseed-screen.png)
Expand Down
20 changes: 12 additions & 8 deletions ntos/credcon/credcon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ show_loading_bar() {
echo 'Starting loading bar'

for ((i=1; i<=100; i++)); do
echo $i
echo "# $i%" > /dev/tty
echo $i | tee /dev/null
echo "# $i%" | tee /dev/tty
sleep 0.1
done | yad --progress \
--title='Loading' \
Expand Down Expand Up @@ -70,14 +70,14 @@ main() {

# Start xfreerdp session in the background and get its process ID (PID).
# This does not hinder the process from taking over the (screen/monitor) session.
xfreerdp "$rdpFile" /u:"${username}" /p:"${password}" /cert-ignore &>> /dev/null &
xfreerdp "$rdpFile" /u:"${username}" /p:"${password}" /cert-ignore | tee /dev/tty &
xfreerdp_pid=$!

# Wait for the xfreerdp process up to $interval seconds, default 30.
threshold=30
elapsed=0
interval=1

# Keep track of how long the FreeRDP process is alive for.
while kill -0 "$xfreerdp_pid" 2> /dev/null; do
sleep "$interval"
Expand All @@ -100,17 +100,21 @@ main() {

# If we exit the loop in under 30 seconds, it means xfreerdp terminated early, which likely means a failure to login/connect.
echo "xfreerdp terminated early (less than '${threshold}' seconds)."

# This is done to kill the loading bar process, because it will be followed-up by the "login_failed" dialogue.
pkill -f yad

# The follow-up.
show_connection_failure


# Kill the bash process, this stops the background counting of the loading bar. While exiting gracefully!
pkill -f bash &

echo "test"
# Gracefully exit.
exit 0
fi
}

# Call main function
main
main

0 comments on commit ba171b6

Please sign in to comment.