@@ -48,7 +48,9 @@ protected function configure(): void {
4848 ->addOption ('admin-user ' , null , InputOption::VALUE_REQUIRED , 'Login of the admin account ' , 'admin ' )
4949 ->addOption ('admin-pass ' , null , InputOption::VALUE_REQUIRED , 'Password of the admin account ' )
5050 ->addOption ('admin-email ' , null , InputOption::VALUE_OPTIONAL , 'E-Mail of the admin account ' )
51- ->addOption ('data-dir ' , null , InputOption::VALUE_REQUIRED , 'Path to data directory ' , \OC ::$ SERVERROOT . '/data ' );
51+ ->addOption ('data-dir ' , null , InputOption::VALUE_REQUIRED , 'Path to data directory ' , \OC ::$ SERVERROOT . '/data ' )
52+ ->addOption ('password-salt ' , null , InputOption::VALUE_OPTIONAL , 'Password salt, at least 30 characters (will be randomly generated if not provided) ' )
53+ ->addOption ('server-secret ' , null , InputOption::VALUE_OPTIONAL , 'Server secret, at least 48 characters (will be randomly generated if not provided) ' );
5254 }
5355
5456 protected function execute (InputInterface $ input , OutputInterface $ output ): int {
@@ -152,6 +154,16 @@ protected function validateInput(InputInterface $input, OutputInterface $output,
152154 throw new InvalidArgumentException ('Invalid e-mail-address < ' . $ adminEmail . '> for < ' . $ adminLogin . '>. ' );
153155 }
154156
157+ $ passwordSalt = $ input ->getOption ('password-salt ' );
158+ $ secret = $ input ->getOption ('server-secret ' );
159+
160+ if ($ passwordSalt !== null && strlen ($ passwordSalt ) < Setup::MIN_PASSWORD_SALT_LENGTH ) {
161+ throw new InvalidArgumentException ('Password salt must be at least ' . Setup::MIN_PASSWORD_SALT_LENGTH . ' characters long. ' );
162+ }
163+ if ($ secret !== null && strlen ($ secret ) < Setup::MIN_SECRET_LENGTH ) {
164+ throw new InvalidArgumentException ('Server secret must be at least ' . Setup::MIN_SECRET_LENGTH . ' characters long. ' );
165+ }
166+
155167 $ options = [
156168 'dbtype ' => $ db ,
157169 'dbuser ' => $ dbUser ,
@@ -162,7 +174,9 @@ protected function validateInput(InputInterface $input, OutputInterface $output,
162174 'adminlogin ' => $ adminLogin ,
163175 'adminpass ' => $ adminPassword ,
164176 'adminemail ' => $ adminEmail ,
165- 'directory ' => $ dataDir
177+ 'directory ' => $ dataDir ,
178+ 'passwordsalt ' => $ passwordSalt ,
179+ 'secret ' => $ secret ,
166180 ];
167181 if ($ db === 'oci ' ) {
168182 $ options ['dbtablespace ' ] = $ input ->getParameterOption ('--database-table-space ' , '' );
0 commit comments