How to setup OAuth on osTicket using Microsoft 365

Upgrading from basic authentication to OAuth on osTicket is a must if you are using Microsoft 365 since Microsoft 365 has a hard cut-off on basic authentication by end of 2022. Here are steps to configure step by step, if you are using multiple departments, this work for that too. You must be using osTicket v1.17 or higher, you can download it from here https://osticket.com/download, also you have to be an admin or have rights to create app registration, and give API permissions. This post covers everything from Creating App registration to, adding plugins, configuring, and Fetching emails automatically. Official documentation can find it here that also covers Google OAuth2 Guide

For your osTicket application, you will need the following info, which you can find, under Overview of your application, you need this info to configure OAuth.

  • Application ID
  • Directory (tenant ID)
  • Endpoints: authorize and token: Overview>Endpoints
    • If you have selected the multi-tenant option, your Endpoints URL will be generic, like these:
      https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize
      https://login.microsoftonline.com/organizations/oauth2/v2.0/token
  • Value of secrets from one of the steps below

Create an app registration

You need to log in to your Azure portal: Go to Azure Active Directory>App registrations

Next, click on New registration

Next, fill in the info

This is where you choose your access options, based on the selection, the next screen will have different options, for us, we choose a Single tenant and Redirect URL: Web

The redirect URL should be: https://YourSupportTicketURL.tld/api/auth/oauth2

Next, add API permission
YourApp>API permissions>Add a permission

Select Microsoft Graph

Next, select Delegated permissions

Then add the following permissions: you can search or scroll to select these, then click add permissions

  • IMAP.AccessAsUser.All
  • Mail.ReadWrite
  • offline_access
  • POP.AccessAsUser.All
  • SMTP.Send
  • User.Read

Once you have added all permission, you have to give admin consent by clicking on Grant admin consent for Name of your Business

You should see Status with Green checks, for all permissions.

Give Implicit grant and hybrid flows under Authentication
Check box for ID tokens (used for implicit and hybrid flows)

You need to be assigned roles to support address as an Application Administrator

To view and manage consented permissions for individual apps, as well as your tenant’s consent settings, need to go to Enterprise applications.

Add your Support email/user, if you have more than one department, you can add them here

Then click on each support email/user and assigned roles

Add assignments>Seach for Application administrator, then click add

Note: you need to do this for each support email address If you are using multiple departments setup.

Now to create client credentials, click on Overview>Add a certificate or secret

Click on the Clent secrets>New client secret

Enter the name, this could be anything and select the time when it Expires, then click on Add

Before you click out of this screen make sure to copy the value of your secret ID, which you will need for your app. Once you leave this screen, you will not be able to get this value back, so you may need to create a new one in case you have not copied it or you need to change it.
Note: You never want to show your Value to anyone, I am showing Value here for the test, which I have already deleted

Install OAuth plugin

If you have not downloaded it, you can go to https://osticket.com/download

Select Plugins>choose v1.17, you should see Oauth2

Install the OAuth plugin by uploading it to your installation/include/plugins

Click Add New Plugin

Click Install

and activate it, do NOT configure it here, go to the next step

To configure OAuth on osTicket

Now go to Emails>Select your support email address>Remote Mailbox>Select OAuth2 – Microsoft under Authentication

Fill in the details, once you click on Submit, it’s going to redirect you to the login page of MS365 https://login.microsoftonline.com :

You will get a prompt to Accept permission

If everything goes well you should see

Then you can enable email fetching, settings

For Outgoing should be something like this:

To schedule to Fetch emails in the background:

https://docs.osticket.com/en/latest/Getting%20Started/POP3-IMAP%20Settings.html

For Ubuntu: This will check email every 1 minute
Sudo nano /etc/crontab

1 * * * * nobody php /var/www/osticket_Path/api/cron.php

That’s all, hope this helps someone out there who is going through these changes in technologies

Issues and Solutions:

Error: Unable to update an email address or blank windows or sping circle

Solution:

Try these

  • Make sure you clear your cache on your browser
  • Make sure your rewrite is enabled:
    To enable rewrite on Ubuntu:
    sudo a2enmod rewrite

    You might need to edit apache2.conf file: sudo nano /etc/apache2/apache2.conf
    change from AllowOverride none to AllowOverride all
    under: < Directory /var/www/>
  • You might need to delete the email and re-add it, If you have only one email address, you will not be able to delete it, so you need to make another email address as default

To change click on Settings>Change Default System Email address to something else, then you can change it back, once you add your original support address.
Note: Don’t forget to change your default MTA back, otherwise it will be set to PHP mail:

Outgoing Email: Default email only applies to outgoing emails without SMTP settings.
Default MTA:

Error:  array ( ‘code’ => ‘MailboxNotEnabledForRESTAPI’, ‘message’ => ‘The mailbox is either inactive, soft-deleted, or is hosted on-premise.’, )

Solution: check the user consent and API permission, also make sure they have admin consent


Error: Expired Access Token

Solution: need to setup a scheduled task to fetch the email: #Fetch-emails
Link to the official documentation:



How to upgrade osTicket to v1.15.4

osTicket v1.15.4

osTicket v1.15.4 is released on October 7, 2021, its open-source ticket system. You can find full release notes at https://github.com/osTicket/osTicket/releases. For osTicket version v1.15.4 PHP version PHP 7.2-7.4 the process is the same as before just make sure you have a good backup of the database and osTicket files. There are many Enhancements, Improvements, and Security from 1.15.1 to 1.15.4.

In this post: upgrade osTicket to v1.15.4:

How to backup osTicket files on Ubuntu

How to backup osTicket database

How to upload osTicket installation files to the server from Windows 10 via PowerShell

The Upgrade process is very simple, I am doing 1.15.1 to 1.15.4

  • Make sure you have a good backup of the Database and files of osTicket
  • Then put the system in the offline mode: by going to the URL of your osTicket support ticket /scp/settings.php
  • Download the new version from https://osticket.com/download/ and choose the osTicket Core, v1.15.4 (Latest Release) don’t download any Languages or plugins, you can add them after to void issues with the upgrade process.
  • Upload to your server v. 1.15.4 and replace current files/folders from the Upload folder from your downloaded, and exclude the script folder/files. Also, Maintain the directory hierarchy any changes could cause an issue with the upgrade process or something might not work well.
    • Optional: Script folder only needed if you are using remote piping, so if you are not using remote piping you don’t need to upload.
  • Make sure NOT to replace your \include\ost-config.php which does not include in the download.

official Plugins can be downloaded and installed after the upgrade

official Documentions can be accessed, which will give you more details

Upgrade Process starts

Here is my current version: v.1.15.1:

Put the system in offline mode:

So, no one accessing the system or making any changes

Download the new version from https://osticket.com/download/

Select the osTicket Core, v1.15.4, then click Next Step

Click Next Step

Language packs, don’t add any at this time, just click Next Step

The Plugins, don’t add at this time, just click Next Step

Then you should see Subscribe to osTicket Mailing Lists, if you already subscribed, you can click on No Thanks and it will start downloading. If you have not subscribed, do filling, so you will get notification of any upgrades and security patches.

Now that you have downloaded, you can upload the installation files the best way you know of and override those that are on the server. If everything goes well you will not see anything, since this version doesn’t have any database changes.

If you look at your Dashboard Information, it should show Up to date

You can look at the system logs to see if there are any errors reported or your web server or PHP logs. You will need to update any customization you may have, test it, then once all is good you can put the system back online. Also, remove the write permission to \include\ost-config.php to secure your config. If you have customized PHP core files, those need to be re-applied after the upgrade. Also, make sure your plugins are good, if a needed upgrade to do so, make sure it supported version. if you don’t see some functions, make sure to check the permissions under Agents>Roles>PermissionsGood luck

There are many ways to backup, upload an osTicket, here is one I used that may help you, otherwise, you are all good to go, enjoy your osTicket system, Thank you to osTIcket Team for making it open source and keeping up to date.

How to backup osTicket files on Ubuntu:

Login to your server and run the following command use -r (copy recursively), and specify a current location and backup location. Note: this command is just doing backup of current osTicket files and dumping to another directory within the same server.

command: sudo cp -r /path/to/directory /path/to/backup-Location/NameOfBackup

How to backup osTicket database:

Login to your server and run the following command, Note: this is doing backup of database and dumping on the same server.

command: mysqldump NameOfosTicketDataBase > backupNameOfosTicket10.11.2021.sql -u SQLuserName -p

When you hit Enter, it will ask to enter a password, once done if you do ls command, you will see backupNameOfosTicket10.11.2021.sql or whatever you named your backup file

How to upload osTicket installation files to the server from Windows 10 via PowerShell:

This is the quickest way to upload and replace files. Please make sure the path is correct, before running the command, when you hit enter, it will ask for a password for your server.

Command: scp -r C:\Users\UserName\Downloads\osTicket-v1.15.4\osTicket-v1.15.4\upload\* userName@IPorFQDN:/var/www/osTicketDirectory

Note: the \* after the upload, if you don’t put * it will create a new directory called upload

After the upgrade, if you don’t see some functions, make sure to check the permissions under Agents>Roles>Permissions



How to upgrade osTicket to v1.15.1

osTicket v1.15.1 is released on Dec 7, 2020, its open-source ticket system. You can find full release notes at https://github.com/osTicket/osTicket/releases. For osTicket version v1.15.1 PHP version PHP 7.2-7.4 the process is the same as before just make sure you have a good backup of the database and osTicket files.

a couple of new plugins added for v1.15:
2FA Google Authenticator
Authentication Password Policy
https://osticket.com/download/#ostPlugin

The Upgrade process is very simple, I am doing 1.14.3 to 1.15.1

  • Make sure you have a good backup of the Database and files of osTicket
  • Then put the system in the offline mode: by going to the URL of your osTicket support ticket /scp/settings.php
  • Download the new version from https://osticket.com/download/ and choose the osTicket Core, v1.15.1 (Latest Release) don’t download any Languages or plugins, you can add them after to void issues with the upgrade process.
  • Upload to your server v. 1.15.1 and replace current files/folders from the Upload folder from your downloaded, and exclude the script folder/files. Also, Maintain the directory hierarchy any changes could cause an issue with the upgrade process or something might not work well.
    • Optional: Script folder only needed if you are using remote piping, so if you are not using remote piping you don’t need to upload.
  • Make sure NOT to replace your \include\ost-config.php which does not include in the download.

This is my current version: v1.14.3

Make sure you have the correct permission, then go to the URL/SCP of the osTicket system and log in, you should see osTicket Upgrader, make sure your Prerequisites are all good, if any errors correct it, then click Start Upgrade Now

This version makes changes to database, click Upgrade Now

If everything goes well you should see Upgrade Completed!

After the installation

Delete the /setup folder and update any customization you may have, test it, then once all is good you can put the system back online. Also, remove the write permission to \include\ost-config.php to secure your config. If you have customized PHP core files, those need to be re-applied after the upgrade. Also, make sure your plugins are good, if needed upgrade do so, make sure it supported version. Good luck

You can check the System Logs to see if there were any errors:

If you look at your Dashboard Information, it should show Up to date

If you still need more info you can check out their official documentation: https://docs.osticket.com/en/latest/



How to set Time Zone in osTicket

How to setup Time Zone in osTicket, which is very important to have your system work correctly.  If the time zone is incorrect tickets get mixed up marked wrong data/time, SLA, etc.. So here are few places you can check to confirm your system is correctly setup.  I am using an Ubuntu system other Linux system works similar path might be different.  If your time shows incorrect you should also check to make sure you have installed the PHP Extensions “Intel” which effects the time you can check it at /scp/system.php. There at least 4 places you can set the time zone, I am listing it here, your settings may vary.

Option 1: from osTicket admin panel System Settings and Preferences

/scp/settings.php

Default settings: Locale Defaults

If you need to customize:

Option 2: via php.ini file

Search or in your file under Date and just uncomment date.timezone =
Put your time zone name after = America/New_York (This would be mine)

Timezone name list: https://www.php.net/manual/en/timezones.php

Sample php.ini file looks like
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =

Option 3: via MySQL directly on the database

To see what’s currently is:

mysql -u YourDataBaseUserName -p -e “SELECT NOW();”

To see your current timezone within mysql: use the following command:

mysql> select now();

or
SHOW VARIABLES LIKE ‘%time_zone%’;

or
SELECT @@GLOBAL.time_zone, @@SESSION.time_zone;

To set a time zone or a value: make sure to choose your own time zone:

SET time_zone = America/New_York;

or
SET GLOBAL time_zone = ‘+8:00’;

or
SET GLOBAL time_zone = ‘ America/New_York ‘;

or
SET @@global.time_zone = ‘+00:00’;

To configure the time zone in Ubuntu system:

 sudo dpkg-reconfigure tzdata

Restart the server or you can restart Apache 2 and MySQL:
/etc/init.d/mysql restart

Option 4: Agent profile, which does not affect system-wide

osTicket Agent profile: Agent panel -> Profile -> Preferences -> Localization

That’s it, check the logs of PHP, web server and osTicket if you having any issues, that will give you some more clue.

Issues you might have:

Time issues: if Intel PHP Extension is not installed:

Once you installed Intel PHP extension then, restart your apache (your webserver) service, if everything goes well it should be fine:



How to upgrade osTicket to 1.14.1

osTicket v1.14.1 is released today November 21, 2019, it’s open-source ticket system. You can find full release notes at https://github.com/osTicket/osTicket/releases. For osTicket version 1.14.1 PHP version 7.0 to 7.3, 7.3 is recommended. The process is the same as before just make sure you have a good backup of database and osTicket files.

The Upgrade process is very simple, I am doing 1.12 to 1.14.1

  • Make sure you have a good backup of Database and files of osTicket
  • Then put the system in the offline mode: by going to URL of your osTicket support ticket /scp/settings.php
  • Download the new version from https://osticket.com/download/ and choose the osTicket Core, v1.14.1 (Latest Release) don’t download any Languages or plugins, you can add them after to void issues with the upgrade.
  • Upload to your server v. 1.14.1 and replace current files/folders from the Upload folder from your downloaded, and exclude the script folder/files. Also, Maintain the directory hierarchy any changes could cause an issue with the upgrade process or something might not work well.
    • Optional: Script folder only needed if you are using remote piping, so if you are not using remote piping don’t upload.
  • Make sure NOT to replace your \include\ost-config.php which does not include in the download.

Make sure you have the correct permission, then go to the URL/SCP of the osTicket system and log in, you should see osTicket Upgrader, make sure your Prerequisites are all good, if any errors correct it, then click Start Upgrade Now

Then you will get Migrate to osTicket v1.14.1, click Upgrade now
My screenshot shows 1.14 because at the time 1.14.1 was not out. If you were to do an upgrade from 1.14 to 1.14.1 there is no database change so you will not see the upgrade screen.

If everything goes well you should see Upgrade Completed! screen

After the installation

Delete the /setup folder and update any customization you may have, test it, then once all is good you can put the system back online. Also, remove the write permission to \include\ost-config.php to secure your config. If you have customized PHP core files, those need to be re-applied after the upgrade. Also, make sure your plugins are good, if needed upgrade do so, make sure it supported version. Good luck

Also make sure to enable new feature Link and Merge tickets, by default it’s off

If you are looking at a list of open tickets you will see two new options:

Link: The ability to link tickets and Merge – the ability to merge tickets

Documentation on how to use it: https://docs.osticket.com/en/latest/Features/Ticket%20Merge%20&%20Link.html

If you have click on the ticket, then option for Link and Merge ticket are shown when clicked on the arrow next to gear icon:

Official documentation: https://docs.osticket.com/en/latest/index.html
Link to: Changelog and Community forum: https://forum.osticket.com/