@@ -1341,8 +1341,8 @@ func SetServerDefaults(v *viper.Viper) error {
13411341
13421342 // Set fed token locations for cache/origin. Note that fed tokens aren't yet used by the
13431343 // Origin (2026-02-05), but they may be soon for things like third party copy.
1344- v .SetDefault (param .Origin_FedTokenLocation .GetName (), filepath .Join (configDir , "origin-fed-token" ))
1345- v .SetDefault (param .Cache_FedTokenLocation .GetName (), filepath .Join (configDir , "cache-fed-token" ))
1344+ v .SetDefault (param .Origin_FedTokenLocation .GetName (), filepath .Join (configDir , "fed-token" , " origin-fed-token" ))
1345+ v .SetDefault (param .Cache_FedTokenLocation .GetName (), filepath .Join (configDir , "fed-token" , " cache-fed-token" ))
13461346
13471347 runtimeDir , _ , err := ensureRuntimeDir (v )
13481348 if err != nil {
@@ -1572,7 +1572,7 @@ func SetServerDefaults(v *viper.Viper) error {
15721572 // stash a copy of its value now.
15731573 v .SetDefault (param .Origin_TokenAudience .GetName (), v .GetString (param .Origin_Url .GetName ()))
15741574
1575- // Set defaults for Director, Registry, and Broker URLs only if the Discovery URL is not set.
1575+ // Set defaults for Director and Registry URLs only if the Discovery URL is not set.
15761576 // This is necessary because, in Viper, there is currently no way to check if a value is coming
15771577 // from the default or was explicitly set by the user. Therefore, if the DiscoveryURL is present,
15781578 // when populating the Director, Registry, and Broker URLs, the discoverFederationImpl function
@@ -1586,7 +1586,6 @@ func SetServerDefaults(v *viper.Viper) error {
15861586 // https://github.com/spf13/viper/issues/1814
15871587 if ! v .IsSet (param .Federation_DiscoveryUrl .GetName ()) {
15881588 v .SetDefault ("Federation.RegistryUrl" , v .GetString (param .Server_ExternalWebUrl .GetName ()))
1589- v .SetDefault ("Federation.BrokerURL" , v .GetString (param .Server_ExternalWebUrl .GetName ()))
15901589 v .SetDefault ("Federation_DirectorUrl" , v .GetString (param .Server_ExternalWebUrl .GetName ()))
15911590 }
15921591
@@ -1673,26 +1672,19 @@ func InitServer(ctx context.Context, currentServers server_structs.ServerType) e
16731672 // Set up the directories for the server to run as a non-root user;
16741673 // for the most part, we need to recursively chown and chmod the directory
16751674 // so either root or pelican can access it.
1676- pelicanLocations := []string {
1675+ pelicanLocationsNoRecursive := []string {
16771676 param .Server_DbLocation .GetString (),
16781677 }
1679- if currentServers .IsEnabled (server_structs .RegistryType ) {
1680- pelicanLocations = append (pelicanLocations , param .Registry_DbLocation .GetString ())
1681- }
1682- if currentServers .IsEnabled (server_structs .OriginType ) {
1683- pelicanLocations = append (pelicanLocations , param .Origin_DbLocation .GetString ())
1684- }
1685- if currentServers .IsEnabled (server_structs .DirectorType ) {
1686- pelicanLocations = append (pelicanLocations , param .Director_DbLocation .GetString (), param .Director_GeoIPLocation .GetString ())
1687- }
1688- if err = setFileAndDirPerms (pelicanLocations , 0750 , 0640 , puser .Uid , 0 , true ); err != nil {
1689- return errors .Wrap (err , "failure when setting up the file permissions for pelican" )
1690- }
1691-
1692- pelicanLocationsNoRecursive := []string {}
16931678 if (currentServers .IsEnabled (server_structs .OriginType ) || currentServers .IsEnabled (server_structs .CacheType )) && param .Shoveler_Enable .GetBool () {
16941679 pelicanLocationsNoRecursive = append (pelicanLocationsNoRecursive , param .Shoveler_AMQPTokenLocation .GetString ())
16951680 }
1681+ if currentServers .IsEnabled (server_structs .CacheType ) {
1682+ tokLoc := param .Cache_FedTokenLocation .GetString ()
1683+ tokDir := filepath .Dir (tokLoc )
1684+ dir := filepath .Dir (tokDir )
1685+ tempTokDir := filepath .Join (dir , "fed-token-temp" )
1686+ pelicanLocationsNoRecursive = append (pelicanLocationsNoRecursive , tempTokDir )
1687+ }
16961688 if err = setFileAndDirPerms (pelicanLocationsNoRecursive , 0750 , 0640 , puser .Uid , 0 , false ); err != nil {
16971689 return errors .Wrap (err , "failure when setting up the file permissions for pelican" )
16981690 }
@@ -1718,9 +1710,9 @@ func InitServer(ctx context.Context, currentServers server_structs.ServerType) e
17181710 if (currentServers .IsEnabled (server_structs .OriginType ) || currentServers .IsEnabled (server_structs .CacheType )) && param .Shoveler_Enable .GetBool () {
17191711 pelicanDirs = append (pelicanDirs , param .Shoveler_QueueDirectory .GetString ())
17201712 }
1721- if currentServers . IsEnabled ( server_structs . OriginType ) {
1722- pelicanDirs = append ( pelicanDirs , param . Origin_GlobusConfigLocation . GetString ())
1723- }
1713+ // Note: Origin_GlobusConfigLocation is intentionally NOT added here.
1714+ // It's under Origin_RunLocation (e.g. /run/pelican/xrootd/origin/) which should be owned by xrootd, not pelican.
1715+ // InitGlobusBackend() handles creating and chowning the Globus directories properly.
17241716 if err = setDirPerms (pelicanDirs , 0750 , 0640 , puser .Uid , puser .Gid , true ); err != nil {
17251717 return errors .Wrap (err , "failure when setting up the directory permissions for pelican" )
17261718 }
@@ -1988,6 +1980,14 @@ func InitServer(ctx context.Context, currentServers server_structs.ServerType) e
19881980 return err
19891981 }
19901982
1983+ // When drop privileges is enabled, ensure the pelican user can read TLS credentials.
1984+ // XRootD does not need direct access to these files as Pelican copies them to a runtime location.
1985+ if param .Server_DropPrivileges .GetBool () {
1986+ if err = CheckTLSCredsForDropPrivileges (); err != nil {
1987+ return err
1988+ }
1989+ }
1990+
19911991 // The certificate was either generated or has been provided by now. Verify that any configured
19921992 // hostnames are valid w.r.t the given certificate.
19931993 //
0 commit comments