mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-10-30 15:45:05 +01:00 
			
		
		
		
	Drop privileges after server start
This commit is contained in:
		| @@ -204,13 +204,6 @@ func main() { | |||||||
| 	taskManager.Start() | 	taskManager.Start() | ||||||
| 	serverInit() | 	serverInit() | ||||||
|  |  | ||||||
| 	// Because this program will want to bind to a privileged port (like 80), the listener must |  | ||||||
| 	// be established first, then the user can be changed, and after that, |  | ||||||
| 	// the actual http server can be started. |  | ||||||
| 	if err := runtimeEnv.DropPrivileges(config.Keys.Group, config.Keys.User); err != nil { |  | ||||||
| 		log.Fatalf("error while preparing server start: %s", err.Error()) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	var wg sync.WaitGroup | 	var wg sync.WaitGroup | ||||||
|  |  | ||||||
| 	wg.Add(1) | 	wg.Add(1) | ||||||
| @@ -219,6 +212,13 @@ func main() { | |||||||
| 		serverStart() | 		serverStart() | ||||||
| 	}() | 	}() | ||||||
|  |  | ||||||
|  | 	// Because this program will want to bind to a privileged port (like 80), the listener must | ||||||
|  | 	// be established first, then the user can be changed, and after that, | ||||||
|  | 	// the actual http server can be started. | ||||||
|  | 	if err := runtimeEnv.DropPrivileges(config.Keys.Group, config.Keys.User); err != nil { | ||||||
|  | 		log.Fatalf("error while preparing server start: %s", err.Error()) | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	wg.Add(1) | 	wg.Add(1) | ||||||
| 	sigs := make(chan os.Signal, 1) | 	sigs := make(chan os.Signal, 1) | ||||||
| 	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) | 	signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user