Jump to content

Angus Robertson

Members
  • Content Count

    1812
  • Joined

  • Last visited

  • Days Won

    33

Everything posted by Angus Robertson

  1. Angus Robertson

    Windows DNS Server

    Has anyone looked at automating management of the Windows DNS Server, such as adding and deleting resource records? It can be done using the WMI namespace root\MicrosoftDNS, done a couple of quick tests, I just need to add and remove TXT records (for Let's Encrypt challenges), but wonder whether there is a demand for a more versatile component. Angus
  2. Angus Robertson

    Windows DNS Server

    I have seen DNS amplification attacks using my DNS in the past, usually from the size of the firewall logs, but then block it using the external firewall. Generally I'm not too worried about exploits, no-one has ever successfully attacked my servers. I have however moved the DNS for a test domain to Cloudfare, so will add updating it's DNS records to the ICS sample application alongside Windows DNS, Not sure if I also moved the web site to Cloudfare, the dashboard is very confusing and I don't really care at the moment, need to write code instead. Angus
  3. Angus Robertson

    Windows DNS Server

    My public DNS servers have recursion and caching disabled, they are primary/secondary DNS servers, not used for local DNS. I believe that avoids the worst abuse, but certainly not an expert. My experience of the three Let's Encrypt challenge methods is they are all similar speed, The ICS component already does DNS, it tells you what TXT records to set-up manually, I'm just making it easier. Now if someone has a Delphi component that handles the various Cloud DNS provides APIs I'd love to use it. I'm sure it's not complicated, just time consuming to set-up accounts with various providers to test it. Angus
  4. Angus Robertson

    Windows DNS Server

    I get the impression from reading the windns.h DNS API documentation that it's mainly for querying and modifying caching DNS servers, rather than updating primary DNS servers, no functions for server setup, zones, etc, all of which are in the DNS WMI API. I also need this to work over a LAN, which WMI handles, albeit sluggishly. Angus
  5. Angus Robertson

    Running commandline app and capturing output

    Thought you ran it 30 times sequentially, not concurrently, you are probably hitting some Windows problem. Are you trying to run 30 parallel instances of openssl.exe? Why? Angus
  6. Angus Robertson

    Running commandline app and capturing output

    This is a function I've been using for 15 years, including with OpenSSL command lines, not looked at your code to see how they differ, but might be worth trying it. Angus procedure GetConsoleOutput (const CommandLine : string; var Output : TStringList); var SA: TSecurityAttributes; SI: TStartupInfo; PI: TProcessInformation; StdOutFile, AppProcess, AppThread : THandle; RootDir, WorkDir, StdOutFileName:string; const FUNC_NAME = 'GetConsoleOuput'; begin StdOutFile:=0; AppProcess:=0; AppThread:=0; try // Initialize dirs RootDir:=ExtractFilePath(ParamStr(0)); WorkDir:=ExtractFilePath(CommandLine); // Check WorkDir if not (FileSearch(ExtractFileName(CommandLine),WorkDir)<>'') then WorkDir:=RootDir; // Initialize output file security attributes FillChar(SA,SizeOf(SA),#0); SA.nLength:=SizeOf(SA); SA.lpSecurityDescriptor:=nil; SA.bInheritHandle:=True; // Create Output File StdOutFileName:=RootDir+'output.tmp'; StdOutFile:=CreateFile(PChar(StdOutFileName), GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, @SA, CREATE_ALWAYS, // Always create it FILE_ATTRIBUTE_TEMPORARY or // Will cache in memory // if possible FILE_FLAG_WRITE_THROUGH, 0); // Check Output Handle if StdOutFile = INVALID_HANDLE_VALUE then raise Exception.CreateFmt('Function %s() failed!' + #10#13 + 'Command line = %s',[FUNC_NAME,CommandLine]); // Initialize Startup Info FillChar(SI,SizeOf(SI),#0); with SI do begin cb:=SizeOf(SI); dwFlags:=STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES; wShowWindow:=SW_HIDE; hStdInput:=GetStdHandle(STD_INPUT_HANDLE); hStdError:=StdOutFile; hStdOutput:=StdOutFile; end; // Create the process if CreateProcess(nil, PChar(CommandLine), nil, nil, True, 0, nil, PChar(WorkDir), SI, PI) then begin WaitForSingleObject(PI.hProcess,INFINITE); AppProcess:=PI.hProcess; AppThread:=PI.hThread; end else raise Exception.CreateFmt('CreateProcess() in function %s() failed!' + #10#13 + 'Command line = %s',[FUNC_NAME,CommandLine]); CloseHandle(StdOutFile); StdOutFile:=0; Output.Clear; Output.LoadFromFile (StdOutFileName); finally // Close handles if StdOutFile <> 0 then CloseHandle(StdOutFile); if AppProcess <> 0 then CloseHandle(AppProcess); if AppThread <> 0 then CloseHandle(AppThread); // Delete Output file if FileExists(StdOutFileName) then SysUtils.DeleteFile(StdOutFileName); end; end;
  7. Angus Robertson

    SSL Hand shake Error on TSslHttpRest

    The chorus certificate is an intermediate, it should be signed by a CA, the main chorus-pro.gouv.fr intermediate is signed by Certigna Services CA which is in the ICS trusted bundle RootCaCertsBundle.pem. But the failure of all the browsers and ICS to connect is not a certificate issue, it is never sent, it failed before that. Perhaps using SHA1 ciphers or something else outdated. Angus
  8. Angus Robertson

    SSL Hand shake Error on TSslHttpRest

    Ssllabs testing is wonderful, but only works on port 443. Angus
  9. Angus Robertson

    SSL Hand shake Error on TSslHttpRest

    I can not reach https://chorus-pro.gouv.fr:5443/ with any of the four browsers on my PC either, so not really surprising that ICS can not reach it, a badly configured site. Perhaps it only supports an ancient SSL version no longer supported by anyone? The certificate is issued by someone that is not a trusted CA, but that is not the main issue. Their main site is fine, but it uses a different SSL certificate to the site on port 5443. Although ICS provides what looks like detailed SSL debug logging, this is virtually useless for SSL protocol investigations since none of the protocol packets are decoded. Wireshark does such decoding, but I really would not waste your time, just ask the web company what TLS protocols they support and which browsers. Angus
  10. Angus Robertson

    TSimpleWebSrv Params gets cut after #

    Sorry, had a quick look at the code, but can not see any reason why ParseReqHdr would truncate RequestParams, it just copies the line after the ?, need to debug it with real data and busy with end of month stuff this week. Angus
  11. Angus Robertson

    SFTP and SSLFTP Are they the same?

    Not sure if Qualys check FTP errors, the logs just show dozens of login attempts with real and anonymous credentials, the fail is when they get access. Did not actually check any RFCs to see what to do, response 533 was already used for another command not allowed without TLS. Angus
  12. Angus Robertson

    SFTP and SSLFTP Are they the same?

    Implicit TCP/IP connections were originally easier to implement since they did not requires changes to the protocol, often done with STunnel or similar for FTP, POP3, NNTP and SMTP. Once the protocols got updated with the STARTTLS command, some people tried to make the implicit ports obsolete, but this can be dangerous since end users don't always tick the use SSL/TLS box. There is new RFC 8314 'Cleartext Considered Obsolete: Use of Transport Layer Security (TLS) for Email Submission and Access' that again recommends implicit ports as being good practice. I have penetration testing by Qualys on my public server and they kept failing FTP port 21 for allowing clear text passwords, so I've just updated the ICS FTP server component to return '533 USER requires a secure connection' if the LOGIN command is sent before STARTTLS, and Qualys is now happy again. Angus
  13. Angus Robertson

    SFTP and SSLFTP Are they the same?

    No ICS does not support SSH. Angus
  14. Angus Robertson

    Need some help on TSslFtpClient

    Depending on your version of Delphi and project options, you may need to copy libcrypto-1_1.dll and libssl-1_1.dll from the samples directory into whatever directory the DCUs and EXE end up in, perhaps win32\debug or win32\release. All ICS SSL applications need access to libcrypto-1_1.dll and libssl-1_1.dll which are the latest versions of OpenSSL. In theory, these can be loaded from a directory in the common path or windows directory, but because there are so many different applications using OpenSSL, you can get lots of old DLL versions on your PC, often not compatible with each other. So generally it is safest to distribute the OpenSSL DLLs in the same directory as your application, so you have a reliable known version. By default, ICS applications will try and load from the local directory first before looking elsewhere, in your case it probably found an old OpenSSL DLL elsewhere on your PC, but was missing the other. You can force ICS to load the DLLs from a specific directory, to avoid such issues. Angus
  15. Angus Robertson

    SVN server updated

    The server now uses all three protocols, svn, http and https. The old server did not have https or rather we never set it up. I agree the svn protocol on port 3690 is very old, but we always supported it and many people will have scripts expecting to use svn (like me) rather than http, so it's still running. Angus
  16. Angus Robertson

    SVN server updated

    Now trying to get the zips updated automatically, seems someone has been messing with SVN commands in the past 12 years, which is why I never updated anything! Angus
  17. Angus Robertson

    filename for download file THttpServer

    ICS has a TMimeTypesList component that will read MIME types from the Windows registry, a supplied file mime.types or an internal list, application/vnd.ms-excel is common. This component is used by TSslHttpServer for files it opens. Angus
  18. Angus Robertson

    Need some help on TSslFtpClient

    You should build the sample OverbyteIcsXferTst.dpr which is a a full SSL FTP client GUI, and uses TIcsFtpMulti which is much easier and quicker to use than TSslFtpclient. Angus
  19. Angus Robertson

    filename for download file THttpServer

    Beware ContentType: xls/xls is not commonly supported by browsers, but if it works... Angus
  20. Angus Robertson

    Only default ICS sample SSL certificate is working

    Sorry, seems the CreateSelfSignedCert function in OverbyteIcsSslX509Utils.pas got broken while being modernised, you need to add a missing line: MySslCertTools.ExpireDays := Days; { V8.64 got lost } and it will work properly again. Sorry, did not test that old function properly. The modern way to create a self signed certificate is using fields and buttons on the New Certificate Properties and Create Certificates tabs. First click 'Generate Key Pair', complete the various New Certificate Request Properties, previous tab, click 'Create Self Signed Cert from Properties', then at the bottom of the tab specify the file names for the formats you want to save, tick if you want the private key in the same file, then click the buttons to save in PEM, PKCS12, DER, etc. Finally on the List Certificate tab, click View Single File to double check the certificate is created properly. Those three tabs perform most of the common certificate functions of the OpenSSL command line tool. Angus
  21. Angus Robertson

    Only default ICS sample SSL certificate is working

    By old files, I meant long expired SSL certificates and job files that are no longer needed since ICS samples can now do everything they did. People try to use them and wonder why they don't work. Angus
  22. Angus Robertson

    filename for download file THttpServer

    Generally, the 'filename' is that of the page accessed with the GET request and is not returned in the response header. Again generally you should use the FilenameToContentType function to get the content type, which will return 'application/octet-stream' for an XLS file, which will cause the browser to bring up a dialogue box asking what to do with the file. If you want to display the file, there are Microsoft special headers to do so. Keep it simple until it works. Angus
  23. Angus Robertson

    Only default ICS sample SSL certificate is working

    Created PEM files how, which applications or which functions with what parameters. Generally public certificates can no longer be issued with an expiry beyond one year and certain ICS tools do limit that. Angus
  24. Angus Robertson

    Only default ICS sample SSL certificate is working

    As I said before, you don't need to use OpenSSL command line tools to create certificates, ICS has functions to do that. ICS has a lot of really old examples untested for 10 years, really should be removed. You should build the OverbyteIcsPemTool.dpr sample which has numerous facilities for creating, testing, converting and viewing X509 certificates, in various formats. Then open your certificate files which will immediately tell you whether ICS can read them, and display all the content. There are several Wiki FAQs on certificates I previously suggested you read that explain this all in detail. ICS with OpenSSL applications work perfectly on Vista and Windows 2008, two of my public servers are 2008, closed down last week due to Microsoft support ending after 12 years. I believe ICS applications still work on Windows XP but that has been out of support for years so no longer tested. The latest version 1.1.1 of OpenSSL no longer supports Windows XP, you need to use 1.0.2 or 1.1.0, both of which are now out of support so no security fixes. OpenSSL and Microsoft do offer paid support for XP and 1.0.2 for large organisations that really can not upgrade, but not for home users. Angus
  25. Angus Robertson

    Loading SSL Certificates into EXE (TSslContext)

    The latest versions of TSslFtpServer and TSslWSocketServer do not require to use an SslContext, which was never well documented and is complicated to use. You should instead use IcsHosts to specify listeners, SSL properties and certificates, The IcsHosts SslCert property can be a file name or an string containing a PEM certificate and the component loads either automatically. This is all done in TSslWSocketServer.LoadOneCert if you really want to do it the old way. Angus
×