Avahi Integration and Network Connection
Project Description
This project aims to integrate Avahi service on a Linux server to manage and control network connections between mobile devices and televisions. The goal is to establish a 1-to-1 connection between specific mobile devices on the 192.168.10.x network and TVs on the 192.168.20.x network, acting as a controlled intermediary.
Why Start This Project?
The project is initiated to address the challenges of uncontrolled network connections facilitated by Avahi. By creating a custom C/C++ program, we aim to restrict and secure connections between mobile and TV networks, allowing specific devices to connect only to designated TVs.
Goal for this Hackweek
The primary objective for this Hackweek is to develop and implement the C/C++ program that will interface with Avahi, handling mDNS queries and unicast responses. We intend to demonstrate the controlled forwarding of packets between networks, achieving the goal of establishing a secure 1-to-1 connection.
To be more specific: For this hackweed we want to achieve
- successfully install avahi on the system
- check /usr/include > cd avahi- avahi-client/ avahi-common/ avahi-compat-libdns_sd/ avahi-core/ avahi-libevent/
- use sudo zypper install avahi-compat-libdns_sd-devel
- run using gcc -o avahiexample avahiexample.c -lavahi-client -lavahi-common ./avahi_example
- output finally > avahi-browse -a
Resources
Other Resources
Keywords
- Avahi
- Network Connection
- mDNS
- Linux
- C/C++ Programming
- Hackweek
- Network Security
- Integration
This project is part of:
Hack Week 23
Activity
Comments
-
about 1 year ago by vojha | Reply
Scenario Overview
This scenario involves establishing a 1-to-1 connection between mobile devices (192.168.10.x network) and televisions (192.168.20.x network) through a Linux server acting as an intermediary. The goal is to allow specific mobile devices to discover and connect only to certain TVs, creating a controlled connection process between networks.
Problem and Objective
Avahi Disabled Scenario
When Avahi is disabled: - Mobile devices on the 192.168.10.x network cannot discover any TVs on the 192.168.20.x network.
Avahi Enabled Scenario
When Avahi is enabled: - All mobile devices can discover all TVs, allowing connections between any mobile and TV on the network.
Proposed Solution and Process
Create a C/C++ Program
The program will interface with Avahi, handling the detection and communication between mobile and TV networks. It identifies the source (mobile) and target (TV) IP addresses and manages mDNS queries.
Purpose of the C/C++ Program
When Avahi is disabled, the program will handle and manipulate mDNS queries, allowing a 1-to-1 connection. The program ensures controlled forwarding of packets between networks, establishing specific connections between mobile devices and TVs.
Steps to Implement
- Install and start the Avahi service.
- Create the C/C++ program to handle mDNS queries and unicast responses between the mobile and TV networks. The program will act as a proxy server, forwarding and restricting packets between the specified mobile and TV.
Testing Procedure
Validate the C program's functionality by sending mDNS queries from mobile devices and forwarding them to the TV network. Test and confirm that the forwarded responses are unicast and specific to the intended mobile device.
Desired Outcomes & Future Works
The desired outcome is to establish controlled 1-to-1 connections between specific mobile devices and TVs without Avahi automatically forwarding mDNS packets. This will ensure a restricted and secure network connection, allowing specific mobile devices to connect only to certain TVs.
Note: Ensure that Avahi doesn't automatically forward packets unless the integration program is actively running.
Result and Outcome
I was able to run a simple service publication.
Service Publication
Publishes a service named "MyService" of type "example.tcp" on all network interfaces and protocols (IPv4 and IPv6) on port 12345. This service can be discovered on the local network.
Output
The output indicates the successful publication of the service. When the service is successfully published, the
entry_group_callback
function is called, and it prints: "Service 'MyService' successfully published."To run the C program, use the following example:
```bash gcc -o avahiintegration avahiintegration.c -lavahi-client -lavahi-common ./avahi_integration There are .sh files to install Avahi on Ubuntu, stop and start the daemon services as well, which makes life easier when testing different scenarios.
Output En02 smart_tv found.
bash Copy code $ ./avahiintegration Resolved service: Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa, _googlecast.tcp, local, a56831aa-ef2a-1db0-9c3f-d6b56ff217fa.local:8009 Resolved service: Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa, googlecast.tcp, local, a56831aa-ef2a-1db0-9c3f-d6b56ff217fa.local:8009 ^C In another tab:
bash Copy code avahi-browse -a Output:
bash Copy code eno2 IPv6 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa googlecast.tcp local eno2 IPv4 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa googlecast.tcp local eno1 IPv4 dap2230 Web Site local eno2 IPv6 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa googlecast.tcp local eno2 IPv6 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa googlecast.tcp local eno2 IPv4 Smart-2K-ATV4-a56831aaef2a1db09c3fd6b56ff217fa googlecast.tcp local Client failure, exiting: Daemon connection failed. The message appeared when we stopped the Avahi daemon using sudo systemctl stop avahi-daemon. Note that the ./avahi_integration ELF file was running in another tab, and nothing happened.
-
about 1 year ago by vojha | Reply
Avahi Integration and Network Connection README
What is Avahi?
Avahi is a system that facilitates service discovery on a local network. It implements Zeroconf networking specifications, including mDNS (multicast Domain Name System) and DNS-SD (DNS-based Service Discovery). Avahi enables devices to automatically discover and utilize services on the local network without requiring manual configuration.
For more information, visit the Avahi website.
Run in SUSE Linux OpenSUSE Tumbleweed
The Avahi files were successfully installed on the system, and the following steps were performed:
```bash cd /usr/include/avahi- avahi-client/ avahi-common/ avahi-compat-libdns_sd/ avahi-core/ avahi-libevent/ To compile and run the example program:
bash Copy code gcc -o avahiexample avahiexample.c -lavahi-client -lavahi-common ./avahi_example To browse services:
bash Copy code avahi-browse -a
-
about 1 year ago by vojha | Reply
All the programs and shell scripts
Everything is posted in github, feel free to check the codes and implement the same at your end. See you in next Hackweek
https://github.com/varunkojha/avahi-c
Desired Outcomes & Future Works
The desired outcome is to establish controlled 1-to-1 connections between specific mobile devices and TVs without Avahi automatically forwarding mDNS packets. This will ensure a restricted and secure network connection, allowing specific mobile devices to connect only to certain TVs.
Similar Projects
Add a machine-readable output to dmidecode by jdelvare
Description
There have been repeated reques...
FizzBuzz OS by mssola
Project Description
FizzBuzz OS (or just ...
YQPkg - Bringing the Single Package Selection Back to Life by shundhammer
tl;dr
Rip out the high-level YQPackageSele...
Port some classic game to Linux by MDoucha
Let's pick some old classic game, reverse engin...
New KDE Plasma notification app/applet by apappas
Description
My memory is terrible so I depe...
Linux Security and Practice by r1chard-lyu
Description
This project focuses on discove...
Explore simple and distro indipendent declarative Linux starting on Tumbleweed or Arch Linux by janvhs
Description
Inspired by [mkosi](https://g...
Testing and adding GNU/Linux distributions on Uyuni by juliogonzalezgil
Join the Gitter channel! [https://gitter.im/uy...
Contributing to Linux Kernel security by pperego
Description
A couple of weeks ago, I foun...
toptop - a top clone written in Go by dshah
Description
toptop
is a clone of Linux's ...
Update Haskell ecosystem in Tumbleweed to GHC-9.10.x by psimons
Description
We are currently at GHC-9.8.x...
Tumbleweed on Mars-CM (RISC-V board) by ph03nix
RISC-V is awesome, Tumbleweed is awesome, choco...