NetWitness sasftpagent.sh script fails with bad substitution on Solaris 10/11
Issue
When running the NetWitness sasftpagent.sh script version 3.0.1, it fails returning this error "bad substitution" on Solaris 10 and Solaris 11.
# ./sasftpagent.sh
./sasftpagent.sh: bad substitution
./sasftpagent.sh: bad substitution
# uname -a
SunOS cauctauth1 5.10 Generic_147440-12 sun4v sparc sun4v
SunOS cauctauth1 5.10 Generic_147440-12 sun4v sparc sun4v
Cause
The Solaris /usr/bin/sh is strict about the POSIX compliance version it will allow.The sasftpagent.sh script version 3.0.1 uses some commands and shell syntax for a different POSIX standard that is not available in Solaris /usr/bin/sh.
Solaris has other versions of the commands and shell under a different path which will work with the sasftpagent.sh script.
Workaround
Another available work-around is to use the older version 2.7.10 sasftpagent.sh script (see attached below), which does work on Solaris 10/11.
Resolution
Change the first line of the sasftpagent.sh script version 3.0.1 from,
#!/bin/sh
to be the following two lines,
#!/usr/bin/bash
PATH=/usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/opt/csw/bin:$PATH
PATH=/usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/opt/csw/bin:$PATH
Notes
Other errors may be observed when running the sasftpagent.sh script.- The sasftpagent.sh script fails with errors,
id: illegal option -- u
Usage: id [-ap] [user]
andawk: syntax error near line 2
awk: illegal statement near line 2
awk: syntax error near line 3
awk: illegal statement near line 3
This indicates the alternate path "/usr/xpg4/bin" to the commands "id" and "awk" is missing or incorrect.
Check that the PATH environment variable is correctly set for this directory in sasftpagent.sh script.
- The sasftpagent.sh script fails with errors,
2019-02-06 12:09:40 ERROR stderr: Connecting to 10.62.31.57...
2019-02-06 12:09:40 ERROR stderr: no kex alg
2019-02-06 12:09:40 ERROR stderr: Connection closed
This indicates the alternate path "/opt/csw/bin" to the command "sftp" is missing or incorrect.
Check the PATH environment variable is correctly set for this directory in the sasftpagent.sh script.
Product Details
RSA Product Set: NetWitnessRSA Product/Service Type: Core Appliance
RSA Version/Condition: 10.6.x, 11.x
Platform: Solaris
O/S Version: 10 and 11
Product Name: sasftpagent.sh
Summary
The RSA NetWitness sasftpagent.sh script version 3.0.1 fails to run, returning the error bad substitution on Solaris 10 and Solaris 11.
Approval Reviewer Queue
Technical approval queue