warn when starting without keys
[openafs.git] / src / viced / viced.c
index e301eb9..6d29129 100644 (file)
@@ -47,7 +47,6 @@
 #include <opr/lock.h>
 #include <opr/proc.h>
 #include <opr/softsig.h>
-#include <afs/procmgmt_softsig.h> /* must come after softsig.h */
 #include <afs/cmd.h>
 #include <afs/ptclient.h>
 #include <afs/afsint.h>
@@ -128,6 +127,7 @@ int rxMaxMTU = -1;
 afs_int32 implicitAdminRights = PRSFS_LOOKUP;  /* The ADMINISTER right is
                                                 * already implied */
 afs_int32 readonlyServer = 0;
+afs_int32 adminwriteServer = 0;
 
 int stackSize = 24000;
 int fiveminutes = 300;         /* 5 minutes.  Change this for debugging only */
@@ -377,7 +377,7 @@ setThreadId(char *s)
 
     /* set our 'thread-id' so that the host hold table works */
     threadId = rx_SetThreadNum();
-    afs_pthread_setname_self(s);
+    opr_threadname_set(s);
     ViceLog(0, ("Set thread id 0x%x for '%s'\n", threadId, s));
 #endif
 }
@@ -682,7 +682,7 @@ PrintCounters(void)
 static void *
 ShutdownWatchdogLWP(void *unused)
 {
-    afs_pthread_setname_self("ShutdownWatchdog");
+    opr_threadname_set("ShutdownWatchdog");
     sleep(panic_timeout);
     ViceLogThenPanic(0, ("ShutdownWatchdogLWP: Failed to shutdown and panic "
                          "within %d seconds; forcing panic\n",
@@ -890,6 +890,7 @@ enum optionsList {
     OPT_implicit,
     OPT_lock,
     OPT_readonly,
+    OPT_adminwrite,
     OPT_saneacls,
     OPT_buffers,
     OPT_callbacks,
@@ -983,6 +984,9 @@ ParseArgs(int argc, char *argv[])
 #endif
     cmd_AddParmAtOffset(opts, OPT_readonly, "-readonly", CMD_FLAG,
                        CMD_OPTIONAL, "be a readonly fileserver");
+    cmd_AddParmAtOffset(opts, OPT_adminwrite, "-admin-write", CMD_FLAG,
+                       CMD_OPTIONAL, "if read-only, allow writes for users "
+                       "from system:administrators");
     cmd_AddParmAtOffset(opts, OPT_saneacls, "-saneacls", CMD_FLAG,
                        CMD_OPTIONAL, "set the saneacls capability bit");
 
@@ -1093,7 +1097,7 @@ ParseArgs(int argc, char *argv[])
 
     /* rx options */
     cmd_AddParmAtOffset(opts, OPT_peer, "-enable_peer_stats", CMD_FLAG,
-                       CMD_OPTIONAL, "enable RX transport statistics");
+                       CMD_OPTIONAL, "enable RX RPC statistics by peer");
     cmd_AddParmAtOffset(opts, OPT_process, "-enable_process_stats", CMD_FLAG,
                        CMD_OPTIONAL, "enable RX RPC statistics");
     cmd_AddParmAtOffset(opts, OPT_nojumbo, "-nojumbo", CMD_FLAG,
@@ -1184,6 +1188,7 @@ ParseArgs(int argc, char *argv[])
     cmd_OptionAsFlag(opts, OPT_lock, &SawLock);
 #endif
     cmd_OptionAsFlag(opts, OPT_readonly, &readonlyServer);
+    cmd_OptionAsFlag(opts, OPT_adminwrite, &adminwriteServer);
     cmd_OptionAsFlag(opts, OPT_saneacls, &saneacls);
     cmd_OptionAsInt(opts, OPT_buffers, &buffs);
 
@@ -1895,7 +1900,12 @@ main(int argc, char *argv[])
     OpenLog(&logopts);
 
     LogCommandLine(argc, argv, "starting", "", "File server", FSLog);
-    if (afsconf_GetLatestKey(confDir, NULL, NULL) == 0) {
+
+    if (afsconf_CountKeys(confDir) == 0) {
+       ViceLog(0, ("WARNING: No encryption keys found! "
+                   "All authenticated accesses will fail. "
+                   "Run akeyconvert or asetkey to import encryption keys.\n"));
+    } else if (afsconf_GetLatestKey(confDir, NULL, NULL) == 0) {
        LogDesWarning();
     }
 
@@ -2037,8 +2047,12 @@ main(int argc, char *argv[])
        exit(-1);
     }
     if (rxkadDisableDotCheck) {
-        rx_SetSecurityConfiguration(tservice, RXS_CONFIG_FLAGS,
-                                    (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
+       code = rx_SetSecurityConfiguration(tservice, RXS_CONFIG_FLAGS,
+                                          (void *)RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
+       if (code) {
+           ViceLog(0, ("Failed to allow dotted principals: code %d\n", code));
+           exit(-1);
+       }
     }
     rx_SetMinProcs(tservice, 3);
     rx_SetMaxProcs(tservice, lwps);