diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/cygwin/README | 137 | ||||
-rwxr-xr-x | contrib/cygwin/ssh-config | 324 |
2 files changed, 461 insertions, 0 deletions
diff --git a/contrib/cygwin/README b/contrib/cygwin/README new file mode 100644 index 000000000..8c9d0bb73 --- /dev/null +++ b/contrib/cygwin/README | |||
@@ -0,0 +1,137 @@ | |||
1 | This package is the actual port of OpenSSH to Cygwin 1.1. | ||
2 | |||
3 | =========================================================================== | ||
4 | Important change since 2.3.0p1: | ||
5 | |||
6 | When using `ntea' or `ntsec' you now have to care for the ownership | ||
7 | and permission bits of your host key files and your private key files. | ||
8 | The host key files have to be owned by the NT account which starts | ||
9 | sshd. The user key files have to be owned by the user. The permission | ||
10 | bits of the private key files (host and user) have to be at least | ||
11 | rw------- (0600)! | ||
12 | |||
13 | Note that this is forced under `ntsec' only if the files are on a NTFS | ||
14 | filesystem (which is recommended) due to the lack of any basic security | ||
15 | features of the FAT/FAT32 filesystems. | ||
16 | =========================================================================== | ||
17 | |||
18 | Since this package is part of the base distribution now, the location | ||
19 | of the files has changed from /usr/local to /usr. The global configuration | ||
20 | files are in /etc now. | ||
21 | |||
22 | If you are installing OpenSSH the first time, you can generate | ||
23 | global config files, server keys and your own user keys by running | ||
24 | |||
25 | /usr/bin/ssh-config | ||
26 | |||
27 | If you are updating your installation you may run the above ssh-config | ||
28 | as well to move your configuration files to the new location and to | ||
29 | erase the files at the old location. | ||
30 | |||
31 | Be sure to start the new ssh-config when updating! | ||
32 | |||
33 | Note that this binary archive doesn't contain default config files in /etc. | ||
34 | That files are only created if ssh-config is started. | ||
35 | |||
36 | Install sshd as daemon via SRVANY.EXE (recommended on NT/W2K), via inetd | ||
37 | (results in very slow deamon startup!) or from the command line (recommended | ||
38 | on 9X/ME). | ||
39 | |||
40 | If starting via inetd, copy sshd to eg. /usr/sbin/in.sshd and add the | ||
41 | following line to your inetd.conf file: | ||
42 | |||
43 | sshd stream tcp nowait root /usr/sbin/in.sshd sshd -i | ||
44 | |||
45 | Moreover you'll have to add the following line to your | ||
46 | ${SYSTEMROOT}/system32/drivers/etc/services file: | ||
47 | |||
48 | sshd 22/tcp #SSH daemon | ||
49 | |||
50 | Authentication to sshd is possible in one of two ways. | ||
51 | You'll have to decide before starting sshd! | ||
52 | |||
53 | - If you want to authenticate via RSA and you want to login to that | ||
54 | machine to exactly one user account you can do so by running sshd | ||
55 | under that user account. You must change /etc/sshd_config | ||
56 | to contain the following: | ||
57 | |||
58 | RSAAuthentication yes | ||
59 | |||
60 | Moreover it's possible to use rhosts and/or rhosts with | ||
61 | RSA authentication by setting the following in sshd_config: | ||
62 | |||
63 | RhostsAuthentication yes | ||
64 | RhostsRSAAuthentication yes | ||
65 | |||
66 | - If you want to be able to login to different user accounts you'll | ||
67 | have to start sshd under system account or any other account that | ||
68 | is able to switch user context. Note that administrators are _not_ | ||
69 | able to do that by default! You'll have to give the following | ||
70 | special user rights to the user: | ||
71 | "Act as part of the operating system" | ||
72 | "Replace process level token" | ||
73 | "Increase quotas" | ||
74 | and if used via service manager | ||
75 | "Logon as a service". | ||
76 | |||
77 | The system account does of course own that user rights by default. | ||
78 | |||
79 | Unfortunately, if you choose that way, you can only logon with | ||
80 | NT password authentification and you should change | ||
81 | /etc/sshd_config to contain the following: | ||
82 | |||
83 | PasswordAuthentication yes | ||
84 | RhostsAuthentication no | ||
85 | RhostsRSAAuthentication no | ||
86 | RSAAuthentication no | ||
87 | |||
88 | However you can login to the user which has started sshd with | ||
89 | RSA authentication anyway. If you want that, change the RSA | ||
90 | authentication setting back to "yes": | ||
91 | |||
92 | RSAAuthentication yes | ||
93 | |||
94 | You may use all features of the CYGWIN=ntsec setting the same | ||
95 | way as they are used by the `login' port on sources.redhat.com: | ||
96 | |||
97 | The pw_gecos field may contain an additional field, that begins | ||
98 | with (upper case!) "U-", followed by the domain and the username | ||
99 | separated by a backslash. | ||
100 | CAUTION: The SID _must_ remain the _last_ field in pw_gecos! | ||
101 | BTW: The field separator in pw_gecos is the comma. | ||
102 | The username in pw_name itself may be any nice name: | ||
103 | |||
104 | domuser::1104:513:John Doe,U-domain\user,S-1-5-21-... | ||
105 | |||
106 | Now you may use `domuser' as your login name with telnet! | ||
107 | This is possible additionally for local users, if you don't like | ||
108 | your NT login name ;-) You only have to leave out the domain: | ||
109 | |||
110 | locuser::1104:513:John Doe,U-user,S-1-5-21-... | ||
111 | |||
112 | V2 server and user keys are generated by `ssh-config'. If you want to | ||
113 | create DSA keys by yourself, call ssh-keygen with `-d' option. | ||
114 | |||
115 | DSA authentication similar to RSA: | ||
116 | Add keys to ~/.ssh/authorized_keys2 | ||
117 | Interop. w/ ssh.com dsa-keys: | ||
118 | ssh-keygen -f /key/from/ssh.com -X >> ~/.ssh/authorized_keys2 | ||
119 | and vice versa: | ||
120 | ssh-keygen -f /privatekey/from/openssh -x > ~/.ssh2/mykey.pub | ||
121 | echo Key mykey.pub >> ~/.ssh2/authorization | ||
122 | |||
123 | If you want to build from source, the following options to | ||
124 | configure are used for the Cygwin binary distribution: | ||
125 | |||
126 | --prefix=/usr --sysconfdir=/etc --libexecdir='${exec_prefix}/sbin | ||
127 | |||
128 | You must have installed the zlib, openssl and regex packages to | ||
129 | be able to build OpenSSH! | ||
130 | |||
131 | Please send requests, error reports etc. to cygwin@sources.redhat.com. | ||
132 | |||
133 | Have fun, | ||
134 | |||
135 | Corinna Vinschen <vinschen@cygnus.com> | ||
136 | Cygwin Developer | ||
137 | Red Hat Inc. | ||
diff --git a/contrib/cygwin/ssh-config b/contrib/cygwin/ssh-config new file mode 100755 index 000000000..20c8cceb0 --- /dev/null +++ b/contrib/cygwin/ssh-config | |||
@@ -0,0 +1,324 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # ssh-config, Copyright 2000, Red Hat Inc. | ||
4 | # | ||
5 | # This file is part of the Cygwin port of OpenSSH. | ||
6 | |||
7 | # set -x | ||
8 | |||
9 | # Subdirectory where the new package is being installed | ||
10 | PREFIX=/usr | ||
11 | |||
12 | # Directory where the config files are stored | ||
13 | SYSCONFDIR=/etc | ||
14 | |||
15 | # Subdirectory where an old package might be installed | ||
16 | OLDPREFIX=/usr/local | ||
17 | OLDSYSCONFDIR=${OLDPREFIX}/etc | ||
18 | |||
19 | request() | ||
20 | { | ||
21 | answer="" | ||
22 | while [ "X${answer}" != "Xyes" -a "X${answer}" != "Xno" ] | ||
23 | do | ||
24 | echo -n "$1 (yes/no) " | ||
25 | read answer | ||
26 | done | ||
27 | if [ "X${answer}" = "Xyes" ] | ||
28 | then | ||
29 | return 0 | ||
30 | else | ||
31 | return 1 | ||
32 | fi | ||
33 | } | ||
34 | |||
35 | # Check for running ssh/sshd processes first. Refuse to do anything while | ||
36 | # some ssh processes are still running | ||
37 | |||
38 | if ps -ef | grep -v grep | grep -q ssh | ||
39 | then | ||
40 | echo | ||
41 | echo "There are still ssh processes running. Please shut them down first." | ||
42 | echo | ||
43 | exit 1 | ||
44 | fi | ||
45 | |||
46 | # Check for ${SYSCONFDIR} directory | ||
47 | |||
48 | if [ -e "${SYSCONFDIR}" -a ! -d "${SYSCONFDIR}" ] | ||
49 | then | ||
50 | echo | ||
51 | echo "${SYSCONFDIR} is existant but not a directory." | ||
52 | echo "Cannot create global configuration files." | ||
53 | echo | ||
54 | exit 1 | ||
55 | fi | ||
56 | |||
57 | # Create it if necessary | ||
58 | |||
59 | if [ ! -e "${SYSCONFDIR}" ] | ||
60 | then | ||
61 | mkdir "${SYSCONFDIR}" | ||
62 | if [ ! -e "${SYSCONFDIR}" ] | ||
63 | then | ||
64 | echo | ||
65 | echo "Creating ${SYSCONFDIR} directory failed" | ||
66 | echo | ||
67 | exit 1 | ||
68 | fi | ||
69 | fi | ||
70 | |||
71 | # Check for an old installation in ${OLDPREFIX} unless ${OLDPREFIX} isn't | ||
72 | # the same as ${PREFIX} | ||
73 | |||
74 | if [ "${OLDPREFIX}" != "${PREFIX}" ] | ||
75 | then | ||
76 | if [ -f "${OLDPREFIX}/sbin/sshd" ] | ||
77 | then | ||
78 | echo | ||
79 | echo "You seem to have an older installation in ${OLDPREFIX}." | ||
80 | echo | ||
81 | # Check if old global configuration files exist | ||
82 | if [ -f "${OLDSYSCONFDIR}/ssh_host_key" ] | ||
83 | then | ||
84 | if request "Do you want to copy your config files to your new installation?" | ||
85 | then | ||
86 | cp -f ${OLDSYSCONFDIR}/ssh_host_key ${SYSCONFDIR} | ||
87 | cp -f ${OLDSYSCONFDIR}/ssh_host_key.pub ${SYSCONFDIR} | ||
88 | cp -f ${OLDSYSCONFDIR}/ssh_host_dsa_key ${SYSCONFDIR} | ||
89 | cp -f ${OLDSYSCONFDIR}/ssh_host_dsa_key.pub ${SYSCONFDIR} | ||
90 | cp -f ${OLDSYSCONFDIR}/ssh_config ${SYSCONFDIR} | ||
91 | cp -f ${OLDSYSCONFDIR}/sshd_config ${SYSCONFDIR} | ||
92 | fi | ||
93 | fi | ||
94 | if request "Do you want to erase your old installation?" | ||
95 | then | ||
96 | rm -f ${OLDPREFIX}/bin/ssh.exe | ||
97 | rm -f ${OLDPREFIX}/bin/ssh-config | ||
98 | rm -f ${OLDPREFIX}/bin/scp.exe | ||
99 | rm -f ${OLDPREFIX}/bin/ssh-add.exe | ||
100 | rm -f ${OLDPREFIX}/bin/ssh-agent.exe | ||
101 | rm -f ${OLDPREFIX}/bin/ssh-keygen.exe | ||
102 | rm -f ${OLDPREFIX}/bin/slogin | ||
103 | rm -f ${OLDSYSCONFDIR}/ssh_host_key | ||
104 | rm -f ${OLDSYSCONFDIR}/ssh_host_key.pub | ||
105 | rm -f ${OLDSYSCONFDIR}/ssh_host_dsa_key | ||
106 | rm -f ${OLDSYSCONFDIR}/ssh_host_dsa_key.pub | ||
107 | rm -f ${OLDSYSCONFDIR}/ssh_config | ||
108 | rm -f ${OLDSYSCONFDIR}/sshd_config | ||
109 | rm -f ${OLDPREFIX}/man/man1/ssh.1 | ||
110 | rm -f ${OLDPREFIX}/man/man1/scp.1 | ||
111 | rm -f ${OLDPREFIX}/man/man1/ssh-add.1 | ||
112 | rm -f ${OLDPREFIX}/man/man1/ssh-agent.1 | ||
113 | rm -f ${OLDPREFIX}/man/man1/ssh-keygen.1 | ||
114 | rm -f ${OLDPREFIX}/man/man1/slogin.1 | ||
115 | rm -f ${OLDPREFIX}/man/man8/sshd.8 | ||
116 | rm -f ${OLDPREFIX}/sbin/sshd.exe | ||
117 | rm -f ${OLDPREFIX}/sbin/sftp-server.exe | ||
118 | fi | ||
119 | fi | ||
120 | fi | ||
121 | |||
122 | # First generate host keys if not already existing | ||
123 | |||
124 | if [ ! -f "${SYSCONFDIR}/ssh_host_key" ] | ||
125 | then | ||
126 | echo "Generating ${SYSCONFDIR}/ssh_host_key" | ||
127 | ssh-keygen -f ${SYSCONFDIR}/ssh_host_key -N '' | ||
128 | fi | ||
129 | |||
130 | if [ ! -f "${SYSCONFDIR}/ssh_host_dsa_key" ] | ||
131 | then | ||
132 | echo "Generating ${SYSCONFDIR}/ssh_host_dsa_key" | ||
133 | ssh-keygen -d -f ${SYSCONFDIR}/ssh_host_dsa_key -N '' | ||
134 | fi | ||
135 | |||
136 | # Check if ssh_config exists. If yes, ask for overwriting | ||
137 | |||
138 | if [ -f "${SYSCONFDIR}/ssh_config" ] | ||
139 | then | ||
140 | if request "Overwrite existing ${SYSCONFDIR}/ssh_config file?" | ||
141 | then | ||
142 | rm -f "${SYSCONFDIR}/ssh_config" | ||
143 | if [ -f "${SYSCONFDIR}/ssh_config" ] | ||
144 | then | ||
145 | echo "Can't overwrite. ${SYSCONFDIR}/ssh_config is write protected." | ||
146 | fi | ||
147 | fi | ||
148 | fi | ||
149 | |||
150 | # Create default ssh_config from here script | ||
151 | |||
152 | if [ ! -f "${SYSCONFDIR}/ssh_config" ] | ||
153 | then | ||
154 | echo "Creating default ${SYSCONFDIR}/ssh_config file" | ||
155 | cat > ${SYSCONFDIR}/ssh_config << EOF | ||
156 | # This is ssh client systemwide configuration file. This file provides | ||
157 | # defaults for users, and the values can be changed in per-user configuration | ||
158 | # files or on the command line. | ||
159 | |||
160 | # Configuration data is parsed as follows: | ||
161 | # 1. command line options | ||
162 | # 2. user-specific file | ||
163 | # 3. system-wide file | ||
164 | # Any configuration value is only changed the first time it is set. | ||
165 | # Thus, host-specific definitions should be at the beginning of the | ||
166 | # configuration file, and defaults at the end. | ||
167 | |||
168 | # Site-wide defaults for various options | ||
169 | |||
170 | # Host * | ||
171 | # ForwardAgent yes | ||
172 | # ForwardX11 yes | ||
173 | # RhostsAuthentication yes | ||
174 | # RhostsRSAAuthentication yes | ||
175 | # RSAAuthentication yes | ||
176 | # PasswordAuthentication yes | ||
177 | # FallBackToRsh no | ||
178 | # UseRsh no | ||
179 | # BatchMode no | ||
180 | # CheckHostIP yes | ||
181 | # StrictHostKeyChecking no | ||
182 | # IdentityFile ~/.ssh/identity | ||
183 | # Port 22 | ||
184 | # Protocol 2,1 | ||
185 | # Cipher 3des | ||
186 | # EscapeChar ~ | ||
187 | |||
188 | # Be paranoid by default | ||
189 | Host * | ||
190 | ForwardAgent no | ||
191 | ForwardX11 no | ||
192 | FallBackToRsh no | ||
193 | EOF | ||
194 | fi | ||
195 | |||
196 | # Check if sshd_config exists. If yes, ask for overwriting | ||
197 | |||
198 | if [ -f "${SYSCONFDIR}/sshd_config" ] | ||
199 | then | ||
200 | if request "Overwrite existing ${SYSCONFDIR}/sshd_config file?" | ||
201 | then | ||
202 | rm -f "${SYSCONFDIR}/sshd_config" | ||
203 | if [ -f "${SYSCONFDIR}/sshd_config" ] | ||
204 | then | ||
205 | echo "Can't overwrite. ${SYSCONFDIR}/sshd_config is write protected." | ||
206 | fi | ||
207 | fi | ||
208 | fi | ||
209 | |||
210 | # Create default sshd_config from here script | ||
211 | |||
212 | if [ ! -f "${SYSCONFDIR}/sshd_config" ] | ||
213 | then | ||
214 | echo "Creating default ${SYSCONFDIR}/sshd_config file" | ||
215 | cat > ${SYSCONFDIR}/sshd_config << EOF | ||
216 | # This is ssh server systemwide configuration file. | ||
217 | |||
218 | Port 22 | ||
219 | #Protocol 2,1 | ||
220 | ListenAddress 0.0.0.0 | ||
221 | #ListenAddress :: | ||
222 | #HostKey /etc/ssh_host_key | ||
223 | ServerKeyBits 768 | ||
224 | LoginGraceTime 600 | ||
225 | KeyRegenerationInterval 3600 | ||
226 | PermitRootLogin yes | ||
227 | # | ||
228 | # Don't read ~/.rhosts and ~/.shosts files | ||
229 | IgnoreRhosts yes | ||
230 | # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication | ||
231 | #IgnoreUserKnownHosts yes | ||
232 | StrictModes yes | ||
233 | X11Forwarding no | ||
234 | X11DisplayOffset 10 | ||
235 | PrintMotd yes | ||
236 | KeepAlive yes | ||
237 | |||
238 | # Logging | ||
239 | SyslogFacility AUTH | ||
240 | LogLevel INFO | ||
241 | #obsoletes QuietMode and FascistLogging | ||
242 | |||
243 | RhostsAuthentication no | ||
244 | # | ||
245 | # For this to work you will also need host keys in /etc/ssh_known_hosts | ||
246 | RhostsRSAAuthentication no | ||
247 | |||
248 | # To install for logon to different user accounts change to "no" here | ||
249 | RSAAuthentication yes | ||
250 | |||
251 | # To install for logon to different user accounts change to "yes" here | ||
252 | PasswordAuthentication no | ||
253 | |||
254 | PermitEmptyPasswords no | ||
255 | |||
256 | CheckMail no | ||
257 | UseLogin no | ||
258 | |||
259 | #Uncomment if you want to enable sftp | ||
260 | #Subsystem sftp /usr/sbin/sftp-server | ||
261 | #MaxStartups 10:30:60 | ||
262 | EOF | ||
263 | fi | ||
264 | |||
265 | # Ask user if user identity should be generated | ||
266 | |||
267 | if [ "X${HOME}" = "X" ] | ||
268 | then | ||
269 | echo '$HOME is nonexistant. Cannot create user identity files.' | ||
270 | exit 1 | ||
271 | fi | ||
272 | |||
273 | if [ ! -d "${HOME}" ] | ||
274 | then | ||
275 | echo '$HOME is not a valid directory. Cannot create user identity files.' | ||
276 | exit 1 | ||
277 | fi | ||
278 | |||
279 | # If HOME is the root dir, set HOME to empty string to avoid error messages | ||
280 | # in subsequent parts of that script. | ||
281 | if [ "X${HOME}" = "X/" ] | ||
282 | then | ||
283 | HOME='' | ||
284 | fi | ||
285 | |||
286 | if [ -e "${HOME}/.ssh" -a ! -d "${HOME}/.ssh" ] | ||
287 | then | ||
288 | echo '$HOME/.ssh is existant but not a directory. Cannot create user identity files.' | ||
289 | exit 1 | ||
290 | fi | ||
291 | |||
292 | if [ ! -e "${HOME}/.ssh" ] | ||
293 | then | ||
294 | mkdir "${HOME}/.ssh" | ||
295 | if [ ! -e "${HOME}/.ssh" ] | ||
296 | then | ||
297 | echo "Creating users ${HOME}/.ssh directory failed" | ||
298 | exit 1 | ||
299 | fi | ||
300 | fi | ||
301 | |||
302 | if [ ! -f "${HOME}/.ssh/identity" ] | ||
303 | then | ||
304 | if request "Shall I create an RSA identity file for you?" | ||
305 | then | ||
306 | echo "Generating ${HOME}/.ssh/identity" | ||
307 | ssh-keygen -f "${HOME}/.ssh/identity" | ||
308 | fi | ||
309 | fi | ||
310 | |||
311 | if [ ! -f "${HOME}/.ssh/id_dsa" ] | ||
312 | then | ||
313 | if request "Shall I create an DSA identity file for you? (yes/no) " | ||
314 | then | ||
315 | echo "Generating ${HOME}/.ssh/id_dsa" | ||
316 | ssh-keygen -d -f "${HOME}/.ssh/id_dsa" | ||
317 | fi | ||
318 | fi | ||
319 | |||
320 | echo | ||
321 | echo "Note: If you have used sshd as service or from inetd, don't forget to" | ||
322 | echo " change the path to sshd.exe in the service entry or in inetd.conf." | ||
323 | echo | ||
324 | echo "Configuration finished. Have fun!" | ||