Ensure that /var/tmp (the location of the Kerberos replay cache) has drwxrwxrwt permissions. If it doesn't, Kerberos will be unhappy in a way that's very difficult to debug. We do this using direct stat() calls because boost doesn't support the detail we need.
| 1286 | // to debug. We do this using direct stat() calls because boost doesn't support the |
| 1287 | // detail we need. |
| 1288 | Status CheckReplayCacheDirPermissions() { |
| 1289 | DCHECK(IsKerberosEnabled()); |
| 1290 | struct stat st; |
| 1291 | |
| 1292 | if (stat("/var/tmp", &st) < 0) { |
| 1293 | return Status(Substitute("Problem accessing /var/tmp: $0", GetStrErrMsg())); |
| 1294 | } |
| 1295 | |
| 1296 | if (!(st.st_mode & S_IFDIR)) { |
| 1297 | return Status("Error: /var/tmp is not a directory"); |
| 1298 | } |
| 1299 | |
| 1300 | if ((st.st_mode & 01777) != 01777) { |
| 1301 | return Status(Substitute("Error: The permissions on /var/tmp must precisely match " |
| 1302 | "\"drwxrwxrwt\". This directory is used by the Kerberos replay cache. " |
| 1303 | "Current permissions: \"$0\". To rectify this issue, run " |
| 1304 | "\"chmod 01777 /var/tmp\" as root.", FormatPermissions(st.st_mode))); |
| 1305 | } |
| 1306 | |
| 1307 | return Status::OK(); |
| 1308 | } |
| 1309 | |
| 1310 | Status SecureAuthProvider::InitKerberos(const string& principal) { |
| 1311 | principal_ = principal; |
no test coverage detected