Is it possible to auto rotate S3 secret key?

English Support for Cloud Storage
Post Reply
dean
Posts: 2
Joined: Wed Nov 09, 2022 1:38 pm

Is it possible to auto rotate S3 secret key?

Post by dean »

Image

My company has a policy for secret key rotations every month.
Is it possible to configure Syncovery to fetch the secret key from a file?

Thanks in advance!

Dean.

tobias
Posts: 1603
Joined: Tue Mar 31, 2020 7:37 pm

Re: Is it possible to auto rotate S3 secret key?

Post by tobias »

Hello,
yes, it can be read from a text file using a PascalScript, please see
https://www.syncovery.com/pascalscript/

I hope I can write an example tomorrow.

dean
Posts: 2
Joined: Wed Nov 09, 2022 1:38 pm

Re: Is it possible to auto rotate S3 secret key?

Post by dean »

tobias wrote:
Thu Nov 10, 2022 9:02 am
Hello,
yes, it can be read from a text file using a PascalScript, please see
https://www.syncovery.com/pascalscript/

I hope I can write an example tomorrow.
Hi.
Thank you for the quick reply.
An example script would be very helpful.
Thanks again.

tobias
Posts: 1603
Joined: Tue Mar 31, 2020 7:37 pm

Re: Is it possible to auto rotate S3 secret key?

Post by tobias »

Here it is. You can put it in each profile via Job->PascalScript, or globally for all profiles via the Program Settings dialog, tab sheet Advanced.

Code: Select all

const cTextFilePath='C:\code19\X.txt';

function OnGetProfilePathBeforeListing(const isRightSide:Boolean;
        var Path,UserName,Password:UnicodeString;
        var AuthKey,AuthKeyPassword:AnsiString;
        var Port:Integer):Boolean;
var F:Opaque;
    NewPass:UnicodeString;
begin
  if Copy(Path,1,5)='S3://' then begin
     F:=OpenTextFile(cTextFilePath);
     if F<>0 then begin
        NewPass:=ReadLine(F);
        CloseFile(F);

        if (NewPass<>'') and (NewPass<>Password) then begin
           Password:=NewPass;
           if isRightSide then
              SetProfileProperty('RightPassword',NewPass)
           else
              SetProfileProperty('LeftPassword',NewPass);
           SaveProfileSettings;
           end;
        end;
     end;
  Result:=true;
  end;

Post Reply