Page 3 of 6

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 15:11
by 24unix
Sheldon Cooper wrote: Sun 13. Aug 2023, 15:05 Ich verstehe euer Problem nicht, IP-Adressen und Domains sind doch öffentliche Informationen, was will man da geheim halten?
Du bist noch relativ neu im Forum, sonst wüsstest Du es schon :-)

Die Daten muss man geheim halten, um die Suche nach Fehlern so schwer wie möglich zu machen :)

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 15:12
by Jolinar
24unix wrote: Sun 13. Aug 2023, 15:11 Du bist noch relativ neu im Forum, sonst wüsstest Du es schon :-)

Die Daten muss man geheim halten, um die Suche nach Fehlern so schwer wie möglich zu machen :)
YMMD :mrgreen: :mrgreen: :mrgreen:

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 15:14
by Jolinar
24unix wrote: Sun 13. Aug 2023, 15:09 Damit könntest Du in zweierlei Weise die Akzeptanz steigern :-)

1) Beim Anwender, der seine Daten verstümmelnanonymisieren will, dass er trotzdem Dein Script nutzt.

2) Bei Leuten wie bei mir, die helfen wollen. Wenn die Leute echte Daten nutzen, weiß ich, dass sie auch echte Hilfe wollen :)
Wer dann lieber Geheimniskrämer spielt muss damit leben, dass nicht jeder für ihn seine Zeit opfern wird …
Genau das war mein Hintergedanke :D 8-)

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 15:31
by Jolinar
Hier nun das Script mit rein englischer Kommentierung und Ausgabe:

Code: Select all

#!/bin/bash

# Check if lsb-release is installed
if ! command -v lsb_release &> /dev/null; then
    echo "lsb-release is not installed. Installing..."
    sudo apt-get update
    sudo apt-get install -y lsb-release
fi

# Redirect output to a file
exec > info.txt

# Set locale
export LC_ALL=C

# Function to print section header
print_section_header() {
    echo -e "\n------------------------------------------------------------"
    echo -e "$1"
    echo -e "------------------------------------------------------------"
}

# System Information
print_section_header "System Information"
echo "Operating System: $(lsb_release -d -s)"
echo "Hostname: $(hostname)"
echo "Kernel Version: $(uname -r)"
echo "Architecture: $(uname -m)"

# CPU Information
print_section_header "CPU Information"
echo "Model Name: $(lscpu | awk -F': ' '/Model name/ {print $2}')"
echo "Number of Cores: $(lscpu | awk -F': ' '/^CPU\(s\)/ {print $2}')"
# Hypervisor (extracted from CPU information)
hypervisor_vendor=$(lscpu | awk -F': ' '/Hypervisor vendor/ {print $2}')
if [ -z "$hypervisor_vendor" ]; then
    hypervisor_vendor="Not Detected"
fi
echo "Hypervisor: $hypervisor_vendor"

# Current CPU Usage
print_section_header "Current CPU Usage"
top -n 1 -b | grep '%Cpu'

# Memory (RAM)
print_section_header "Memory (RAM)"
free -h

# Disk Space
print_section_header "Disk Space"
df -h

# Additional Disk Information
print_section_header "Additional Disk Information"
du -h --max-depth=1 --exclude=/proc / | sort -rn

# Running Processes
print_section_header "Running Processes"
ps aux

# Network Adapters
print_section_header "Network Adapters"
ip a

# Network Connections
print_section_header "Network Connections"
netstat -tulpen

# View Firewall Rules (iptables)
print_section_header "Firewall Rules (iptables)"
iptables -L

# Apache Configuration
print_section_header "Apache Configuration"
apache_config_path="/etc/apache2/apache2.conf"
cat "$apache_config_path"

# Included Configuration Files
print_section_header "Included Configuration Files"
apache_includes_path="/etc/apache2/conf-enabled"
for include in "$apache_includes_path"/*; do
    echo -e "\nInclude: $include\n"
    cat "$include"
done

# Enabled Virtual Hosts
print_section_header "Enabled Virtual Hosts"
apache_vhosts_path="/etc/apache2/keyhelp/vhosts"
for vhost in "$apache_vhosts_path"/*; do
    echo -e "\nVirtual Host: $vhost\n"
    cat "$vhost"
done
Ich mußte das Script noch geringfügig modifizieren...Auf einem meiner Testsysteme war lsb-release noch nicht installiert, das Paket ist aber notwendig, um das OS korrekt auszulesen. Also wird es vom Script direkt mit installiert, wenn nötig.

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 16:27
by FaWa
Alternative damit man nicht unbedingt lsb-release installieren muss:

Code: Select all

ls /etc/ | grep -e '[_-]release$' -e '[_-]version$' | xargs -I % -n 1 cat /etc/%

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 16:53
by Jolinar
FaWa wrote: Sun 13. Aug 2023, 16:27 Alternative damit man nicht unbedingt lsb-release installieren muss:

Code: Select all

ls /etc/ | grep -e '[_-]release$' -e '[_-]version$' | xargs -I % -n 1 cat /etc/%
Danke für dein Feedback. :mrgreen:
Ich habe deinen Ansatz aufgegriffen und lese direkt das File /etc/os-release aus. So bin ich tatsächlich nicht mehr auf das Paket lsb-release angewiesen. :geek:

Hier die aktuelle Scripversion:

Code: Select all

#!/bin/bash

# Redirect output to a file
exec > info.txt

# Set locale
export LC_ALL=C

# Function to print section header
print_section_header() {
    echo -e "\n------------------------------------------------------------"
    echo -e "$1"
    echo -e "------------------------------------------------------------"
}

# Function to get operating system information
get_os_info() {
    if [ -f /etc/os-release ]; then
        source /etc/os-release
        echo "Operating System: $PRETTY_NAME"
    else
        echo "Operating System: Unknown"
    fi
}

# System Information
print_section_header "System Information"
get_os_info
echo "Hostname: $(hostname)"
echo "Kernel Version: $(uname -r)"
echo "Architecture: $(uname -m)"

# CPU Information
print_section_header "CPU Information"
echo "Model Name: $(lscpu | awk -F': ' '/Model name/ {print $2}')"
echo "Number of Cores: $(lscpu | awk -F': ' '/^CPU\(s\)/ {print $2}')"
# Hypervisor (extracted from CPU information)
hypervisor_vendor=$(lscpu | awk -F': ' '/Hypervisor vendor/ {print $2}')
if [ -z "$hypervisor_vendor" ]; then
    hypervisor_vendor="Not Detected"
fi
echo "Hypervisor: $hypervisor_vendor"

# Current CPU Usage
print_section_header "Current CPU Usage"
top -n 1 -b | grep '%Cpu'

# Memory (RAM)
print_section_header "Memory (RAM)"
free -h

# Disk Space
print_section_header "Disk Space"
df -h

# Additional Disk Information
print_section_header "Additional Disk Information"
du -h --max-depth=1 --exclude=/proc / | sort -rn

# Running Processes
print_section_header "Running Processes"
ps aux

# Network Adapters
print_section_header "Network Adapters"
ip a

# Network Connections
print_section_header "Network Connections"
netstat -tulpen

# View Firewall Rules (iptables)
print_section_header "Firewall Rules (iptables)"
iptables -L

# Apache Configuration
print_section_header "Apache Configuration"
apache_config_path="/etc/apache2/apache2.conf"
cat "$apache_config_path"

# Included Configuration Files
print_section_header "Included Configuration Files"
apache_includes_path="/etc/apache2/conf-enabled"
for include in "$apache_includes_path"/*; do
    echo -e "\nInclude: $include\n"
    cat "$include"
done

# Enabled Virtual Hosts
print_section_header "Enabled Virtual Hosts"
apache_vhosts_path="/etc/apache2/keyhelp/vhosts"
for vhost in "$apache_vhosts_path"/*; do
    vhost_name=$(basename "$vhost")
    echo -e "\nVirtual Host: $vhost_name\n"
    cat "$vhost"
done

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 17:04
by 24unix
Jolinar wrote: Sun 13. Aug 2023, 15:02 denn manche Sachen (zB. DNS-RR) kann man ja nur anhand echter Infos von extern prüfen.
Ach ja, das könnte man direkt ins Script einbauen, je nachdem, wie viel Zeit Du investieren willst :)

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 17:08
by Jolinar
24unix wrote: Sun 13. Aug 2023, 17:04 Ach ja, das könnte man direkt ins Script einbauen, je nachdem, wie viel Zeit Du investieren willst :)
Hatte ich auch schon überlegt...Aber wenn die Namensauflösung lokal aufgrund von Fehlkonfigurationen nicht funktioniert, läuft das ins Leere.
Davon abgesehen gibt es im DNS so viele mögliche Variablen, daß eine automatisierte Auswertung ziemlich aufwändig wäre... :?

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 19:16
by Jolinar
24unix wrote: Sun 13. Aug 2023, 17:04 Ach ja, das könnte man direkt ins Script einbauen, je nachdem, wie viel Zeit Du investieren willst :)
Ich hab es mal eingebaut.
Allerdings werden die Domainnamen doppelt ausgelesen und auch doppelt abgefragt (wegen ServerName bei vhost:80 und vhost:443). Falls jemand einen Denkanstoß hat, wie man das besser lösen kann...immer her damit :mrgreen:

Hier die aktuelle Version des Scripts:

Code: Select all

#!/bin/bash

# Redirect output to a file
exec > info.txt

# Set locale
export LC_ALL=C

# Function to print section header
print_section_header() {
    echo -e "\n------------------------------------------------------------"
    echo -e "$1"
    echo -e "------------------------------------------------------------"
}

# Function to get operating system information
get_os_info() {
    if [ -f /etc/os-release ]; then
        source /etc/os-release
        echo "Operating System: $PRETTY_NAME"
    else
        echo "Operating System: Unknown"
    fi
}

# Check if dig is installed, if not, install dnsutils package
check_and_install_dig() {
    if ! command -v dig &> /dev/null; then
        echo "dig is not installed. Installing dnsutils package..."
        sudo apt-get update
        sudo apt-get install -y dnsutils
    fi
}

# System Information
print_section_header "System Information"
get_os_info
echo "Hostname: $(hostname)"
echo "Kernel Version: $(uname -r)"
echo "Architecture: $(uname -m)"

# CPU Information
print_section_header "CPU Information"
echo "Model Name: $(lscpu | awk -F': ' '/Model name/ {print $2}')"
echo "Number of Cores: $(lscpu | awk -F': ' '/^CPU\(s\)/ {print $2}')"
hypervisor_vendor=$(lscpu | awk -F': ' '/Hypervisor vendor/ {print $2}')
if [ -z "$hypervisor_vendor" ]; then
    hypervisor_vendor="Not Detected"
fi
echo "Hypervisor: $hypervisor_vendor"

# Current CPU Usage
print_section_header "Current CPU Usage"
top -n 1 -b | grep '%Cpu'

# Memory (RAM)
print_section_header "Memory (RAM)"
free -h

# Disk Space
print_section_header "Disk Space"
df -h

# Additional Disk Information
print_section_header "Additional Disk Information"
du -h --max-depth=1 --exclude=/proc / | sort -rn

# Running Processes
print_section_header "Running Processes"
ps aux

# Network Adapters
print_section_header "Network Adapters"
ip a

# Network Connections
print_section_header "Network Connections"
netstat -tulpen

# View Firewall Rules (iptables)
print_section_header "Firewall Rules (iptables)"
iptables -L

# Display Used Nameservers
print_section_header "Used Nameservers"
cat /etc/resolv.conf

# Check and install dig if needed
check_and_install_dig

# Enabled Virtual Hosts
print_section_header "Enabled Virtual Hosts"
apache_vhosts_path="/etc/apache2/keyhelp/vhosts"
for vhost in "$apache_vhosts_path"/*; do
    vhost_domain=$(grep -oP 'ServerName \K.*' "$vhost" | awk '{print $1}')  # Extract domain from ServerName directive
    echo -e "\nVirtual Host: $vhost_domain\n"
    cat "$vhost"

    # Get DNS resource records for the domain
    echo -e "\nDNS Resource Records for $vhost_domain:"
    dns_records=$(dig $vhost_domain)
    echo "$dns_records"
done

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 19:37
by 24unix
Jolinar wrote: Sun 13. Aug 2023, 19:16
Richtige Version hochgeladen?

Ich sehe da nur ein dig auf die NS, mehr nicht.
ich dachte an die Abfrage der PTR …

Wegen der Sache mit den dppelten hostst, meinst Du das:
95 vhost_domain=$(grep -oP 'ServerName \K.*' "$vhost" | awk '{print $1}') # Extract domain from ServerName directive

Da könnte ein "uniq" hinters grep gepiped reichen.

Code: Select all

26,118c26,31
< # System Information
< print_section_header "System Information"
< get_os_info
< echo "Hostname: $(hostname)"
< echo "Kernel Version: $(uname -r)"
< echo "Architecture: $(uname -m)"
<
< # CPU Information
< print_section_header "CPU Information"
< echo "Model Name: $(lscpu | awk -F': ' '/Model name/ {print $2}')"
< echo "Number of Cores: $(lscpu | awk -F': ' '/^CPU\(s\)/ {print $2}')"
< # Hypervisor (extracted from CPU information)
< hypervisor_vendor=$(lscpu | awk -F': ' '/Hypervisor vendor/ {print $2}')
< if [ -z "$hypervisor_vendor" ]; then
<     hypervisor_vendor="Not Detected"
< fi
< echo "Hypervisor: $hypervisor_vendor"
<
< # Current CPU Usage
< print_section_header "Current CPU Usage"
< top -n 1 -b | grep '%Cpu'
<
< # Memory (RAM)
< print_section_header "Memory (RAM)"
< free -h
<
< # Disk Space
< print_section_header "Disk Space"
< df -h
<
< # Additional Disk Information
< print_section_header "Additional Disk Information"
< du -h --max-depth=1 --exclude=/proc / | sort -rn
<
< # Running Processes
< print_section_header "Running Processes"
< ps aux
<
< # Network Adapters
< print_section_header "Network Adapters"
< ip a
<
< # Network Connections
< print_section_header "Network Connections"
< netstat -tulpen
<
< # View Firewall Rules (iptables)
< print_section_header "Firewall Rules (iptables)"
< iptables -L
<
< # Apache Configuration
< print_section_header "Apache Configuration"
< apache_config_path="/etc/apache2/apache2.conf"
< cat "$apache_config_path"
<
< # Included Configuration Files
< print_section_header "Included Configuration Files"
< apache_includes_path="/etc/apache2/conf-enabled"
< for include in "$apache_includes_path"/*; do
<     echo -e "\nInclude: $include\n"
<     cat "$include"
< done
<
< # Enabled Virtual Hosts
< print_section_header "Enabled Virtual Hosts"
< apache_vhosts_path="/etc/apache2/keyhelp/vhosts"
< for vhost in "$apache_vhosts_path"/*; do
<     vhost_name=$(basename "$vhost")
<     echo -e "\nVirtual Host: $vhost_name\n"
<     cat "$vhost"
< done
< #!/bin/bash
<
< # Redirect output to a file
< exec > info.txt
<
< # Set locale
< export LC_ALL=C
<
< # Function to print section header
< print_section_header() {
<     echo -e "\n------------------------------------------------------------"
<     echo -e "$1"
<     echo -e "------------------------------------------------------------"
< }
<
< # Function to get operating system information
< get_os_info() {
<     if [ -f /etc/os-release ]; then
<         source /etc/os-release
<         echo "Operating System: $PRETTY_NAME"
<     else
<         echo "Operating System: Unknown"
---
> # Check if dig is installed, if not, install dnsutils package
> check_and_install_dig() {
>     if ! command -v dig &> /dev/null; then
>         echo "dig is not installed. Installing dnsutils package..."
>         sudo apt-get update
>         sudo apt-get install -y dnsutils
133d45
< # Hypervisor (extracted from CPU information)
172,183c84,89
< # Apache Configuration
< print_section_header "Apache Configuration"
< apache_config_path="/etc/apache2/apache2.conf"
< cat "$apache_config_path"
<
< # Included Configuration Files
< print_section_header "Included Configuration Files"
< apache_includes_path="/etc/apache2/conf-enabled"
< for include in "$apache_includes_path"/*; do
<     echo -e "\nInclude: $include\n"
<     cat "$include"
< done
---
> # Display Used Nameservers
> print_section_header "Used Nameservers"
> cat /etc/resolv.conf
>
> # Check and install dig if needed
> check_and_install_dig
189,190c95,96
<     vhost_name=$(basename "$vhost")
<     echo -e "\nVirtual Host: $vhost_name\n"
---
>     vhost_domain=$(grep -oP 'ServerName \K.*' "$vhost" | awk '{print $1}')  # Extract domain from ServerName directive
>     echo -e "\nVirtual Host: $vhost_domain\n"
191a98,102
>
>     # Get DNS resource records for the domain
>     echo -e "\nDNS Resource Records for $vhost_domain:"
>     dns_records=$(dig $vhost_domain)
>     echo "$dns_records"

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 19:49
by Jolinar
24unix wrote: Sun 13. Aug 2023, 19:37 ich dachte an die Abfrage der PTR …
PTR Abfrage eingebaut.

24unix wrote: Sun 13. Aug 2023, 19:37 Da könnte ein "uniq" hinters grep gepiped reichen.
Perfekt, danke für den Ansatz :mrgreen:

Hier das aktuelle Script:

Code: Select all

#!/bin/bash

# Redirect output to a file
exec > info.txt

# Set locale
export LC_ALL=C

# Function to print section header
print_section_header() {
    echo -e "\n------------------------------------------------------------"
    echo -e "$1"
    echo -e "------------------------------------------------------------"
}

# Function to get operating system information
get_os_info() {
    if [ -f /etc/os-release ]; then
        source /etc/os-release
        echo "Operating System: $PRETTY_NAME"
    else
        echo "Operating System: Unknown"
    fi
}

# Check if dig is installed, if not, install dnsutils package
check_and_install_dig() {
    if ! command -v dig &> /dev/null; then
        echo "dig is not installed. Installing dnsutils package..."
        sudo apt-get update
        sudo apt-get install -y dnsutils
    fi
}

# System Information
print_section_header "System Information"
get_os_info
echo "Hostname: $(hostname)"
echo "Kernel Version: $(uname -r)"
echo "Architecture: $(uname -m)"

# CPU Information
print_section_header "CPU Information"
echo "Model Name: $(lscpu | awk -F': ' '/Model name/ {print $2}')"
echo "Number of Cores: $(lscpu | awk -F': ' '/^CPU\(s\)/ {print $2}')"
hypervisor_vendor=$(lscpu | awk -F': ' '/Hypervisor vendor/ {print $2}')
if [ -z "$hypervisor_vendor" ]; then
    hypervisor_vendor="Not Detected"
fi
echo "Hypervisor: $hypervisor_vendor"

# Current CPU Usage
print_section_header "Current CPU Usage"
top -n 1 -b | grep '%Cpu'

# Memory (RAM)
print_section_header "Memory (RAM)"
free -h

# Disk Space
print_section_header "Disk Space"
df -h

# Additional Disk Information
print_section_header "Additional Disk Information"
du -h --max-depth=1 --exclude=/proc / | sort -rn

# Running Processes
print_section_header "Running Processes"
ps aux

# Network Adapters
print_section_header "Network Adapters"
ip a

# Network Connections
print_section_header "Network Connections"
netstat -tulpen

# View Firewall Rules (iptables)
print_section_header "Firewall Rules (iptables)"
iptables -L

# Display Used Nameservers
print_section_header "Used Nameservers"
cat /etc/resolv.conf | awk '/^nameserver/ {print "Nameserver:", $2}'

# Reverse DNS Lookup (PTR) for IP Addresses
print_section_header "Reverse DNS Lookup (PTR) for IP Addresses"
for ip in $(ip -o -4 addr show scope global | awk '{print $4}' | cut -d'/' -f1); do
    ptr_record=$(dig -x "$ip" +short)
    echo "IP Address: $ip"
    echo "PTR Record: $ptr_record"
    echo
done

# Check and install dig if needed
check_and_install_dig

# Enabled Virtual Hosts
print_section_header "Enabled Virtual Hosts"
apache_vhosts_path="/etc/apache2/keyhelp/vhosts"
for vhost in "$apache_vhosts_path"/*; do
    vhost_domain=$(grep -oP 'ServerName \K.*' "$vhost" | awk '{print $1}' | uniq)  # Extract domain from ServerName directive
    echo -e "\nVirtual Host: $vhost_domain\n"
    cat "$vhost"

    # Get DNS resource records for the domain
    echo -e "\nDNS Resource Records for $vhost_domain:"
    dns_records=$(dig $vhost_domain)
    echo "$dns_records"
done

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 20:01
by Sheldon Cooper
Wenn ihr das DNS abfragt, wird das aber nichts mehr mit der Anonymisierung. :o

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Sun 13. Aug 2023, 20:05
by 24unix
Sheldon Cooper wrote: Sun 13. Aug 2023, 20:01 Wenn ihr das DNS abfragt, wird das aber nichts mehr mit der Anonymisierung. :o
Tja, wer die Option "anonym" auswählt muss darauf dann verzichten.

Und sicher auch auf die freiwillige Hilfe vieler im Forum :-)

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Mon 14. Aug 2023, 07:44
by Jolinar
Kann mir jemand einen Denkanstoß geben?

Hier erstmal das aktuelle Script:

Code: Select all

#!/bin/bash

# Redirect output to a file
exec > info.txt

# Set locale
export LC_ALL=C

# Function to print section header
print_section_header() {
    echo -e "\n------------------------------------------------------------"
    echo -e "$1"
    echo -e "------------------------------------------------------------"
}

# Function to get operating system information
get_os_info() {
    if [ -f /etc/os-release ]; then
        source /etc/os-release
        echo "Operating System: $PRETTY_NAME"
    else
        echo "Operating System: Unknown"
    fi
}

# Check if dig is installed, if not, install dnsutils package
check_and_install_dig() {
    if ! command -v dig &> /dev/null; then
        echo "dig is not installed. Installing dnsutils package..."
        sudo apt-get update
        sudo apt-get install -y dnsutils
    fi
}

# System Information
print_section_header "System Information"
get_os_info
echo "Hostname: $(hostname)"
echo "Kernel Version: $(uname -r)"
echo "Architecture: $(uname -m)"

# CPU Information
print_section_header "CPU Information"
echo "Model Name: $(lscpu | awk -F': ' '/Model name/ {print $2}')"
echo "Number of Cores: $(lscpu | awk -F': ' '/^CPU\(s\)/ {print $2}')"
hypervisor_vendor=$(lscpu | awk -F': ' '/Hypervisor vendor/ {print $2}')
if [ -z "$hypervisor_vendor" ]; then
    hypervisor_vendor="Not Detected"
fi
echo "Hypervisor: $hypervisor_vendor"

# Current CPU Usage
print_section_header "Current CPU Usage"
top -n 1 -b | grep '%Cpu'

# Memory (RAM)
print_section_header "Memory (RAM)"
free -h

# Disk Space
print_section_header "Disk Space"
df -h

# Additional Disk Information
print_section_header "Additional Disk Information"
du -h --max-depth=1 --exclude=/proc / | sort -rn

# Running Processes
print_section_header "Running Processes"
ps aux

# Network Adapters
print_section_header "Network Adapters"
ip a

# Network Connections
print_section_header "Network Connections"
netstat -tulpen

# View Firewall Rules (iptables)
print_section_header "Firewall Rules (iptables)"
iptables -L

# Display Used Nameservers
print_section_header "Used Nameservers"
cat /etc/resolv.conf | awk '/^nameserver/ {print "Nameserver:", $2}'

# Reverse DNS Lookup (PTR) for IP Addresses
print_section_header "Reverse DNS Lookup (PTR) for IP Addresses"
for ip in $(ip -o -4 addr show scope global | awk '{print $4}' | cut -d'/' -f1); do
    ptr_record=$(dig -x "$ip" +short)
    echo "IP Address: $ip"
    echo "PTR Record: $ptr_record"
    echo
done

# Check and install dig if needed
check_and_install_dig

# Enabled Virtual Hosts
print_section_header "Enabled Virtual Hosts"
apache_vhosts_path="/etc/apache2/keyhelp/vhosts"
for vhost in "$apache_vhosts_path"/*; do
    vhost_domain=$(grep -oP 'ServerName \K.*' "$vhost" | awk '{print $1}' | uniq)  # Extract domain from ServerName directive
    echo -e "\nVirtual Host: $vhost_domain\n"
    cat "$vhost"

    # Get DNS resource records for the domain
    echo -e "\nDNS Resource Records for $vhost_domain:"
    dns_records=$(dig $vhost_domain any)
    echo "$dns_records"
done
Bei der Ermittlung der DNS-RR gebe ich dem dig Kommando den Parameter any mit. Trotzdem bekomme ich nur A-RR gelistet, obwohl weitere DNS-RR (AAAA, MX, TXT) existieren. Wo liegt mein Denkfehler?

Re: Data Collector für Community Support -- Diskussionsthread

Posted: Mon 14. Aug 2023, 08:40
by CaseF
Kein Denkfehler. "any" funktioniert nicht mit jedem DNS Server bzw. ist die Ausgabe nicht überall komplett.