Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
15a4fdfa66 | |||
e713daba26 | |||
b78f2cd2e7 | |||
601c98000a | |||
ab1c9417b1 | |||
f6d96013e1 | |||
f74dba7ff0 | |||
794accf3dc | |||
2ca0ced808 | |||
17b430fd44 | |||
0d4197fb2c | |||
f74a77d80b | |||
5f1d61a3ba |
3
Makefile
3
Makefile
@ -100,9 +100,10 @@ uncached-docker-build-toolchain:
|
|||||||
docker tag $(DOCKER_TOOLCHAIN_IMAGE):latest $(DOCKER_TOOLCHAIN_IMAGE):${SOLO_VERSION_MAJ}
|
docker tag $(DOCKER_TOOLCHAIN_IMAGE):latest $(DOCKER_TOOLCHAIN_IMAGE):${SOLO_VERSION_MAJ}
|
||||||
docker tag $(DOCKER_TOOLCHAIN_IMAGE):latest $(DOCKER_TOOLCHAIN_IMAGE):${SOLO_VERSION_MAJ}.${SOLO_VERSION_MIN}
|
docker tag $(DOCKER_TOOLCHAIN_IMAGE):latest $(DOCKER_TOOLCHAIN_IMAGE):${SOLO_VERSION_MAJ}.${SOLO_VERSION_MIN}
|
||||||
|
|
||||||
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
|
||||||
|
@ -1 +1 @@
|
|||||||
3.0.0
|
3.1.0
|
||||||
|
@ -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,35 +35,57 @@ 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 (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 on **Ubuntu** (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
|
||||||
```
|
```
|
||||||
and add
|
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.
|
||||||
@ -78,17 +107,36 @@ The login passwordless won't make your system more secure, but maybe more comfor
|
|||||||
To use Solo as second factor, for login into your Linux system, is nearly the same.
|
To use Solo as second factor, for login into your Linux system, is nearly the same.
|
||||||
|
|
||||||
```
|
```
|
||||||
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
|
||||||
```
|
```
|
||||||
and add
|
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.
|
||||||
|
@ -45,7 +45,7 @@ email=example@example.com
|
|||||||
openssl ecparam -genkey -name "$curve" -out root_key.pem -rand seed.bin
|
openssl ecparam -genkey -name "$curve" -out root_key.pem -rand seed.bin
|
||||||
|
|
||||||
# generate a "signing request"
|
# generate a "signing request"
|
||||||
openssl req -new -key root_key.pem -out root_key.pem.csr -subj "/C=$country/ST=$state/O=$organization/OU=$unit/CN=example.com/emailAddress=$email"
|
openssl req -new -key root_key.pem -out root_key.pem.csr -subj "/C=$country/ST=$state/O=$organization/OU=$unit/CN=$CN/emailAddress=$email"
|
||||||
|
|
||||||
# self sign the request
|
# self sign the request
|
||||||
openssl x509 -trustout -req -days 18250 -in root_key.pem.csr -signkey root_key.pem -out root_cert.pem -sha256
|
openssl x509 -trustout -req -days 18250 -in root_key.pem.csr -signkey root_key.pem -out root_cert.pem -sha256
|
||||||
@ -82,7 +82,7 @@ email=example@example.com
|
|||||||
openssl ecparam -genkey -name "$curve" -out device_key.pem -rand seed.bin
|
openssl ecparam -genkey -name "$curve" -out device_key.pem -rand seed.bin
|
||||||
|
|
||||||
# generate a "signing request"
|
# generate a "signing request"
|
||||||
openssl req -new -key device_key.pem -out device_key.pem.csr -subj "/C=$country/ST=$state/O=$organization/OU=$unit/CN=example.com/emailAddress=$email"
|
openssl req -new -key device_key.pem -out device_key.pem.csr -subj "/C=$country/ST=$state/O=$organization/OU=$unit/CN=$CN/emailAddress=$email"
|
||||||
|
|
||||||
# sign the request
|
# sign the request
|
||||||
openssl x509 -req -days 18250 -in device_key.pem.csr -extfile v3.ext -CA root_cert.pem -CAkey root_key.pem -set_serial 01 -out device_cert.pem -sha256
|
openssl x509 -req -days 18250 -in device_key.pem.csr -extfile v3.ext -CA root_cert.pem -CAkey root_key.pem -set_serial 01 -out device_cert.pem -sha256
|
||||||
@ -119,7 +119,7 @@ First, [Build your solo application and bootloader](/solo/building).
|
|||||||
Print your attestation key in a hex string format. Using our utility script:
|
Print your attestation key in a hex string format. Using our utility script:
|
||||||
|
|
||||||
```
|
```
|
||||||
python tools/print_x_y.py device_key.pem
|
python3 tools/gencert/print_x_y.py device_key.pem
|
||||||
```
|
```
|
||||||
|
|
||||||
Merge the `bootloader.hex`, `solo.hex`, attestion key, and certificate into one firmware file.
|
Merge the `bootloader.hex`, `solo.hex`, attestion key, and certificate into one firmware 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`
|
||||||
|
@ -542,6 +542,9 @@ extern void _check_ret(CborError ret, int line, const char * filename);
|
|||||||
|
|
||||||
uint8_t ctaphid_custom_command(int len, CTAP_RESPONSE * ctap_resp, CTAPHID_WRITE_BUFFER * wb);
|
uint8_t ctaphid_custom_command(int len, CTAP_RESPONSE * ctap_resp, CTAPHID_WRITE_BUFFER * wb);
|
||||||
|
|
||||||
|
|
||||||
|
extern void solo_lock_if_not_already();
|
||||||
|
|
||||||
uint8_t ctaphid_handle_packet(uint8_t * pkt_raw)
|
uint8_t ctaphid_handle_packet(uint8_t * pkt_raw)
|
||||||
{
|
{
|
||||||
uint8_t cmd = 0;
|
uint8_t cmd = 0;
|
||||||
@ -762,6 +765,16 @@ uint8_t ctaphid_custom_command(int len, CTAP_RESPONSE * ctap_resp, CTAPHID_WRITE
|
|||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Remove on next release
|
||||||
|
#if !defined(IS_BOOTLOADER) && defined(SOLO)
|
||||||
|
case 0x99:
|
||||||
|
solo_lock_if_not_already();
|
||||||
|
wb->bcnt = 0;
|
||||||
|
ctaphid_write(wb, NULL, 0);
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(IS_BOOTLOADER) && (defined(SOLO_EXPERIMENTAL))
|
#if !defined(IS_BOOTLOADER) && (defined(SOLO_EXPERIMENTAL))
|
||||||
case CTAPHID_LOADKEY:
|
case CTAPHID_LOADKEY:
|
||||||
/**
|
/**
|
||||||
|
@ -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 = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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*) 0;
|
||||||
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,17 +109,20 @@ 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()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (last_written_app_address == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
printf1(TAG_BOOT,"Current firmware version: %u.%u.%u.%u (%02x.%02x.%02x.%02x)\r\n",
|
printf1(TAG_BOOT,"Current firmware version: %u.%u.%u.%u (%02x.%02x.%02x.%02x)\r\n",
|
||||||
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 +176,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 +203,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.
|
||||||
|
@ -199,6 +199,20 @@ int solo_is_locked(){
|
|||||||
return tag == ATTESTATION_CONFIGURED_TAG && (device_settings & SOLO_FLAG_LOCKED) != 0;
|
return tag == ATTESTATION_CONFIGURED_TAG && (device_settings & SOLO_FLAG_LOCKED) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Locks solo flash from debugging. Locks on next reboot.
|
||||||
|
// This should be removed in next Solo release.
|
||||||
|
void solo_lock_if_not_already() {
|
||||||
|
uint8_t buf[2048];
|
||||||
|
|
||||||
|
memmove(buf, (uint8_t*)ATTESTATION_PAGE_ADDR, 2048);
|
||||||
|
|
||||||
|
((flash_attestation_page *)buf)->device_settings |= SOLO_FLAG_LOCKED;
|
||||||
|
|
||||||
|
flash_erase_page(ATTESTATION_PAGE);
|
||||||
|
|
||||||
|
flash_write(ATTESTATION_PAGE_ADDR, buf, 2048);
|
||||||
|
}
|
||||||
|
|
||||||
/** device_migrate
|
/** device_migrate
|
||||||
* Depending on version of device, migrates:
|
* Depending on version of device, migrates:
|
||||||
* * Moves attestation certificate to data segment.
|
* * Moves attestation certificate to data segment.
|
||||||
|
@ -146,12 +146,14 @@ void device_set_clock_rate(DEVICE_CLOCK_RATE param)
|
|||||||
case DEVICE_LOW_POWER_IDLE:
|
case DEVICE_LOW_POWER_IDLE:
|
||||||
SET_CLOCK_RATE0();
|
SET_CLOCK_RATE0();
|
||||||
break;
|
break;
|
||||||
|
#if !defined(IS_BOOTLOADER)
|
||||||
case DEVICE_LOW_POWER_FAST:
|
case DEVICE_LOW_POWER_FAST:
|
||||||
SET_CLOCK_RATE1();
|
SET_CLOCK_RATE1();
|
||||||
break;
|
break;
|
||||||
case DEVICE_FAST:
|
case DEVICE_FAST:
|
||||||
SET_CLOCK_RATE2();
|
SET_CLOCK_RATE2();
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
ecdsa
|
ecdsa
|
||||||
fido2==0.7.3
|
|
||||||
intelhex
|
intelhex
|
||||||
pyserial
|
pyserial
|
||||||
solo-python
|
solo-python
|
||||||
|
Reference in New Issue
Block a user