Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize the installation #42

Open
sport80 opened this issue Jan 24, 2024 · 4 comments
Open

Customize the installation #42

sport80 opened this issue Jan 24, 2024 · 4 comments
Labels
question Further information is requested

Comments

@sport80
Copy link

sport80 commented Jan 24, 2024

Hi, I tried the project with a Raspberry PI 3A+ and it works very well.
However, I would like to customize some settings for security reasons. I would like to change the WiFi password, try to ask for the bluetooth pin and change the root password but I couldn't.
When I change the WiFi password from the pre-built sd card image, the smartphone no longer connects.
I also tried to recompile the image changing the parameters in the sources files configuration but it still doesn't work.
Is there a way to customize the installation?

Thanks

Best regards

@nisargjhaveri
Copy link
Owner

For wifi password:

  1. You need to change /etc/hostapd.conf
  2. If you're building from scratch, you need to change the password mentioned package/aawg/src/common.cpp. OR you can somehow set the AAWG_WIFI_PASSWORD environment variable for the aawgd process.

For bluetooth, you'd likely need to change the bt_agent settings, the entry point is /etc/init.d/90bt_agent.

For the root password, if you're building from scratch, you can update the BR2_TARGET_GENERIC_ROOT_PASSWD setting in respective defconfig file. Or you can ssh and change the password on first use.

We should make some changes to have unique wifi passwords for each device on first boot or something, and maybe lock down root somehow unless in debugging mode. Bluetooth, I believe is okay, since the device does not have any input/output, generic PIN method does not work well.

@sport80
Copy link
Author

sport80 commented Jan 24, 2024 via email

@sport80
Copy link
Author

sport80 commented Jan 25, 2024

Hi, changing the hostapd.conf and the common.cpp it works like a charm. I've also changed the root password and no issue about the functionality. Now, next step, I try to implement the bluetooth PIN. I don't have really understood if the bluetooth discovery turn off after the pairing, after the WiFi connection the bluetooth remain on and connected to the raspberry. If another device want to connect, even if the discovery was disabled, it can potentially find it and connect to the them, so, connect to the wifi and can access to more others data and this could be a security issue. Also the static PIN it's a low level protection, but with this it could be a limited and accettable security issue. What do you think about this?

Thank you very much

@hkfuertes
Copy link
Contributor

If it helps (maybe I'm late), this is a little diff/patch file that I use when building my own images.

diff --git a/aa_wireless_dongle/board/common/rootfs_overlay/etc/hostapd.conf b/aa_wireless_dongle/board/common/rootfs_overlay/etc/hostapd.conf
index cddea29..b3a7ca5 100644
--- a/aa_wireless_dongle/board/common/rootfs_overlay/etc/hostapd.conf
+++ b/aa_wireless_dongle/board/common/rootfs_overlay/etc/hostapd.conf
@@ -1,4 +1,4 @@
-country_code=IN
+country_code=ES
 
 ctrl_interface=/var/run/hostapd
 interface=wlan0
@@ -12,5 +12,5 @@ wpa=2
 wpa_key_mgmt=WPA-PSK
 rsn_pairwise=CCMP
 
-ssid=AAWirelessDongle
-wpa_passphrase=ConnectAAWirelessDongle
+ssid=AndroidAuto_28a9a7
+wpa_passphrase=1234567890
diff --git a/aa_wireless_dongle/board/common/rootfs_overlay/etc/init.d/S92usb_gadget b/aa_wireless_dongle/board/common/rootfs_overlay/etc/init.d/S92usb_gadget
index 4ab6f5c..9a18e7b 100755
--- a/aa_wireless_dongle/board/common/rootfs_overlay/etc/init.d/S92usb_gadget
+++ b/aa_wireless_dongle/board/common/rootfs_overlay/etc/init.d/S92usb_gadget
@@ -3,9 +3,9 @@
 # Configure USB gadget interfaces
 #
 
-SERIAL_NUMBER="0123456"
-MANUFACTURER="My Own"
-PRODUCT="AA Wireless Dongle"
+SERIAL_NUMBER="1234567890"
+MANUFACTURER="Raspberry Pi"
+PRODUCT="Android Auto Wireless"
 
 ACCESSORY_GADGET_NAME="accessory"
 DEFAULT_GADGET_NAME="default"
diff --git a/aa_wireless_dongle/board/raspberrypi4/rootfs_overlay/etc/hostapd.conf b/aa_wireless_dongle/board/raspberrypi4/rootfs_overlay/etc/hostapd.conf
index 7ee0915..84670ce 100644
--- a/aa_wireless_dongle/board/raspberrypi4/rootfs_overlay/etc/hostapd.conf
+++ b/aa_wireless_dongle/board/raspberrypi4/rootfs_overlay/etc/hostapd.conf
@@ -1,4 +1,4 @@
-country_code=IN
+country_code=ES
 
 ctrl_interface=/var/run/hostapd
 interface=wlan0
@@ -13,5 +13,5 @@ wpa=2
 wpa_key_mgmt=WPA-PSK
 rsn_pairwise=CCMP
 
-ssid=AAWirelessDongle
-wpa_passphrase=ConnectAAWirelessDongle
+ssid=AndroidAuto_28a9a7
+wpa_passphrase=1234567890
diff --git a/aa_wireless_dongle/package/aawg/src/bluetoothHandler.cpp b/aa_wireless_dongle/package/aawg/src/bluetoothHandler.cpp
index 150e4a0..0384a97 100644
--- a/aa_wireless_dongle/package/aawg/src/bluetoothHandler.cpp
+++ b/aa_wireless_dongle/package/aawg/src/bluetoothHandler.cpp
@@ -4,7 +4,7 @@
 #include "bluetoothHandler.h"
 #include "bluetoothProfiles.h"
 
-static constexpr const char* ADAPTER_ALIAS = "AA Wireless Dongle";
+static constexpr const char* ADAPTER_ALIAS = "AndroidAuto_28a9a7";
 
 static constexpr const char* BLUEZ_BUS_NAME = "org.bluez";
 static constexpr const char* BLUEZ_ROOT_OBJECT_PATH = "/";
diff --git a/aa_wireless_dongle/package/aawg/src/common.cpp b/aa_wireless_dongle/package/aawg/src/common.cpp
index ae137cc..e2b4f35 100644
--- a/aa_wireless_dongle/package/aawg/src/common.cpp
+++ b/aa_wireless_dongle/package/aawg/src/common.cpp
@@ -39,8 +39,8 @@ std::string Config::getMacAddress(std::string interface) {
 
 WifiInfo Config::getWifiInfo() {
     return {
-        getenv("AAWG_WIFI_SSID", "AAWirelessDongle"),
-        getenv("AAWG_WIFI_PASSWORD", "ConnectAAWirelessDongle"),
+        "AndroidAuto_28a9a7",
+        "1234567890",
         getenv("AAWG_WIFI_BSSID", getMacAddress("wlan0")),
         SecurityMode::WPA2_PERSONAL,
         AccessPointType::DYNAMIC,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants