technote:cgi
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| technote:cgi [2026/02/19 04:08] – [Step 4: Enable CGI Execution for .exe Files] Scott Cunliffe | technote:cgi [2026/02/19 04:51] (current) – [Report Variables] Scott Cunliffe | ||
|---|---|---|---|
| Line 54: | Line 54: | ||
| <code apache> < | <code apache> < | ||
| | | ||
| - | | + | |
| - | | + | |
| - | | + | |
| </ | </ | ||
| - | This tells Apache: | + | This tells Apache |
| - | allow CGI execution in this folder | + | ===== (Recommended) Restrict Access to Localhost Only ===== |
| - | + | ||
| - | treat .exe files as CGI programs | + | |
| - | + | ||
| - | ===== Step 5: (Recommended) Restrict Access to Localhost Only ===== | + | |
| For security reasons, it is strongly recommended to restrict execution of TapeTrack executables to the local machine only. | For security reasons, it is strongly recommended to restrict execution of TapeTrack executables to the local machine only. | ||
| Line 89: | Line 85: | ||
| </ | </ | ||
| - | ===== Step 6: Restart Apache ===== | + | ===== Restart Apache ===== |
| After saving httpd.conf, restart Apache. | After saving httpd.conf, restart Apache. | ||
| Line 95: | Line 91: | ||
| From an Administrator Command Prompt: | From an Administrator Command Prompt: | ||
| - | < | + | < |
| + | net start Apache2.4 </ | ||
| Or restart Apache via Windows Services. | Or restart Apache via Windows Services. | ||
| - | ===== Step 7: Test Execution in Web Browser ===== | + | ===== Test Execution in Web Browser ===== |
| Open a browser and visit: | Open a browser and visit: | ||
| - | < | + | < |
| + | |||
| + | Replace user and pass with actual username and password. | ||
| If CGI is configured correctly, Apache will execute the program instead of downloading it. | If CGI is configured correctly, Apache will execute the program instead of downloading it. | ||
| - | ===== Step 8: Running TapeTrack Inventory Report from Browser ===== | + | =====Running TapeTrack Inventory Report from Browser ===== |
| TapeTrack utilities accept command-line arguments. CGI allows passing arguments via the query string. | TapeTrack utilities accept command-line arguments. CGI allows passing arguments via the query string. | ||
| Line 113: | Line 112: | ||
| Example command normally run from command prompt: | Example command normally run from command prompt: | ||
| - | < | + | < |
| To run this through the browser, use: | To run this through the browser, use: | ||
| - | < | + | < |
| Notes: | Notes: | ||
| Line 125: | Line 124: | ||
| spaces are replaced with + | spaces are replaced with + | ||
| - | ===== Step 9: Setting Report Format | + | To avoid using your password in plain text in the URL, create a file C: |
| + | |||
| + | Attributes are separated using the & symbol | ||
| + | |||
| + | =====Setting Report Format | ||
| TapeTrack utilities can output different formats depending on environment variables. | TapeTrack utilities can output different formats depending on environment variables. | ||
| - | To force CSV output, the variable may be required: | + | To force CSV output, the variable may be required, in a command prompt: |
| < | < | ||
| - | Because environment variables cannot easily be set directly from a URL, it is recommended to set this globally for Apache or use a wrapper script if required. | + | Other formats are text (default), PDF & Excel. |
| - | ===== Option A: Set TMSSREPORTFORMAT Globally for Apache ===== | + | Using CGI, to set the report format locally, use the variable RPT |
| + | |||
| + | < | ||
| + | |||
| + | Or if the report format stays as CSV, you can set the value globally. | ||
| Add the following to Apache configuration (inside global scope): | Add the following to Apache configuration (inside global scope): | ||
| Line 145: | Line 152: | ||
| This forces TapeTrack utilities run via Apache CGI to output in CSV format. | This forces TapeTrack utilities run via Apache CGI to output in CSV format. | ||
| - | ===== Example: Generate CSV Inventory | + | ===== Report |
| - | Once TMSSREPORTFORMAT is set, run: | + | All report [[variable:start|Variables]] can be used similar to the command line interface, with the exception of syntax. |
| - | < | + | A command line example of calling |
| - | The browser should display the CSV output, or prompt to open it in Excel. | + | < |
| + | TMSS10Inventory -S user: | ||
| - | ===== Troubleshooting ===== | + | Apache/CGI |
| - | ==== Browser downloads the EXE instead of running it ==== | + | < |
| - | Check: | ||
| - | Options +ExecCGI exists in the Directory block | + | ===== Example: Generate CSV Inventory Report ===== |
| - | AddHandler cgi-script .exe exists | + | Once TMSSREPORTFORMAT is set, run: |
| - | the directory path is correct | + | < |
| - | Apache has been restarted | + | The browser should display the CSV output, or prompt to open it in Excel. |
| - | ==== Output is blank ==== | ||
| - | Possible causes: | ||
| - | The TapeTrack executable is writing output to a file instead of stdout | ||
| - | TapeTrack is failing due to permissions (Apache service account) | ||
| - | Missing environment variables (example: TMSSREPORTFORMAT) | ||
| - | TapeTrack cannot connect to the TapeTrack server | ||
| - | Check Apache logs: | ||
| - | |||
| - | < | ||
| - | |||
| - | ==== TapeTrack utility works in CMD but not in browser ==== | ||
| - | |||
| - | Apache runs under a service account (often LocalSystem). That account may not have access to: | ||
| - | |||
| - | TapeTrack registry settings | ||
| - | |||
| - | network resources | ||
| - | |||
| - | configuration files | ||
| - | |||
| - | authentication credentials | ||
| - | |||
| - | Fix: configure Apache service to run as a specific Windows user with access to TapeTrack. | ||
| ===== Security Warning ===== | ===== Security Warning ===== | ||
| Executing .exe files over HTTP is powerful and potentially dangerous. | Executing .exe files over HTTP is powerful and potentially dangerous. | ||
| - | |||
| Recommendations: | Recommendations: | ||
| + | * Use Require local to limit access to the machine only | ||
| + | * Do not expose this server to the internet | ||
| + | * Consider firewall restrictions | ||
| + | * Only allow execution in a controlled folder | ||
| - | Use Require local to limit access to the machine only | + | {{tag> reports utils cgi apache technote cli}} |
| - | + | ||
| - | Do not expose this server to the internet | + | |
| - | + | ||
| - | Consider firewall restrictions | + | |
| - | + | ||
| - | Only allow execution in a controlled folder | + | |
| - | + | ||
| - | ===== Summary ===== | + | |
| - | + | ||
| - | To run TapeTrack utilities like TMSS10Inventory.exe through Apache: | + | |
| - | + | ||
| - | Add a ScriptAlias pointing to the TapeTrack utility folder | + | |
| - | + | ||
| - | Enable ExecCGI on that directory | + | |
| - | + | ||
| - | Add handler mapping for .exe | + | |
| - | + | ||
| - | Restart Apache | + | |
| - | + | ||
| - | Run the program via browser URL with query string parameters | + | |
| - | + | ||
| - | Example URL: | + | |
| - | + | ||
| - | < | + | |
technote/cgi.1771474125.txt.gz · Last modified: 2026/02/19 04:08 by Scott Cunliffe
