blob: 2969a1c8d7e0519acf643be2b23604bb9c86d31b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# New ports collection makefile for: OpenSSH
# Date created: 7 October 1999
# Whom: green
#
# $FreeBSD$
#
PORTNAME= openssh
PORTVERSION= 3.4
PORTREVISION= 4
CATEGORIES= security
MASTER_SITES= ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/ \
ftp://ftp.usa.openbsd.org/pub/OpenBSD/OpenSSH/ \
ftp://ftp1.se.openbsd.org/pub/OpenBSD/OpenSSH/
DISTNAME= openssh-${PORTVERSION}
EXTRACT_SUFX= .tgz
PATCH_SITES= ${MASTER_SITES}
PATCHFILES= openbsd28_${PORTVERSION}.patch
MAINTAINER= dinoex@FreeBSD.org
MAN1= scp.1 slogin.1 ssh-add.1 ssh-agent.1 ssh-keygen.1 ssh.1 \
ssh-keyscan.1 sftp.1
MAN5= ssh_config.5 sshd_config.5
MAN8= sshd.8 sftp-server.8 ssh-keysign.8
MANCOMPRESSED= yes
MODIFY= ssh.h sshd_config sshd.sh pathnames.h
FIXME= lib/Makefile scp/Makefile sftp/Makefile sftp-server/Makefile \
ssh/Makefile ssh-add/Makefile ssh-agent/Makefile \
ssh-keygen/Makefile ssh-keyscan/Makefile sshd/Makefile
ADDME+= auth-pam.c auth-pam.h auth2-pam.c
ADDLIB+= strlcat.c strlcpy.c \
getaddrinfo.c name6.c bindresvport.c rcmd.c getnameinfo.c
PRECIOUS= ssh_config sshd_config \
ssh_host_key ssh_host_key.pub \
ssh_host_rsa_key ssh_host_rsa_key.pub \
ssh_host_dsa_key ssh_host_dsa_key.pub
# PAM ist broken, use openssh-portable instead.
PAM=no
.include <bsd.port.pre.mk>
.include <${PORTSDIR}/security/openssl/Makefile.ssl>
CRYPTOLIBS= -L${OPENSSLLIB} -lcrypto
# Here, MANDIR is concetenated to DESTDIR which all forms the man install dir...
MAKE_ENV+= DESTDIR=${PREFIX} MANDIR=/man/man CRYPTOLIBS="${CRYPTOLIBS}"
.if ${OSVERSION} < 400014
MAKE_ENV+= COMPAT_GETADDRINFO=yes
ADDME+= netdb.h
.else
MAKE_ENV+= INET6FLAGS=-DINET6
.endif
.if !exists(/usr/include/tcpd.h)
MAKE_ENV+= TCP_WRAPPERS=no
.endif
.if defined(AFS) && ${AFS} == YES
MAKE_ENV+= AFS=yes
.endif
.if defined(KERBEROS) && ${KERBEROS} == YES
MAKE_ENV+= KERBEROS=yes
.endif
.if exists(/usr/include/security/pam_modules.h)
PAM?= yes
.else
PAM= no
.endif
MAKE_ENV+= PAM=${PAM}
.if defined(SKEY) && ${SKEY} == YES
MAKE_ENV+= SKEY=yes
.endif
EMPTYDIR= ${PREFIX}/empty
ETCOLD= ${PREFIX}/etc
ETCSSH= ${PREFIX}/etc/ssh
PLIST_SUB+= EMPTYDIR=${EMPTYDIR}
WRKSRC= ${WRKDIR}/ssh
post-extract:
@${CP} ${FILESDIR}/sshd.sh ${WRKSRC}/
.for i in ${ADDLIB}
@${CP} ${FILESDIR}/${i} ${WRKSRC}/lib/
.endfor
.for i in ${ADDME}
@${CP} ${FILESDIR}/${i} ${WRKSRC}/
.endfor
pre-configure:
.for i in ${MODIFY:S/pathnames.h//} ${MAN1:S/slogin.1//} ${MAN5} ${MAN8}
@${MV} ${WRKSRC}/${i} ${WRKSRC}/${i}.sed
${SED} -e "s=/etc/ssh=${ETCSSH}/ssh=" \
-e "s=/usr/libex=${PREFIX}/libex=" \
-e 's:__PREFIX__:${PREFIX}:g' \
${WRKSRC}/${i}.sed >${WRKSRC}/${i}
.endfor
.for i in pathnames.h
@${MV} ${WRKSRC}/${i} ${WRKSRC}/${i}.sed
${SED} -e 's:__PREFIX__:${PREFIX}:g' \
${WRKSRC}/${i}.sed >${WRKSRC}/${i}
.endfor
.if ${OSVERSION} < 430000
post-configure:
.for i in ${FIXME}
@${MV} ${WRKSRC}/${i} ${WRKSRC}/${i}.sed
${SED} -e "s=KERBEROS[:]L=KERBEROS=" \
-e "s=KERBEROS5[:]L=KERBEROS5=" \
-e "s=AFS[:]L=AFS=" \
-e "s=TCP_WRAPPERS[:]L=TCP_WRAPPERS=" \
-e "s=SKEY[:]L=SKEY=" \
-e "s=PAM[:]L=PAM=" \
${WRKSRC}/${i}.sed >${WRKSRC}/${i}
.endfor
.endif
pre-install:
-${MKDIR} ${EMPTYDIR}
if ! pw groupshow sshd; then pw groupadd sshd -g 22; fi
if ! pw usershow sshd; then pw useradd sshd -g sshd -u 22 \
-h - -d ${EMPTYDIR} -s /nonexistent -c "sshd privilege separation"; fi
${MKDIR} ${PREFIX}/libdata/ssh
-@[ ! -d ${ETCSSH} ] && ${MKDIR} ${ETCSSH}
.for i in ${PRECIOUS}
-@[ -f ${ETCOLD}/${i} ] && [ ! -f ${ETCSSH}/${i} ] && \
${ECHO_MSG} ">> Linking ${ETCSSH}/${i} from old layout." && \
${LN} ${ETCOLD}/${i} ${ETCSSH}/${i}
.endfor
post-install:
.if !defined(BATCH)
.if !exists(${ETCSSH}/ssh_host_key) && !exists(${ETCOLD}/ssh_host_key)
@${ECHO_MSG} ">> Generating an RSA1 secret host key."
${PREFIX}/bin/ssh-keygen -t rsa1 -N "" -f ${ETCSSH}/ssh_host_key
.endif
.if !exists(${ETCSSH}/ssh_host_rsa_key) && !exists(${ETCOLD}/ssh_host_rsa_key)
@${ECHO_MSG} ">> Generating a RSA secret host key."
${PREFIX}/bin/ssh-keygen -t rsa -N "" -f ${ETCSSH}/ssh_host_rsa_key
.endif
.if !exists(${ETCSSH}/ssh_host_dsa_key) && !exists(${ETCOLD}/ssh_host_dsa_key)
@${ECHO_MSG} ">> Generating a DSA secret host key."
${PREFIX}/bin/ssh-keygen -t dsa -N "" -f ${ETCSSH}/ssh_host_dsa_key
.endif
.endif
.if !exists(${ETCSSH}/moduli)
@${ECHO_MSG} ">> Installing moduli."
${INSTALL_DATA} -c ${FILESDIR}/moduli ${ETCSSH}/moduli
.endif
${INSTALL_SCRIPT} ${WRKSRC}/sshd.sh ${PREFIX}/etc/rc.d/sshd.sh.sample
${INSTALL_DATA} -c ${WRKSRC}/ssh_config ${ETCSSH}/ssh_config-dist
${INSTALL_DATA} -c ${WRKSRC}/sshd_config ${ETCSSH}/sshd_config-dist
.if !exists(${ETCSSH}/ssh_config) && !exists(${ETCSSH}/sshd_config) \
&& !exists(${ETCOLD}/ssh_config) && !exists(${ETCOLD}/sshd_config)
${INSTALL_DATA} -c ${WRKSRC}/ssh_config ${ETCSSH}/ssh_config
${INSTALL_DATA} -c ${WRKSRC}/sshd_config ${ETCSSH}/sshd_config
.else
@${ECHO_MSG} ">> ${ETCSSH}/ssh{,d}_config exists, not being replaced!"
@${ECHO_MSG} ">> If this is left over from another version of SSH, you will"
@${ECHO_MSG} ">> need to update it to work with OpenSSH."
.endif
@${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>
|