.. _update-server-sensor:

Updating Policy Server and Network Sensor
============================================

You can update the Policy Server and Sensor through the WEBUI or CLI.

.. note:: For **Genians Cloud Managed Edition** the Policy Server,
   will update automatically. Network Sensor upgrades must be manually
   initiated.

Update the Policy Server and Sensor Automatically
---------------------------------------------------

#. Go to **System** in the top panel
#. Go to **Update > Genian Software** in the left System Management panel.
#. Find **Available Version** software in Genian Software window. Click
   **Update from Genian Cloud**
#. Select either **Download Only**  retrieve the update and install manually,
   or **Download and Apply** to automate the installation to all eligible
   components.

    - If choosing **Download Only**: See steps 7-13 under "Update the Policy
      Server and Sensor Manually"

Update the Policy Server and Sensor Manually
----------------------------------------------

This is done by obtaining Genian ZTNA Software from Genians and storing it locally on
your machine to then upload onto the servers.

**Prepare System Files for upload**

#. Extract contents from the .iso file.
#. Select desired software version from the /images directory in the .iso.
    * For **Policy Server**, select file beginning with **NAC-CT** (*Includes
      network sensor files*)
    * For **Network Sensor**, select file beginning with **NAC-SS**

Update the Policy Server and Sensor by WEBUI
----------------------------------------------

#. Go to **System** in the top panel
#. Find **Update** section in the left System Management panel. Go to **Genian
   Software**
#. Find and click **Upload File** button in Genian Software window
#. Click **Select File** in Upload window
#. Locate **Genian Software** in **File Upload** window. Double click on
   desired file
#. Click **Upload**
#. Go to **System** in the top panel
#. Go to **System > System** in the left System Management panel
#. Find **Policy Server/Sensor** in System window. Click **Checkbox**
#. Click **Tasks**
#. Click **Update Specific System Image** (*If you selected Policy Server and
   ALL sensors in Step 9, Click Update Latest System Images*)
#. **Enable** or **Disable** Database Backup before upgrade.
#. System will automatically update and reboot.

Update the Policy Server and Sensor by CLI(Command Line Interface)
----------------------------------------------------------------------
Genian ZTNA provides updates to policy servers and network sensors through the CLI.

Genians highly recommends CLI upgrades for following case:
   - Upgrade server separately, such a  Policy server or DB server
   - HA configuration

**CLI update Command** : ``geniup``

**Command Option**
    - ``-h`` : help
    - ``-f [image filename]`` : Update software image from file
    - ``-u [URL]`` : Specify image URL
    - ``-d`` : Allow downgrade
    - ``-c`` : Don't check image validation (Package, Owner)

#. Connect SSH with terminal emulator that supports Zmodem.
#. Use command ``rz`` and upload an image file on server.

    .. code-block:: bash
        
        Genians$ cd /tmp
        Genians$ rz

#. Use ``geniup`` command and options to proceed with the upgrade.
    
    .. code-block:: bash
        
        Genians$ geniup -cf [image filename]
        System software upgrade from 
        Current Version : 
        Target Version  : 
        Do you want to upgrade this target version ? (y/N):
        Do you want to backup current database ? (Y/n): 
        Do you want to restart system after upgrade ? (Y/n): 


For the details, please check the :ref:`cli` documents.

.. warning::
    Genians highly recommends a backup be completed prior to performing a CLI upgrade.

------------------

Upgrade methods by Configuration
----------------------------------

How to upgrade Policy Server/Network Sensor
----------------------------------------------
Different version of policy server and network sensor may cause abnormal operation.
Please upgrade both server to the same version.

#. Access shell mode by typing ``@shell``
#. Stop Policy server service.

    .. code-block:: bash
        
        Genians$ alder stop

#. Upgrade Policy server (Don't reboot policy server).
#. Upgrade Network sensor.
#. Reboot Policy server.

------------------

How to upgrade Individual Policy Server/DB Server
----------------------------------------------------
The DB Server should not be upgraded during the Policy server upgrade process.

#. Access to shell mode. 
#. Stop Policy server service.

    .. code-block:: bash
        
        Genians$ alder stop

#. Upgrade DB server.
#. Reboot DBserver.
#. Upgrade Policy server.

.. note:: | The policy server and the DB server do not necessarily have to be the same version. Please refer to the release note and check the DB server revision before performing an upgrade.


------------------

How to upgrade HA configuration 
-----------------------------------
The Master system should not be changed during the upgrade process.

#. Upgrade Slave server (Don't reboot policy server).
#. Stop Slave server service

    .. code-block:: bash
        
        Genians$ alder stop

#. Upgrade Master server
#. Reboot Master server
#. Reboot Slave server