Browse Source

Finished with my part

master
Martins Eglitis 8 months ago
parent
commit
2d9e42df75
6 changed files with 509 additions and 1 deletions
  1. 1
    0
      .gitignore
  2. 492
    0
      lab1/Lab1_Group64.lyx
  3. BIN
      lab1/Lab1_Group64.pdf
  4. 13
    0
      lab1/src/main.c
  5. 2
    0
      lab1/src/main.h
  6. 1
    1
      lab1/src/passdb

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
*.lyx~

+ 492
- 0
lab1/Lab1_Group64.lyx View File

@@ -0,0 +1,492 @@
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\begin_preamble
% Constants to set once
\newcommand{\hmwkAuthorName}{Lina Blomkvist, Martins Eglitis} % Your name

% Packages
\usepackage{fancyhdr} % Required for custom headers
\usepackage{lastpage} % Required to determine the last page for the footer
\usepackage{extramarks} % Required for headers and footers
\usepackage{siunitx} % Required for SI units
\usepackage{cleveref} % Required for SI units

% Margins
\topmargin=-0.45in
\evensidemargin=0in
\oddsidemargin=0in
\textwidth=6.5in
\textheight=9.0in
\headsep=0.25in

% General document properties
\linespread{1.1} % Line spacing
%\setlength\parindent{0pt} % Removes all indentation from paragraphs
\setlength\parskip{8pt} % Removes all spacing from paragraphs
% Required to not count titlepage in page numbering
%\addtocounter {page} {-1}

% Make a simple command for use in document body
\newcommand{\start}{
\maketitle
\thispagestyle{empty}
\newpage
}

% Set up the header and footer
\pagestyle{fancy}
\lhead{\hmwkAuthorName} % Top left header
\rhead{January 30, 2019}
\lfoot{\lastxmark} % Bottom left footer
\cfoot{} % Bottom center footer
\rfoot{Page\ \thepage\ of\ \protect\pageref{LastPage}} % Bottom right footer
\renewcommand\headrulewidth{0.4pt} % Size of the header rule
\renewcommand\footrulewidth{0.4pt} % Size of the footer rule

% The following 2 commands setup the title page
\title{
\vspace{2in}
\textmd{\textbf{\hmwkClass:\ Labs}}\\
\normalsize\vspace{0.1in}\small{January 30, 2019}\\
\vspace{3in}
}

\author{
\textbf{\hmwkAuthorName} \\
\texttt{\hmwkUserID \hspace{0.1in}- \hmwkStudentNumber}
}

% Do not display standard date since we use a custom date
\date{}

% Change the list format
\renewcommand{\labelenumi}{\alph{enumi})}
\end_preamble
\use_default_options true
\begin_modules
theorems-ams
eqs-within-sections
figs-within-sections
\end_modules
\maintain_unincluded_children false
\language english
\language_package auto
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 0
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 5
\tocdepth 5
\paragraph_separation skip
\defskip bigskip
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\noindent
\align center

\series bold
\size huge
Laboratory Assignment 1
\end_layout

\begin_layout Subsubsection*
Task 1
\end_layout

\begin_layout Standard
Password aging is a mechanisim of UNIX which limits the lifetime of passwords.
One can specify the expire date when creating a new user, modifying an
existing user, modifying an existing user's password using the useradd,
usermod, passwd commands respectively.
Also, it is possible to modify the /etc/passwd file by other means (editors,
library functions) with escalated (root) permissions.
\end_layout

\begin_layout Subsubsection*
Task 2
\end_layout

\begin_layout Standard
The advantage is that the password is valid only once, which might improve
the safety in way the user will be forced to change it every time after
using it.
However, if user authenticates often the necessity for changing password
might lead to frustration and result in shorter, less secure password.
\end_layout

\begin_layout Subsubsection*
Task 3
\end_layout

\begin_layout Subsubsection*
Task 4
\end_layout

\begin_layout Enumerate
Kerberos.
It is designed to provide strong authentication for client/server applications
by using secret-key cryptography.
Works under the given scenario using a centralized server and multiple
clients (eg.
students, staff).
\end_layout

\begin_layout Enumerate
PAM + 2FA.
Basically, if it is a top secret machine, there should be no connection
to networks of any kind.
Users might want to use 2 factor authentication provided via PAM, for example
a physical USB drive holding a key and a strong password.
\end_layout

\begin_layout Enumerate
See point a) .
\end_layout

\begin_layout Enumerate
Password.
Most of the times, a decent password works perfectly for regular use home
computers.
\end_layout

\begin_layout Subsubsection*
Task 5
\end_layout

\begin_layout Subsubsection*
Task 6
\end_layout

\begin_layout Enumerate
Before: RUID = csec028, EUID = csec028.
After: RUID = csec028, EUID = 0.
\end_layout

\begin_layout Enumerate
\begin_inset Tabular
<lyxtabular version="3" rows="7" columns="3">
<features tabularvalignment="middle">
<column alignment="center" valignment="top">
<column alignment="center" valignment="top">
<column alignment="center" valignment="top">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
Number
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
success/failure
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout

\series bold
user EUID after setuid()
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
1
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Success
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
0
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
2
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Success
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
20757
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
3
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Success
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
20716
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
4
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Failure
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
20716
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
5
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Failure
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
20716
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
6
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
Success
\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
20716
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\begin_inset Newpage pagebreak
\end_inset


\end_layout

\begin_layout Subsubsection*
Task 7
\end_layout

\begin_layout Enumerate
The RUID is that of csec028, the EUID = 0.
\end_layout

\begin_layout Enumerate
With the special SUID permission bit the user that is executing the program
sets its EUID to the one UID of the owner of the file.
\end_layout

\begin_layout Subsubsection*
Task 8
\end_layout

\begin_layout Enumerate
Before: RUID = csec028, EUID = csec028.
After: RUID = csec028, EUID = csec028.
\end_layout

\begin_layout Enumerate
The reason is that if it were a different user which did not have
\begin_inset Quotes eld
\end_inset

enough
\begin_inset Quotes erd
\end_inset

privileges to setuid(csec028), the SUID bit still allows the execution
of setuid(csec028) for anyone.
\end_layout

\end_body
\end_document

BIN
lab1/Lab1_Group64.pdf View File


+ 13
- 0
lab1/src/main.c View File

@@ -4,14 +4,25 @@
#include <unistd.h>
#include <pwd.h>
#include <crypt.h>
#include <signal.h>
#include <unistd.h>
#include <readline/readline.h>

//user libraries
#include "main.h"
#include "pwent.h"

void shint()
{
}

int main (int argc, char *argv[])
{
//set the signal handlers
struct sigaction saint;
saint.sa_handler = shint;
sigaction(SIGINT, &saint, NULL);

mypwent *password;

//around we go
@@ -71,4 +82,6 @@ int main (int argc, char *argv[])
}

printf("Welcome, %s\n", password->pwname);

execvp("/bin/sh", NULL);
}

+ 2
- 0
lab1/src/main.h View File

@@ -5,4 +5,6 @@

int main (int argc, char *argv[]);

void shint();

#endif

+ 1
- 1
lab1/src/passdb View File

@@ -1,2 +1,2 @@
aa:1000:xyA2MdUfoiZU2:xy:5:101
aa:1000:xyA2MdUfoiZU2:xy:0:107
bb:1000:xym8CY2zmHjdY:xy:0:100

Loading…
Cancel
Save