From b199d6adce3aa9b89513314b1318dafd2f5931bb Mon Sep 17 00:00:00 2001 From: bens Date: Wed, 09 Dec 2009 03:27:02 +0000 Subject: Initial import --- diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..7d1f84e --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1 @@ +Ben Schwartz (bens@alum.mit.edu) diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..3acffd4 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,15 @@ +NEWS +hostkey.pub +ssh_config +terminal.py +userkey.pub +screenrc +userkey +setup.py +hostkey +COPYING +README +sshd_config +MAINTAINERS +activity/activity-shareterm.svg +activity/activity.info diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..5bcaff4 --- /dev/null +++ b/NEWS @@ -0,0 +1,4 @@ +1 + +* Initial Version, based on Terminal-18 + diff --git a/README b/README new file mode 100644 index 0000000..5f2b35a --- /dev/null +++ b/README @@ -0,0 +1,4 @@ +Shared Terminal Activity + +This activity provides a shared terminal based on ssh and GNU screen. The codebase +is fragile and full of hacks. It depends on screen being installed. diff --git a/activity/activity-shareterm.svg b/activity/activity-shareterm.svg new file mode 100644 index 0000000..267a371 --- /dev/null +++ b/activity/activity-shareterm.svg @@ -0,0 +1,12 @@ + + +]> + + + + + + + + diff --git a/activity/activity.info b/activity/activity.info new file mode 100644 index 0000000..ba56c6a --- /dev/null +++ b/activity/activity.info @@ -0,0 +1,9 @@ +[Activity] +name = ShareTerm +activity_version = 1 +service_name = org.sugarlabs.ShareTerm +exec = sugar-activity terminal.SharedTerminalActivity +icon = activity-shareterm +mime_types = +license = GPLv2+ + diff --git a/hostkey b/hostkey new file mode 100644 index 0000000..75bbe48 --- /dev/null +++ b/hostkey @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEA6iJWiems/+N+zVkUzXV8BaFjtICm5CCL+4diysPPSUDrimFi +vv0nVioGELIZRO8LH3Rmr1jV2kLqBlTdIjyDzcMFH1uIcEg1kL7dKGuckiF92f9p +luD7VIO4HXJKCAueCsON0JHHE9OVrxS2uD3+nwmRiWB83b0Qaq9MKHJY2Z6mjrRZ +VwzJuXx/Jsz7cYuMY6EJtDVrpazMQ1nqGfNGjpsibP/kskPqBPgB4O1uuqwS1CSA +us8/eNHA4gGAz0Dl6JwZim/MknUX4k3vVxEpJexQhuAWMSMuMAtWzuXagGor41wp +TgAif2tErjdZHZ0N+7AMBoZANldWWMCS6oCxCwIBIwKCAQEA1hDEJlH9QboNiIv1 +wymV9oTtcdS11+M+J8w9ESgN+dT0m8bArp5P2cAFi5uE0U+VJBKnBree83Bg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zt4kIY+R1VrT2sZGayEffwCeq7i/8jCEcj571pJ6J6R3vNbnVDV5uqqKIGfC8USv +KzadPoDmmgulkTzbUU+ZiH6iSC7s0q42svAa/TAOv1cecQsntbQ= +-----END RSA PRIVATE KEY----- diff --git a/hostkey.pub b/hostkey.pub new file mode 100644 index 0000000..34d439e --- /dev/null +++ b/hostkey.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6iJWiems/+N+zVkUzXV8BaFjtICm5CCL+4diysPPSUDrimFivv0nVioGELIZRO8LH3Rmr1jV2kLqBlTdIjyDzcMFH1uIcEg1kL7dKGuckiF92f9pluD7VIO4HXJKCAueCsON0JHHE9OVrxS2uD3+nwmRiWB83b0Qaq9MKHJY2Z6mjrRZVwzJuXx/Jsz7cYuMY6EJtDVrpazMQ1nqGfNGjpsibP/kskPqBPgB4O1uuqwS1CSAus8/eNHA4gGAz0Dl6JwZim/MknUX4k3vVxEpJexQhuAWMSMuMAtWzuXagGor41wpTgAif2tErjdZHZ0N+7AMBoZANldWWMCS6oCxCw== olpc@xo-14-4C-34.localdomain diff --git a/screenrc b/screenrc new file mode 100644 index 0000000..89a5e39 --- /dev/null +++ b/screenrc @@ -0,0 +1,2 @@ +bindkey -d ^@ stuff ^H +bindkey -d ^? stuff ^H diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..297d112 --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/python + +# Copyright (C) 2006, Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +from sugar.activity import bundlebuilder + +bundlebuilder.start('Terminal') + diff --git a/ssh_config b/ssh_config new file mode 100644 index 0000000..7e4c90b --- /dev/null +++ b/ssh_config @@ -0,0 +1,56 @@ +# $OpenBSD: ssh_config,v 1.23 2007/06/08 04:40:40 pvalchev Exp $ + +# This is the ssh client system-wide configuration file. See +# ssh_config(5) for more information. This file provides defaults for +# users, and the values can be changed in per-user configuration files +# or on the command line. + +# Configuration data is parsed as follows: +# 1. command line options +# 2. user-specific file +# 3. system-wide file +# Any configuration value is only changed the first time it is set. +# Thus, host-specific definitions should be at the beginning of the +# configuration file, and defaults at the end. + +# Site-wide defaults for some commonly used options. For a comprehensive +# list of available options, their meanings and defaults, please see the +# ssh_config(5) man page. + +# Host * +# ForwardAgent no +# ForwardX11 no +# RhostsRSAAuthentication no +# RSAAuthentication yes +# PasswordAuthentication yes +# HostbasedAuthentication no +# GSSAPIAuthentication no +# GSSAPIDelegateCredentials no +# BatchMode no +# CheckHostIP yes +# AddressFamily any +# ConnectTimeout 0 +# StrictHostKeyChecking ask +StrictHostKeyChecking no +# IdentityFile ~/.ssh/identity +# IdentityFile ~/.ssh/id_rsa +# IdentityFile ~/.ssh/id_dsa +# Port 22 +# Protocol 2,1 +# Cipher 3des +# Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc +# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160 +# EscapeChar ~ +# Tunnel no +# TunnelDevice any:any +# PermitLocalCommand no +Host * + GSSAPIAuthentication yes +# If this option is set to yes then remote X11 clients will have full access +# to the original X11 display. As virtually no X11 client supports the untrusted +# mode correctly we set this to yes. + ForwardX11Trusted yes +# Send locale-related environment variables + SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES + SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT + SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE diff --git a/sshd_config b/sshd_config new file mode 100644 index 0000000..b3813fe --- /dev/null +++ b/sshd_config @@ -0,0 +1,141 @@ +# $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $ + +# This is the sshd server system-wide configuration file. See +# sshd_config(5) for more information. + +# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin + +# The strategy used for options in the default sshd_config shipped with +# OpenSSH is to specify options with their default value where +# possible, but leave them commented. Uncommented options change a +# default value. + +#Port 22 +#AddressFamily any +#ListenAddress 0.0.0.0 +#ListenAddress :: + +# Disable legacy (protocol version 1) support in the server for new +# installations. In future the default will change to require explicit +# activation of protocol 1 +Protocol 2 + +# HostKey for protocol version 1 +#HostKey /etc/ssh/ssh_host_key +# HostKeys for protocol version 2 +#HostKey /etc/ssh/ssh_host_rsa_key +#HostKey /etc/ssh/ssh_host_dsa_key + +# Lifetime and size of ephemeral version 1 server key +#KeyRegenerationInterval 1h +#ServerKeyBits 1024 + +# Logging +# obsoletes QuietMode and FascistLogging +#SyslogFacility AUTH +SyslogFacility AUTHPRIV +#LogLevel INFO +LogLevel INFO +# ShareTerm currently depends in a fragile way on LogLevel=INFO. + + +# Authentication: + +#LoginGraceTime 2m +#PermitRootLogin yes +#StrictModes yes +StrictModes no +#MaxAuthTries 6 +#MaxSessions 10 + +#RSAAuthentication yes +#PubkeyAuthentication yes +#AuthorizedKeysFile .ssh/authorized_keys +AuthorizedKeysFile .ShareTerm/authorized_keys + +# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts +#RhostsRSAAuthentication no +# similar for protocol version 2 +#HostbasedAuthentication no +# Change to yes if you don't trust ~/.ssh/known_hosts for +# RhostsRSAAuthentication and HostbasedAuthentication +#IgnoreUserKnownHosts no +# Don't read the user's ~/.rhosts and ~/.shosts files +#IgnoreRhosts yes + +# To disable tunneled clear text passwords, change to no here! +#PasswordAuthentication yes +#PermitEmptyPasswords no +PasswordAuthentication no + +# Change to no to disable s/key passwords +#ChallengeResponseAuthentication yes +ChallengeResponseAuthentication no + +# Kerberos options +#KerberosAuthentication no +#KerberosOrLocalPasswd yes +#KerberosTicketCleanup yes +#KerberosGetAFSToken no + +# GSSAPI options +#GSSAPIAuthentication no +GSSAPIAuthentication no +#GSSAPICleanupCredentials yes +GSSAPICleanupCredentials yes + +# Set this to 'yes' to enable PAM authentication, account processing, +# and session processing. If this is enabled, PAM authentication will +# be allowed through the ChallengeResponseAuthentication and +# PasswordAuthentication. Depending on your PAM configuration, +# PAM authentication via ChallengeResponseAuthentication may bypass +# the setting of "PermitRootLogin without-password". +# If you just want the PAM account and session checks to run without +# PAM authentication, then enable this but set PasswordAuthentication +# and ChallengeResponseAuthentication to 'no'. +#UsePAM no +UsePAM yes +# UsePAM=yes is necessary for ShareTerm because otherwise OpenSSH notices that +# the account has no password set (i.e. "is locked") and refuses to log in with +# publickey auth. I have no idea what UsePAM=yes fixes this, but it does. + +# Accept locale-related environment variables +AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES +AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT +AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE + +#AllowAgentForwarding yes +#AllowTcpForwarding yes +#GatewayPorts no +#X11Forwarding no +X11Forwarding yes +#X11DisplayOffset 10 +#X11UseLocalhost yes +#PrintMotd yes +#PrintLastLog yes +#TCPKeepAlive yes +#UseLogin no +#UsePrivilegeSeparation yes +#PermitUserEnvironment no +#Compression delayed +#ClientAliveInterval 0 +#ClientAliveCountMax 3 +#ShowPatchLevel no +#UseDNS yes +#PidFile /var/run/sshd.pid +#MaxStartups 10 +#PermitTunnel no +#ChrootDirectory none + +# no default banner path +#Banner none + +# override default of no subsystems +Subsystem sftp /usr/libexec/openssh/sftp-server + +# Example of overriding settings on a per-user basis +#Match User anoncvs +# X11Forwarding no +# AllowTcpForwarding no +# ForceCommand cvs server +PermitEmptyPasswords no diff --git a/terminal.py b/terminal.py new file mode 100644 index 0000000..2e15c1e --- /dev/null +++ b/terminal.py @@ -0,0 +1,393 @@ +# Copyright (C) 2007, Eduardo Silva . +# Copyright (C) 2008, One Laptop Per Child +# Copyright (C) 2009, Ben Schwartz +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import os + +import logging +from gettext import gettext as _ + +import gtk +import dbus + +from sugar.activity import activity +from sugar import env +from sugar.graphics.toolbutton import ToolButton +from sugar.graphics.palette import Palette +import ConfigParser +import os.path + +import vte +import pango + +import telepathy +import shutil +import subprocess +import stat + +import random +import re +import signal + +SERVICE = 'org.sugarlabs.ShareTerm' +IFACE = SERVICE +PATH = '/org/sugarlabs/ShareTerm' + +class SharedTerminalActivity(activity.Activity): + + def __init__(self, handle): + activity.Activity.__init__(self, handle) + + self._logger = logging.getLogger('shareterm-activity') + self._logger.debug('Starting the ShareTerm activity') + + self.set_title(_('ShareTerm Activity')) + self.connect('key-press-event', self.__key_press_cb) + + toolbox = activity.ActivityToolbox(self) + + self._edit_toolbar = activity.EditToolbar() + toolbox.add_toolbar(_('Edit'), self._edit_toolbar) + self._edit_toolbar.show() + self._edit_toolbar.undo.props.visible = False + self._edit_toolbar.redo.props.visible = False + self._edit_toolbar.separator.props.visible = False + self._edit_toolbar.copy.connect('clicked', self._copy_cb) + self._edit_toolbar.paste.connect('clicked', self._paste_cb) + + activity_toolbar = toolbox.get_activity_toolbar() + activity_toolbar.keep.props.visible = False + + self.set_toolbox(toolbox) + toolbox.show() + + box = gtk.HBox(False, 4) + + self._vte = VTE() + self._vte.set_scroll_on_keystroke(True) + self._vte.connect("child-exited", lambda term: self.close()) + + self._screenpid = None + self._sshdaemon = None + self._otherscreenpid = None + + if not self._shared_activity: #I am the initiator + suffix = "ShareTerm%d" % random.getrandbits(32) + os.putenv('SCREENDIR',os.path.join(os.getenv('HOME'),'.screen')) + + #I tried to use envv with fork_command here, but it causes the + #command to die without explanation. It seems to work without it, though. + self._screenpid = self._vte.fork_command(command='screen', + argv=['screen','-S',suffix, + '-c',os.path.join(activity.get_bundle_path(),'screenrc')]) + + #Don't show the screen until Screen is active + self._vte.show() + + #self._screenname = "%d.%s" % (self._screenpid, suffix) + #The above line would be the logical way to determine the screenname. + #Unfortunately, screen seems to fork before determining the pid to use here, + #so the name computed this way has the wrong pid. Therefore, we must instead + #search the list of existing screens for one matching our unique random + #suffix. + #Note that there will only be more than one screen for the current user + #if Rainbow is not running. + + L = subprocess.Popen(['screen','-list'],stdout=subprocess.PIPE) + r = re.compile(r"\s*((\d+)\.%s)" % suffix) + for line in L.stdout: + m = r.match(line) + if m is not None: + self._screenname = m.group(1) + self._otherscreenpid = int(m.group(2)) + + self._connected = True + self.connect('shared', self._shared_cb) + else: # I am joining + self._connected = False + if self.get_shared(): #Already joined for some reason + self._joined_cb() + else: + self.connect('joined', self._joined_cb) + + scrollbar = gtk.VScrollbar(self._vte.get_adjustment()) + scrollbar.show() + + box.pack_start(self._vte) + box.pack_start(scrollbar, False, False, 0) + + self.set_canvas(box) + box.show() + + self._vte.grab_focus() + + def _copy_cb(self, button): + if self._vte.get_has_selection(): + self._vte.copy_clipboard() + + def _paste_cb(self, button): + self._vte.paste_clipboard() + + def __key_press_cb(self, window, event): + if event.state & gtk.gdk.CONTROL_MASK and event.state & gtk.gdk.SHIFT_MASK: + + if gtk.gdk.keyval_name(event.keyval) == "C": + if self._vte.get_has_selection(): + self._vte.copy_clipboard() + return True + elif gtk.gdk.keyval_name(event.keyval) == "V": + self._vte.paste_clipboard() + return True + + return False + + def _sharing_setup(self): + # This section creates the authorized_keys file, containing the public key in + # question. This code must agree with sshd_config's AuthorizedKeysFile. + home = os.getenv('HOME') + self._sshdir = os.path.join(home,'.ShareTerm') + os.mkdir(self._sshdir) + os.chmod(self._sshdir,stat.S_IRWXU) + bundle_path = activity.get_bundle_path() + authkeys = os.path.join(self._sshdir,'authorized_keys') + shutil.copyfile(os.path.join(bundle_path,'userkey.pub'), authkeys) + os.chmod(authkeys,stat.S_IRUSR|stat.S_IWUSR) + + + params = {} + params['screenname'] = self._screenname + params['username'] = os.getenv('USER') + + port = 5000 + listening = False + while not listening: + #FIXME: assumes sshd is in /usr/bin/sshd. (Full path invocation is required + #by sshd when running as non-root.) + self._sshdaemon = subprocess.Popen(['/usr/sbin/sshd','-h',os.path.join(bundle_path,'hostkey'), + '-f',os.path.join(bundle_path,'sshd_config'), + '-p',str(port),'-D','-e'], stderr=subprocess.PIPE) + x = self._sshdaemon.stderr.readline() + #FIXME: The following is an ugly hack, in attempt to determine + #whether sshd successfully launched by observing its logging output. + # It would be better if sshd used a return code to indicate whether it + # had successfully daemonized or failed, but this does not seem to be + # the case. + success = 'Server listening' + if x[:len(success)] == success: + listening = True + else: #failure; the daemon will stop itself + self._sshdaemon.wait() + port += 1 + if port == 65536: + break #FIXME: What should happen here? + self._logger.debug('started sshd on port %d' % port) + + return (params, port) + + def _shared_cb(self, activity): + self._logger.debug('My activity was shared') + self.initiating = True + (params, port) = self._sharing_setup() + + self._logger.debug('This is my activity: making a tube...') + + address = ('127.0.0.1', dbus.UInt16(port)) + + tubes_chan = self._shared_activity.telepathy_tubes_chan + id = tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferStreamTube( + SERVICE, params, telepathy.SOCKET_ADDRESS_TYPE_IPV4, address, + telepathy.SOCKET_ACCESS_CONTROL_LOCALHOST, 0) + + def _joined_cb(self, also_self): + tubes_chan = self._shared_activity.telepathy_tubes_chan + + tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal('NewTube', + self._new_tube_cb) + tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes( + reply_handler=self._list_tubes_reply_cb, + error_handler=self._list_tubes_error_cb) + + def _new_tube_cb(self, tube_id, initiator, tube_type, service, params, state): + self._logger.debug('New Tube') + if ((tube_type == telepathy.TUBE_TYPE_STREAM) and + (service == SERVICE) and (not self._connected)): + tubes_chan = self._shared_activity.telepathy_tubes_chan + iface = tubes_chan[telepathy.CHANNEL_TYPE_TUBES] + addr = iface.AcceptStreamTube(tube_id, + telepathy.SOCKET_ADDRESS_TYPE_IPV4, + telepathy.SOCKET_ACCESS_CONTROL_LOCALHOST, 0) + + port = int(addr[1]) + username = str(params['username']) + screenname = str(params['screenname']) + bundle_path = activity.get_bundle_path() + + #self._vte.fork_command('ssh', '-l %s -F %s -p %d -i %s localhost' + # % (username, + # os.path.join(bundle_path,'ssh_config'), + # port, + # os.path.join(bundle_path,'userkey'))) + # I would prefer to use fork_command, but it doesn't seem to work here + # and I don't know why. + self._vte.feed_child("ssh -l %s -F %s -p %d -i %s localhost\n" + % (username, + os.path.join(bundle_path,'ssh_config'), + port, + os.path.join(bundle_path,'userkey'))) + # "SCREENDIR=" is necessary here because otherwise screen attempts to write + # to /var/run/screen, which is not permitted by Rainbow + self._vte.feed_child("SCREENDIR=$HOME/.screen screen -x %s\n" % screenname) + self._connected = True + # Now that we are connected and screen is up, we can show the screen + self._vte.show() + + def _list_tubes_reply_cb(self, tubes): + for tube_info in tubes: + self._new_tube_cb(*tube_info) + + def _list_tubes_error_cb(self, e): + self._logger.error('ListTubes() failed: %s' % e) + + def can_close(self): + #self._sshdaemon.terminate() #This requires 2.6, so we can't use it yet. + try: + os.kill(self._sshdaemon.pid,signal.SIGTERM) + except: + pass + try: + os.kill(self._screenpid,signal.SIGTERM) + except: + pass + try: + os.kill(self._otherscreenpid,signal.SIGTERM) + except: + pass + # Removing sshdir is only necessary in the absence of Rainbow, but in that case + # it has the potential to break if multiple ShareTerm sessions + # are in use simultaneously, and sshdir is deleted while still in use. + # The FIXME would be to use a randomly generated per-session sshdir, if we + # really care. + #try: + # shutil.rmtree(self._sshdir,ignore_errors=True) + #except: + # pass + return True + + +class VTE(vte.Terminal): + def __init__(self): + vte.Terminal.__init__(self) + self._configure_vte() + + os.chdir(os.environ["HOME"]) + self.fork_command() + + def _configure_vte(self): + conf = ConfigParser.ConfigParser() + conf_file = os.path.join(env.get_profile_path(), 'terminalrc') + + if os.path.isfile(conf_file): + f = open(conf_file, 'r') + conf.readfp(f) + f.close() + else: + conf.add_section('terminal') + + if conf.has_option('terminal', 'font'): + font = conf.get('terminal', 'font') + else: + font = 'Monospace 8' + conf.set('terminal', 'font', font) + self.set_font(pango.FontDescription(font)) + + if conf.has_option('terminal', 'fg_color'): + fg_color = conf.get('terminal', 'fg_color') + else: + fg_color = '#000000' + conf.set('terminal', 'fg_color', fg_color) + if conf.has_option('terminal', 'bg_color'): + bg_color = conf.get('terminal', 'bg_color') + else: + bg_color = '#FFFFFF' + conf.set('terminal', 'bg_color', bg_color) + self.set_colors(gtk.gdk.color_parse (fg_color), + gtk.gdk.color_parse (bg_color), + []) + + if conf.has_option('terminal', 'cursor_blink'): + blink = conf.getboolean('terminal', 'cursor_blink') + else: + blink = False + conf.set('terminal', 'cursor_blink', blink) + + self.set_cursor_blinks(blink) + + if conf.has_option('terminal', 'bell'): + bell = conf.getboolean('terminal', 'bell') + else: + bell = False + conf.set('terminal', 'bell', bell) + self.set_audible_bell(bell) + + if conf.has_option('terminal', 'scrollback_lines'): + scrollback_lines = conf.getint('terminal', 'scrollback_lines') + else: + scrollback_lines = 1000 + conf.set('terminal', 'scrollback_lines', scrollback_lines) + + self.set_scrollback_lines(scrollback_lines) + self.set_allow_bold(True) + + if conf.has_option('terminal', 'scroll_on_keystroke'): + scroll_key = conf.getboolean('terminal', 'scroll_on_keystroke') + else: + scroll_key = False + conf.set('terminal', 'scroll_on_keystroke', scroll_key) + self.set_scroll_on_keystroke(scroll_key) + + if conf.has_option('terminal', 'scroll_on_output'): + scroll_output = conf.getboolean('terminal', 'scroll_on_output') + else: + scroll_output = False + conf.set('terminal', 'scroll_on_output', scroll_output) + self.set_scroll_on_output(scroll_output) + + if conf.has_option('terminal', 'emulation'): + emulation = conf.get('terminal', 'emulation') + else: + emulation = 'xterm' + conf.set('terminal', 'emulation', emulation) + self.set_emulation(emulation) + + if conf.has_option('terminal', 'visible_bell'): + visible_bell = conf.getboolean('terminal', 'visible_bell') + else: + visible_bell = False + conf.set('terminal', 'visible_bell', visible_bell) + self.set_visible_bell(visible_bell) + conf.write(open(conf_file, 'w')) + + def on_gconf_notification(self, client, cnxn_id, entry, what): + self.reconfigure_vte() + + def on_vte_button_press(self, term, event): + if event.button == 3: + self.do_popup(event) + return True + + def on_vte_popup_menu(self, term): + pass diff --git a/userkey b/userkey new file mode 100644 index 0000000..db28894 --- /dev/null +++ b/userkey @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEAsBFJhEJUds8aHHqtAC68jJ0mWofWQJpnl092ANRczPCSevNE +5YZTsM2K21U40rqElllhF0gjYL3f5T5T3d7EovHXfDv3LDwsfMMUyjNfuNDB1MC3 +BAbJrt9n0UXIkotgu7c+SZhy/JoCnUHntj/6y6ScReOxZBhtTnLN6D9DWX63XlRw +tOEXgJN+xrGtSGCZSfv6+yjbe6YP4lBCta34s0Efl3tz1t4GaiPaXZpdenywm0YU +iHIyBOiUuKAZCjJj//NJhMxJbWf4Q7KYt4qAzDGPyH3r/m/W5INkbYpvNu6Y2dfc +OBOGMCTUpypRwc2FteH/4Iws3RMu4XDFtdERmQIBIwKCAQAtRkYasfh2UoMOozPM +2NFl/IY0iVRZwU3Wc4S+Yn5DU83lGfvF/fhDaA3DXw6cllybsJVPIS2rKYK3SoqY +I1cilfWU+XoSsGM2Bkcsrh/tsgX04RkeSuNne0aU5g8BHIaWq3ZqsiwyU30D3b89 +fiqMIwOc8WghDZhzQhewv899aUyxIxicEh4kV9NTzRegRkCmZ9N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.pub b/userkey.pub new file mode 100644 index 0000000..11d0c67 --- /dev/null +++ b/userkey.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAsBFJhEJUds8aHHqtAC68jJ0mWofWQJpnl092ANRczPCSevNE5YZTsM2K21U40rqElllhF0gjYL3f5T5T3d7EovHXfDv3LDwsfMMUyjNfuNDB1MC3BAbJrt9n0UXIkotgu7c+SZhy/JoCnUHntj/6y6ScReOxZBhtTnLN6D9DWX63XlRwtOEXgJN+xrGtSGCZSfv6+yjbe6YP4lBCta34s0Efl3tz1t4GaiPaXZpdenywm0YUiHIyBOiUuKAZCjJj//NJhMxJbWf4Q7KYt4qAzDGPyH3r/m/W5INkbYpvNu6Y2dfcOBOGMCTUpypRwc2FteH/4Iws3RMu4XDFtdERmQ== olpc@xo-14-4C-34.localdomain -- cgit v0.9.1