I'm working on a solution that will create a Certificate Signing Request needed by an ICANN authorized SSL reseller (e.g., GoDaddy, Comodo, Symantec, Thawte, GeoTrust) to generate the SSL Cert you need for FileMaker Server. I have the commands all worked out and tested in Terminal, but I'm having problems getting the BE_ExecuteSystemCommand (Base Elements Plugin from Goya) to work on this command. If anyone has suggestions, that would be appreciated.
The following script creates a folder with the domain name in the Documents folder and that part works fine. It is the $Request that is failing.
If [ IsEmpty ( Main::CSR_Domain ) or IsEmpty ( Main::CSR_Country ) or IsEmpty ( Main::CSR_State ) or IsEmpty ( Main::CSR_City ) or IsEmpty ( Main::CSR_Owner ) or IsEmpty ( Main::CSR_Dept ) ]
Show Custom Dialog [ "Error" ; "ERROR: Missing Data. All fields must be completed." ]
Set Variable [ $Folder ; Value:
Let ( [
F1 = Get ( DocumentsPath ) ;
F2 = Get ( Device ) ;
F3 = Case ( F2 = 1 ; "Mac" ; F2 = 2 ; "Windows" ) ;
F4 = Position ( F1 ; "/Users/" ; 1 ; 1 ) ;
F5 = Middle ( F1 ; F4 ; Length ( F1 ) ) ;
F6 = Main::CSR_Domain ;
F7 = F5 & F6 ] ;
F7 ) ]
Set Variable [ $MkDir ; Value: BE_CreateFolder ( $Folder ) ]
Set Variable [ $SetDir ; Value:
Let ( [
F1 = "CD $Folder" ;
F2 = BE_ExecuteSystemCommand ( F1 ; 500 ) ] ;
F2 ) ]
Set Variable [ $Request ; Value:
Let ( [
F1 = Main::CSR_Domain ;
F2 = Main::CSR_Owner ;
F3 = Main::CSR_Dept ;
F4 = Main::CSR_City ;
F5 = Main::CSR_State ;
F6 = Main::CSR_Country ;
F7 = PatternCount ( F1 ; "." ) ;
F8 = Position ( F1 ; "." ; 1 ; F7 ) ;
F9 = Left ( F1 ; F8 - 1 ) ;
F10 = "openssl req -new -newkey rsa:2048 -nodes -out " & F9 & ".csr -keyout " & F9 & ".key -subj \"/C=" & F6 & "/ST=" & F5 & "/L=" & F4 & "/O=" & F2 & "/OU=" & F3 & "/CN=" & F1 & "\"" ] ;
F10 ) ]
Set Variable [ $Result ; Value: BE_ExecuteSystemCommand ( $Request ; 5000 ) ]
Exit Script [ Text Result: ]
Basically what is being Executed is as follows and if I go to Terminal I can type this command in and it will work. I have made sure that the data viewer has in it exactly what I have put into Terminal (e.g., literally cut and paste) and it works. I am uncertain if there is something I have to do with the BE_ExecuteSystemCommand to make this work (e.g., escape certain characters or handle quotes different).
openssl req -new -newkey rsa:2048 -nodes -out somedomain.csr -keyout somedomain.key -subj "/C=US/ST=Texas/L=Dallas/O=SomeCompany/OU=IT/CN=somedomain.com"
FYI, this is all one long line with no return on it when entered in Terminal.