Compare commits

...

7 Commits
3.0.1 ... 3.1.0

Author SHA1 Message Date
f74dba7ff0 enforce ascending writes in bootloader update 2020-02-06 13:05:57 -05:00
794accf3dc Added how to setup Manjaro 18.x.
Added Manjaro setup for passwordless and second factor login to
documentation of applcation ideas. Also did some text formating.
2020-02-06 12:47:36 -05:00
2ca0ced808 Update programming.md 2020-01-22 12:41:39 -05:00
17b430fd44 Remove stale python-fido2 dependency 2020-01-16 10:35:22 +01:00
0d4197fb2c Merge pull request #356 from jnaulty/jnaulty/no-root-artifacts
Use current user at build container runtime
2020-01-15 21:17:53 +01:00
f74a77d80b Use current user at build container runtime
Using the current user id and group removes the need to use `sudo` when
cleaning up build artifacts from the docker build stage.

Issue: #355
2020-01-06 01:55:47 -08:00
5f1d61a3ba bump 2019-12-01 18:25:45 -05:00
6 changed files with 89 additions and 27 deletions

View File

@ -103,6 +103,7 @@ uncached-docker-build-toolchain:
docker-build-all: docker-build-all:
docker run --rm -v "$(CURDIR)/builds:/builds" \ docker run --rm -v "$(CURDIR)/builds:/builds" \
-v "$(CURDIR):/solo" \ -v "$(CURDIR):/solo" \
-u $(shell id -u ${USER}):$(shell id -g ${USER}) \
$(DOCKER_TOOLCHAIN_IMAGE) "solo/in-docker-build.sh" ${SOLO_VERSION_FULL} $(DOCKER_TOOLCHAIN_IMAGE) "solo/in-docker-build.sh" ${SOLO_VERSION_FULL}
CPPCHECK_FLAGS=--quiet --error-exitcode=2 CPPCHECK_FLAGS=--quiet --error-exitcode=2

View File

@ -1 +1 @@
3.0.0 3.0.1

View File

@ -1,16 +1,23 @@
# Using Solo for passwordless or second factor login on Linux # Using Solo for passwordless or second factor login on Linux
## Setup on Ubuntu 18.04 ## Setup on Ubuntu and Manjaro
Before you can use Solo for passwordless or second factor login in your Linux system you have to install some packages. Before you can use Solo for passwordless or second factor login in your Linux system you have to install some packages.
This was tested under **Linux Mint 19.2**. This was tested on **Linux Mint 19.3** and on **Manjaro 18.x**
First you have to install PAM modules for u2f. First you have to install PAM modules for u2f.
**Ubuntu (Linux Mint):**
``` ```
sudo apt install libpam-u2f pamu2fcfg sudo apt install libpam-u2f pamu2fcfg
``` ```
**Manjaro**
```
pacman -Syu pam-u2f
```
## Setting up key ## Setting up key
To use Solo as passwordless or second factor login, you have to setup your system with your Solo. To use Solo as passwordless or second factor login, you have to setup your system with your Solo.
First create a new folder named **Yubico** in your **.config** folder in your **home** directory First create a new folder named **Yubico** in your **.config** folder in your **home** directory
@ -28,25 +35,30 @@ If you want to register an additional key use this command instead:
pamu2fcfg >> ~/.config/Yubico/u2f_keys pamu2fcfg >> ~/.config/Yubico/u2f_keys
``` ```
Now press the button on your Solo. Now press the button on your Solo.
<br>
<br>
If you can't generate your key on **Ubuntu** (error message), you may add Yubico Team from PPA and install latest libpam-u2f and pamu2fcfg and try again.
If you can't generate your key (error message), you may add Yubico Team from PPA and install latest libpam-u2f and pamu2fcfg and try again.
``` ```
sudo add-apt-repository ppa:yubico/stable sudo add-apt-repository ppa:yubico/stable
sudo apt-get update sudo apt-get update
sudo apt-get upgrade sudo apt-get upgrade
``` ```
**Manjaro** should work without problems.
## Login into Linux ## Login into Linux
### Passwordless ### Passwordless
To login passwordless into your Linux system, you have to edit the file **lightdm** (or **gdm** or which display manager you prefered). To login passwordless into your Linux system, you have to edit the file **lightdm** (or **gdm** or which display manager you prefered).
In case of lightdm: In case of lightdm and VIM as editor:
``` ```
sudo vim /etc/pam.d/lightdm sudo vim /etc/pam.d/lightdm
``` ```
Now search following entry:
**On Ubuntu:**<br>
Search following entry:
``` ```
@include common-auth @include common-auth
``` ```
@ -54,9 +66,26 @@ and add
``` ```
auth sufficient pam_u2f.so auth sufficient pam_u2f.so
``` ```
**before** @include common-auth. **before** *@include common-auth.*
<br>
<br>
Save the file and test it.<br> **On Manjaro**<br>
Search following enrty
```
auth include system-login
```
and add
```
auth sufficient pam_u2f.so
```
** before** *auth include system-login*.
<br>
<br>
Now save the file and test it.<br>
Insert Solo in your USB port and logout. Insert Solo in your USB port and logout.
Now you should be able to login into Linux without password, only with pressing your button on Solo and press enter. Now you should be able to login into Linux without password, only with pressing your button on Solo and press enter.
@ -65,7 +94,7 @@ Why **sufficient**? The difference between the keyword sufficient and required i
The login mechanism can be also used for additional features like: The login mechanism can be also used for additional features like:
: - Login after screen timeout - edit /etc/pam.d/mate-screensaver (or kde-screensaver, ...) - Login after screen timeout - edit /etc/pam.d/mate-screensaver (or kde-screensaver, ...)
- Passwordless sudo - edit /etc/pam.d/sudo - Passwordless sudo - edit /etc/pam.d/sudo
Check out your folder **/etc/pam.d/** and do some experiments. Check out your folder **/etc/pam.d/** and do some experiments.
@ -80,7 +109,9 @@ To use Solo as second factor, for login into your Linux system, is nearly the sa
``` ```
sudo vim /etc/pam.d/lightdm sudo vim /etc/pam.d/lightdm
``` ```
Now search following entry:
**On Ubuntu**<br>
Search following entry:
``` ```
@include common-auth @include common-auth
``` ```
@ -88,7 +119,24 @@ and add
``` ```
auth required pam_u2f.so auth required pam_u2f.so
``` ```
**after** @include common-auth. **after** *@include common-auth*.
<br>
<br>
**On Manjaro**<br>
Search following entry:
```
auth include system-login
```
Add following entry
```
auth required pam_u2f.so
```
**after** *auth include system-login*.
<br>
<br>
Save the file and test it. <br> Save the file and test it. <br>
In case your Solo is not present, your password will be incrorrect. If Solo is plugged into your USB port, it will signal pressing the button and you will be able to login into Linux. In case your Solo is not present, your password will be incrorrect. If Solo is plugged into your USB port, it will signal pressing the button and you will be able to login into Linux.

View File

@ -36,9 +36,13 @@ So it's important to not mess this up or you may brick your device.
You can use a firmware build from the [latest release](https://github.com/solokeys/solo/releases) or use You can use a firmware build from the [latest release](https://github.com/solokeys/solo/releases) or use
a build that you made yourself. a build that you made yourself.
You need to use a firmware file that has the combined bootloader and application (or at the very least just the bootloader). You need to use a firmware file that has the combined bootloader, application, and attestation key pair (bootloader + firmware + key).
This means using the `bundle-*.hex` file or the `bundle.hex` from your build. If you overwrite the Solo flash with a missing bootloader, This means using the `bundle-*.hex` file or the `bundle.hex` from your build.
it will be bricked.
#### *Warning*
* **If you overwrite the Solo flash with a missing bootloader, it will be bricked**.
* **If you program bootloader and firmware with no attestation, you will run into FIDO registration issues**
We provide two types of bundled builds. The `bundle-hacker-*.hex` build is the hacker build. If you update with this, We provide two types of bundled builds. The `bundle-hacker-*.hex` build is the hacker build. If you update with this,
you will update the bootloader and application, but nothing will be secured. The `bundle-secure-non-solokeys.hex` you will update the bootloader and application, but nothing will be secured. The `bundle-secure-non-solokeys.hex`

View File

@ -50,12 +50,15 @@ typedef struct {
uint8_t payload[255 - 10]; uint8_t payload[255 - 10];
} __attribute__((packed)) BootloaderReq; } __attribute__((packed)) BootloaderReq;
uint8_t * last_written_app_address;
/** /**
* Erase all application pages. **APPLICATION_END_PAGE excluded**. * Erase all application pages. **APPLICATION_END_PAGE excluded**.
*/ */
static void erase_application() static void erase_application()
{ {
int page; int page;
last_written_app_address = (uint8_t*) APPLICATION_START_ADDR;
for(page = APPLICATION_START_PAGE; page < APPLICATION_END_PAGE; page++) for(page = APPLICATION_START_PAGE; page < APPLICATION_END_PAGE; page++)
{ {
flash_erase_page(page); flash_erase_page(page);
@ -106,7 +109,6 @@ int is_bootloader_disabled()
uint32_t * auth = (uint32_t *)(AUTH_WORD_ADDR+4); uint32_t * auth = (uint32_t *)(AUTH_WORD_ADDR+4);
return *auth == 0; return *auth == 0;
} }
uint8_t * last_written_app_address;
#include "version.h" #include "version.h"
bool is_firmware_version_newer_or_equal() bool is_firmware_version_newer_or_equal()
@ -116,7 +118,7 @@ bool is_firmware_version_newer_or_equal()
current_firmware_version.major, current_firmware_version.minor, current_firmware_version.patch, current_firmware_version.reserved, current_firmware_version.major, current_firmware_version.minor, current_firmware_version.patch, current_firmware_version.reserved,
current_firmware_version.major, current_firmware_version.minor, current_firmware_version.patch, current_firmware_version.reserved current_firmware_version.major, current_firmware_version.minor, current_firmware_version.patch, current_firmware_version.reserved
); );
volatile version_t * new_version = ((volatile version_t *) last_written_app_address); volatile version_t * new_version = ((volatile version_t *) (last_written_app_address-8+4));
printf1(TAG_BOOT,"Uploaded firmware version: %u.%u.%u.%u (%02x.%02x.%02x.%02x)\r\n", printf1(TAG_BOOT,"Uploaded firmware version: %u.%u.%u.%u (%02x.%02x.%02x.%02x)\r\n",
new_version->major, new_version->minor, new_version->patch, new_version->reserved, new_version->major, new_version->minor, new_version->patch, new_version->reserved,
new_version->major, new_version->minor, new_version->patch, new_version->reserved new_version->major, new_version->minor, new_version->patch, new_version->reserved
@ -170,6 +172,7 @@ int bootloader_bridge(int klen, uint8_t * keyh)
uint32_t addr = ((*((uint32_t*)req->addr)) & 0xffffff) | 0x8000000; uint32_t addr = ((*((uint32_t*)req->addr)) & 0xffffff) | 0x8000000;
uint32_t * ptr = (uint32_t *)addr; uint32_t * ptr = (uint32_t *)addr;
uint32_t current_address;
switch(req->op){ switch(req->op){
case BootWrite: case BootWrite:
@ -196,9 +199,16 @@ int bootloader_bridge(int klen, uint8_t * keyh)
printf2(TAG_ERR, "Error, boot check bypassed\n"); printf2(TAG_ERR, "Error, boot check bypassed\n");
exit(1); exit(1);
} }
current_address = addr + len;
if (current_address < (uint32_t) last_written_app_address) {
printf2(TAG_ERR, "Error, only ascending writes allowed.\n");
has_erased = 0;
return CTAP2_ERR_NOT_ALLOWED;
}
last_written_app_address = (uint8_t*) current_address;
// Do the actual write // Do the actual write
flash_write((uint32_t)ptr,req->payload, len); flash_write((uint32_t)ptr,req->payload, len);
last_written_app_address = (uint8_t *)ptr + len - 8 + 4;
break; break;
case BootDone: case BootDone:
// Writing to flash finished. Request code validation. // Writing to flash finished. Request code validation.

View File

@ -1,5 +1,4 @@
ecdsa ecdsa
fido2==0.7.3
intelhex intelhex
pyserial pyserial
solo-python solo-python