Author Topic: Best Way To Transfer Files To The Z Over A Netwok  (Read 87862 times)

Da_Blitz

  • Hero Member
  • *****
  • Posts: 1579
    • View Profile
    • http://www.pocketnix.org
Best Way To Transfer Files To The Z Over A Netwok
« Reply #15 on: February 14, 2007, 09:22:57 pm »
firewalling is your best option if its by ip adress but i use and recomend public key crypto for this

give yourself about 30mins and read up on it, set it up on your ubuntu box and you will find that you will never use the user:pass combo again

i use passwords on my private keys so that i can keep them on a flashdisk so i also use ssh-agent which is greaat once you work out that to exectute it is eval `ssh-keychain`

that wont work on multiple shells, if you want somthing that will allow you to use your ssh keys for every xterm you open then i recomend getting a prog named keychain and using that, gentoo has the best docs on thier page for it (they wrote it) but it helps preserve the settings between shell launches. you might have to add it to your bashrc file

just ignore my rambeleing, the best reason to use it is that i only have to type my password for my private keys once and then every ssh session is password less or can optionally pop up a dialog box asking for permission under X

would anyone like me to start up a therad on ssh, i have found some stuff recentlly that is little used (such as connection sharing which speeds up the login delay to under a second) and proper keymanagment/generation and such + how to disable all authentication methods but public key and optionally krb5 while still using PAM for session managment and accounting (normally you have to leave passphrase authentication on to do this)
Personal Blog
Code
Twitter

Gemini Order: #95 (roughly)
Current Device: Samsung Chromebook Gen 3
Current Arm Devices Count: ~30
Looking to acquire: Cavium Thunder X2 Hardware

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Best Way To Transfer Files To The Z Over A Netwok
« Reply #16 on: February 15, 2007, 11:10:08 am »
That's exactly what I want to do. You get a new key every time you open a terminal? Or is that just for moving your key around to different computers? I'm assuming that it is, because it seems that the Z only generates a rsa/dsa key pair the first time it boots after flashing.

Could somebody just tell me what file/strings I need to copy from where to where? I sadly haven't really gleaned that info yet.

Thanks.
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

Da_Blitz

  • Hero Member
  • *****
  • Posts: 1579
    • View Profile
    • http://www.pocketnix.org
Best Way To Transfer Files To The Z Over A Netwok
« Reply #17 on: February 16, 2007, 06:28:19 am »
the rsa/dsa key generation is only for identifing the host. not for logging in

to log in you need to generate a key and put half of it (the public half) on the server you want to log into and the rest  (the private part) somewhere safe.

i put my keys on a flashdisk. this is not that safe as anyone can read a flashdisk when its plugged in (unless you tweak /prooc/usb for a multihead setup so that some users get acsess to some usb port, i havent tested that) i do keep them encrypted so that they need to be decrypted in ram so that no one else can just copy them off unlsess they are root. they could do a offline attack however but thats beyond the scope of this post

so you want to genetare a rsa key pair. well go somewhere on your fs thats "clean" or create a folder and change your current dir to there (cmd line here) and run ssh-keygen.

follow the prompts. i recomend you change the name. it isnt a requirement but i dont want to clober my keys in the futre. i also generate a diffrent key for each host i use however the added benifits of this are slight. it dosent cost me however so i do it. ill come back to that latter

well i suppose you entered a name instead of a path for the keyfile which is what you would want if you want the files in the current directory. if not for the rest of this tut the keys are in your .ssh folder it your /home dir

now the fun part. you have to get the <key file>.pub to your Z somehow. eaist way is to log in via ssh like this. cat <path to public key> | ssh <user>@<host> "touch ~/.ssh/authorized_keys | tee !$"

what i did is cat the public key, pipe that as standard input to ssh. on the Z what happens is ssh logs in, creates the authorised keys file if its not been created and takes the standard input from the box you are working on and adds it to the allowed keys for this user list

congratulations you are now half way there

ok now you half to execute "eval `ssh-agent`" (note the backticks, we need a shell for ssh-agent) OR "eval $((ssh-agent))" which is the posix version (its a history lesson kids )

this launches a authentication proxy for you. its goal is to collect your ssh keys and store them. not that handy if you didnt put a password on your key (shame on you) but really handy if you did as you only have to type the pass once.

add the private key with ssh-add <path to private key> (the one without .pub).

now ssh into your box . it shouldnt ask for a password

this is just stage one. you can take it futher if you want and i am willing to write the guides if someone wants it. as i have stated before it mainly increses security by disabling 3des encryption and using blowfish or AES-256-cbc, adds session sharing (poor mans ssh-agent and faster loging times as well as less conections) and compresion of everything thats goes throgh the link (best on slow WANs, some people like to only do it manually but i fuigure it dosent hurt unless you are doing file transfer to somthing without much cpu grunt like the Z over usb)

also a guide to allowingpublic key logins and hardeneing your ssh server could be written too if i am up to it and there is demand

now back to some issues, i use 1 key per srever. you can use the one id for every server if you wish however i like it my way as when i am on a windows PC i can give it only the certs i need to get the job done so if someone reads its mem they wont get all the keys

the other hand reason is that it makes ssh-agent proxying alot safer, if you create a seperate ssh-keychain instance with only node B and node C (if you are on A and can only see B but B can see C) then you only add 2 keys and you can enable fowarding to your hearts content knowing thatnot every server you can connect to will be comprimised if someone has hacked that box (as only B and Cs keys have been put on the keychain

just aquick word about the proxy thing, that means when you logg into B from A, B can reuse the ssh-keychain and the keys on its keychain to log into C without a password, if the kys to D were on it and the bok got hacked then someone with your privs or root could then tell a ssh session to authenticate to the ssh-agent onA to log into D

confused?, i know i was. it clicks once you have mastered the basics

you might want to try X fowarding, add -X to your ssh prog (ie ssh -X <user>@<host>. now any X app on your Z will run on you PCs monitor, but exectue on the Z. makes editing text files fun and is best used with a usb flashdisk with putty and an X server on it. meaning you can do stuff on your work pc knowing that the progs on the Z (security) or that the data is on your Z (portability). it also means you then get cross platform compatability as you then have an X server for nearly evrey OS on the market (macos, unix and clones, windows)

might tell you about the "revers ssh" that i suggested else where to bypass a firewall, basically its a good use of port fowarding.

you connect the port on a machine A (the Z for eg) that connects to ssh (127.0.0.1:22) to a port on a remote machine (eg 2222), you then ssh into port 2222 on the proxy machine © from your PC (. this will mean that you have just ssh'd into the Z (ssh from B to C, then wrap it in another ssh session and onto A)

note that thats cpu intensive as it does 2 ssh sessions. B (your laptop) and C (the proxy) will only do one but A (the Z) will have to do 2 of them. this can kill a Z if transfering files but is fine for ssh work. not sure about X as i never did any bandwidth testing on it but pretend its a 8mbit linx (overhead) with near lan latency (near lan because ssh add latency, even more so when overloaded)
Personal Blog
Code
Twitter

Gemini Order: #95 (roughly)
Current Device: Samsung Chromebook Gen 3
Current Arm Devices Count: ~30
Looking to acquire: Cavium Thunder X2 Hardware

Meanie

  • Hero Member
  • *****
  • Posts: 2803
    • View Profile
    • http://www.users.on.net/~hluc/myZaurus/
Best Way To Transfer Files To The Z Over A Netwok
« Reply #18 on: February 16, 2007, 07:18:06 am »
wow, you wrote half an essay
SL-C3000 - pdaXii13 build5.4.9 (based on pdaXrom beta3) / SL-C3100 - Sharp ROM 1.02 JP (heavily customised)
Netgear MA701 CF, SanDisk ConnectPlus CF, Socket Bluetooth CF, 4GB Kingston CF,  4GB pqi SD, 4GB ChoiceOnly SD, 2GB SanDisk SD USB Plus, 1GB SanDisk USB Plus, 1GB Transcend SD, 2GB SanDisk MicroSD with SD adaptor, Piel Frama Leather Case, GoldX 5-in-1 USB cable, USB hub, USB mouse, USB keyboard, USB ethernet, USB HDD, many other USB accessories...
(Zaurus SL-C3000 owner since March 14. 2005, Zaurus SL-C3100 owner since September 21. 2005)
http://members.iinet.net.au/~wyso/myZaurus - zBook3K

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Best Way To Transfer Files To The Z Over A Netwok
« Reply #19 on: February 18, 2007, 07:00:35 pm »
OK, I have this set up, but I want my server to block all SSH requests except from those in the authorized_keys file. I searched, but I can't figure out how to do it. Could somebody help here as well?

Oh, and thanks for the essay! It was very helpful.
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3706
    • View Profile
Best Way To Transfer Files To The Z Over A Netwok
« Reply #20 on: February 19, 2007, 05:00:57 am »
Quote
OK, I have this set up, but I want my server to block all SSH requests except from those in the authorized_keys file. I searched, but I can't figure out how to do it. Could somebody help here as well?[div align=\"right\"][a href=\"index.php?act=findpost&pid=154617\"][{POST_SNAPBACK}][/a][/div]


have a look in your sshd_config file and turn off password encryption like this:
Code: [Select]
PasswordAuthentication no
you probably also want
Code: [Select]
PermitEmptyPasswords no
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

Da_Blitz

  • Hero Member
  • *****
  • Posts: 1579
    • View Profile
    • http://www.pocketnix.org
Best Way To Transfer Files To The Z Over A Netwok
« Reply #21 on: February 19, 2007, 05:44:44 am »
that looks about right but my config has:

Code: [Select]
UsePAM yes
ChallengeResponseAuthentication no
PermitEmptyPasswords no
PasswordAuthentication no

the challenge response has to do with PAM password authentication, whereas i am using PAM for the session and accounting rather than session, accounting and password.

basically it means you can use the pam rlimits, sourcing a file, login between certin time stuff. the good stuff of pam that dosent deal with passwords (and that many people dont relise it does)
Personal Blog
Code
Twitter

Gemini Order: #95 (roughly)
Current Device: Samsung Chromebook Gen 3
Current Arm Devices Count: ~30
Looking to acquire: Cavium Thunder X2 Hardware

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Best Way To Transfer Files To The Z Over A Netwok
« Reply #22 on: February 19, 2007, 09:18:13 am »
It's now working, my Ubuntu box will block all computers except my Z, and I don't need a password for that.

Thanks for your help!
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

Da_Blitz

  • Hero Member
  • *****
  • Posts: 1579
    • View Profile
    • http://www.pocketnix.org
Best Way To Transfer Files To The Z Over A Netwok
« Reply #23 on: February 20, 2007, 02:17:28 am »
dont know if you have your ubuntu box connected to the net but mine gets about 100 attempts to log in via ssh, the usual suspects, root, nobody,mail, ftp, http and such all with no password.

so as you can see it can be a good idea to just use keys as it means if i did accedentially not put a password on an account and you could login localy with it it wouldnt allow ssh to let you in as there is no authorized keys ifle for that account

security always pays off in the end
Personal Blog
Code
Twitter

Gemini Order: #95 (roughly)
Current Device: Samsung Chromebook Gen 3
Current Arm Devices Count: ~30
Looking to acquire: Cavium Thunder X2 Hardware

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3706
    • View Profile
Best Way To Transfer Files To The Z Over A Netwok
« Reply #24 on: February 20, 2007, 06:29:07 am »
Since I tried iptables firewalling more than I trust ssh daemon, I don't allow anything to connect to ssh from world, and then I use "port knocking" to open a hole in the firewall for the IP I am knocking from... I can then connect over ssh and secure-imap.

That means in order to break in there must be a failure in iptables and also sshd.

See my website http://www.zaurus.org.uk/portknocking.html for details
get the download for my fixed "barricade" ping-knocking s/w at http://www.zaurus.org.uk/download/barricad...0.0-PADM.tar.gz
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

Capn_Fish

  • Hero Member
  • *****
  • Posts: 2342
    • View Profile
    • http://
Best Way To Transfer Files To The Z Over A Netwok
« Reply #25 on: February 20, 2007, 07:46:25 am »
Quote
dont know if you have your ubuntu box connected to the net but mine gets about 100 attempts to log in via ssh, the usual suspects, root, nobody,mail, ftp, http and such all with no password.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154738\"][{POST_SNAPBACK}][/a][/div]
How do you tell how many times somebody tried to login with SSH?
SL-C750- pdaXrom beta 1 (mostly unused)
Current distro: Gentoo

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3706
    • View Profile
Best Way To Transfer Files To The Z Over A Netwok
« Reply #26 on: February 20, 2007, 09:26:42 am »
Quote
How do you tell how many times somebody tried to login with SSH?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154765\"][{POST_SNAPBACK}][/a][/div]

hmm, let me look at my firewall log, this file active since Jan 30 @21:01
# cd /var/log
# grep EXT-Drop | grep DPT=22 firewall | wc -l
113

so, about five or six times a day someone's probed my sshd (!)

for the same 21 day period I've had 15253 drops logged.
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

desertrat

  • Hero Member
  • *****
  • Posts: 743
    • View Profile
    • http://
Best Way To Transfer Files To The Z Over A Netwok
« Reply #27 on: February 20, 2007, 10:48:16 am »
One thing worth adding to /etc/ssh/sshd_config is
Code: [Select]
AllowUsers sometrusteduserThis will allow only sometrusteduser to login.
SL-C3100 / Ambicon WL1100C-CF / pdaXrom 1.1.0beta3 / IceWM

speculatrix

  • Administrator
  • Hero Member
  • *****
  • Posts: 3706
    • View Profile
Best Way To Transfer Files To The Z Over A Netwok
« Reply #28 on: February 20, 2007, 11:36:22 am »
Quote
One thing worth adding to /etc/ssh/sshd_config is
Code: [Select]
AllowUsers sometrusteduserThis will allow only sometrusteduser to login.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=154786\"][{POST_SNAPBACK}][/a][/div]

also consider running sshd on a different port, e.g. 222, as this cuts down the number of attempted probes very significantly.

on the Z you have to change inetd.conf (for cacko at least) doesn't run sshd as a daemon but only via inetd.
Gemini 4G/Wi-Fi owner, formerly zaurus C3100 and 860 owner; also owner of an HTC Doubleshot, a Zaurus-like phone.

zmiq2

  • Sr. Member
  • ****
  • Posts: 383
    • View Profile
    • http://
Best Way To Transfer Files To The Z Over A Netwok
« Reply #29 on: February 20, 2007, 12:25:11 pm »
Hi speculatix, in

Quote
See my website http://www.zaurus.org.uk/portknocking.html for details

you mention that


Quote
The advantage of using ping is that its much easier to set up the client - nearly every linux x86 PC has the required software already installed. For the Zaurus (Cacko at least) and Windows, the standard ping program doesn't work because they don't support the required options to insert a character string password into the ping datagram; however, just install hping2 on the Zaurus and it works. It also means that if you're using a guest computer, there's a good chance you can run ping!

which doesn't make sense to me: if you need hping2 as a client, because normal ping doesn't work, you cannot use ping on a guest computer

Nice web, btw
sl-c750, archos av580, socket cf [bt, wifi, modem], noname cf lan, audiovox rtm800 gsm-gprs cf, rom: sharp -> oz3.5.3 -> cacko -> oz3.5.4.1