diff --git a/.github/lint-device-urls.sh b/.github/lint-device-urls.sh new file mode 100755 index 0000000..ce25c9a --- /dev/null +++ b/.github/lint-device-urls.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +ret=0 +base_url="192.168.0.90" +exclude_dir_list="\ + --exclude-dir=.github \ + --exclude-dir=src \ + --exclude-dir=_site \ + --exclude-dir=capture \ + --exclude=test.sh \ +" +allowed_patterns="\ + \`$base_url\` \ + $base_url \ + $base_url/index.html \ + $base_url/axis-cgi \ + @$base_url \ +" + +# Set +e to not having to handle the grep exit status +__url_grep_list=$(grep -nir "$base_url" $exclude_dir_list | \ + grep -vE "$base_url(\`| |/axis-cgi|/index.html#)" | \ + grep -vE "@$base_url" || :) +[ -z "$__url_grep_list" ] || { + printf '\n%s\n%s\n\n' \ + "## Error - The following device URLs are not matching allowed patterns" \ + "$__url_grep_list" + printf "## Allowed patterns (Including URLs prefixed http://):\n" + for pattern in $allowed_patterns + do + printf '%s\n' "* $pattern" + done + printf "\nA typical error is to copy the redirected URL that include e.g. product specific string 'camera'\n" + ret=1 +} +exit $ret diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 574ee96..bdf5351 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,6 +28,9 @@ jobs: ret=1 } exit $ret + - name: Check that device URLs have approved structure + run: | + .github/lint-device-urls.sh - run: cat .github/super-linter.env >> "$GITHUB_ENV" - name: Lint Code Base uses: super-linter/super-linter/slim@v5 diff --git a/docs/acap-sdk-version-3/develop-applications/vapix-access-for-acap-applications.md b/docs/acap-sdk-version-3/develop-applications/vapix-access-for-acap-applications.md index 80115e3..ace5439 100644 --- a/docs/acap-sdk-version-3/develop-applications/vapix-access-for-acap-applications.md +++ b/docs/acap-sdk-version-3/develop-applications/vapix-access-for-acap-applications.md @@ -111,7 +111,7 @@ After obtaining the credentials, it's ready to make the actual VAPIX call. The A 2. Generate and set credentials: - The credentials obtained from the D-Bus call are concatenated and then added to the cURL request. + The credentials obtained from the D-Bus call are concatenated and then added to the curl request. ```c curl_easy_setopt(curl, CURLOPT_USERPWD, credentials); @@ -119,7 +119,7 @@ After obtaining the credentials, it's ready to make the actual VAPIX call. The A 3. Set the authentication method and make the VAPIX call: - Here, basic access authentication is used, and then the actual cURL request is made. + Here, basic access authentication is used, and then the actual curl request is made. ```c curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); @@ -149,15 +149,15 @@ Example response: ('id:a0-testuser, pass:MH757eGZdsyBuAbhAQ3j2ZtRNg9xchEg',) ``` -Make a VAPIX request on local virtual host 127.0.0.12 with the given credentials using cURL. +Make a VAPIX request on local virtual host 127.0.0.12 with the given credentials using `curl`. Example ```bash -curl -s -u '' http://127.0.0.12/axis-cgi/applications/list.cgi +curl -s -u : http://127.0.0.12/axis-cgi/applications/list.cgi ``` -Where `id` and `pass` are the credentials obtained from the GDBus call. This cURL command sends an HTTP GET request to the specified VAPIX endpoint with the required authentication. +Where `id` and `pass` are the credentials obtained from the GDBus call. This `curl` command sends an HTTP GET request to the specified VAPIX endpoint with the required authentication. ## Limitations diff --git a/docs/acap-sdk-version-3/get-started/set-up-the-device.md b/docs/acap-sdk-version-3/get-started/set-up-the-device.md index 5cfd95b..5e5c982 100644 --- a/docs/acap-sdk-version-3/get-started/set-up-the-device.md +++ b/docs/acap-sdk-version-3/get-started/set-up-the-device.md @@ -33,18 +33,14 @@ You can enable SSH on an Axis device either through the device's web interface o #### In the old web interface -1. Depending on you AXIS OS version, go to - - - 10.5 and earlier: `http://192.168.0.90/#settings/system/tools/plainconfig` - - 10.6 and later: `http://192.168.0.90/aca/index.html#settings/system/tools/plainconfig` - -2. Click **Network**. -3. Under **SSH**, select **Enabled**. -4. Scroll to the bottom of the page and click **Save**. +1. Go to `http://192.168.0.90/index.html#settings/system/tools/plainconfig` +2. Click on **Network** in the list +3. Under **SSH** select **Enabled** +4. Scroll to the bottom of the page and click button **Save** #### In the new web interface -1. Go to `http://192.168.0.90/camera/index.html#/system/plainConfig`. +1. Go to `http://192.168.0.90/index.html#/system/plainConfig`. 2. Select the **Network** group from the drop-down menu. 3. Under **Network/SSH**, select **Enabled**. 4. Scroll to the bottom of the page and click **Save**. @@ -54,7 +50,7 @@ You can enable SSH on an Axis device either through the device's web interface o In this example we're using curl, and more options may be required depending on your network setup: ```sh -curl -u ':' "" +curl --anyauth -u : "http://192.168.0.90/axis-cgi/admin/param.cgi?action=update&Network.SSH.Enabled=yes" ``` ## Setup the device on the network @@ -123,9 +119,12 @@ http://192.168.0.90/axis-cgi/basicdeviceinfo.cgi To extract the messages, use the CGI from a terminal, using the credentials set in the network configuration: ```sh -curl --anyauth "*" -u [username]:[password] 192.168.0.90/axis-cgi/basicdeviceinfo.cgi --data "{\"apiVersion\":\"1.0\",\"context\":\"Client defined request ID\",\"method\":\"getAllProperties\"}" +curl --anyauth -u : "http://192.168.0.90/axis-cgi/basicdeviceinfo.cgi" --data '{"apiVersion":"1.0","context":"Client defined request ID","method":"getAllProperties"}' ``` +> To get a pretty-print of the JSON response from the curl call, the program +> `jq` can be used by appending the following snippet ` | jq` + The following response contains architecture `"Architecture": "armv7hf"`, and firmware version `"Version": "9.50.1"`: ```json diff --git a/docs/develop/VAPIX-access-for-ACAP-applications.md b/docs/develop/VAPIX-access-for-ACAP-applications.md index 9b6b81a..dbd738c 100644 --- a/docs/develop/VAPIX-access-for-ACAP-applications.md +++ b/docs/develop/VAPIX-access-for-ACAP-applications.md @@ -104,7 +104,7 @@ After obtaining the credentials, it's ready to make the actual VAPIX call. The A 2. Generate and set credentials: - The credentials obtained from the D-Bus call are concatenated and then added to the cURL request. + The credentials obtained from the D-Bus call are concatenated and then added to the curl request. ```c curl_easy_setopt(curl, CURLOPT_USERPWD, credentials); @@ -112,7 +112,7 @@ After obtaining the credentials, it's ready to make the actual VAPIX call. The A 3. Set the authentication method and make the VAPIX call: - Here, basic access authentication is used, and then the actual cURL request is made. + Here, basic access authentication is used, and then the actual curl request is made. ```c curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); @@ -142,15 +142,15 @@ Example response: ('id:a0-testuser, pass:MH757eGZdsyBuAbhAQ3j2ZtRNg9xchEg',) ``` -Make a VAPIX request on local virtual host 127.0.0.12 with the given credentials using cURL. +Make a VAPIX request on local virtual host 127.0.0.12 with the given credentials using `curl`. Example ```bash -curl -s -u '' http://127.0.0.12/axis-cgi/applications/list.cgi +curl -s -u : http://127.0.0.12/axis-cgi/applications/list.cgi ``` -Where `id` and `pass` are the credentials obtained from the GDBus call. This cURL command sends an HTTP GET request to the specified VAPIX endpoint with the required authentication. +Where `id` and `pass` are the credentials obtained from the GDBus call. This `curl` command sends an HTTP GET request to the specified VAPIX endpoint with the required authentication. ## Limitations diff --git a/docs/get-started/set-up-developer-environment/set-up-device-advanced.md b/docs/get-started/set-up-developer-environment/set-up-device-advanced.md new file mode 100644 index 0000000..f72e413 --- /dev/null +++ b/docs/get-started/set-up-developer-environment/set-up-device-advanced.md @@ -0,0 +1,77 @@ +--- +layout: page +grand_parent: Get started +parent: Set up developer environment +title: Set up device - advanced +nav_order: 3 +--- + +# Set up device - advanced topics + +- [Access the device through SSH](#access-the-device-through-ssh) + +## Access the device through SSH + +This section shows how to setup and log in to a device through Secure Shell +Protocol (SSH) to run command-line operations in AXIS OS. + +### Enable SSH + +SSH is by default disabled on Axis devices, but can be enabled either through +the device's web interface or by calling a VAPIX API from command-line. + +#### Through new web interface + +1. Go to `http://192.168.0.90/index.html#system/plainConfig` +2. Select the **Network** group from the drop-down menu +3. Under **Network / SSH** select **Enabled** +4. Scroll to the bottom of the page and click button **Save** + +#### Through old web interface + +1. Go to `http://192.168.0.90/index.html#settings/system/tools/plainconfig` +2. Click on **Network** in the list +3. Under **SSH** select **Enabled** +4. Scroll to the bottom of the page and click button **Save** + +#### Through command-line + +This is exemplified using `curl`: + +> More options may be required depending on your network setup. + +```sh +curl -u ':' --anyauth "http://192.168.0.90/axis-cgi/admin/param.cgi?action=update&Network.SSH.Enabled=yes" +``` + +### Create an SSH user + +> - Prior to AXIS OS 11.5 it's only possible to SSH as `root` user. +> - From AXIS OS 11.5 it's possible to create a non-root SSH user. +> - After AXIS OS 12.0 it will not be possible to SSH to an Axis device as +> `root` user. + +#### Through web interface + +1. Go to the following URL: + - AXIS OS < 11.6 `http://192.168.0.90/index.html#system/users` + - AXIS OS >= 11.6 `http://192.168.0.90/index.html#system/accounts` +2. Find the field on the web page called: + - AXIS OS < 11.6 **SSH users** + - AXIS OS >= 11.6 **SSH accounts** +3. Click the `+` icon with text **Add SSH user** +4. Follow the instructions in the dialog to create an SSH user. + +### Connect to the device + +To connect to the Axis device through SSH, it's required to install a program +that can communicate via SSH. This will be exemplified using `ssh` and a +non-root SSH user called `my-ssh-user`. + +> The SSH user needs to be created on the device before connecting to the +> device, see [Create an SSH user](create-an-ssh-user). + +```sh +ssh my-ssh-user@192.168.0.90 +my-ssh-user@axis-aabbcc112233:~# +``` diff --git a/docs/get-started/set-up-developer-environment/set-up-device.md b/docs/get-started/set-up-developer-environment/set-up-device.md index 9f78e9e..ca09c3b 100644 --- a/docs/get-started/set-up-developer-environment/set-up-device.md +++ b/docs/get-started/set-up-developer-environment/set-up-device.md @@ -30,36 +30,6 @@ For more information about how to find and assign IP addresses, go to [How to as 2. Enter the username and password. If you access the device for the first time, you must set the root password. See [Set a new password for the root account](#set-a-new-password-for-the-root-account). 3. The live view page opens in your browser. -### Access the device through SSH - -You can enable SSH on an Axis device either through the device's web interface or by calling a VAPIX API from command-line. - -#### Through old web interface - -1. Go to the following URL: - - AXIS OS < 10.6 `http://192.168.0.90/#settings/system/tools/plainconfig` - - AXIS OS >= 10.6 `http://192.168.0.90/aca/index.html#settings/system/tools/plainconfig` -2. Click on **Network** in the list -3. Under **SSH** select **Enabled** -4. Scroll to the bottom of the page and click button **Save** - -#### Through new web interface - -1. Go to `http://192.168.0.90/camera/index.html#/system/plainConfig` -2. Select the **Network** group from the drop-down menu -3. Under **Network / SSH** select **Enabled** -4. Scroll to the bottom of the page and click button **Save** - -#### Through command-line - -This is exemplified using `curl`: - -```sh -curl -u ':' "http://192.168.0.90/axis-cgi/admin/param.cgi?action=update&Network.SSH.Enabled=yes" -``` - -> More options may be required depending on your network setup. - ## Setup the device on the network Some extra steps can be followed to make sure the device is ready to be used and connected to the network. @@ -125,10 +95,13 @@ http://192.168.0.90/axis-cgi/basicdeviceinfo.cgi To extract the messages, use the CGI from a terminal, using the credentials set in the network configuration: ```sh -curl --anyauth '*' -u ':' 192.168.0.90/axis-cgi/basicdeviceinfo.cgi --data '{"apiVersion":"1.0","context":"Client defined request ID","method":"getAllProperties"}' +curl --anyauth -u : "http://192.168.0.90/axis-cgi/basicdeviceinfo.cgi" --data '{"apiVersion":"1.0","context":"Client defined request ID","method":"getAllProperties"}' ``` -The following response contains architecture `"Architecture": "armv7hf"`, and AXIS OS version `"Version": "9.50.1"`: +> To get a pretty-print of the JSON response from the curl call, the program +> `jq` can be used by appending the following snippet ` | jq` + +The following response contains architecture `"Architecture": "armv7hf"`, and firmware version `"Version": "9.50.1"`: ```json { @@ -158,11 +131,6 @@ The following response contains architecture `"Architecture": "armv7hf"`, and AX Axis offers product firmware (AXIS OS) management according to the active track or the long-term support (LTS) tracks. Regardless of the track chosen, it is recommended to upgrade AXIS OS regularly in order to get the latest security updates. AXIS OS can be upgraded using AXIS Device Manager, AXIS Camera Station, AXIS Companion, HTTP or FTP. -> If using AXIS A1001 in cluster mode, make sure to upgrade all controllers. -> Either all at a time using AXIS Device Manager or straight after each other -> using the web interface or FTP. The entire cluster should always be on the -> same firmware - ### AXIS Device Manager or AXIS Camera Station 1. Go to the **Device Manager Tab** in Axis Device Manager or **Configuration Tab > Devices - Management** in AXIS Camera Station.