summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/dropbear/dropbear
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/dropbear/dropbear')
-rw-r--r--meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch23
-rw-r--r--meta/recipes-core/dropbear/dropbear/0003-configure.patch40
-rw-r--r--meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch22
-rw-r--r--meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch28
-rw-r--r--meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch22
-rw-r--r--meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch140
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbear4
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbear.socket10
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbear@.service11
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbearkey.service8
-rwxr-xr-xmeta/recipes-core/dropbear/dropbear/init113
-rw-r--r--meta/recipes-core/dropbear/dropbear/run-ptest2
12 files changed, 423 insertions, 0 deletions
diff --git a/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch b/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch
new file mode 100644
index 0000000000..71a4666b5c
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch
@@ -0,0 +1,23 @@
1Subject: [PATCH 1/6] urandom-xauth-changes-to-options.h
2
3Upstream-Status: Inappropriate [configuration]
4---
5 options.h | 2 +-
6 1 file changed, 1 insertion(+), 1 deletion(-)
7
8diff --git a/options.h b/options.h
9index 7d06322..71a21c2 100644
10--- a/options.h
11+++ b/options.h
12@@ -247,7 +247,7 @@ much traffic. */
13 /* The command to invoke for xauth when using X11 forwarding.
14 * "-q" for quiet */
15 #ifndef XAUTH_COMMAND
16-#define XAUTH_COMMAND "/usr/bin/X11/xauth -q"
17+#define XAUTH_COMMAND "xauth -q"
18 #endif
19
20 /* if you want to enable running an sftp server (such as the one included with
21--
221.7.11.7
23
diff --git a/meta/recipes-core/dropbear/dropbear/0003-configure.patch b/meta/recipes-core/dropbear/dropbear/0003-configure.patch
new file mode 100644
index 0000000000..2baf665ae4
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0003-configure.patch
@@ -0,0 +1,40 @@
1From c5f5c5054c1b15539dccf866e2c3faba7ed68456 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Eric=20B=C3=A9nard?= <eric@eukrea.com>
3Date: Thu, 25 Apr 2013 00:27:25 +0200
4Subject: [PATCH 3/6] configure
5
6---
7 configure.ac | 11 ++++++++---
8 1 file changed, 8 insertions(+), 3 deletions(-)
9
10diff --git a/configure.ac b/configure.ac
11index 05461f3..9c16d90 100644
12--- a/configure.ac
13+++ b/configure.ac
14@@ -166,15 +166,20 @@ AC_ARG_ENABLE(openpty,
15 AC_MSG_NOTICE(Not using openpty)
16 else
17 AC_MSG_NOTICE(Using openpty if available)
18- AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)])
19+ AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
20 fi
21 ],
22 [
23 AC_MSG_NOTICE(Using openpty if available)
24- AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY)])
25+ AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
26 ]
27 )
28-
29+
30+if test "x$dropbear_cv_func_have_openpty" = "xyes"; then
31+ AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)
32+ no_ptc_check=yes
33+ no_ptmx_check=yes
34+fi
35
36 AC_ARG_ENABLE(syslog,
37 [ --disable-syslog Don't include syslog support],
38--
391.7.11.7
40
diff --git a/meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch b/meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch
new file mode 100644
index 0000000000..7539d2034f
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch
@@ -0,0 +1,22 @@
1Subject: [PATCH 4/6] fix 2kb keys
2
3Upstream-Status: Inappropriate [configuration]
4---
5 kex.h | 2 +-
6 1 file changed, 1 insertion(+), 1 deletion(-)
7
8diff --git a/kex.h b/kex.h
9index 72430e9..375c677 100644
10--- a/kex.h
11+++ b/kex.h
12@@ -67,6 +67,6 @@ struct KEXState {
13 };
14
15
16-#define MAX_KEXHASHBUF 2000
17+#define MAX_KEXHASHBUF 3000
18
19 #endif /* _KEX_H_ */
20--
211.7.11.7
22
diff --git a/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch b/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch
new file mode 100644
index 0000000000..c408c571e6
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch
@@ -0,0 +1,28 @@
1Subject: [PATCH 5/6] dropbear enable pam
2
3dropbear: We need modify file option.h besides enabling pam in \
4configure if we want dropbear to support pam.
5
6Upstream-Status: Pending
7
8Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
9---
10 options.h | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13Index: dropbear-2013.62/options.h
14===================================================================
15--- dropbear-2013.62.orig/options.h 2014-01-14 21:53:02.803262009 +0000
16+++ dropbear-2013.62/options.h 2014-01-14 21:53:56.119263462 +0000
17@@ -192,9 +192,9 @@
18 * PAM challenge/response.
19 * You can't enable both PASSWORD and PAM. */
20
21-#define ENABLE_SVR_PASSWORD_AUTH
22+/*#define ENABLE_SVR_PASSWORD_AUTH*/
23 /* PAM requires ./configure --enable-pam */
24-/*#define ENABLE_SVR_PAM_AUTH */
25+#define ENABLE_SVR_PAM_AUTH
26 #define ENABLE_SVR_PUBKEY_AUTH
27
28 /* Whether to take public key options in
diff --git a/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch b/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch
new file mode 100644
index 0000000000..fa4c8d0a67
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch
@@ -0,0 +1,22 @@
1Subject: [PATCH 6/6] dropbear configuration file
2
3dropbear: Change the path ("/etc/pam.d/sshd" as default) to find a pam configuration file \
4to "/etc/pam.d/dropbear for dropbear when enabling pam supporting"
5
6Upstream-Status: Inappropriate [configuration]
7
8Signed-off-by: Maxin B. John <maxin.john@enea.com>
9Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
10---
11diff -Naur dropbear-2013.60-orig/svr-authpam.c dropbear-2013.60/svr-authpam.c
12--- dropbear-2013.60-orig/svr-authpam.c 2013-10-16 16:34:53.000000000 +0200
13+++ dropbear-2013.60/svr-authpam.c 2013-10-21 17:04:04.969416055 +0200
14@@ -211,7 +211,7 @@
15 userData.passwd = password;
16
17 /* Init pam */
18- if ((rc = pam_start("sshd", NULL, &pamConv, &pamHandlep)) != PAM_SUCCESS) {
19+ if ((rc = pam_start("dropbear", NULL, &pamConv, &pamHandlep)) != PAM_SUCCESS) {
20 dropbear_log(LOG_WARNING, "pam_start() failed, rc=%d, %s",
21 rc, pam_strerror(pamHandlep, rc));
22 goto cleanup;
diff --git a/meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch b/meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch
new file mode 100644
index 0000000000..b4501211c3
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch
@@ -0,0 +1,140 @@
1Upstream-Status: Pending
2
3The dropbearkey utility built in x32 abi format, when generating ssh
4keys, was getting lost in the infinite loop.
5
6This patch fixes the issue by fixing types of variables and
7parameters of functions used in the code, which were getting
8undesired size, when compiled with the x32 abi toolchain.
9
102013/05/23
11Received this fix from H J Lu.
12
13Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
14
15# HG changeset patch
16# User H.J. Lu <hjl.tools@gmail.com>
17# Date 1369344079 25200
18# Node ID a10a1c46b857cc8a3923c3bb6d1504aa25b6052f
19# Parent e76614145aea67f66e4a4257685c771efba21aa1
20Typdef mp_digit to unsigned long long for MP_64BIT
21
22When GCC is used with MP_64BIT, we should typedef mp_digit to unsigned
23long long instead of unsigned long since for x32, unsigned long is
2432-bit and unsigned long long is 64-bit and it is safe to use unsigned
25long long for 64-bit integer with GCC.
26
27diff -r e76614145aea -r a10a1c46b857 libtommath/tommath.h
28--- a/libtommath/tommath.h Thu Apr 18 22:57:47 2013 +0800
29+++ b/libtommath/tommath.h Thu May 23 14:21:19 2013 -0700
30@@ -73,7 +73,7 @@
31 typedef signed long long long64;
32 #endif
33
34- typedef unsigned long mp_digit;
35+ typedef unsigned long long mp_digit;
36 typedef unsigned long mp_word __attribute__ ((mode(TI)));
37
38 #define DIGIT_BIT 60
39# HG changeset patch
40# User H.J. Lu <hjl.tools@gmail.com>
41# Date 1369344241 25200
42# Node ID c7555a4cb7ded3a88409ba85f4027baa7af5f536
43# Parent a10a1c46b857cc8a3923c3bb6d1504aa25b6052f
44Cast to mp_digit when updating *rho
45
46There is
47
48int
49mp_montgomery_setup (mp_int * n, mp_digit * rho)
50
51We should cast to mp_digit instead of unsigned long when updating
52*rho since mp_digit may be unsigned long long and unsigned long long
53may be different from unsigned long, like in x32.
54
55diff -r a10a1c46b857 -r c7555a4cb7de libtommath/bn_mp_montgomery_setup.c
56--- a/libtommath/bn_mp_montgomery_setup.c Thu May 23 14:21:19 2013 -0700
57+++ b/libtommath/bn_mp_montgomery_setup.c Thu May 23 14:24:01 2013 -0700
58@@ -48,7 +48,7 @@
59 #endif
60
61 /* rho = -1/m mod b */
62- *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
63+ *rho = (mp_digit)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
64
65 return MP_OKAY;
66 }
67# HG changeset patch
68# User H.J. Lu <hjl.tools@gmail.com>
69# Date 1369344541 25200
70# Node ID 7c656e7071a6412688b2f30a529a9afac6c7bf5a
71# Parent c7555a4cb7ded3a88409ba85f4027baa7af5f536
72Define LTC_FAST_TYPE to unsigned long long for __x86_64__
73
74We should define LTC_FAST_TYPE to unsigned long long instead of unsigned
75long if __x86_64__ to support x32 where unsigned long long is 64-bit
76and unsigned long is 32-bit.
77
78diff -r c7555a4cb7de -r 7c656e7071a6 libtomcrypt/src/headers/tomcrypt_cfg.h
79--- a/libtomcrypt/src/headers/tomcrypt_cfg.h Thu May 23 14:24:01 2013 -0700
80+++ b/libtomcrypt/src/headers/tomcrypt_cfg.h Thu May 23 14:29:01 2013 -0700
81@@ -74,7 +74,7 @@
82 #define ENDIAN_LITTLE
83 #define ENDIAN_64BITWORD
84 #define LTC_FAST
85- #define LTC_FAST_TYPE unsigned long
86+ #define LTC_FAST_TYPE unsigned long long
87 #endif
88
89 /* detect PPC32 */
90# HG changeset patch
91# User H.J. Lu <hjl.tools@gmail.com>
92# Date 1369344730 25200
93# Node ID a7d4690158fae4ede2c4e5b56233e83730bf38ee
94# Parent 7c656e7071a6412688b2f30a529a9afac6c7bf5a
95Use unsigned long long aas unsigned 64-bit integer for x86-64 GCC
96
97We should use unsigned long long instead of unsigned long as unsigned
9864-bit integer for x86-64 GCC to support x32 where unsigned long is
9932-bit.
100
101diff -r 7c656e7071a6 -r a7d4690158fa libtomcrypt/src/headers/tomcrypt_macros.h
102--- a/libtomcrypt/src/headers/tomcrypt_macros.h Thu May 23 14:29:01 2013 -0700
103+++ b/libtomcrypt/src/headers/tomcrypt_macros.h Thu May 23 14:32:10 2013 -0700
104@@ -343,7 +343,7 @@
105 /* 64-bit Rotates */
106 #if !defined(__STRICT_ANSI__) && defined(__GNUC__) && defined(__x86_64__) && !defined(LTC_NO_ASM)
107
108-static inline unsigned long ROL64(unsigned long word, int i)
109+static inline unsigned long long ROL64(unsigned long long word, int i)
110 {
111 asm("rolq %%cl,%0"
112 :"=r" (word)
113@@ -351,7 +351,7 @@
114 return word;
115 }
116
117-static inline unsigned long ROR64(unsigned long word, int i)
118+static inline unsigned long long ROR64(unsigned long long word, int i)
119 {
120 asm("rorq %%cl,%0"
121 :"=r" (word)
122@@ -361,7 +361,7 @@
123
124 #ifndef LTC_NO_ROLC
125
126-static inline unsigned long ROL64c(unsigned long word, const int i)
127+static inline unsigned long long ROL64c(unsigned long long word, const int i)
128 {
129 asm("rolq %2,%0"
130 :"=r" (word)
131@@ -369,7 +369,7 @@
132 return word;
133 }
134
135-static inline unsigned long ROR64c(unsigned long word, const int i)
136+static inline unsigned long long ROR64c(unsigned long long word, const int i)
137 {
138 asm("rorq %2,%0"
139 :"=r" (word)
140
diff --git a/meta/recipes-core/dropbear/dropbear/dropbear b/meta/recipes-core/dropbear/dropbear/dropbear
new file mode 100644
index 0000000000..47e787fb10
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbear
@@ -0,0 +1,4 @@
1#%PAM-1.0
2
3auth include common-auth
4account include common-account
diff --git a/meta/recipes-core/dropbear/dropbear/dropbear.socket b/meta/recipes-core/dropbear/dropbear/dropbear.socket
new file mode 100644
index 0000000000..e5c61b755e
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbear.socket
@@ -0,0 +1,10 @@
1[Unit]
2Conflicts=dropbear.service
3
4[Socket]
5ListenStream=22
6Accept=yes
7
8[Install]
9WantedBy=sockets.target
10Also=dropbearkey.service
diff --git a/meta/recipes-core/dropbear/dropbear/dropbear@.service b/meta/recipes-core/dropbear/dropbear/dropbear@.service
new file mode 100644
index 0000000000..6fe9942090
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbear@.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=SSH Per-Connection Server
3Wants=dropbearkey.service
4After=syslog.target dropbearkey.service
5
6[Service]
7EnvironmentFile=-/etc/default/dropbear
8ExecStart=-@SBINDIR@/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key $DROPBEAR_EXTRA_ARGS
9ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
10StandardInput=socket
11KillMode=process
diff --git a/meta/recipes-core/dropbear/dropbear/dropbearkey.service b/meta/recipes-core/dropbear/dropbear/dropbearkey.service
new file mode 100644
index 0000000000..ccc21d5cca
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbearkey.service
@@ -0,0 +1,8 @@
1[Unit]
2Description=SSH Key Generation
3ConditionPathExists=|!/etc/dropbear/dropbear_rsa_host_key
4
5[Service]
6Type=oneshot
7ExecStart=@SBINDIR@/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
8RemainAfterExit=yes
diff --git a/meta/recipes-core/dropbear/dropbear/init b/meta/recipes-core/dropbear/dropbear/init
new file mode 100755
index 0000000000..e8fed3f94d
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/init
@@ -0,0 +1,113 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: sshd
4# Required-Start: $remote_fs $syslog $networking
5# Required-Stop: $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 1
8# Short-Description: Dropbear Secure Shell server
9### END INIT INFO
10#
11# Do not configure this file. Edit /etc/default/dropbear instead!
12#
13
14PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
15DAEMON=/usr/sbin/dropbear
16NAME=dropbear
17DESC="Dropbear SSH server"
18PIDFILE=/var/run/dropbear.pid
19
20DROPBEAR_PORT=22
21DROPBEAR_EXTRA_ARGS=
22NO_START=0
23
24set -e
25
26test ! -r /etc/default/dropbear || . /etc/default/dropbear
27test "$NO_START" = "0" || exit 0
28test -x "$DAEMON" || exit 0
29test ! -h /var/service/dropbear || exit 0
30
31readonly_rootfs=0
32for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' </proc/mounts`; do
33 case $flag in
34 ro)
35 readonly_rootfs=1
36 ;;
37 esac
38done
39
40if [ $readonly_rootfs = "1" ]; then
41 mkdir -p /var/lib/dropbear
42 DROPBEAR_RSAKEY_DEFAULT="/var/lib/dropbear/dropbear_rsa_host_key"
43 DROPBEAR_DSSKEY_DEFAULT="/var/lib/dropbear/dropbear_dss_host_key"
44else
45 DROPBEAR_RSAKEY_DEFAULT="/etc/dropbear/dropbear_rsa_host_key"
46 DROPBEAR_DSSKEY_DEFAULT="/etc/dropbear/dropbear_dss_host_key"
47fi
48
49test -z "$DROPBEAR_BANNER" || \
50 DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER"
51test -n "$DROPBEAR_RSAKEY" || \
52 DROPBEAR_RSAKEY=$DROPBEAR_RSAKEY_DEFAULT
53test -n "$DROPBEAR_DSSKEY" || \
54 DROPBEAR_DSSKEY=$DROPBEAR_DSSKEY_DEFAULT
55test -n "$DROPBEAR_KEYTYPES" || \
56 DROPBEAR_KEYTYPES="rsa"
57
58gen_keys() {
59for t in $DROPBEAR_KEYTYPES; do
60 case $t in
61 rsa)
62 if [ -f "$DROPBEAR_RSAKEY" -a ! -s "$DROPBEAR_RSAKEY" ]; then
63 rm $DROPBEAR_RSAKEY || true
64 fi
65 test -f $DROPBEAR_RSAKEY || dropbearkey -t rsa -f $DROPBEAR_RSAKEY
66 ;;
67 dsa)
68 if [ -f "$DROPBEAR_DSSKEY" -a ! -s "$DROPBEAR_DSSKEY" ]; then
69 rm $DROPBEAR_DSSKEY || true
70 fi
71 test -f $DROPBEAR_DSSKEY || dropbearkey -t dss -f $DROPBEAR_DSSKEY
72 ;;
73 esac
74done
75}
76
77case "$1" in
78 start)
79 echo -n "Starting $DESC: "
80 gen_keys
81 KEY_ARGS=""
82 test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
83 test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
84 start-stop-daemon -S -p $PIDFILE \
85 -x "$DAEMON" -- $KEY_ARGS \
86 -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
87 echo "$NAME."
88 ;;
89 stop)
90 echo -n "Stopping $DESC: "
91 start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
92 echo "$NAME."
93 ;;
94 restart|force-reload)
95 echo -n "Restarting $DESC: "
96 start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
97 sleep 1
98 KEY_ARGS=""
99 test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
100 test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
101 start-stop-daemon -S -p $PIDFILE \
102 -x "$DAEMON" -- $KEY_ARGS \
103 -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
104 echo "$NAME."
105 ;;
106 *)
107 N=/etc/init.d/$NAME
108 echo "Usage: $N {start|stop|restart|force-reload}" >&2
109 exit 1
110 ;;
111esac
112
113exit 0
diff --git a/meta/recipes-core/dropbear/dropbear/run-ptest b/meta/recipes-core/dropbear/dropbear/run-ptest
new file mode 100644
index 0000000000..61f1e0c0dd
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/run-ptest
@@ -0,0 +1,2 @@
1#!/bin/sh
2cd libtomcrypt; ./test 2>&1 | sed 's/NOPPASS/SKIP/'