From: Peter Avalos Date: Fri, 2 Jan 2009 20:25:46 +0000 (-0500) Subject: Remove rexecd(8). X-Git-Tag: v2.3.0~130 X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/0a6f00b3cb98ae95595b83d603ada704601d087e Remove rexecd(8). It's been obsolete since the 4.3BSD days, and it's been discouraged for over a decade. --- diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc index e91ec455db..5e46fbbcae 100644 --- a/Makefile_upgrade.inc +++ b/Makefile_upgrade.inc @@ -1013,3 +1013,6 @@ TO_REMOVE+=/usr/share/man/cat3/xdr_authunix_parms.3.gz TO_REMOVE+=/usr/share/man/man3/xdr_authunix_parms.3.gz TO_REMOVE+=/usr/share/man/cat9/KTR_LOG_PTR.9.gz TO_REMOVE+=/usr/share/man/man9/KTR_LOG_PTR.9.gz +TO_REMOVE+=/usr/libexec/rexecd +TO_REMOVE+=/usr/share/man/man8/rexecd.8.gz +TO_REMOVE+=/usr/share/man/cat8/rexecd.8.gz diff --git a/etc/inetd.conf b/etc/inetd.conf index 23e4d801d3..d04e9d996f 100644 --- a/etc/inetd.conf +++ b/etc/inetd.conf @@ -19,7 +19,6 @@ #login stream tcp6 nowait root /usr/libexec/rlogind rlogind #finger stream tcp nowait/3/10 nobody /usr/libexec/fingerd fingerd -s #finger stream tcp6 nowait/3/10 nobody /usr/libexec/fingerd fingerd -s -#exec stream tcp nowait root /usr/libexec/rexecd rexecd # # run comsat as root to be able to print partial mailbox contents w/ biff, # or use the safer tty:tty to just print that new mail has been received. diff --git a/lib/libc/net/rcmd.3 b/lib/libc/net/rcmd.3 index 0838ee67b9..035a38ff21 100644 --- a/lib/libc/net/rcmd.3 +++ b/lib/libc/net/rcmd.3 @@ -265,8 +265,6 @@ is overloaded to mean ``All network ports in use.'' .Xr rlogin 1 , .Xr rsh 1 , .Xr intro 2 , -.Xr rexec 3 , -.Xr rexecd 8 , .Xr rlogind 8 , .Xr rshd 8 .Pp diff --git a/libexec/Makefile b/libexec/Makefile index f3fe58d810..f4d8a0eb1e 100644 --- a/libexec/Makefile +++ b/libexec/Makefile @@ -17,7 +17,6 @@ SUBDIR= atrun \ pppoed \ rbootd \ revnetgroup \ - rexecd \ rlogind \ rpc.rquotad \ rpc.rstatd \ diff --git a/libexec/rexecd/Makefile b/libexec/rexecd/Makefile deleted file mode 100644 index db353a42a9..0000000000 --- a/libexec/rexecd/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 6/4/93 -# $FreeBSD: src/libexec/rexecd/Makefile,v 1.10.2.1 2001/04/25 10:40:55 ru Exp $ -# $DragonFly: src/libexec/rexecd/Makefile,v 1.2 2003/06/17 04:27:07 dillon Exp $ - -PROG= rexecd -MAN= rexecd.8 -CFLAGS+= -DSKEY - -DPADD= ${LIBSKEY} ${LIBMD} ${LIBCRYPT} ${LIBUTIL} -LDADD= -lskey -lmd -lcrypt -lutil - -.include diff --git a/libexec/rexecd/rexecd.8 b/libexec/rexecd/rexecd.8 deleted file mode 100644 index 6a87a7982b..0000000000 --- a/libexec/rexecd/rexecd.8 +++ /dev/null @@ -1,160 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)rexecd.8 8.2 (Berkeley) 12/11/93 -.\" $FreeBSD: src/libexec/rexecd/rexecd.8,v 1.9.2.4 2001/08/16 10:44:16 ru Exp $ -.\" $DragonFly: src/libexec/rexecd/rexecd.8,v 1.5 2008/05/02 02:05:05 swildner Exp $ -.\" -.Dd September 23, 1994 -.Dt REXECD 8 -.Os -.Sh NAME -.Nm rexecd -.Nd remote execution server -.Sh SYNOPSIS -.Nm -.Op Fl i -.Sh DESCRIPTION -.Nm Rexecd -is the server for the -.Xr rexec 3 -routine. The server provides remote execution facilities -with authentication based on user names and -passwords. -.Pp -.Nm Rexecd -listens for service requests at the port indicated in -the ``exec'' service specification; see -.Xr services 5 . -When a service request is received the following protocol -is initiated: -.Bl -enum -.It -The server reads characters from the socket up -to a NUL -.Pq Ql \e0 -byte. The resultant string is -interpreted as an -.Tn ASCII -number, base 10. -.It -If the number received in step 1 is non-zero, -it is interpreted as the port number of a secondary -stream to be used for the -.Em stderr . -A second connection is then created to the specified -port on the client's machine. -.It -A NUL terminated user name of at most 16 characters -is retrieved on the initial socket. -.It -A NUL terminated, unencrypted password of at most -16 characters is retrieved on the initial socket. -.It -A NUL terminated command to be passed to a -shell is retrieved on the initial socket. The length of -the command is limited by the upper bound on the size of -the system's argument list. -.It -.Nm Rexecd -then validates the user as is done at login time -and, if the authentication was successful, changes -to the user's home directory, and establishes the user -and group protections of the user. -If any of these steps fail the connection is -aborted with a diagnostic message returned. -.It -A NUL byte is returned on the initial socket -and the command line is passed to the normal login -shell of the user. The -shell inherits the network connections established -by -.Nm . -.El -.Sh CAVEATS -.Nm Rexecd -will not allow root logins unless the -.Fl i -option is given on the command line (typically in -.Pa /etc/inetd.conf ) . -It will also disallow access for users listed in -.Pa /etc/ftpusers , -or users with no passwords, which were all serious security holes. -The entire concept of rexec/rexecd is a major security hole and an example -of how not to do things. -.Nm Rexecd -is disabled by default in -.Pa /etc/inetd.conf . -.Sh DIAGNOSTICS -Except for the last one listed below, -all diagnostic messages are returned on the initial socket, -after which any network connections are closed. -An error is indicated by a leading byte with a value of -1 (0 is returned in step 7 above upon successful completion -of all the steps prior to the command execution). -.Bl -tag -width Ds -.It Sy username too long -The name is -longer than 16 characters. -.It Sy password too long -The password is longer than 16 characters. -.It Sy command too long -The command line passed exceeds the size of the argument -list (as configured into the system). -.It Sy Login incorrect. -No password file entry for the user name existed. -.It Sy Password incorrect. -The wrong password was supplied. -.It Sy \&No remote directory. -The -.Xr chdir 2 -to the home directory failed. -.It Sy Try again. -A -.Xr fork 2 -by the server failed. -.It Sy : ... -The user's login shell could not be started. -This message is returned -on the connection associated with the -.Em stderr , -and is not preceded by a flag byte. -.El -.Sh SEE ALSO -.Xr rexec 3 -.Sh HISTORY -The -.Nm -command appeared in -.Bx 4.2 . -.Sh BUGS -A facility to allow all data and password exchanges to be encrypted should be -present. diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c deleted file mode 100644 index 510d6a5ca3..0000000000 --- a/libexec/rexecd/rexecd.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#) Copyright (c) 1983, 1993 The Regents of the University of California. All rights reserved. - * @(#)rexecd.c 8.1 (Berkeley) 6/4/93 - * $FreeBSD: src/libexec/rexecd/rexecd.c,v 1.18.2.3 2002/05/14 22:27:21 des Exp $ - * $DragonFly: src/libexec/rexecd/rexecd.c,v 1.5 2007/11/25 01:28:23 swildner Exp $ - */ - -#include -#include -#include - -#include - -#include -#ifdef DEBUG -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - -char username[MAXLOGNAME + 5 + 1] = "USER="; -char homedir[MAXPATHLEN + 5 + 1] = "HOME="; -char shell[MAXPATHLEN + 6 + 1] = "SHELL="; -char path[sizeof(_PATH_DEFPATH) + sizeof("PATH=")] = "PATH="; -char *envinit[] = - {homedir, shell, path, username, 0}; -char **environ; -char remote[MAXHOSTNAMELEN]; - -struct sockaddr_in asin = { AF_INET }; - -void doit (int, struct sockaddr_in *); -void getstr (char *, int, char *); -/*VARARGS1*/ -void error (); - -int no_uid_0 = 1; - -void -usage(void) -{ - syslog(LOG_ERR, "usage: rexecd [-i]"); - exit(1); -} - -/* - * remote execute server: - * username\0 - * password\0 - * command\0 - * data - */ -/*ARGSUSED*/ -int -main(argc, argv) - int argc; - char **argv; -{ - struct sockaddr_in from; - int fromlen; - int ch; - - openlog("rexecd", LOG_PID, LOG_AUTH); - - while ((ch = getopt(argc, argv, "i")) != -1) - switch (ch) { - case 'i': - no_uid_0 = 0; - break; - default: - usage(); - } - argc -= optind; - argv += optind; - - fromlen = sizeof (from); - if (getpeername(0, (struct sockaddr *)&from, &fromlen) < 0) - err(1, "getpeername"); - - realhostname(remote, sizeof(remote) - 1, &from.sin_addr); - - doit(0, &from); - return(0); -} - -void -doit(f, fromp) - int f; - struct sockaddr_in *fromp; -{ - FILE *fp; - char cmdbuf[NCARGS+1], *cp, *namep; -#ifdef SKEY - char user[16], pass[100]; -#else /* SKEY */ - char user[16], pass[16]; -#endif /* SKEY */ - struct passwd *pwd; - int s; - u_short port; - int pv[2], pid, ready, readfrom, cc; - char buf[BUFSIZ], sig; - int one = 1; - - (void) signal(SIGINT, SIG_DFL); - (void) signal(SIGQUIT, SIG_DFL); - (void) signal(SIGTERM, SIG_DFL); -#ifdef DEBUG - { int t = open(_PATH_TTY, 2); - if (t >= 0) { - ioctl(t, TIOCNOTTY, (char *)0); - (void) close(t); - } - } -#endif - dup2(f, 0); - dup2(f, 1); - dup2(f, 2); - (void) alarm(60); - port = 0; - for (;;) { - char c; - if (read(f, &c, 1) != 1) - exit(1); - if (c == 0) - break; - port = port * 10 + c - '0'; - } - (void) alarm(0); - if (port != 0) { - s = socket(AF_INET, SOCK_STREAM, 0); - if (s < 0) - exit(1); - if (bind(s, (struct sockaddr *)&asin, sizeof (asin)) < 0) - exit(1); - (void) alarm(60); - fromp->sin_port = htons(port); - if (connect(s, (struct sockaddr *)fromp, sizeof (*fromp)) < 0) - exit(1); - (void) alarm(0); - } - (void) alarm(60); - getstr(user, sizeof(user), "username"); - getstr(pass, sizeof(pass), "password"); - getstr(cmdbuf, sizeof(cmdbuf), "command"); - (void) alarm(0); - setpwent(); - pwd = getpwnam(user); - if (pwd == NULL) { - error("Login incorrect.\n"); - exit(1); - } - endpwent(); - if (*pwd->pw_passwd != '\0') { -#ifdef SKEY - namep = skey_crypt(pass, pwd->pw_passwd, pwd, - skeyaccess(user, NULL, remote, NULL)); -#else /* SKEY */ - namep = crypt(pass, pwd->pw_passwd); -#endif /* SKEY */ - if (strcmp(namep, pwd->pw_passwd)) { - syslog(LOG_ERR, "LOGIN FAILURE from %s, %s", - remote, user); - error("Login incorrect.\n"); - exit(1); - } - } - - if ((pwd->pw_uid == 0 && no_uid_0) || *pwd->pw_passwd == '\0' || - (pwd->pw_expire && time(NULL) >= pwd->pw_expire)) { - syslog(LOG_ERR, "%s LOGIN REFUSED from %s", user, remote); - error("Login incorrect.\n"); - exit(1); - } - - if ((fp = fopen(_PATH_FTPUSERS, "r")) != NULL) { - while (fgets(buf, sizeof(buf), fp) != NULL) { - if ((cp = index(buf, '\n')) != NULL) - *cp = '\0'; - if (strcmp(buf, pwd->pw_name) == 0) { - syslog(LOG_ERR, "%s LOGIN REFUSED from %s", - user, remote); - error("Login incorrect.\n"); - exit(1); - } - } - } - (void) fclose(fp); - - syslog(LOG_INFO, "login from %s as %s", remote, user); - - (void) write(2, "\0", 1); - if (port) { - (void) pipe(pv); - pid = fork(); - if (pid == -1) { - error("Try again.\n"); - exit(1); - } - if (pid) { - (void) close(0); (void) close(1); (void) close(2); - (void) close(f); (void) close(pv[1]); - readfrom = (1<pw_shell == '\0') - pwd->pw_shell = _PATH_BSHELL; - if (f > 2) - (void) close(f); - if (setlogin(pwd->pw_name) < 0) - syslog(LOG_ERR, "setlogin() failed: %m"); - (void) setgid((gid_t)pwd->pw_gid); - initgroups(pwd->pw_name, pwd->pw_gid); - (void) setuid((uid_t)pwd->pw_uid); - (void)strcat(path, _PATH_DEFPATH); - environ = envinit; - strncat(homedir, pwd->pw_dir, sizeof(homedir)-6); - strncat(shell, pwd->pw_shell, sizeof(shell)-7); - strncat(username, pwd->pw_name, sizeof(username)-6); - cp = strrchr(pwd->pw_shell, '/'); - if (cp) - cp++; - else - cp = pwd->pw_shell; - if (chdir(pwd->pw_dir) < 0) { - error("No remote directory.\n"); - exit(1); - } - execl(pwd->pw_shell, cp, "-c", cmdbuf, 0); - err(1, "%s", pwd->pw_shell); -} - -/*VARARGS1*/ -void -error(fmt, a1, a2, a3) - char *fmt; - int a1, a2, a3; -{ - char buf[BUFSIZ]; - - buf[0] = 1; - (void) snprintf(buf+1, sizeof(buf) - 1, fmt, a1, a2, a3); - (void) write(2, buf, strlen(buf)); -} - -void -getstr(buf, cnt, err) - char *buf; - int cnt; - char *err; -{ - char c; - - do { - if (read(0, &c, 1) != 1) - exit(1); - *buf++ = c; - if (--cnt == 0) { - error("%s too long\n", err); - exit(1); - } - } while (c != 0); -} diff --git a/usr.sbin/inetd/inetd.8 b/usr.sbin/inetd/inetd.8 index a0965ef3ce..0118974bb8 100644 --- a/usr.sbin/inetd/inetd.8 +++ b/usr.sbin/inetd/inetd.8 @@ -887,7 +887,6 @@ socket but was unable to. .Xr comsat 8 , .Xr fingerd 8 , .Xr ftpd 8 , -.Xr rexecd 8 , .Xr rlogind 8 , .Xr rpcbind 8 , .Xr rshd 8 , diff --git a/usr.sbin/rmt/rmt.8 b/usr.sbin/rmt/rmt.8 index 5110074fc4..18c9fb2949 100644 --- a/usr.sbin/rmt/rmt.8 +++ b/usr.sbin/rmt/rmt.8 @@ -47,8 +47,6 @@ The utility is used by the remote dump and restore programs in manipulating a magnetic tape drive through an interprocess communication connection. It is normally started up with an -.Xr rexec 3 -or .Xr rcmd 3 call. .Pp @@ -209,7 +207,6 @@ to exit. All responses are of the form described above. .Sh SEE ALSO .Xr rcmd 3 , -.Xr rexec 3 , .Xr mtio 4 , .Xr rdump 8 , .Xr rrestore 8