mirror of
				https://github.com/dani-garcia/vaultwarden.git
				synced 2025-10-31 18:28:20 +02:00 
			
		
		
		
	Fix for RSA Keys which are read only (#4744)
* Fix for RSA Keys which are read only Sometimes an RSA Key file could be read only. We currently failed because we also wanted to write. Added an extra check if the file exists already and is not 0 in size. If it does already exists and is larger then 0, then open in read only mode. Fixes #4644 * Updated code to work atomically - Changed the code to work atomically - Also show the alert generated from `Io` * Fix spelling
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							54bfcb8bc3
						
					
				
				
					commit
					505b30eec2
				
			| @@ -73,11 +73,9 @@ async fn main() -> Result<(), Error> { | ||||
|     }); | ||||
|     init_logging(level).ok(); | ||||
|  | ||||
|     let extra_debug = matches!(level, LF::Trace | LF::Debug); | ||||
|  | ||||
|     check_data_folder().await; | ||||
|     auth::initialize_keys().unwrap_or_else(|_| { | ||||
|         error!("Error creating keys, exiting..."); | ||||
|     auth::initialize_keys().unwrap_or_else(|e| { | ||||
|         error!("Error creating private key '{}'\n{e:?}\nExiting Vaultwarden!", CONFIG.private_rsa_key()); | ||||
|         exit(1); | ||||
|     }); | ||||
|     check_web_vault(); | ||||
| @@ -91,6 +89,7 @@ async fn main() -> Result<(), Error> { | ||||
|     schedule_jobs(pool.clone()); | ||||
|     crate::db::models::TwoFactor::migrate_u2f_to_webauthn(&mut pool.get().await.unwrap()).await.unwrap(); | ||||
|  | ||||
|     let extra_debug = matches!(level, LF::Trace | LF::Debug); | ||||
|     launch_rocket(pool, extra_debug).await // Blocks until program termination. | ||||
| } | ||||
|  | ||||
| @@ -514,7 +513,7 @@ async fn launch_rocket(pool: db::DbPool, extra_debug: bool) -> Result<(), Error> | ||||
|  | ||||
|     tokio::spawn(async move { | ||||
|         tokio::signal::ctrl_c().await.expect("Error setting Ctrl-C handler"); | ||||
|         info!("Exiting vaultwarden!"); | ||||
|         info!("Exiting Vaultwarden!"); | ||||
|         CONFIG.shutdown(); | ||||
|     }); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user