TapeTrack Documentation

Because there is more to tape management than you ever realized

User Tools

Site Tools


technote:cgi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
technote:cgi [2026/02/19 04:10] – [Restart Apache] Scott Cunliffetechnote:cgi [2026/02/19 04:51] (current) – [Report Variables] Scott Cunliffe
Line 61: Line 61:
 This tells Apache allow CGI execution in this folder, treat .exe files as CGI programs. This tells Apache allow CGI execution in this folder, treat .exe files as CGI programs.
  
-===== Step 5: (Recommended) Restrict Access to Localhost Only =====+===== (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 96: Line 96:
 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:
  
-<code> http://localhost/tapetrack/TMSS10Inventory.exe </code>+<code> http://localhost/tapetrack/TMSS10Inventory.exe?S=user:-pass@localhost </code> 
 + 
 +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 110: Line 112:
 Example command normally run from command prompt: Example command normally run from command prompt:
  
-<code> TMSS10Inventory.exe -S tapemaster:-@localhost </code>+<code> TMSS10Inventory.exe -S user:-passsword@localhost </code>
  
 To run this through the browser, use: To run this through the browser, use:
  
-<code> http://localhost/tapetrack/TMSS10Inventory.exe?-S+tapemaster:-@localhost </code>+<code> http://localhost/tapetrack/TMSS10Inventory.exe?S=user:-pass@localhost </code>
  
 Notes: Notes:
Line 122: Line 124:
 spaces are replaced with + spaces are replaced with +
  
-===== Step 9: Setting Report Format (CSV Output) =====+To avoid using your password in plain text in the URL, create a file C:\tapetrack\pw\user where user is the username and the contents of the file is the users password.  The -S arg only needs to specify -S user@locahost and the password will be looked up by the process. 
 + 
 +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:
  
 <code> TMSSREPORTFORMAT=CSV </code> <code> TMSSREPORTFORMAT=CSV </code>
  
-Because environment variables cannot easily be set directly from a URLit is recommended to set this globally for Apache or use a wrapper script if required.+Other formats are text (default)PDF & Excel.
  
-===== Option ASet TMSSREPORTFORMAT Globally for Apache =====+Using CGI, to set the report format locally, use the variable RPT 
 + 
 +<code> http://localhost/tapetrack/TMSS10Inventory.exe?S=user:-pass@localhost &RPT=CSV</code> 
 + 
 +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 142: 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 =====+===== Report Variables =====
  
-Once TMSSREPORTFORMAT is set, run:+All report [[variable:start|Variables]] can be used similar to the command line interface, with the exception of syntax.
  
-<code> http://localhost/tapetrack/TMSS10Inventory.exe?-S+tapemaster:-@localhost </code>+A command line example of calling TMSS10Inventory, with access details, customer filter and CSV output.
  
-The browser should display the CSV output, or prompt to open it in Excel.+<code> set TMSSREPORTFORMAT=CSV 
 +TMSS10Inventory -S user:-pass@localhost -V UK01.*.* </code>
  
-===== Troubleshooting =====+Apache/CGI
  
-==== Browser downloads the EXE instead of running it ====+<code> http://localhost/tapetrack/TMSS10Inventory.exe?S=user:-pass@localhost&V=UK01.*.*&RPT=CSV</code>
  
-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+<code> http://localhost/tapetrack/TMSS10Inventory.exe?user:-pass@localhost </code>
  
-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: 
- 
-<code> C:\Apache24\logs\error.log </code> 
- 
-==== 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 +{{tagreports 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: +
- +
-<code> http://localhost/tapetrack/TMSS10Inventory.exe?-S+tapemaster:-@localhost </code>+
technote/cgi.1771474208.txt.gz · Last modified: 2026/02/19 04:10 by Scott Cunliffe