OVERVIEW
Support Packet Generation tool will allow users to grab information about their Mattermost instance to provide to the support team to save the trouble for support asking manually for this information. It is in the hopes of increasing productivity and making the process of getting information from a customer faster and easier.
After a meeting with product manager and UX designer, it was decided that the code will be directly implemented in the codebase without a plugin. The people who will have access to it is anyone who access to the system console (or any Admin roles).
The reason it was decided that putting it directly in the code base rather than a plugin makes more sense is because
We wanted it somewhere in the system console. After brief discussion with the integrations team, it was mentioned that plugins currently can render a custom React component for a plugin’s settings but that is as much modifying they can do in the system console. There is currently no structured way to do any more modifying and would require
creative thinking
as mentioned by integrations.We noticed that we already have a
commercial support
link in the dropdown in the hamburger menu of the system console which leads you the a generic Mattermost support webpage. It was decided that we like to improve upon this even further by adding a modal for licensed customers (customers with E10 and E20 licenses) which allows them to download the support packet.
GOALS
Make it easier for support to gather the information they need by providing an downloadable zip file that includes 5 files which will allow support to trouble shoot users problems easier.
SCOPE
Out:
All the requirements seen in phase 2 (EE: Support Packet Generation ) will be out of scope.
High-level Architecture
A GET request will be made to an endpoint which then returns a zip file with one support_packet.yaml
file outlining information regarding their server, a plugins.json
file which will outline all the plugins they have installed on their server, a mattermost.log
and notifications.log
which has all the server activity in it, and finally a sanitized_config.json
which has their active sanitized config settings.
Permissions
Anyone who has access to system console (any admin role) should be allowed to do this.
Schema
No database changes required
REST API
GET /api4/system/generate_support_packet
Once the above API endpoint is hit, a ZIP file namedmattermost_support_packet_YYYY-MM-DD-HH-MM.zip
Within this ZIP file will include 5 files.
support_packet.yaml
server_os: {os} database_type: {type} database_version: {version} ldap_vendor_name: {name} ldap_vendor_version: {version} elastic_server_version: {elastic_version} elastic_server_plugins: {plugins}
The possible GO struct to marshal to the above format may look something like this
type SupportPacket struct { ServerOS string `yaml:"server_os"` DatabaseType string `yaml:"database_type"` DatabaseVersion string `yaml:"database_version"` LdapVendorName string `yaml:"ldap_vendor_name,omitempty"` LdapVendorVersion string `yaml:"ldap_vendor_version,omitempty"` ElasticServerVersion string `yaml:"elastic_server_version,omitempty"` ElasticServerPlugins string[] `yaml:"elastic_server_plugins,omitempty"` }
plugins.json
{ "active": [ ], "inactive": [{ "id": "antivirus", "name": "Antivirus", "description": "Antivirus plugin for scanning uploaded files.", "version": "0.1.2", "server": { "executables": { "linux-amd64": "server/dist/plugin-linux-amd64", "darwin-amd64": "server/dist/plugin-darwin-amd64", "windows-amd64": "server/dist/plugin-windows-amd64.exe" }, "executable": "" }, "settings_schema": { "header": "Antivirus plugin for scanning uploaded files to Mattermost, uses ClamAV to scan files. See [documentation here](https://github.com/mattermost/mattermost-plugin-antivirus)", "footer": "", "settings": [{ "key": "ClamavHostPort", "display_name": "ClamAV - Host and Port", "type": "text", "help_text": "The hostname and port to connect to clamd", "placeholder": "localhost:3310", "default": "localhost:3310" }, { "key": "ScanTimeoutSeconds", "display_name": "Scan Timeout (seconds)", "type": "number", "help_text": "How long the virus scan can take before giving up.", "placeholder": "10", "default": 10 } ] } }] }
mattermost.log
notifications.log
sanitized_config.json
(A truncated example)
{ "ServiceSettings": { "SiteURL": "http://localhost:8065", "WebsocketURL": null, "LicenseFileLocation": null, "ListenAddress": ":8065", "ConnectionSecurity": "", "TLSCertFile": "", "TLSKeyFile": "", "TLSMinVer": null, "TLSStrictTransport": null, "TLSStrictTransportMaxAge": null, "TLSOverwriteCiphers": null, "UseLetsEncrypt": false, "LetsEncryptCertificateCacheFile": "./config/letsencrypt.cache", "Forward80To443": false, "TrustedProxyIPHeader": null, "ReadTimeout": 300, "WriteTimeout": 300, "IdleTimeout": null, "MaximumLoginAttempts": 10, "GoroutineHealthThreshold": null, "GoogleDeveloperKey": "", "EnableOAuthServiceProvider": false, "EnableIncomingWebhooks": true, "EnableOutgoingWebhooks": true, "EnableCommands": true, "EnableOnlyAdminIntegrations": null, "EnablePostUsernameOverride": false, "EnablePostIconOverride": false, "EnableLinkPreviews": false, "EnableTesting": false, "EnableDeveloper": true, "EnableOpenTracing": null, "EnableSecurityFixAlert": true, "EnableInsecureOutgoingConnections": false, "AllowedUntrustedInternalConnections": "localhost,", "EnableMultifactorAuthentication": false, "EnforceMultifactorAuthentication": false, "EnableUserAccessTokens": false, "AllowCorsFrom": "", "CorsExposedHeaders": "", "CorsAllowCredentials": false, "CorsDebug": false, "AllowCookiesForSubdomains": null, "ExtendSessionLengthWithActivity": true, "SessionLengthWebInDays": 30, "SessionLengthMobileInDays": 30, "SessionLengthSSOInDays": 30, "SessionCacheInMinutes": 10, "SessionIdleTimeoutInMinutes": 43200, "WebsocketSecurePort": null, "WebsocketPort": null, "WebserverMode": "gzip", "EnableCustomEmoji": false, "EnableEmojiPicker": true, "EnableGifPicker": false, "GfycatApiKey": "2_KtH_W5", "GfycatApiSecret": "********************************", "RestrictCustomEmojiCreation": null, "RestrictPostDelete": null, "AllowEditPost": null, "PostEditTimeLimit": -1, "TimeBetweenUserTypingUpdatesMilliseconds": null, "EnablePostSearch": null, "MinimumHashtagLength": 3, "EnableUserTypingMessages": null, "EnableChannelViewedMessages": null, "EnableUserStatuses": null, "ExperimentalEnableAuthenticationTransfer": null, "ClusterLogTimeoutMilliseconds": null, "CloseUnusedDirectMessages": null, "EnablePreviewFeatures": null, "EnableTutorial": null, "ExperimentalEnableDefaultChannelLeaveJoinMessages": null, "ExperimentalGroupUnreadChannels": null, "ExperimentalChannelOrganization": null, "ExperimentalChannelSidebarOrganization": null, "ImageProxyType": null, "ImageProxyURL": null, "ImageProxyOptions": null, "EnableAPITeamDeletion": null, "EnableAPIUserDeletion": null, "ExperimentalEnableHardenedMode": null, "DisableLegacyMFA": null, "ExperimentalStrictCSRFEnforcement": null, "EnableEmailInvitations": true, "DisableBotsWhenOwnerIsDeactivated": true, "EnableBotAccountCreation": true, "EnableSVGs": true, "EnableLatex": false, "EnableAPIChannelDeletion": null, "EnableLocalMode": null, "LocalModeSocketLocation": null, "EnableAWSMetering": null, "SplitKey": "********************************", "FeatureFlagSyncIntervalSeconds": 30, "DebugSplit": false, "ThreadAutoFollow": null, "CollapsedThreads": null, "ManagedResourcePaths": "" }, "TeamSettings": { "SiteName": "Mattermost", "MaxUsersPerTeam": 100, "EnableTeamCreation": null, "EnableUserCreation": true, "EnableOpenServer": true, "EnableUserDeactivation": null, "RestrictCreationToDomains": "", "EnableCustomBrand": false, "CustomBrandText": "", "CustomDescriptionText": "", "RestrictDirectMessage": "any", "RestrictTeamInvite": null, "RestrictPublicChannelManagement": null, "RestrictPrivateChannelManagement": null, "RestrictPublicChannelCreation": null, "RestrictPrivateChannelCreation": null, "RestrictPublicChannelDeletion": null, "RestrictPrivateChannelDeletion": null, "RestrictPrivateChannelManageMembers": null, "EnableXToLeaveChannelsFromLHS": null, "UserStatusAwayTimeout": null, "MaxChannelsPerTeam": 2000, "MaxNotificationsPerChannel": 1000000, "EnableConfirmNotificationsToChannel": true, "TeammateNameDisplay": "username", "ExperimentalViewArchivedChannels": false, "ExperimentalEnableAutomaticReplies": null, "ExperimentalHideTownSquareinLHS": null, "ExperimentalTownSquareIsReadOnly": null, "LockTeammateNameDisplay": false, "ExperimentalPrimaryTeam": null, "ExperimentalDefaultChannels": null }, "SqlSettings": { "DriverName": "postgres", "DataSource": "********************************", "DataSourceReplicas": [], "DataSourceSearchReplicas": [], "MaxIdleConns": 20, "ConnMaxLifetimeMilliseconds": 3600000, "MaxOpenConns": 300, "Trace": false, "AtRestEncryptKey": "********************************", "QueryTimeout": 30, "DisableDatabaseSearch": false }, "FileSettings": { "EnableFileAttachments": true, "EnableMobileUpload": true, "EnableMobileDownload": true, "MaxFileSize": 52428800, "DriverName": "local", "Directory": "./data/", "EnablePublicLink": false, "PublicLinkSalt": "********************************", "InitialFont": "nunito-bold.ttf", "AmazonS3AccessKeyId": "", "AmazonS3SecretAccessKey": "", "AmazonS3Bucket": "", "AmazonS3PathPrefix": "", "AmazonS3Region": "", "AmazonS3Endpoint": "s3.amazonaws.com", "AmazonS3SSL": true, "AmazonS3SignV2": false, "AmazonS3SSE": false, "AmazonS3Trace": false }, "EmailSettings": { "EnableSignUpWithEmail": true, "EnableSignInWithEmail": true, "EnableSignInWithUsername": true, "SendEmailNotifications": true, "UseChannelInEmailNotifications": null, "RequireEmailVerification": false, "FeedbackName": "", "FeedbackEmail": "test@example.com", "ReplyToAddress": "test@example.com", "FeedbackOrganization": "", "EnableSMTPAuth": true, "SMTPUsername": "", "SMTPPassword": "********************************", "SMTPServer": "localhost", "SMTPPort": "10025", "SMTPServerTimeout": null, "ConnectionSecurity": "", "SendPushNotifications": true, "PushNotificationServer": "https://push-test.mattermost.com", "PushNotificationContents": "generic", "PushNotificationBuffer": null, "EnableEmailBatching": false, "EmailBatchingBufferSize": null, "EmailBatchingInterval": null, "EnablePreviewModeBanner": true, "SkipServerCertificateVerification": false, "EmailNotificationContentsType": "full", "LoginButtonColor": null, "LoginButtonBorderColor": null, "LoginButtonTextColor": null }, "RateLimitSettings": { "Enable": false, "PerSec": 10, "MaxBurst": 100, "MemoryStoreSize": 10000, "VaryByRemoteAddr": true, "VaryByUser": false, "VaryByHeader": "" }, "PrivacySettings": { "ShowEmailAddress": true, "ShowFullName": true }, "AnnouncementSettings": { "EnableBanner": false, "BannerText": "", "BannerColor": "#f2a93b", "BannerTextColor": "#333333", "AllowBannerDismissal": true, "AdminNoticesEnabled": false, "UserNoticesEnabled": false, "NoticesURL": "https://notices.mattermost.com/", "NoticesFetchFrequency": 3600, "NoticesSkipCache": false }, "ThemeSettings": { "EnableThemeSelection": null, "DefaultTheme": null, "AllowCustomThemes": null, "AllowedThemes": null }, "GitLabSettings": { "Enable": false, "Secret": "", "Id": "", "Scope": "", "AuthEndpoint": "", "TokenEndpoint": "", "UserApiEndpoint": "", "DiscoveryEndpoint": "", "ButtonText": "", "ButtonColor": "" }, "GoogleSettings": { "Enable": false, "Secret": "", "Id": "", "Scope": "profile email", "AuthEndpoint": "https://accounts.google.com/o/oauth2/v2/auth", "TokenEndpoint": "https://www.googleapis.com/oauth2/v4/token", "UserApiEndpoint": "https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses,nicknames,metadata", "DiscoveryEndpoint": "https://accounts.google.com/.well-known/openid-configuration", "ButtonText": "", "ButtonColor": "" }, "OpenIdSettings": { "Enable": false, "Secret": "", "Id": "", "Scope": "profile openid email", "AuthEndpoint": "", "TokenEndpoint": "", "UserApiEndpoint": "", "DiscoveryEndpoint": "", "ButtonText": "", "ButtonColor": "#145DBF" }, "LdapSettings": { "Enable": true, "EnableSync": false, "LdapServer": "localhost", "LdapPort": 389, "ConnectionSecurity": "", "BaseDN": "dc=mm,dc=test,dc=com", "BindUsername": "cn=admin,dc=mm,dc=test,dc=com", "BindPassword": "********************************", "UserFilter": "", "GroupFilter": "", "GuestFilter": "", "EnableAdminFilter": null, "AdminFilter": null, "GroupDisplayNameAttribute": "cn", "GroupIdAttribute": "entryUUID", "FirstNameAttribute": "cn", "LastNameAttribute": "sn", "EmailAttribute": "mail", "UsernameAttribute": "uid", "NicknameAttribute": "cn", "IdAttribute": "uid", "PositionAttribute": "sAMAccountType", "LoginIdAttribute": "uid", "PictureAttribute": "", "SyncIntervalMinutes": 10000, "SkipCertificateVerification": false, "PublicCertificateFile": "", "PrivateKeyFile": "", "QueryTimeout": 60, "MaxPageSize": 500, "LoginFieldName": "", "LoginButtonColor": "#0000", "LoginButtonBorderColor": "#2389D7", "LoginButtonTextColor": "#2389D7", "Trace": false }, ... }
Server OS:
In golang, we can use runtime.GOOS
to get the operating system which the server is running on.
Although not mentioned in the MVP, we can use runtime.GOARCH
to get the architecture of the server. (ex. amd64)
Database Type:
In the store, we have a function available called DriverName()
which returns either mysql
or postgres
. This is what we use elsewhere to determine if our database is either mysql
or postgres
.
(*SqlChannelStore).DriverName()
Database Version:
In the database, we have a table called Systems
which we can query to get the version.
SELECT systems WHERE name == Version
Possibly looking to use GetByName
in System SQL store.
List plugins installed (including versions) (Included as a separate file called plugins.json):
We can do a
response, err := c.App.GetPlugins() if err != nil { c.Err = err return }
which we can then marshal into a JSON file as shown above.
LDAP Vendor & LDAP Version:
Due to the limited support for retrieving these and complexities that arise when dealing with different vendors and their specific implementation, the best we can do is query for vendorName
and vendorVersion
and provide those if anything return.
Elastic Search Server Version:
In elasticsearch.go in enterprise, in the Start() function, we are already getting the version and storing it in a variable called version
. It would be a matter of storing that in a new field called fullVersion
and writing a function which returns that since currently version
field is only storing the major version instead of the full version.
Elastic Search Plugins:
The library we are using for Elastic Search (https://github.com/olivere/elastic )
already has this implemented (https://github.com/olivere/elastic/blob/v6.2.35/plugins.go#L24)
Log File (mattermost.log + notifications.log):
The below code snippet is a example of how the mattermost.log
will be retrieved and then it will be taken and attached to the .zip.
if *s.Config().LogSettings.EnableFile { // mattermost.log logFile := utils.GetLogFileLocation(*s.Config().LogSettings.FileLocation) // notifications.log notificationsLogFile := utils.GetNotificationsLogFileLocation(*s.Config().LogSettings.FileLocation) file, err := os.Open(logFile) // Write that file into the zip the user will download }
Active Config Setting (This will be included as a separate file called sanitized_config.json)
A matter of calling c.App.GetSanitizedConfig()
as it already seems to scrub out all confidential information
-Designs can be found at https://www.figma.com/file/ck3EfTynW7nrRlkJGCYKRL/Support-Packet-Request .
Regarding debug level, check to see if their out logs to file is enabled and if the file log levels is set to debug. If not, then let’s show the message
Before downloading the support packet, set Output Logs to File to true and set File Log Level to DEBUG [here]. Afterwards, please recreate the issue with these settings before submitting.
as seen in the design to encourage them to enable it and set it to debug and try to recreate their issue to provide us with the most amount of information.
This will be a simple modal with translated text and button to download your support packet.
CLI
ZIP file creation not accessible via CLI in any of the current phases.
Mobile and Webapp
Mobile does not have anything because this feature is only accessible through the system console
Performance
No performance impact expected as this is simple/request response that is retrieving information.
CREDITS
Big thanks to the following for their support and help: