Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

SSH Tunnel

All examples are included with download of MBS FileMaker Plugin.

SSH Tunnel.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts5
Value Lists0
Custom Functions0
Custom Menus33
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
SSH
12 fields defined, 3 records
SSH

Fields

Table Name: SSH - 12 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
HostNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Global
  • Repetitions: 1
  • Index Language: German
      PortNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Global
      • Repetitions: 1
      • Index Language: German
          UsernameNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Global
          • Repetitions: 1
          • Index Language: German
              PasswordNormal, TextAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Global
              • Repetitions: 1
              • Index Language: German
                  ResultNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                      MessagesNormal, TextAuto-Enter:
                      • Allow editing
                      Validation:
                      • Only during data entry
                      Storage:
                      • Repetitions: 1
                      • Indexing: None
                      • Automatically create indexes as needed
                      • Index Language: German
                          HostKeyHashNormal, TextAuto-Enter:
                          • Allow editing
                          Validation:
                          • Only during data entry
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                              UserAuthListNormal, TextAuto-Enter:
                              • Allow editing
                              Validation:
                              • Only during data entry
                              Storage:
                              • Repetitions: 1
                              • Indexing: None
                              • Automatically create indexes as needed
                              • Index Language: German
                                  RemoteHostNormal, TextAuto-Enter:
                                  • Allow editing
                                  Validation:
                                  • Only during data entry
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: German
                                      RemotePortNormal, NumberAuto-Enter:
                                      • Allow editing
                                      Validation:
                                      • Only during data entry
                                      Storage:
                                      • Repetitions: 1
                                      • Indexing: None
                                      • Automatically create indexes as needed
                                      • Index Language: German
                                          LocalHostNormal, TextAuto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                          • Indexing: None
                                          • Automatically create indexes as needed
                                          • Index Language: German
                                              LocalIPNormal, NumberAuto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                              • Indexing: None
                                              • Automatically create indexes as needed
                                              • Index Language: German

                                                  Layout Objects: SSH

                                                  Regular Fields

                                                  Field Name: SSH::Host
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 7 pt
                                                  • Left: 138 pt
                                                  • Bottom: 28 pt
                                                  • Right: 391 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: System Default
                                                  • Go to next field using: Tab key
                                                  No

                                                  Field Name: SSH::Port
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 34 pt
                                                  • Left: 138 pt
                                                  • Bottom: 55 pt
                                                  • Right: 391 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: System Default
                                                  • Go to next field using: Tab key
                                                  No

                                                  Field Name: SSH::Username
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 61 pt
                                                  • Left: 138 pt
                                                  • Bottom: 82 pt
                                                  • Right: 391 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: System Default
                                                  • Go to next field using: Tab key
                                                  No

                                                  Field Name: SSH::Password
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 88 pt
                                                  • Left: 138 pt
                                                  • Bottom: 109 pt
                                                  • Right: 391 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: System Default
                                                  • Go to next field using: Tab key
                                                  No

                                                  Field Name: SSH::Result
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 177 pt
                                                  • Left: 138 pt
                                                  • Bottom: 198 pt
                                                  • Right: 391 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: System Default
                                                  • Go to next field using: Tab key
                                                  Yes

                                                  Field Name: SSH::Messages
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 205 pt
                                                  • Left: 138 pt
                                                  • Bottom: 411 pt
                                                  • Right: 595 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: System Default
                                                  • Go to next field using: Tab key
                                                  Yes

                                                  Field Name: SSH::HostKeyHash
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 425 pt
                                                  • Left: 138 pt
                                                  • Bottom: 446 pt
                                                  • Right: 391 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: System Default
                                                  • Go to next field using: Tab key
                                                  Yes

                                                  Field Name: SSH::UserAuthList
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 452 pt
                                                  • Left: 138 pt
                                                  • Bottom: 473 pt
                                                  • Right: 391 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: System Default
                                                  • Go to next field using: Tab key
                                                  Yes

                                                  Field Name: SSH::RemoteHost
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 115 pt
                                                  • Left: 138 pt
                                                  • Bottom: 137 pt
                                                  • Right: 391 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: Default for Data Type
                                                  • Go to next field using: Tab key
                                                  Yes

                                                  Field Name: SSH::RemotePort
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 115 pt
                                                  • Left: 402 pt
                                                  • Bottom: 137 pt
                                                  • Right: 481 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: Default for Data Type
                                                  • Go to next field using: Tab key
                                                  Yes

                                                  Field Name: SSH::LocalHost
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 143 pt
                                                  • Left: 138 pt
                                                  • Bottom: 165 pt
                                                  • Right: 391 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: Default for Data Type
                                                  • Go to next field using: Tab key
                                                  Yes

                                                  Field Name: SSH::LocalIP
                                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                  • Top: 143 pt
                                                  • Left: 402 pt
                                                  • Bottom: 165 pt
                                                  • Right: 481 pt
                                                  • Anchoring: Left, Top
                                                  Field Format:
                                                  • Edit Box
                                                  Field Behavior:
                                                  • Allow field to be entered: In Find mode, In Browse mode
                                                  • Touch keyboard type: Default for Data Type
                                                  • Go to next field using: Tab key
                                                  Yes

                                                  Buttons

                                                  Button PropertiesCoordinatesScript/Script Step
                                                    Type:
                                                  • Text: Connect and start Tunnel
                                                  • Top: 17 pt
                                                  • Left: 534 pt
                                                  • Bottom: 46 pt
                                                  • Right: 697 pt
                                                  • Anchoring: Left, Top
                                                  Perform Script [ “Start Tunnel” ]

                                                  Scripts:


                                                  Button PropertiesCoordinatesScript/Script Step
                                                    Type:
                                                  • Text: Close Tunnel
                                                  • Top: 53 pt
                                                  • Left: 534 pt
                                                  • Bottom: 82 pt
                                                  • Right: 697 pt
                                                  • Anchoring: Left, Top
                                                  Perform Script [ “Close SSH” ]

                                                  Scripts:


                                                  Button PropertiesCoordinatesScript/Script Step
                                                    Type:
                                                  • Text: Update Messages
                                                  • Top: 89 pt
                                                  • Left: 534 pt
                                                  • Bottom: 118 pt
                                                  • Right: 697 pt
                                                  • Anchoring: Left, Top
                                                  Perform Script [ “Update Messages” ]

                                                  Scripts:


                                                  Script Hierarchy

                                                  Init SSH
                                                  Start Tunnel
                                                  Update Messages
                                                  Close SSH
                                                  Clear

                                                  Next Script: [Start Tunnel]
                                                  Script NameInit SSH
                                                  Run script with full access privilegesOff
                                                  Include In MenuYes
                                                  Layouts that use this script
                                                    Scripts that use this script
                                                    Script Definition
                                                    Script Steps
                                                    • If [ Length ( $$ssh ) > 0 ]
                                                    • Perform Script [ “Close SSH” ]
                                                    • End If
                                                    • # Start a new SSH session
                                                    • Set Variable [ $ssh; Value:MBS( "SSH.New" ) ]
                                                    • # Connect to an IP
                                                    • Set Variable [ $r; Value:MBS( "SSH.Connect"; $ssh; SSH::Host; SSH::Port ) ]
                                                    • If [ MBS("IsError") ]
                                                    • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                    • Set Field [ SSH::Result; $r ]
                                                    • Else
                                                    • # Run the session handshake.
                                                    • Set Variable [ $r; Value:MBS( "SSH.SessionHandshake"; $ssh) ]
                                                    • If [ MBS("IsError") ]
                                                    • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                                    • Set Field [ SSH::Result; $r ]
                                                    • Else
                                                    • # We can show the hostkey. You can compare it to known hostkey.
                                                    • Set Field [ SSH::HostKeyHash; MBS( "SSH.HostKey"; $ssh ) ]
                                                    • # We query supported authentication ways
                                                    • Set Variable [ $authuserlist; Value:MBS( "SSH.userauthlist"; $ssh; SSH::Username) ]
                                                    • Set Field [ SSH::UserAuthList; $authuserlist ]
                                                    • Set Variable [ $pos1; Value:Position ( $authuserlist ; "password"; 1; 1 ) ]
                                                    • Set Variable [ $pos2; Value:Position ( $authuserlist ; "keyboard-interactive"; 1; 1 ) ]
                                                    • Set Variable [ $pos3; Value:Position ( $authuserlist ; "publickey"; 1; 1 ) ]
                                                    • If [ $pos1 > 0 ]
                                                    • # Authenticate with password
                                                    • Set Variable [ $r; Value:MBS( "SSH.UserAuthPassword"; $ssh; SSH::Username; SSH::Password ) ]
                                                    • If [ MBS("IsError") ]
                                                    • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                                    • End If
                                                    • Set Field [ SSH::Result; $r ]
                                                    • Else If [ $pos2 > 0 ]
                                                    • # Authenticate with answering question. Plugin passes password for answer.
                                                    • Set Variable [ $r; Value:MBS( "SSH.UserAuthKeyboardInteractive"; $ssh; SSH::Username; SSH::Password ) ]
                                                    • If [ MBS("IsError") ]
                                                    • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                                    • End If
                                                    • Set Field [ SSH::Result; $r ]
                                                    • Else If [ $pos3 > 0 ]
                                                    • # Authenticate with public key file
                                                    • Set Variable [ $r; Value:MBS( "SSH.UserAuthPublicKey"; $ssh; SSH::Username; "your key path"; "your key path"; SSH::Password ) ]
                                                    • If [ MBS("IsError") ]
                                                    • Show Custom Dialog [ Title: "Connect error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                                    • End If
                                                    • Set Field [ SSH::Result; $r ]
                                                    • End If
                                                    • If [ MBS( "SSH.IsAuthenticated"; $ssh ) ≠ 1 ]
                                                    • Show Custom Dialog [ Title: "Authentication"; Message: "no authenticated. Supported ways: " & $authuserlist; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                    • Else
                                                    • # Keep connection
                                                    • Set Variable [ $$ssh; Value:$ssh ]
                                                    • Exit Script [ Result: "OK" ]
                                                    • End If
                                                    • End If
                                                    • End If
                                                    Fields used in this script
                                                    Scripts used in this script
                                                    Layouts used in this script
                                                      Tables used in this script
                                                      Table occurrences used by this script
                                                      Custom Functions used by this script
                                                        Custom menu set used by this script

                                                          Previous Script: [Init SSH]Next Script: [Update Messages]
                                                          Script NameStart Tunnel
                                                          Run script with full access privilegesOff
                                                          Include In MenuYes
                                                          Layouts that use this script
                                                          Scripts that use this script
                                                            Script Definition
                                                            Script Steps
                                                            • Perform Script [ “Init SSH” ]
                                                            • If [ Length ( $$ssh ) > 0 ]
                                                            • Set Variable [ $r; Value:MBS( "SSH.Tunnel.Run"; $$ssh; SSH::RemoteHost; SSH::RemotePort; SSH::LocalHost; SSH::LocalIP ) ]
                                                            • Set Field [ SSH::Result; $r ]
                                                            • Set Field [ SSH::Messages; MBS( "SSH.Tunnel.Messages"; $$ssh ) ]
                                                            • End If
                                                            Fields used in this script
                                                            Scripts used in this script
                                                            Layouts used in this script
                                                              Tables used in this script
                                                              Table occurrences used by this script
                                                              Custom Functions used by this script
                                                                Custom menu set used by this script

                                                                  Previous Script: [Start Tunnel]Next Script: [Close SSH]
                                                                  Script NameUpdate Messages
                                                                  Run script with full access privilegesOff
                                                                  Include In MenuYes
                                                                  Layouts that use this script
                                                                  Scripts that use this script
                                                                    Script Definition
                                                                    Script Steps
                                                                    Fields used in this script
                                                                    Scripts used in this script
                                                                      Layouts used in this script
                                                                        Tables used in this script
                                                                        Table occurrences used by this script
                                                                        Custom Functions used by this script
                                                                          Custom menu set used by this script

                                                                            Previous Script: [Update Messages]Next Script: [Clear]
                                                                            Script NameClose SSH
                                                                            Run script with full access privilegesOff
                                                                            Include In MenuYes
                                                                            Layouts that use this script
                                                                            Scripts that use this script
                                                                            Script Definition
                                                                            Script Steps
                                                                            • If [ Length($$SSH) > 0 ]
                                                                            • # Stop tunneel
                                                                            • Set Variable [ $r; Value:MBS( "SSH.Tunnel.Cancel"; $$ssh ) ]
                                                                            • Pause/Resume Script [ Duration (seconds): ,1 ]
                                                                            • # Disconnect
                                                                            • Set Variable [ $r; Value:MBS( "SSH.Disconnect"; $$ssh ) ]
                                                                            • # Release memory.
                                                                            • Set Variable [ $r; Value:MBS( "SSH.Release"; $$ssh ) ]
                                                                            • End If
                                                                            Fields used in this script
                                                                              Scripts used in this script
                                                                                Layouts used in this script
                                                                                  Tables used in this script
                                                                                    Table occurrences used by this script
                                                                                      Custom Functions used by this script
                                                                                        Custom menu set used by this script

                                                                                          Previous Script: [Close SSH]
                                                                                          Script NameClear
                                                                                          Run script with full access privilegesOff
                                                                                          Include In MenuYes
                                                                                          Layouts that use this script
                                                                                            Scripts that use this script
                                                                                              Script Definition
                                                                                              Script Steps
                                                                                              • Go to Record/Request/Page [ First ]
                                                                                              • Loop
                                                                                              • Set Field [ SSH::HostKeyHash; "" ]
                                                                                              • Set Field [ SSH::UserAuthList; "" ]
                                                                                              • Set Field [ SSH::Messages; "" ]
                                                                                              • Go to Record/Request/Page [ Next; Exit after last ]
                                                                                              • End Loop
                                                                                              • Go to Record/Request/Page [ First ]
                                                                                              Fields used in this script
                                                                                              Scripts used in this script
                                                                                                Layouts used in this script
                                                                                                  Tables used in this script
                                                                                                  Table occurrences used by this script
                                                                                                  Custom Functions used by this script
                                                                                                    Custom menu set used by this script

                                                                                                      Download example: SSH Tunnel

                                                                                                      Used functions: