1
0
Fork 0
mirror of https://github.com/RobotechLille/cdf2018-principal synced 2024-11-21 23:56:04 +01:00

Remote connection via PPPoE

This commit is contained in:
Geoffrey Frogeye 2018-04-29 21:56:15 +02:00
parent ad736b1a0e
commit 832306706d
4 changed files with 27 additions and 10 deletions

View file

@ -6,6 +6,8 @@ upgrade-all: upgrade-chef upgrade-arduino upgrade-fpga upgrade-filesystem
# Périphérique bloc à utiliser pour flasher # Périphérique bloc à utiliser pour flasher
SDCARD=/dev/mmcblk0 SDCARD=/dev/mmcblk0
CON_MODE=wifi
ETH_IFACE=enp3s0
# SYSTÈME D'EXPLOITATION # SYSTÈME D'EXPLOITATION
@ -50,7 +52,12 @@ graphs:
# Crée un fichier de conf utilisable pour s'y connecter # Crée un fichier de conf utilisable pour s'y connecter
sshconf: principalconf.sh sshconf: principalconf.sh
ifeq ($(CON_MODE), eth)
source $$PWD/$<; echo -e "Host principal p\n User root\n Hostname $$ETHADDRESS\n PreferredAuthentications publickey\n PubkeyAuthentication yes\n IdentityFile \"$$PWD/sshkey\"" > "$@"
source $$PWD/$<; sudo ip address add dev $(ETH_IFACE) $${ETHPEER}/20 peer $${ETHADDRESS}
else
source $$PWD/$<; echo -e "Host principal p\n User root\n Hostname $$ADDRESS\n PreferredAuthentications publickey\n PubkeyAuthentication yes\n IdentityFile \"$$PWD/sshkey\"" > "$@" source $$PWD/$<; echo -e "Host principal p\n User root\n Hostname $$ADDRESS\n PreferredAuthentications publickey\n PubkeyAuthentication yes\n IdentityFile \"$$PWD/sshkey\"" > "$@"
endif
source $$PWD/$<; echo -e "$$SSHCPRV" > sshkey source $$PWD/$<; echo -e "$$SSHCPRV" > sshkey
chmod 600 sshkey chmod 600 sshkey
@ -72,10 +79,12 @@ reboot: sshconf
upgrade-filesystem: sshconf configure upgrade-filesystem: sshconf configure
make -C buildroot target-finalize make -C buildroot target-finalize
@# TODO Récupérer les ACL plutot que de mettre tous les fichiers en root @# TODO Récupérer les ACL plutot que de mettre tous les fichiers en root
ssh -F sshconf principal true
rsync --rsh 'ssh -F sshconf' --archive --chown root:root buildroot/output/target/ principal:/ rsync --rsh 'ssh -F sshconf' --archive --chown root:root buildroot/output/target/ principal:/
# Met jour les overlays (une partie des fichiers) # Met jour les overlays (une partie des fichiers)
upgrade-overlays: sshconf upgrade-overlays: sshconf
ssh -F sshconf principal true
rsync --rsh 'ssh -F sshconf' --archive --chown root:root robotech/chef/rootfs_overlay/ principal:/ rsync --rsh 'ssh -F sshconf' --archive --chown root:root robotech/chef/rootfs_overlay/ principal:/
# ARDUINO # ARDUINO
@ -97,5 +106,6 @@ chef:
upgrade-chef: chef upgrade-chef: chef
make -C buildroot chef-reinstall make -C buildroot chef-reinstall
ssh -F sshconf principal true
rsync --rsh 'ssh -F sshconf' --archive --chown root:root buildroot/output/target/opt/chef principal:/opt/ rsync --rsh 'ssh -F sshconf' --archive --chown root:root buildroot/output/target/opt/chef principal:/opt/

View file

@ -11,11 +11,17 @@ then
# Network configuration # Network configuration
echo -e " echo -e "
auto eth0
iface eth0 inet static
address ${ETHADDRESS}
netmask 255.255.255.0
peer ${ETHPEER}
gateway ${ETHPEER}
auto wlan0 auto wlan0
iface wlan0 inet static iface wlan0 inet dhcp
address $ADDRESS pre-up wpa_supplicant -D wext -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -P /var/run/wpa_supplicant.pid
netmask $NETMASK pre-down start-stop-daemon -K -q -p /var/run/wpa_supplicant.pid
gateway $GATEWAY
" >> ${TARGET_DIR}/etc/network/interfaces " >> ${TARGET_DIR}/etc/network/interfaces
# SSH configuration # SSH configuration

View file

@ -7,15 +7,12 @@ start() {
printf "Starting Wi-Fi connection: " printf "Starting Wi-Fi connection: "
# modprobe brcmfmac # modprobe brcmfmac
modprobe r8188eu modprobe r8188eu
ip link set wlan0 up
wpa_supplicant -D wext -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -P /var/run/wpa_supplicant.pid
ifup wlan0 ifup wlan0
echo "OK" echo "OK"
} }
stop() { stop() {
printf "Stopping Wi-Fi connection: " printf "Stopping Wi-Fi connection: "
start-stop-daemon -K -q -p /var/run/wpa_supplicant.pid
ifdown wlan0 ifdown wlan0
# rmmod brcmfmac # rmmod brcmfmac
rmmod r8188eu rmmod r8188eu

View file

@ -1,11 +1,15 @@
WPASSID="MySSID" WPASSID="MySSID"
WPAKEYMGMT="WPA-PSK" WPAKEYMGMT="WPA-PSK"
WPAPSK=mypassword WPAPSK=mypassword
ADDRESS=192.168.1.42 ADDRESS=192.168.43.126
NETMASK=255.255.255.0 NETMASK=255.255.255.0
GATEWAY=192.168.1.1 GATEWAY=192.168.43.1
ETHADDRESS=192.168.82.80
ETHPEER=192.168.82.65
SSHCPUB="ecdsa-sha2-nistp256 ... principal@robotech" SSHCPUB="ecdsa-sha2-nistp256 ... principal@robotech"
SSHCPRV="-----BEGIN EC PRIVATE KEY----- SSHCPRV="-----BEGIN EC PRIVATE KEY-----
... ...
-----END EC PRIVATE KEY-----" -----END EC PRIVATE KEY-----"
SSHSPRV="..." SSHSPRV="AAAAE2VjZHNhLXNo...