ccgx:root_access
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ccgx:root_access [2023-03-02 09:09] – [Disable touch on the attached screen] dfaber | ccgx:root_access [2024-12-03 11:17] (current) – [3.1 Set access level to Superuser] mvader | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Venus OS: Root Access ====== | ====== Venus OS: Root Access ====== | ||
- | ===== Introduction ===== | + | ===== 1. Introduction ===== |
This document explains how to access a GX device via SSH, or straight on the Serial Console, with the root user. It also covers customizing and hardening a GX device against nonauthorised access. | This document explains how to access a GX device via SSH, or straight on the Serial Console, with the root user. It also covers customizing and hardening a GX device against nonauthorised access. | ||
Line 9: | Line 9: | ||
Do note that, while we try to maintain to provide all mentioned functionality in this document, the used commands and functionality may change with future updates. | Do note that, while we try to maintain to provide all mentioned functionality in this document, the used commands and functionality may change with future updates. | ||
- | ===== Warning about modifying the rootfs ===== | + | ===== 2. Warning about modifying the rootfs ===== |
__1. Your changes can be lost during a firmware update__ | __1. Your changes can be lost during a firmware update__ | ||
Line 30: | Line 30: | ||
- if you remove the files in / | - if you remove the files in / | ||
- | ======= Root access ====== | + | ===== 3. Root access ===== |
+ | |||
+ | ==== 3.1 Set access level to Superuser ==== | ||
+ | To set the root password, first set the access level to Superuser. | ||
- | ==== Set access level to Superuser ==== | ||
- | To set the root password, first set the access level to Superuser: | ||
- Go to Settings, General | - Go to Settings, General | ||
- Set the Access Level to User and installer, the password is '' | - Set the Access Level to User and installer, the password is '' | ||
- Highlight Access Level (don't open the select page, ie. make sure you are in the General Page, not the Access Level page) | - Highlight Access Level (don't open the select page, ie. make sure you are in the General Page, not the Access Level page) | ||
- | - Press and hold the right button of the center pad until you see the Access Level change to Superuser. Note: when working from the Remote Console, you need to use the right key on your keyboard. Pressing and holding the right button with your mouse won't work. | + | - Press and hold the right button of the center pad until you see the Access Level change to Superuser. Note: when working from the Remote Console |
Now you have access to the super user features. | Now you have access to the super user features. | ||
Line 43: | Line 44: | ||
Note that on a touchscreen, | Note that on a touchscreen, | ||
- | ==== Create a temporary root password ==== | + | ==== 3.2 Create a temporary root password ==== |
Go to //Settings -> General -> Set root password//. And create a temporary root password. | Go to //Settings -> General -> Set root password//. And create a temporary root password. | ||
Line 49: | Line 50: | ||
Note that, for firmware version v2.00 and later, the root password will be reset by a firmware update. The reason is that the passwd file is on the rootfs, which is fully replaced by an update. More info [[https:// | Note that, for firmware version v2.00 and later, the root password will be reset by a firmware update. The reason is that the passwd file is on the rootfs, which is fully replaced by an update. More info [[https:// | ||
- | Our advice is to create a complex root password. But use it to login only the first time, and then install a public ssh key(s). Thereafter login with the keys. If key authentication works, you can also | + | Our advice is to create a complex root password. But use it to login only the first time, and then install a public ssh key(s). Thereafter login with the keys. If key authentication works, you can |
- | safely | + | safely |
- | ==== Enable sshd and log in ===== | + | The password needs to be 6 characters long, minimum. |
+ | ==== 3.3 Enable sshd and log in ===== | ||
- | To login via ssh, enable SSH on LAN (//Settings -> General//). On Venus versions before v2.40, you need to enable Remote Support, which also enables sshd. More info on Remote Support [[ccgx:ccgx_faq#what_is_the_functionality_behind_the_menu_item_remote_support_ssh_in_the_ethernet_menu|here]]. | + | To login via ssh, enable SSH on LAN (//Settings -> General//). On Venus versions before v2.40, you need to enable Remote Support, which also enables sshd. More info on Remote Support [[https:// |
To the login, enter the ip address of the GX device in a ssh client. Most Linux and Mac users will simply do this from the command line: | To the login, enter the ip address of the GX device in a ssh client. Most Linux and Mac users will simply do this from the command line: | ||
Line 62: | Line 64: | ||
And a very commonly used client for Windows is [[http:// | And a very commonly used client for Windows is [[http:// | ||
- | ==== Installing ssh keys ==== | + | ==== 3.4 Installing ssh keys ==== |
Using a ssh key for authentication, | Using a ssh key for authentication, | ||
Line 75: | Line 77: | ||
The third file contains the keys we use for Remote Support login. | The third file contains the keys we use for Remote Support login. | ||
- | ==== Play time! Start executing commands ==== | + | ==== 3.5 Play time! Start executing commands ==== |
https:// | https:// | ||
- | ======= Customizing a GX device | + | ===== 4. Customizing a GX device ===== |
- | ==== Hooks to install/run own code at boot ==== | + | ==== 4.1 Hooks to install/run own code at boot ==== |
Everything, except for information on ''/ | Everything, except for information on ''/ | ||
Line 89: | Line 91: | ||
If the files ''/ | If the files ''/ | ||
- | Also if '' | + | Also if '' |
That venus-data file has one extra feature: if the archive contains '' | That venus-data file has one extra feature: if the archive contains '' | ||
+ | |||
+ | You can draw further inspiration from [[https:// | ||
You can test the ' | You can test the ' | ||
Line 100: | Line 104: | ||
https:// | https:// | ||
- | ==== Creating a patch file ==== | + | ==== 4.2 Partitions, read-only rootfs and available disk space ==== |
- | + | ||
- | As mentioned before, the recommended way of customising Venus OS is by applying patch files. This section describes how to make and apply a patch. | + | |
- | + | ||
- | You start by making a copy of the original file and modifying it to accommodate your changes. In order to create a patch file containing the changes you’ve made, run the following command: | + | |
- | + | ||
- | diff -u OriginalFile UpdatedFile > PatchFile | + | |
- | + | ||
- | In order to patch the original file with your changes, you can use the below command: | + | |
- | + | ||
- | patch OriginalFile < PatchFile | + | |
- | + | ||
- | For more advanced features please check the manual page of [[https:// | + | |
- | + | ||
- | ==== Partitions, read-only rootfs and available disk space ==== | + | |
On a GX Device, there are three partitions that matter: | On a GX Device, there are three partitions that matter: | ||
Line 122: | Line 112: | ||
* the data partition | * the data partition | ||
- | === One active rootfs at a time === | + | === 4.2.1 One active rootfs at a time === |
Only one of the two rootfs partitions will be in use at time. During a firmware update, the new firmware is installed on the other one; and once finished the subsequent reboot will reboot the device onto that other partition. | Only one of the two rootfs partitions will be in use at time. During a firmware update, the new firmware is installed on the other one; and once finished the subsequent reboot will reboot the device onto that other partition. | ||
Line 128: | Line 118: | ||
The data partition is not touched during a firmware update, except maybe some migration scripts that run at boot. | The data partition is not touched during a firmware update, except maybe some migration scripts that run at boot. | ||
- | === Always prevent running out of diskspace === | + | === 4.2.2 Read-only rootfs === |
+ | |||
+ | By default, the rootfs is mounted read only. Also, by default, it only has 5% of free space, while the partition in which its installed is actually larger. | ||
+ | |||
+ | The recommended method to **(a)** mount it as read/write, and **(b)** expand it to use all of the available space in its partition, is by running ''/ | ||
+ | |||
+ | Here is a short overview of the three ways mount the rootfs as read/ | ||
+ | |||
+ | * // | ||
+ | * // | ||
+ | * // | ||
+ | |||
+ | === 4.2.3 Always prevent running out of diskspace === | ||
When doing modifications, | When doing modifications, | ||
Line 134: | Line 136: | ||
With regards to the size of the data partition, thats easy to check using the '' | With regards to the size of the data partition, thats easy to check using the '' | ||
- | After logging into a GX device, and checking the free disk space on the rootfs(! | + | After logging into a GX device, and checking the free disk space on the rootfs (! that is not the data partition), you might get a bit disappointed at first. Don't worry about that, there will always be only 5% of free space, but thats not the actual free space: |
- | The reason for this is that a firmware update replaces the full filesystem on the rootfs, as an image. And its then not expanded to the full available space of the partition | + | The reason for this is that a firmware update replaces the full filesystem on the rootfs, as an image. And its then **not** by default |
To expand it, run ''/ | To expand it, run ''/ | ||
Line 148: | Line 150: | ||
Note that a firmware update will replace all of the rootfs, as also explained above. Which implies that you'll need to run '' | Note that a firmware update will replace all of the rootfs, as also explained above. Which implies that you'll need to run '' | ||
- | ===== Adding or modifying services | + | ==== 4.3 Creating a patch file ==== |
+ | |||
+ | As mentioned before, the recommended way of customising Venus OS is by applying patch files. This section describes how to make and apply a patch. | ||
+ | |||
+ | You start by making a copy of the original file and modifying it to accommodate your changes. In order to create a patch file containing the changes you’ve made, run the following command: | ||
+ | |||
+ | diff -u OriginalFile UpdatedFile > PatchFile | ||
+ | |||
+ | In order to patch the original file with your changes, you can use the below command: | ||
+ | |||
+ | patch OriginalFile < PatchFile | ||
+ | |||
+ | For more advanced features please check the manual page of [[https:// | ||
+ | |||
+ | In this thread, there is an example of how to make a patch file to change a certain setting in the GX, and how to apply that at boot. To make it survive a firmware update: | ||
+ | https:// | ||
+ | |||
+ | ==== 4.4 Adding or modifying services ==== | ||
Changes made to ''/ | Changes made to ''/ | ||
Line 157: | Line 176: | ||
''/ | ''/ | ||
- | By default the root filesystem of Venus is read-only. There are three ways to change | + | Further details here: https:// |
- | * // | + | ===== 5. Hardening a GX device ===== |
- | * // | + | |
- | * // | + | |
- | + | ||
- | ======= Hardening a GX device | + | |
- | ===== Limit physical access to the device | + | ==== 5.1 Limit physical access to the device ==== |
The first thing to keep in mind is that we as Victron Energy always want an | The first thing to keep in mind is that we as Victron Energy always want an | ||
Line 183: | Line 198: | ||
access to the device. | access to the device. | ||
- | ===== Disable touch on the attached screen | + | ==== 5.2 Disable touch on the attached screen ==== |
Per Venus OS version v3.00, we are introducing a feature that allows disabling the touch feature on the GX Touch display. | Per Venus OS version v3.00, we are introducing a feature that allows disabling the touch feature on the GX Touch display. | ||
Line 190: | Line 205: | ||
Details per GX device: | Details per GX device: | ||
+ | * Ekrano GX: a digital input can be configured to be used for this. Wire it to a momentary-push button, that shorts the input (grounds it). | ||
* Cerbo GX + GX touch: a digital input can be configured to be used for this. Wire it to a momentary-push button, that shorts the input (grounds it). | * Cerbo GX + GX touch: a digital input can be configured to be used for this. Wire it to a momentary-push button, that shorts the input (grounds it). | ||
* Venus GX: has no screen, not relevant. | * Venus GX: has no screen, not relevant. | ||
Line 198: | Line 213: | ||
Note that this setting only disables touch/mouse control. On the remote console you are still able to control the device with keyboard input. That is also true if you plugin an external USB keyboard. With the keyboard it is also possible to toggle the ''/ | Note that this setting only disables touch/mouse control. On the remote console you are still able to control the device with keyboard input. That is also true if you plugin an external USB keyboard. With the keyboard it is also possible to toggle the ''/ | ||
- | ===== Limiting digital access | + | |
+ | ==== 5.3 Limiting digital access | ||
When securing the device, it is also advised to disable the Wi-Fi access point, | When securing the device, it is also advised to disable the Wi-Fi access point, | ||
Line 246: | Line 262: | ||
that. | that. | ||
- | ===== Installing a tamper alarm ===== | + | ==== 5.4 Installing a tamper alarm ==== |
By using the digital input(s) of the GX device, you can set the digital | By using the digital input(s) of the GX device, you can set the digital | ||
Line 261: | Line 277: | ||
* If a logical low input (0V) should be considered a positive condition, set //Inverted alarm logic// to on. | * If a logical low input (0V) should be considered a positive condition, set //Inverted alarm logic// to on. | ||
- | ===== Hardening multiple devices | + | ==== 5.5 Hardening multiple devices ==== |
If you have a lot of Venus devices to modify, probably the easiest way is to | If you have a lot of Venus devices to modify, probably the easiest way is to | ||
Line 271: | Line 287: | ||
Later replace that by something more strong and store it in your vault. Use the USB stick to put your public ssh keys on the GX device so you can gain remote access. | Later replace that by something more strong and store it in your vault. Use the USB stick to put your public ssh keys on the GX device so you can gain remote access. | ||
- | ====== | + | ===== 6. Connecting on the serial console ===== |
The serial console offers a straight connection from your computer. Not relying on TCP or anything else. | The serial console offers a straight connection from your computer. Not relying on TCP or anything else. | ||
Line 281: | Line 297: | ||
The serial consoles on all GX devices are configured to 115200 baud. | The serial consoles on all GX devices are configured to 115200 baud. | ||
- | ===== Serial console on GX device ===== | + | ==== 6.1 Color Control |
All GX Devices have a dedicated serial console, except for the CCGX. Therefor its documented on a separate page: | All GX Devices have a dedicated serial console, except for the CCGX. Therefor its documented on a separate page: | ||
Line 287: | Line 303: | ||
[[https:// | [[https:// | ||
- | ===== Serial Console on Cerbo GX ===== | + | ==== 6.2 Cerbo GX ==== |
The serial console is located on the CPU board, header JP201. GND is pin 1, RX and TX are pins 4 and 5. Here is a picture showing a [[https:// | The serial console is located on the CPU board, header JP201. GND is pin 1, RX and TX are pins 4 and 5. Here is a picture showing a [[https:// | ||
Line 295: | Line 311: | ||
{{ : | {{ : | ||
- | ===== Serial Console on Venus GX ===== | + | ==== 6.3 Venus GX ==== |
The serial console is located on the base-board, and can be accessed through the slot between that board and the Ethernet connector on the beaglebone-board. | The serial console is located on the base-board, and can be accessed through the slot between that board and the Ethernet connector on the beaglebone-board. | ||
Line 309: | Line 325: | ||
{{ : | {{ : | ||
- | ===== Serial console on GX Card / Nanopi | + | ==== 6.4 GX Card / Nanopi ==== |
The GX Card is the PCBA inside the MultiPlus-II GX and EasySolar-II GX product ranges. This photo shows the card, when unmounted from these inverter/ | The GX Card is the PCBA inside the MultiPlus-II GX and EasySolar-II GX product ranges. This photo shows the card, when unmounted from these inverter/ | ||
Line 320: | Line 336: | ||
- | ===== Serial console on Octo GX ===== | + | ==== 6.5 Octo GX ==== |
The serial console is located on the base-board, and can be accessed with the top-board unmounted. With the serial console cable connected the top-board can be put back on again. | The serial console is located on the base-board, and can be accessed with the top-board unmounted. With the serial console cable connected the top-board can be put back on again. | ||
Line 334: | Line 350: | ||
{{ : | {{ : | ||
+ | |||
+ | ==== 6.6 Ekrano GX ==== | ||
+ | |||
+ | Getting to console on the Ekrano GX is not that easy. The pins are located between the network and USB connector on the back of the device. | ||
+ | |||
+ | - Black: ground | ||
+ | - NC | ||
+ | - NC | ||
+ | - Green: RX of the Ekrano GX - connect to TX on your cable | ||
+ | - White: TX of the Ekrano GX - connect to RX on your cable | ||
+ | - NC | ||
+ | |||
+ | {{ : |
ccgx/root_access.1677744585.txt.gz · Last modified: 2023-03-02 09:09 by dfaber