commit deb09bd52f3a52b04f4d211d4a94843e66b695cc833bfffad5efe38169556f3d from: Stefan Sperling date: Tue Sep 30 09:35:10 2025 UTC disable gotwebd authentication if it is not enabled in gotwebd.conf gotwebd has always worked out of the box without requiring a configuration file to run, until the authentication feature was added and enabled by default. Enabling authentication by default means that gotwebd is useless out of the box unless a gotwebd.conf file exists which sets access rules or disables authentication. commit - edebe83572c3b469633032e931e91f69222be786e466326b09a0889f9e4ba4ce commit + deb09bd52f3a52b04f4d211d4a94843e66b695cc833bfffad5efe38169556f3d blob - c233428fdf7fa971bd985b2724cde4540d10c1b1b78d105827cfbe8ea5191560 blob + c54281b7e1431d559e7f0766605c4de7766ed7ac433df1d17013f79badb15b67 --- gotwebd/gotwebd.conf.5 +++ gotwebd/gotwebd.conf.5 @@ -65,7 +65,7 @@ Disable authentication, allowing any browser to view a not hidden via the .Ic respect_exportok directive. -Authentication can also be configured on a per-server or per-repository basis. +Authentication is disabled by default. .It Ic enable authentication Oo Ic insecure Oc Enable authentication, requiring browsers to present a login token cookie before read-only repository access is granted. @@ -388,7 +388,6 @@ server "localhost" { site_name "my public repos" site_owner "Flan Hacker" site_link "Flan' Projects" - disable authentication } .Ed .Pp @@ -403,7 +402,6 @@ listen on ::1 port 9000 server "localhost" { site_name "my public repos" repos_path "/var/git" - disable authentication } .Ed .Pp @@ -412,20 +410,18 @@ authentication: .Bd -literal -offset indent # 3 scopes: global, per-server, per-repository -disable authentication # override the default which is 'enable' +enable authentication # override the default which is 'disable' # Allow user "admin" to read anything unless overridden with a # "deny" rule later. permit "admin" server "public.example.com" { - # inherit global default, i.e. authentication is disabled + disable authentication # override global setting repos_path "/var/www/got/public" } server "secure.example.com" { - enable authentication # override global default - permit flan_squee # grant access to flan_squee permit :developers # grant access to developers group blob - 483713c2df02c5238073c40a1a38ad8400e25ba0a45d23a861a948ceb74c8e74 blob + 5e1596b90d4107072ecdde102ce54db55e621961ba76384b89e6aa5bcf44e013 --- gotwebd/parse.y +++ gotwebd/parse.y @@ -1060,14 +1060,18 @@ parse_config(const char *filename, struct gotwebd *env gotwebd->login_sock = sockets_conf_new_socket(-1, h); } - /* Enable authentication if not explicitly configured. */ + /* + * Disable authentication if not explicitly configured. + * Authentication requires access rules to be configured, and we want + * gotwebd to work out of the box if no configuration file exists. + */ switch (env->auth_config) { case GOTWEBD_AUTH_SECURE: case GOTWEBD_AUTH_INSECURE: case GOTWEBD_AUTH_DISABLED: break; default: - env->auth_config = GOTWEBD_AUTH_SECURE; + env->auth_config = GOTWEBD_AUTH_DISABLED; break; }